mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-30 15:24:05 +03:00
feat: update all deps versions, move from babel to swc
- move all package commands to scripts/pkg-task - jest now uses swc - rollup now uses swc - move all benchmark packages to benchmark/package.json
This commit is contained in:
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const { resolve } = require('path')
|
||||
const { spawn } = require('child_process')
|
||||
const { Command } = require('commander');
|
||||
|
||||
const program = new Command();
|
||||
const nmBinDir = resolve(`../../node_modules/.bin/`)
|
||||
const shell = { cmd: 'sh', arg: '-c' }
|
||||
|
||||
const actionCommand = (command) => () => {
|
||||
spawn(shell.cmd, [shell.arg, `${nmBinDir}/${command}`], {
|
||||
env: process.env,
|
||||
cwd: process.cwd(),
|
||||
stdio: 'inherit',
|
||||
})
|
||||
}
|
||||
|
||||
const commandMap = {
|
||||
'build-commonjs': `cross-env BABEL_ENV=commonjs NODE_ENV=production ${nmBinDir}/swc --config-file ../../.swcrc-commonjs --out-dir lib src`,
|
||||
'build-es': `cross-env BABEL_ENV=es NODE_ENV=production ${nmBinDir}/swc --out-dir es src`,
|
||||
'build-umd': `cross-env BABEL_ENV=rollup NODE_ENV=production ${nmBinDir}/rollup --config ../../rollup.config.js`,
|
||||
test: `jest`,
|
||||
cover: `jest --config ../../jest.config.js --coverage .`,
|
||||
lint: `eslint .`,
|
||||
bundlesize: `cross-env NODE_ENV=production ${nmBinDir}/bundlesize .`
|
||||
}
|
||||
|
||||
program.version('1.0.0')
|
||||
|
||||
for (const [key, command] of Object.entries(commandMap)) {
|
||||
program.command(key).action(actionCommand(command))
|
||||
}
|
||||
|
||||
program.parse();
|
||||
Reference in New Issue
Block a user