-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds webpack as a js_taskrunner option to cookiecutter-json. Will clone @hzdg/cookiecutter-webpack --pydanny-django branch into the project using cookiecutter's api in post_hooks. The static webpack project will be placed into the <project_slug>/static/<project_slug>/ directory. The webpack configs are placed in the ./config/ directory. The cookiecutter-webpack project includes react / redux / karma configurations that are brought into the project.
- Loading branch information
Showing
8 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
import os | ||
import random | ||
import shutil | ||
from cookiecutter.main import cookiecutter | ||
|
||
# Get the root project directory | ||
PROJECT_DIRECTORY = os.path.realpath(os.path.curdir) | ||
|
@@ -161,6 +162,30 @@ def remove_packageJSON_file(): | |
PROJECT_DIRECTORY, filename | ||
)) | ||
|
||
|
||
def add_webpack(): | ||
""" | ||
Adds webpack configuration using cookiecutter to install hzdg/cookiecutter-webpack | ||
""" | ||
cookiecutter( | ||
'[email protected]:hzdg/cookiecutter-webpack.git', | ||
replay=False, overwrite_if_exists=True, output_dir='../', | ||
checkout='pydanny-django', no_input=True, extra_context={ | ||
'project_name': '{{ cookiecutter.project_name }}', | ||
'repo_name': '{{ cookiecutter.project_slug }}', | ||
'repo_owner': '', | ||
'project_dir': '{{ cookiecutter.project_slug }}', | ||
'static_root': '{{ cookiecutter.project_slug }}/static/{{ cookiecutter.project_slug }}', | ||
'production_output_path': '{{ cookiecutter.project_slug }}/static/{{ cookiecutter.project_slug }}/dist/', | ||
'author_name': '{{ cookiecutter.author_name }}', | ||
'description': '{{ cookiecutter.description }}', | ||
'version': '{{ cookiecutter.version }}', | ||
'existing_project': 'y', | ||
'css_extension': 'sass', | ||
'use_ejs': 'n', | ||
'open_source_license': '{{ cookiecutter.open_source_license }}' | ||
}) | ||
|
||
def remove_certbot_files(): | ||
""" | ||
Removes files needed for certbot if it isn't going to be used | ||
|
@@ -212,6 +237,11 @@ def remove_certbot_files(): | |
remove_grunt_files() | ||
elif '{{ cookiecutter.js_task_runner}}'.lower() == 'grunt': | ||
remove_gulp_files() | ||
elif '{{ cookiecutter.js_task_runner }}'.lower() == 'webpack': | ||
remove_gulp_files() | ||
remove_grunt_files() | ||
remove_packageJSON_file() | ||
add_webpack() | ||
else: | ||
remove_gulp_files() | ||
remove_grunt_files() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters