mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
chore: update build system and dependencies (#155)
* chore: fix swc + rollup transform * chore: fix pkg-task args parsing * chore: update lerna, rollup and swc to build proper es6 files * chore: fix swc build for es targets * ci: nodes matrix to newest versions * ci: rollup to mjs, swc to json * ci: add canary publish * ci: no git tag for canary * ci: no private publish for canary * ci: remove --canary from publish-canary * fix: remove gitHead from package.json * fix: tests setup * fix: bbob plugin helper imports * fix: plugin helper build priority and circular deps * fix: add nx for parallel build * fix: npm ci * fix: code ql * fix: remove exports directive * fix: rollup build * fix: vue2 test and minify * fix: bundle size limits * feat: bundlephobia pr review * feat: bundlephobia more popular action * feat: publish branch to npm * fix: secret NPM token * fix: bundlephobia version * fix: remove bundlephobia checker * fix: npm publish in PR * chore: release 2.8.3 * chore: fix test runs on CI, removed 14.x version * fix: sync package-lock * fix: remove lock files in sub packages * fix: bundlesize > bundlesize2 * fix: update lock files * fix: lock file in vue2-example
This commit is contained in:
Generated
+18
-1
@@ -1,6 +1,23 @@
|
||||
{
|
||||
"name": "scripts",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "scripts",
|
||||
"dependencies": {
|
||||
"commander": "8.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "8.2.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-8.2.0.tgz",
|
||||
"integrity": "sha512-LLKxDvHeL91/8MIyTAD5BFMNtoIwztGPMiM/7Bl8rIPmHCZXRxmSWr91h57dpOpnQ6jIUqEWdXE/uBYMfiVZDA==",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "8.2.0",
|
||||
|
||||
+17
-9
@@ -2,17 +2,17 @@
|
||||
'use strict';
|
||||
const { resolve } = require('path')
|
||||
const { spawn } = require('child_process')
|
||||
const { Command } = require('commander');
|
||||
const pkg = require(resolve(__dirname, '../package.json'))
|
||||
|
||||
const program = new Command();
|
||||
const pkg = require(resolve(__dirname, '../package.json'))
|
||||
const nmBinDir = resolve(__dirname, '../node_modules/.bin/')
|
||||
|
||||
const shell = { cmd: 'sh', arg: '-c' }
|
||||
|
||||
// replace all @/ to node modules bin dir
|
||||
const replaceTokens = str => String(str).replace(new RegExp('@\\/', 'gi'), `${nmBinDir}/`)
|
||||
|
||||
const actionCommand = (command) => () => {
|
||||
const proc = spawn(shell.cmd, [shell.arg, replaceTokens(command)], {
|
||||
function runCommand(command, args = '') {
|
||||
const proc = spawn(shell.cmd, [shell.arg, `${replaceTokens(command)} ${args}`], {
|
||||
env: process.env,
|
||||
cwd: process.cwd(),
|
||||
stdio: 'inherit',
|
||||
@@ -27,10 +27,18 @@ const actionCommand = (command) => () => {
|
||||
});
|
||||
}
|
||||
|
||||
program.version('1.0.0')
|
||||
function runCommandByKey(key, command) {
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
for (const [key, command] of Object.entries(pkg.pkgTasks)) {
|
||||
program.command(key).action(actionCommand(command))
|
||||
if (args.length >= 1) {
|
||||
const [name, ...argarr] = args
|
||||
|
||||
if (name === key) {
|
||||
return runCommand(command, argarr.join(' '))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
program.parse();
|
||||
for (const [key, command] of Object.entries(pkg.pkgTasks)) {
|
||||
runCommandByKey(key, command)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user