chore(madrun) simplify with cutEnv

This commit is contained in:
coderaiser 2021-01-12 00:56:03 +02:00
parent 82c576c850
commit af2548acd1
2 changed files with 17 additions and 11 deletions

View file

@ -1,16 +1,21 @@
import {createRequire} from 'module';
import {run, parallel} from 'madrun';
import {run, parallel, cutEnv} from 'madrun';
const require = createRequire(import.meta.url);
const {version} = require('./package');
const env = 'THREAD_IT_COUNT=0';
const testEnv = {
THREAD_IT_COUNT: 0,
};
const dockerName = 'coderaiser/cloudcmd';
export default {
'start': () => 'node bin/cloudcmd.mjs',
'start:dev': async () => `NODE_ENV=development ${await run('start')}`,
'start:dev': async () => await run('start', null, {
NODE_ENV: 'development',
}),
'build:start': () => run(['build:client', 'start']),
'build:start:dev': () => run(['build:client:dev', 'start:dev']),
'lint:all': () => run(['lint', 'spell']),
@ -19,9 +24,8 @@ export default {
'lint:fresh': () => run('lint', '--fresh'),
'spell': () => 'yaspeller .',
'fix:lint': () => run('lint', '--fix'),
'lint:stream': () => run('lint:base', '-f stream'),
'test:base': () => `tape 'test/**/*.js' '{client,static,common,server}/**/*.spec.js' -f fail`,
'test': async () => `${env} ${await run('test:base')}`,
'lint:stream': () => run('lint', '-f stream'),
'test': () => [testEnv, `tape 'test/**/*.js' '{client,static,common,server}/**/*.spec.js' -f fail`],
'test:client': () => `tape 'test/client/**/*.js'`,
'test:server': () => `tape 'test/**/*.js' 'server/**/*.spec.js' 'common/**/*.spec.js'`,
'wisdom': () => run(['lint:all', 'build', 'test']),
@ -111,21 +115,23 @@ export default {
'docker:rm:arm64': () => dockerRmi('arm64', version),
'docker:rm:latest-arm64': () => dockerRmi('arm64'),
'docker:rm-old': async () => `${await parallel('docker:rm:*')} || true`,
'coverage': async () => `${env} nyc ${await run('test:base')}`,
'coverage': async () => [testEnv, `nyc ${await cutEnv('test')}`],
'report': () => 'nyc report --reporter=text-lcov | coveralls',
'6to5': () => 'webpack --progress',
'6to5:client': () => run('6to5', '--mode production'),
'6to5:client:dev': async () => `NODE_ENV=development ${await run('6to5', '--mode development')}`,
'6to5:client:dev': async () => await run('6to5', '--mode development', {
NODE_ENV: 'development',
}),
'pre6to5:client': () => 'rimraf dist',
'pre6to5:client:dev': () => 'rimraf dist-dev',
'watch:client': () => run('6to5:client', '--watch'),
'watch:client:dev': () => run('6to5:client:dev', '--watch'),
'watch:server': () => 'nodemon bin/cloudcmd.js',
'watch:lint': async () => `nodemon -w client -w server -w webpack.config.js -x ${await run('lint')}`,
'watch:test': async () => `nodemon -w client -w server -w test -w common -x ${await run('test')}`,
'watch:test': async () => [testEnv, `nodemon -w client -w server -w test -w common -x ${await cutEnv('test')}`],
'watch:test:client': async () => `nodemon -w client -w test/client -x ${await run('test:client')}`,
'watch:test:server': async () => `nodemon -w client -w test/client -x ${await run('test:server')}`,
'watch:coverage': async () => `nodemon -w server -w test -w common -x ${await run('coverage')}`,
'watch:coverage': async () => [testEnv, `nodemon -w server -w test -w common -x ${await cutEnv('coverage')}`],
'build': () => run('6to5:*'),
'build:client': () => run('6to5:client'),
'build:client:dev': () => run('6to5:client:dev'),

View file

@ -207,7 +207,7 @@
"just-pascal-case": "^1.1.0",
"limier": "^3.0.0",
"load.js": "^3.0.0",
"madrun": "^8.0.0",
"madrun": "^8.6.0",
"memfs": "^3.0.1",
"minor": "^1.2.2",
"mock-require": "^3.0.1",