Skip to content

Commit 75fbccd

Browse files
committed
Move long npm scripts to separate bash files
1 parent 4c87826 commit 75fbccd

File tree

9 files changed

+32
-12
lines changed

9 files changed

+32
-12
lines changed

packages/uikit/.babelrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"presets": [
33
["@babel/preset-env", { "useBuiltIns": "usage" }],
44
"@babel/preset-react",
5-
"@babel/preset-stage-3",
5+
"@babel/preset-stage-3"
66
],
77
"env": {
88
"development": {

packages/uikit/.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"singleQuote": true,
3-
"trailingComma": "all",
3+
"trailingComma": "all"
44
}

packages/uikit/package.json

+6-9
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,21 @@
55
"author": "Puppet, Inc.",
66
"license": "UNLICENSED",
77
"scripts": {
8-
"build":
9-
"NODE_ENV=production webpack --config=config/bundle.webpack.config.js",
10-
"build:styleguide":
11-
"(export $(cat config/.env.production | xargs) && webpack --config=config/production.webpack.config.js)",
8+
"build": "./scripts/build",
9+
"build:styleguide": "./scripts/build-styleguide",
1210
"precommit": "lint-staged",
1311
"prepare": "echo 'Building uikit' && npm run build",
14-
"format":
15-
"eslint --fix src styleguide config && prettier --write --list-different '{src,styleguide,config}/**/*.{js,jsx,mjs,graphql,json,css,md}'",
16-
"lint": "eslint src styleguide config --ext .js --ext .jsx",
12+
"format": "./scripts/format",
13+
"lint": "./scripts/lint",
1714
"start": "node --experimental-modules styleguide/server/dev.mjs",
1815
"serve": "node --experimental-modules styleguide/server/prod.mjs",
1916
"test": "jest",
2017
"test:coverage": "jest --collectCoverage",
2118
"test:watch": "jest --watch"
2219
},
2320
"lint-staged": {
24-
"*.{js, jsx, mjs}": ["eslint --fix"],
25-
"*.{js,jsx,mjs,graphql,json,css,md}": [
21+
"*.{js,jsx,mjs}": ["eslint --fix", "git add"],
22+
"*.{graphql,json,css,md}": [
2623
"prettier --single-quote --trailing-comma=all --write",
2724
"git add"
2825
]

packages/uikit/postcss.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const parseVariables = require('./scripts/parseVariables');
1+
const parseVariables = require('./utils/parseVariables');
22

33
const variables = {
44
...parseVariables('src/styles/colors.css'),

packages/uikit/scripts/build

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
NODE_ENV=production webpack --config=config/bundle.webpack.config.js
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
(export $(cat config/.env.production | xargs) && webpack --config=config/production.webpack.config.js)

packages/uikit/scripts/format

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
ESLINT_EXTS=\{js,jsx,mjs\}
4+
ESLINT_EXTRAS=( jest.config.js postcss.config.js )
5+
PRETTIER_EXTS=\{graphql,json,css,md\}
6+
PRETTIER_EXTRAS=( .babelrc .prettierrc package.json README.md )
7+
SRC_DIRS=\{config,jest,scripts,src,styleguide,utils\}
8+
9+
eslint --fix $SRC_DIRS/**/*.$ESLINT_EXTS ${ESLINT_EXTRAS[@]} && \
10+
prettier --write $SRC_DIRS/**/*.$PRETTIER_EXTS ${PRETTIER_EXTRAS[@]}

packages/uikit/scripts/lint

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
ESLINT_EXTS=\{js,jsx,mjs\}
4+
ESLINT_EXTRAS=( jest.config.js postcss.config.js )
5+
SRC_DIRS=\{config,jest,scripts,src,styleguide,utils\}
6+
7+
eslint $SRC_DIRS/**/*.$ESLINT_EXTS ${ESLINT_EXTRAS[@]}

0 commit comments

Comments
 (0)