@startupjs/cli 0.61.10 → 0.62.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/commands/check.js +40 -0
- package/commands/index.js +2 -0
- package/commands/start-worker-production.js +21 -0
- package/index.js +3 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -16,12 +16,26 @@ Run `npx startupjs install --help` for a full manual
|
|
|
16
16
|
|
|
17
17
|
Build web bundle for production usage
|
|
18
18
|
|
|
19
|
+
### `check`
|
|
20
|
+
|
|
21
|
+
Type-check the current project with React-Pug support.
|
|
22
|
+
|
|
23
|
+
You can pass specific files, for example `npx startupjs check src/App.tsx`.
|
|
24
|
+
|
|
19
25
|
### `start-production`
|
|
20
26
|
|
|
21
27
|
Start production node server with production web build
|
|
22
28
|
|
|
23
29
|
(run this after `npx startupjs build`)
|
|
24
30
|
|
|
31
|
+
### `start-worker`
|
|
32
|
+
|
|
33
|
+
Start worker node server (uses current `NODE_ENV`)
|
|
34
|
+
|
|
35
|
+
### `start-worker-production`
|
|
36
|
+
|
|
37
|
+
Start worker node server with `NODE_ENV=production`
|
|
38
|
+
|
|
25
39
|
### `init-pm`, `pr`, `task <github_issue_number>`
|
|
26
40
|
|
|
27
41
|
Project management helper commands.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { runCli } from '@react-pug/check-types'
|
|
2
|
+
|
|
3
|
+
export const name = 'check [files...]'
|
|
4
|
+
export const description = 'Type-check the current project with React-Pug support'
|
|
5
|
+
export const helpText = [
|
|
6
|
+
'Examples:',
|
|
7
|
+
' npx startupjs check',
|
|
8
|
+
' Check the current working directory as a full TypeScript project.',
|
|
9
|
+
'',
|
|
10
|
+
' npx startupjs check src/App.tsx src/Button.tsx',
|
|
11
|
+
' Check only the selected files while still using the full project context.',
|
|
12
|
+
'',
|
|
13
|
+
' npx startupjs check --project packages/web src/App.tsx',
|
|
14
|
+
' Resolve tsconfig.json from a specific project path and then check selected files.'
|
|
15
|
+
].join('\n')
|
|
16
|
+
|
|
17
|
+
export const options = [
|
|
18
|
+
{
|
|
19
|
+
name: '-p, --project <path>',
|
|
20
|
+
description: 'Path to tsconfig.json or a directory containing it'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: '--tagFunction <name>',
|
|
24
|
+
description: 'Tagged template function name to recognize (default: pug)'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: '--injectCssxjsTypes <mode>',
|
|
28
|
+
description: 'cssxjs/startupjs React prop injection mode: never, auto, or force'
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
export async function action (files = [], options) {
|
|
33
|
+
const args = [...files]
|
|
34
|
+
if (options.project) args.push('--project', options.project)
|
|
35
|
+
if (options.tagFunction) args.push('--tagFunction', options.tagFunction)
|
|
36
|
+
if (options.injectCssxjsTypes) args.push('--injectCssxjsTypes', options.injectCssxjsTypes)
|
|
37
|
+
|
|
38
|
+
const exitCode = await runCli(args)
|
|
39
|
+
if (exitCode !== 0) process.exit(exitCode)
|
|
40
|
+
}
|
package/commands/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
export * as check from './check.js'
|
|
1
2
|
export * as initPm from './pm/init-pm.js'
|
|
2
3
|
export * as pr from './pm/pr.js'
|
|
3
4
|
export * as task from './pm/task.js'
|
|
4
5
|
export * as postinstall from './postinstall.js'
|
|
5
6
|
export * as startProduction from './start-production.js'
|
|
6
7
|
export * as startWorker from './start-worker.js'
|
|
8
|
+
export * as startWorkerProduction from './start-worker-production.js'
|
|
7
9
|
export * as build from './build.js'
|
|
8
10
|
export * as install from 'create-startupjs/install'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { $ } from 'execa'
|
|
2
|
+
|
|
3
|
+
export const name = 'start-worker-production'
|
|
4
|
+
export const description = 'Start worker node server with NODE_ENV=production'
|
|
5
|
+
export const options = [{
|
|
6
|
+
name: '-i, --inspect',
|
|
7
|
+
description: 'Enable NodeJS inspector agent'
|
|
8
|
+
}]
|
|
9
|
+
|
|
10
|
+
export async function action ({ inspect } = {}) {
|
|
11
|
+
await $({
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
env: { NODE_ENV: 'production' }
|
|
14
|
+
})`\
|
|
15
|
+
node \
|
|
16
|
+
--experimental-detect-module \
|
|
17
|
+
${inspect ? '--inspect' : []} \
|
|
18
|
+
--import=startupjs/nodeRegister \
|
|
19
|
+
-e import('startupjs/startWorker') \
|
|
20
|
+
`
|
|
21
|
+
}
|
package/index.js
CHANGED
|
@@ -13,7 +13,7 @@ const program = new Command()
|
|
|
13
13
|
|
|
14
14
|
async function run () {
|
|
15
15
|
for (const command of Object.values(commands)) {
|
|
16
|
-
const { name, description, options = [], action } = command
|
|
16
|
+
const { name, description, options = [], helpText, action } = command
|
|
17
17
|
|
|
18
18
|
if (program.commands.find(cmd => cmd.name() === name)) {
|
|
19
19
|
throw new Error(`Attempted to override an already registered command: ${name}`)
|
|
@@ -27,6 +27,8 @@ async function run () {
|
|
|
27
27
|
cmd.option(name, description)
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
if (helpText) cmd.addHelpText('after', `\n${helpText}`)
|
|
31
|
+
|
|
30
32
|
cmd.action(action)
|
|
31
33
|
}
|
|
32
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.62.0-alpha.0",
|
|
4
4
|
"description": "The command-line tool for StartupJS apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
"access": "public"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@
|
|
13
|
-
"@startupjs/
|
|
12
|
+
"@react-pug/check-types": "^0.1.10",
|
|
13
|
+
"@startupjs/patches": "^0.62.0-alpha.0",
|
|
14
|
+
"@startupjs/pm": "^0.62.0-alpha.0",
|
|
14
15
|
"chalk": "^5.3.0",
|
|
15
16
|
"commander": "^12.0.0",
|
|
16
|
-
"create-startupjs": "^0.
|
|
17
|
+
"create-startupjs": "^0.62.0-alpha.0",
|
|
17
18
|
"execa": "^8.0.1"
|
|
18
19
|
},
|
|
19
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "bb6cf80cd815fcc068d470dbf38a507c3bfa466a"
|
|
20
21
|
}
|