Make and document npm run build now a mandatory step of the install/build setup

This has several reasons, benefits and consequences:

- When running on root (which is not recommended anyway), `npm run build` was already necessary.
- This allows to not use the `prepublish` hook, whose behavior is going to change in npm v5 and again in npm v6.
- This allows to create both production and development builds when running from source.
- It makes `npm run build` compatible with Windows again for development environments (lost in previous commit).
- It uses the `prepublishOnly` hook added in npm v4. Since this hook is not available prior to that, deployment to npm from Travis has to be done on the Node.js v7 environment.
This commit is contained in:
Jérémie Astori 2017-01-07 18:29:56 -05:00
parent d8f1690904
commit 552fa3fae8
4 changed files with 9 additions and 7 deletions

View File

@ -11,6 +11,9 @@ cache:
directories: directories:
- ~/.npm - ~/.npm
before_script:
- npm run build
notifications: notifications:
email: email:
on_success: never on_success: never
@ -23,6 +26,6 @@ deploy:
api_key: api_key:
secure: I9iN31GWI+Mz0xPw81N7qh1M6uidB+3BmiPUXt8QigX45zwp9EhvfZ0U/AIdUyQwzK2RK1zLRQSt+2/1jyeVi+U+AAsRRmaAUx8iqKaQPAkPnQtElolgRP04WSgo7fvNejfM7zS939bQNKG3RlSm04yPgu+ke2igf799p2bpFe2LtyoEeIiUfrUkBiMSpMguN9XF8a7jqCyIouTKjXHR24RmzJ9r7ZoMV27yQauS7XlD81bontzNRZxTytDKdJpZ+sxGIT9mbbtM4LUFX8MeNe3p/bjWavEhrO0ZIpkbOfS/L/w1375YDoNPXxCs288lnGUH+NbGNAEfn+BTz8cmUp7jI7QWR/kNACPeopdAX4OdZxT8wfQcfQZrfCuSpKciOMC7vGgPpQqjQ61t1RKcKs9VUnwC0SwWjyo8LlzkFKnP1ks0eDGYsSoPLdpC9+76UmePkQdxMhscO8TOgkOCcsTMLiyt6ABGOGKu2iE5SsjUYtPiSiRzSBAQENoO560+xBSVTKwqvvhzUAIt4AuAQSgsFjAylDdyzKoObHX12hBdALrqSOOSVwwIQ5/jTgNAsilURHo7KPD407PhRnLOsvumL0qg4sr9S1hjuUKnNla5dg9GY8FVjJ+b2t0A2vgfG1pR1e3vrJRXrpkfRorhmjvKAk2o5you5pQ1Itty7rM= secure: I9iN31GWI+Mz0xPw81N7qh1M6uidB+3BmiPUXt8QigX45zwp9EhvfZ0U/AIdUyQwzK2RK1zLRQSt+2/1jyeVi+U+AAsRRmaAUx8iqKaQPAkPnQtElolgRP04WSgo7fvNejfM7zS939bQNKG3RlSm04yPgu+ke2igf799p2bpFe2LtyoEeIiUfrUkBiMSpMguN9XF8a7jqCyIouTKjXHR24RmzJ9r7ZoMV27yQauS7XlD81bontzNRZxTytDKdJpZ+sxGIT9mbbtM4LUFX8MeNe3p/bjWavEhrO0ZIpkbOfS/L/w1375YDoNPXxCs288lnGUH+NbGNAEfn+BTz8cmUp7jI7QWR/kNACPeopdAX4OdZxT8wfQcfQZrfCuSpKciOMC7vGgPpQqjQ61t1RKcKs9VUnwC0SwWjyo8LlzkFKnP1ks0eDGYsSoPLdpC9+76UmePkQdxMhscO8TOgkOCcsTMLiyt6ABGOGKu2iE5SsjUYtPiSiRzSBAQENoO560+xBSVTKwqvvhzUAIt4AuAQSgsFjAylDdyzKoObHX12hBdALrqSOOSVwwIQ5/jTgNAsilURHo7KPD407PhRnLOsvumL0qg4sr9S1hjuUKnNla5dg9GY8FVjJ+b2t0A2vgfG1pR1e3vrJRXrpkfRorhmjvKAk2o5you5pQ1Itty7rM=
on: on:
node: '4' node: 7
tags: true tags: true
repo: thelounge/lounge repo: thelounge/lounge

View File

@ -50,14 +50,12 @@ The following commands install the development version of The Lounge:
git clone https://github.com/thelounge/lounge.git git clone https://github.com/thelounge/lounge.git
cd lounge cd lounge
npm install npm install
NODE_ENV=production npm run build
npm start npm start
``` ```
A word of caution: ⚠️ While it is the most recent codebase, this is not production-ready! Run at
your own risk. It is also not recommended to run this as root.
- While it is the most recent codebase, this is not production-ready!
- It is not recommended to run this as root. However, if you decide to do so,
you will have to run `npm run build`.
## Development setup ## Development setup

View File

@ -13,6 +13,7 @@ environment:
install: install:
- ps: Install-Product node $env:nodejs_version - ps: Install-Product node $env:nodejs_version
- appveyor-retry npm install - appveyor-retry npm install
- npm run build
- npm install mocha-appveyor-reporter - npm install mocha-appveyor-reporter
- echo --reporter mocha-appveyor-reporter >> test/mocha.opts - echo --reporter mocha-appveyor-reporter >> test/mocha.opts

View File

@ -24,7 +24,7 @@
"lint": "npm-run-all -c lint:*", "lint": "npm-run-all -c lint:*",
"lint:js": "eslint .", "lint:js": "eslint .",
"lint:css": "stylelint \"**/*.css\"", "lint:css": "stylelint \"**/*.css\"",
"prepublish": "NODE_ENV=production npm run build" "prepublishOnly": "NODE_ENV=production npm run build"
}, },
"keywords": [ "keywords": [
"lounge", "lounge",