fix: args and cleaning

This commit is contained in:
cha0s 2021-03-20 10:46:27 -05:00
parent e69639a858
commit 0f04e43132
2 changed files with 16 additions and 7 deletions

View File

@ -8,8 +8,7 @@
"latus-build": "./build.js"
},
"scripts": {
"build": "LATUS_POSTCSS_CONFIG=./src/build/postcss.config.js NODE_PATH=./node_modules webpack --config ./webpack.config.js --mode production",
"clean": "rm -rf yarn.lock node_modules/* $(node -e \"process.stdout.write(require('./package.json').files.filter((file) => {const parts = file.split('/'); return 1 === parts.length || 'test' !== parts[0];}).join(' '));\")",
"build": "LATUS_POSTCSS_CONFIG=./src/build/postcss.config.js LATUS_WEBPACK_CONFIG=./src/build/webpack.config.js NODE_PATH=./node_modules webpack --config ./webpack.config.js --mode production",
"fp": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
"lint": "NODE_PATH=./node_modules eslint --config ./.eslintrc.js --format codeframe --ext mjs,js .",
"test": "yarn --silent run build --display none && mocha --colors test.js"

View File

@ -70,16 +70,25 @@ const clean = () => {
rimraf.sync(join(cwd, 'node_modules', '*'));
rimraf.sync(join(cwd, 'yarn.lock'));
const {files} = __non_webpack_require__(join(cwd, 'package.json'));
rimraf.sync(
files
.map((filename) => join(cwd, filename))
.join(' '),
if (files && files.length > 0) {
rimraf.sync(
files
.map((filename) => join(cwd, filename))
.join(' '),
);
}
spawn(
'yarn',
[],
{
stdio: 'inherit',
},
);
};
program
.command('clean')
.description('remove node_modules, yarn.lock, and build artifacts')
.description('remove node_modules, yarn.lock, and build artifacts and run yarn')
.action(clean);
const unpublish = async () => {
@ -162,6 +171,7 @@ program
.action(lint);
const test = async () => {
process.argv.splice(2, 1);
await build(['--display', 'none']);
const {production} = program.opts();
const configFile = localConfig('.eslintrc.js');