Skip to content

Commit

Permalink
chore: automatically bundle external assets on install
Browse files Browse the repository at this point in the history
when installing the project by just reading the docs, assets are not
generated after launching the app for the first time. Now they are and
marking this as postinstall ensures we always get the correct build
after dependencies updates
  • Loading branch information
manuhabitela committed Feb 9, 2024
1 parent 1ad1fc0 commit cf79ab3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ This guide provides steps to run the MonComptePro Node.js application locally wh
npm install
```
Note: this will also build required JS and CSS assets of dependencies and add them in the `public/` dir.
You can build those assets again at anytime with the `npm run build:assets` command.
2. **Create a local version of dotenv file**: Inside the project's root directory, run:

```bash
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
"node": "16.20.2"
},
"scripts": {
"postinstall": "npm run build:assets",
"lint": "prettier --write */*.ts",
"start": "node build/index.js",
"dev": "concurrently \"npm:watch:*\"",
"build": "run-s build:**",
"build:typescript": "tsc",
"build:views": "bash -c 'cp -r src/views build/views'",
"build:assets": "run-s build:assets:**",
"build:assets:simplewebauthn": "bash -c 'cp node_modules/@simplewebauthn/browser/dist/bundle/index.umd.min.js public/simplewebauthn.umd.min.js'",
"build:assets:choicesjs": "bash -c 'cp node_modules/choices.js/public/assets/{scripts/choices.min.js,styles/choices.min.css} public/'",
"build:assets:dsfr": "bash -c 'cp -r node_modules/@gouvfr/dsfr/dist/{dsfr.min.css,fonts,icons,utility} public/'",
Expand Down

0 comments on commit cf79ab3

Please sign in to comment.