Configure Dependabot for npm packages at the template level (#3436)

This commit is contained in:
Bruno Alla 2021-12-07 19:05:59 +00:00 committed by GitHub
parent 163975120d
commit 035eede670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 6 deletions

View File

@ -10,3 +10,11 @@ updates:
interval: "daily"
labels:
- "update"
# Update npm packages
- package-ecosystem: "npm"
directory: "{{cookiecutter.project_slug}}/"
schedule:
interval: "daily"
labels:
- "update"

View File

@ -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(

View File

@ -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 %}
}
}