Browse Source

package.json: use NodeJS scripts instead of unix commands

develop
Alice Gaudon 3 weeks ago
parent
commit
12f82f0f3d
4 changed files with 20 additions and 5 deletions
  1. +1
    -0
      .eslintrc.json
  2. +5
    -5
      package.json
  3. +10
    -0
      scripts/clean.js
  4. +4
    -0
      scripts/prepare-sources.js

+ 1
- 0
.eslintrc.json View File

@ -88,6 +88,7 @@
},
"ignorePatterns": [
"jest.config.js",
"scripts/**/*",
"webpack.config.js",
"dist/**/*",
"public/**/*",


+ 5
- 5
package.json View File

@ -8,13 +8,13 @@
"main": "dist/main.js",
"scripts": {
"test": "jest --verbose --runInBand",
"clean": "(test ! -d dist || rm -r dist)",
"prepareSources": "cp package.json src/",
"clean": "node scripts/clean.js",
"prepare-sources": "node scripts/prepare-sources.js",
"compile": "yarn clean && tsc",
"build": "yarn prepareSources && yarn compile && webpack --mode production",
"dev": "yarn prepareSources && concurrently -k -n \"Typescript,Node,Webpack,Maildev\" -p \"[{name}]\" -c \"blue,green,red,yellow\" \"tsc --watch\" \"nodemon\" \"webpack --watch --mode development\" \"maildev\"",
"build": "yarn prepare-sources && yarn compile && webpack --mode production",
"dev": "yarn prepare-sources && concurrently -k -n \"Typescript,Node,Webpack,Maildev\" -p \"[{name}]\" -c \"blue,green,red,yellow\" \"tsc --watch\" \"nodemon\" \"webpack --watch --mode development\" \"maildev\"",
"start": "yarn build && node",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx"
"lint": "eslint ."
},
"devDependencies": {
"@babel/core": "^7.9.0",


+ 10
- 0
scripts/clean.js View File

@ -0,0 +1,10 @@
const fs = require('fs');
[
'dist',
].forEach(file => {
if (fs.existsSync(file)) {
console.log('Cleaning', file, '...');
fs.rmSync(file, {recursive: true});
}
});

+ 4
- 0
scripts/prepare-sources.js View File

@ -0,0 +1,4 @@
const fs = require('fs');
const path = require('path');
fs.copyFileSync('package.json', path.join('src', 'package.json'));

Loading…
Cancel
Save