mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-09 20:26:16 -08:00
build(tooling): [ENG-11] add module analysis without changing artifacts
This commit is contained in:
1 parent
4a9a26d4fc
commit
5efc7f7699
11 files changed
+12673
-16
No files matched your search
+6
-3
@@ -20,9 +20,12 @@ export function getEntryFile(projectDir) {
|
||||
export function parseProjects(args, projects, command) {
|
||||
const names = []
|
||||
let open = true
|
||||
let analyze = false
|
||||
for (const arg of args) {
|
||||
if (arg === '--no-open' && command === 'dev')
|
||||
open = false
|
||||
else if (arg === '--analyze' && command === 'build')
|
||||
analyze = true
|
||||
else if (arg === '--help')
|
||||
return { help: true, names: [], open }
|
||||
else if (arg !== '--')
|
||||
@@ -31,7 +34,7 @@ export function parseProjects(args, projects, command) {
|
||||
if (names.includes('all')) {
|
||||
if (command !== 'build' || names.length !== 1)
|
||||
throw new Error('Use build all on its own; dev accepts one package')
|
||||
return { names: Object.keys(projects), open }
|
||||
return { names: Object.keys(projects), open, analyze }
|
||||
}
|
||||
for (const name of names) {
|
||||
if (!Object.hasOwn(projects, name))
|
||||
@@ -39,13 +42,13 @@ export function parseProjects(args, projects, command) {
|
||||
}
|
||||
if (command === 'dev' && names.length > 1)
|
||||
throw new Error('dev accepts one package')
|
||||
return { names: [...new Set(names)], open }
|
||||
return { names: [...new Set(names)], open, analyze }
|
||||
}
|
||||
|
||||
export async function selectProjects(projects, command) {
|
||||
const selection = parseProjects(process.argv.slice(2), projects, command)
|
||||
if (selection.help) {
|
||||
console.log(command === 'build' ? 'Usage: yarn build [all | package ...]' : 'Usage: yarn dev [package] [--no-open]')
|
||||
console.log(command === 'build' ? 'Usage: yarn build [all | package ...] [--analyze]' : 'Usage: yarn dev [package] [--no-open]')
|
||||
return selection
|
||||
}
|
||||
if (!selection.names.length) {
|
||||
|
||||
Reference in new issue
Block a user