Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document pitfalls when building production assets #33322

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ build-js:
npm run dev

build-js-production:
@echo Using node version $(shell node -v) and npm version $(shell npm -v)
@echo Please make sure you are using the same version as recommended in the README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we instead read the environment from package.json?
Could even compare it and fail the make step

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought of this but this was from the time I believed that my asset problem was related to node versions, but it wasn't, it was about the additional apps I didn't move to apps-extra, so not sure if we should be hard about node versions

@echo
npm run build

watch-js:
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ Otherwise, git checkouts can be handled the same as release archives, by using t

### Working with front-end code 🏗

#### Pre-requisites

##### Node JS

You will need Node.js and npm to be able to build assets during development and for checking in.

One way to do this is by [setting up nvm](https://github.com/nvm-sh/nvm#install--update-script) and then running the following commands:
```
# install and select node version
nvm install 14.20.0

npm i -g npm@"^7.0.0"
```

##### App folders

If you are using additional apps that are not present in this repository, please make sure that they are checked out in a separate folder "apps-extra" (or similar).
Otherwise the build script for production assets will include styles and icons from unrelated apps and this will result in a asset mismatches causing a failure in CI.

See the `apps_paths` [config.php setting](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html) for further details.

#### Building

We are moving more and more towards using Vue.js in the frontend, starting with Settings. For building the code on changes, use these terminal commands in the root folder:
Expand Down