diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5cb5a142..8922cd45 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,3 +10,11 @@ updates: interval: "daily" labels: - "update" + + # Update npm packages + - package-ecosystem: "npm" + directory: "{{cookiecutter.project_slug}}/" + schedule: + interval: "daily" + labels: + - "update" diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 3ad0e9e5..d04970d3 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -10,6 +10,7 @@ TODO: restrict Cookiecutter Django project initialization to """ from __future__ import print_function +import json import os import random import shutil @@ -95,6 +96,16 @@ def remove_packagejson_file(): os.remove(file_name) +def remove_bootstrap_packages(): + with open("package.json", mode="r") as fd: + content = json.load(fd) + for package_name in ["bootstrap", "gulp-concat", "@popperjs/core"]: + content["devDependencies"].pop(package_name) + with open("package.json", mode="w") as fd: + json.dump(content, fd, ensure_ascii=False, indent=2) + fd.write("\n") + + def remove_celery_files(): file_names = [ os.path.join("config", "celery_app.py"), @@ -381,6 +392,8 @@ def main(): remove_packagejson_file() if "{{ cookiecutter.use_docker }}".lower() == "y": remove_node_dockerfile() + elif "{{ cookiecutter.custom_bootstrap_compilation }}" == "n": + remove_bootstrap_packages() if "{{ cookiecutter.cloud_provider}}".lower() == "none": print( diff --git a/{{cookiecutter.project_slug}}/package.json b/{{cookiecutter.project_slug}}/package.json index ac868d95..bff0a34a 100644 --- a/{{cookiecutter.project_slug}}/package.json +++ b/{{cookiecutter.project_slug}}/package.json @@ -3,12 +3,9 @@ "version": "{{ cookiecutter.version }}", "dependencies": {}, "devDependencies": { - {% if cookiecutter.js_task_runner == 'Gulp' -%} - {% if cookiecutter.custom_bootstrap_compilation == 'y' -%} "bootstrap": "^5.1.3", "gulp-concat": "^2.6.1", "@popperjs/core": "^2.10.2", - {% endif -%} "autoprefixer": "^10.4.0", "browser-sync": "^2.27.7", "cssnano": "^5.0.11", @@ -22,7 +19,6 @@ "pixrem": "^5.0.0", "postcss": "^8.3.11", "sass": "^1.43.4" - {%- endif %} }, "engines": { "node": "16" @@ -31,9 +27,7 @@ "last 2 versions" ], "scripts": { - {% if cookiecutter.js_task_runner == 'Gulp' -%} "dev": "gulp", "build": "gulp generate-assets" - {%- endif %} } }