@xrystal/core 3.32.1 → 3.37.4
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 +676 -136
- package/package.json +27 -24
- package/tsconfig.base.json +15 -0
- package/x/bin/commands/create.mjs +34 -5
- package/x/bin/commands/doctor.mjs +115 -25
- package/x/bin/commands/hooks.mjs +55 -0
- package/x/bin/commands/project.mjs +75 -42
- package/x/bin/commands/release.mjs +8 -3
- package/x/bin/commands/sync-toolchain.mjs +43 -0
- package/x/bin/commands/tmp.mjs +13 -4
- package/x/bin/helpers/.generated/.generated-from +1 -0
- package/x/bin/helpers/.generated/tmp-schema.mjs +192 -0
- package/x/bin/helpers/banner.mjs +66 -12
- package/x/bin/helpers/build-config.mjs +342 -0
- package/x/bin/helpers/cli-help.mjs +164 -0
- package/x/bin/helpers/create-target.mjs +18 -2
- package/x/bin/helpers/project-artifacts.mjs +142 -0
- package/x/bin/helpers/runtime-info.mjs +172 -0
- package/x/bin/helpers/tmp-config.mjs +11 -10
- package/x/bin/helpers/tmp-layout.mjs +10 -16
- package/x/bin/helpers/tmp-schema.mjs +9 -0
- package/x/bin/helpers/toolchain-config.mjs +233 -0
- package/x/bin/main-cli.js +31 -3
- package/x/bin/scripts/clean-source-types.mjs +19 -0
- package/x/bin/scripts/fix-dist-imports.mjs +80 -0
- package/x/bin/scripts/install-git-hooks.mjs +86 -0
- package/x/bin/scripts/minify-dist.mjs +50 -0
- package/x/bin/scripts/prepare-npm-publish.mjs +39 -0
- package/x/bin/scripts/publish-guard.mjs +113 -0
- package/x/bin/scripts/verify-npm-pack.mjs +12 -0
- package/x/bin/scripts/verify-publish-config.mjs +10 -0
- package/x/bin/scripts/verify-version-bump.mjs +27 -0
- package/x/bin/scripts/version-check.mjs +173 -0
- package/x/dist/index.js +1 -0
- package/x/dist/loader/clients/index.js +1 -0
- package/x/dist/loader/configs/index.js +1 -0
- package/{source → x/dist}/loader/controller/index.d.ts +20 -17
- package/x/dist/loader/controller/index.js +1 -0
- package/x/dist/loader/dto/index.js +1 -0
- package/x/dist/loader/events/index.js +1 -0
- package/x/dist/loader/index.d.ts +11 -0
- package/x/dist/loader/index.js +1 -0
- package/{source → x/dist}/loader/kafka/index.d.ts +1 -0
- package/x/dist/loader/kafka/index.js +1 -0
- package/x/dist/loader/localizations/index.js +1 -0
- package/{source → x/dist}/loader/logger/index.d.ts +1 -0
- package/x/dist/loader/logger/index.js +2 -0
- package/x/dist/loader/service/index.js +1 -0
- package/x/dist/loader/system/index.js +1 -0
- package/x/dist/project/index.d.ts +12 -0
- package/x/dist/project/index.js +1 -0
- package/x/dist/utils/constants/defaults.json +44 -0
- package/x/dist/utils/constants/index.js +1 -0
- package/x/dist/utils/helpers/configs/index.js +1 -0
- package/x/dist/utils/helpers/context/controller-store.js +1 -0
- package/x/dist/utils/helpers/context/index.js +1 -0
- package/{source → x/dist}/utils/helpers/core/index.d.ts +1 -1
- package/x/dist/utils/helpers/core/index.js +1 -0
- package/x/dist/utils/helpers/core/paths.js +1 -0
- package/x/dist/utils/helpers/core/tmp-layout.js +1 -0
- package/x/dist/utils/helpers/date/index.js +1 -0
- package/x/dist/utils/helpers/dispatch/index.js +1 -0
- package/x/dist/utils/helpers/dto/index.js +1 -0
- package/x/dist/utils/helpers/filters/index.js +1 -0
- package/x/dist/utils/helpers/framework/index.js +1 -0
- package/x/dist/utils/helpers/handlers/adapters.js +1 -0
- package/x/dist/utils/helpers/handlers/execute.js +1 -0
- package/x/dist/utils/helpers/handlers/index.js +1 -0
- package/x/dist/utils/helpers/hash/crypto.js +1 -0
- package/x/dist/utils/helpers/id/index.js +1 -0
- package/x/dist/utils/helpers/index.js +1 -0
- package/x/dist/utils/helpers/ip/index.js +1 -0
- package/x/dist/utils/helpers/is/index.js +1 -0
- package/x/dist/utils/helpers/locales/index.js +1 -0
- package/x/dist/utils/helpers/math/index.js +1 -0
- package/{source → x/dist}/utils/helpers/middleware/index.d.ts +2 -2
- package/x/dist/utils/helpers/middleware/index.js +1 -0
- package/x/dist/utils/helpers/objects/index.js +1 -0
- package/x/dist/utils/helpers/path/index.js +1 -0
- package/{source → x/dist}/utils/helpers/protocol/index.d.ts +2 -10
- package/x/dist/utils/helpers/protocol/index.js +1 -0
- package/x/dist/utils/helpers/protocol/options.js +1 -0
- package/x/dist/utils/helpers/regex/checkSpecialRegexControl.js +1 -0
- package/x/dist/utils/helpers/runtime/dto-access.js +1 -0
- package/x/dist/utils/helpers/runtime/dto-types.js +1 -0
- package/{source → x/dist}/utils/helpers/runtime/index.d.ts +1 -0
- package/x/dist/utils/helpers/runtime/index.js +1 -0
- package/x/dist/utils/helpers/runtime/shutdown.d.ts +3 -0
- package/x/dist/utils/helpers/runtime/shutdown.js +1 -0
- package/x/dist/utils/helpers/state/index.js +1 -0
- package/x/dist/utils/helpers/state/props-from-tmp.js +1 -0
- package/x/dist/utils/helpers/state/request-key-guard.js +1 -0
- package/x/dist/utils/helpers/state/scopes.js +1 -0
- package/x/dist/utils/helpers/string/index.js +1 -0
- package/x/dist/utils/helpers/tests/tmp-schema.test.js +1 -0
- package/x/dist/utils/helpers/tests/tmp-watch.test.d.ts +1 -0
- package/x/dist/utils/helpers/tests/tmp-watch.test.js +1 -0
- package/x/dist/utils/helpers/timer/index.js +1 -0
- package/x/dist/utils/helpers/tmp/index.d.ts +5 -0
- package/x/dist/utils/helpers/tmp/index.js +1 -0
- package/x/dist/utils/helpers/tmp/loader-tmp-sync.js +1 -0
- package/{source → x/dist}/utils/helpers/tmp/runtime-tmp.d.ts +2 -6
- package/x/dist/utils/helpers/tmp/runtime-tmp.js +1 -0
- package/{source → x/dist}/utils/helpers/tmp/tmp-loader.d.ts +1 -0
- package/x/dist/utils/helpers/tmp/tmp-loader.js +1 -0
- package/x/dist/utils/helpers/tmp/tmp-schema.d.ts +47 -0
- package/x/dist/utils/helpers/tmp/tmp-schema.js +1 -0
- package/x/dist/utils/helpers/tmp/tmp-watch.d.ts +1 -0
- package/x/dist/utils/helpers/tmp/tmp-watch.js +1 -0
- package/x/dist/utils/helpers/validates/index.js +1 -0
- package/x/dist/utils/index.js +1 -0
- package/x/dist/utils/models/classes/class.clients.js +1 -0
- package/x/dist/utils/models/classes/class.interfaces.js +1 -0
- package/x/dist/utils/models/classes/class.service-locator.js +1 -0
- package/{source → x/dist}/utils/models/classes/class.tmp-file-loader.d.ts +3 -2
- package/x/dist/utils/models/classes/class.tmp-file-loader.js +1 -0
- package/x/dist/utils/models/classes/class.x.js +1 -0
- package/x/dist/utils/models/enums/index.js +1 -0
- package/x/dist/utils/models/index.js +1 -0
- package/x/dist/utils/models/types/index.js +1 -0
- package/x/dist/utils/package-root.js +1 -0
- package/x/tmp.yml +51 -42
- package/source/index.js +0 -11
- package/source/loader/clients/index.js +0 -22
- package/source/loader/configs/index.js +0 -88
- package/source/loader/controller/index.js +0 -236
- package/source/loader/dto/index.js +0 -92
- package/source/loader/events/index.js +0 -44
- package/source/loader/index.d.ts +0 -11
- package/source/loader/index.js +0 -11
- package/source/loader/kafka/index.js +0 -137
- package/source/loader/localizations/index.js +0 -46
- package/source/loader/logger/index.js +0 -217
- package/source/loader/service/index.js +0 -7
- package/source/loader/system/index.js +0 -25
- package/source/project/index.d.ts +0 -8
- package/source/project/index.js +0 -70
- package/source/utils/constants/defaults.json +0 -15
- package/source/utils/constants/defaults.mjs +0 -10
- package/source/utils/constants/index.js +0 -22
- package/source/utils/helpers/configs/index.js +0 -1
- package/source/utils/helpers/context/controller-store.js +0 -12
- package/source/utils/helpers/context/index.js +0 -24
- package/source/utils/helpers/core/index.js +0 -58
- package/source/utils/helpers/core/paths.js +0 -78
- package/source/utils/helpers/core/tmp-layout.js +0 -241
- package/source/utils/helpers/date/index.js +0 -48
- package/source/utils/helpers/dispatch/index.js +0 -53
- package/source/utils/helpers/dto/index.js +0 -10
- package/source/utils/helpers/filters/index.js +0 -44
- package/source/utils/helpers/framework/index.js +0 -17
- package/source/utils/helpers/handlers/adapters.js +0 -40
- package/source/utils/helpers/handlers/execute.js +0 -82
- package/source/utils/helpers/handlers/index.js +0 -31
- package/source/utils/helpers/hash/crypto.js +0 -22
- package/source/utils/helpers/id/index.js +0 -24
- package/source/utils/helpers/index.js +0 -26
- package/source/utils/helpers/ip/index.js +0 -21
- package/source/utils/helpers/is/index.js +0 -35
- package/source/utils/helpers/locales/index.js +0 -82
- package/source/utils/helpers/math/index.js +0 -14
- package/source/utils/helpers/middleware/index.js +0 -36
- package/source/utils/helpers/objects/index.js +0 -55
- package/source/utils/helpers/path/index.js +0 -4
- package/source/utils/helpers/protocol/index.js +0 -99
- package/source/utils/helpers/protocol/options.js +0 -13
- package/source/utils/helpers/regex/checkSpecialRegexControl.js +0 -3
- package/source/utils/helpers/runtime/dto-access.js +0 -5
- package/source/utils/helpers/runtime/index.js +0 -1
- package/source/utils/helpers/state/index.js +0 -185
- package/source/utils/helpers/state/props-from-tmp.js +0 -44
- package/source/utils/helpers/state/request-key-guard.js +0 -42
- package/source/utils/helpers/state/scopes.js +0 -69
- package/source/utils/helpers/string/index.js +0 -9
- package/source/utils/helpers/timer/index.js +0 -5
- package/source/utils/helpers/tmp/index.d.ts +0 -3
- package/source/utils/helpers/tmp/index.js +0 -3
- package/source/utils/helpers/tmp/loader-tmp-sync.js +0 -13
- package/source/utils/helpers/tmp/runtime-tmp.js +0 -30
- package/source/utils/helpers/tmp/tmp-loader.js +0 -48
- package/source/utils/helpers/validates/index.js +0 -20
- package/source/utils/index.js +0 -3
- package/source/utils/models/classes/class.clients.js +0 -142
- package/source/utils/models/classes/class.interfaces.js +0 -10
- package/source/utils/models/classes/class.service-locator.js +0 -16
- package/source/utils/models/classes/class.tmp-file-loader.js +0 -38
- package/source/utils/models/classes/class.x.js +0 -180
- package/source/utils/models/enums/index.js +0 -148
- package/source/utils/models/index.js +0 -9
- package/source/utils/models/types/index.js +0 -2
- package/source/utils/models/types/shims.d.ts +0 -123
- package/source/utils/package-root.js +0 -5
- package/x/tests/cli.test.ts +0 -85
- package/x/tests/context.test.ts +0 -25
- package/x/tests/dispatch.test.ts +0 -84
- package/x/tests/fixtures/locales/en/translation.json +0 -8
- package/x/tests/fixtures/locales/tr/translation.json +0 -8
- package/x/tests/frameworks.integration.test.ts +0 -185
- package/x/tests/helpers/i18n-setup.ts +0 -52
- package/x/tests/helpers/middleware.ts +0 -23
- package/x/tests/helpers/register-test-dto.ts +0 -52
- package/x/tests/i18n.integration.test.ts +0 -77
- package/x/tests/i18n.test.ts +0 -96
- package/x/tests/middleware.test.ts +0 -83
- package/x/tests/project-layout.test.ts +0 -65
- package/x/tests/protocol.test.ts +0 -75
- package/x/tests/realtime.examples.test.ts +0 -198
- package/x/tests/runtime-tmp.test.ts +0 -49
- package/x/tests/socket.integration.test.ts +0 -174
- package/x/tests/state.test.ts +0 -183
- package/x/tests/tmp-layout-guard.test.ts +0 -40
- /package/{source → x/dist}/index.d.ts +0 -0
- /package/{source → x/dist}/loader/clients/index.d.ts +0 -0
- /package/{source → x/dist}/loader/configs/index.d.ts +0 -0
- /package/{source → x/dist}/loader/dto/index.d.ts +0 -0
- /package/{source → x/dist}/loader/events/index.d.ts +0 -0
- /package/{source → x/dist}/loader/localizations/index.d.ts +0 -0
- /package/{source → x/dist}/loader/service/index.d.ts +0 -0
- /package/{source → x/dist}/loader/system/index.d.ts +0 -0
- /package/{source → x/dist}/utils/constants/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/configs/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/context/controller-store.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/context/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/core/paths.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/core/tmp-layout.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/date/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/dispatch/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/dto/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/filters/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/framework/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/handlers/adapters.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/handlers/execute.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/handlers/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/hash/crypto.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/id/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/ip/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/is/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/locales/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/math/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/objects/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/path/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/protocol/options.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/regex/checkSpecialRegexControl.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/runtime/dto-access.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/runtime/dto-types.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/state/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/state/props-from-tmp.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/state/request-key-guard.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/state/scopes.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/string/index.d.ts +0 -0
- /package/{source/utils/helpers/runtime/dto-types.js → x/dist/utils/helpers/tests/tmp-schema.test.d.ts} +0 -0
- /package/{source → x/dist}/utils/helpers/timer/index.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/tmp/loader-tmp-sync.d.ts +0 -0
- /package/{source → x/dist}/utils/helpers/validates/index.d.ts +0 -0
- /package/{source → x/dist}/utils/index.d.ts +0 -0
- /package/{source → x/dist}/utils/models/classes/class.clients.d.ts +0 -0
- /package/{source → x/dist}/utils/models/classes/class.interfaces.d.ts +0 -0
- /package/{source → x/dist}/utils/models/classes/class.service-locator.d.ts +0 -0
- /package/{source → x/dist}/utils/models/classes/class.x.d.ts +0 -0
- /package/{source → x/dist}/utils/models/enums/index.d.ts +0 -0
- /package/{source → x/dist}/utils/models/index.d.ts +0 -0
- /package/{source → x/dist}/utils/models/types/index.d.ts +0 -0
- /package/{source → x/dist}/utils/package-root.d.ts +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Yusuf Yasir KAYGUSUZ",
|
|
3
3
|
"name": "@xrystal/core",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.37.4",
|
|
5
5
|
"description": "Project core for xrystal",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -12,39 +12,40 @@
|
|
|
12
12
|
"url": "git+https://github.com/xdloper/-xrystal-core.git"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"
|
|
15
|
+
"x/dist",
|
|
16
16
|
"x/bin",
|
|
17
|
-
"x/tests",
|
|
18
17
|
"x/tmp.yml",
|
|
19
18
|
"x/assets",
|
|
19
|
+
"tsconfig.base.json",
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
|
-
"main": "
|
|
23
|
-
"types": "./
|
|
22
|
+
"main": "./x/dist/project/index.js",
|
|
23
|
+
"types": "./x/dist/project/index.d.ts",
|
|
24
24
|
"exports": {
|
|
25
|
+
"./tsconfig.base.json": "./tsconfig.base.json",
|
|
25
26
|
".": {
|
|
26
|
-
"types": "./
|
|
27
|
-
"default": "./
|
|
27
|
+
"types": "./x/dist/project/index.d.ts",
|
|
28
|
+
"default": "./x/dist/project/index.js"
|
|
28
29
|
},
|
|
29
30
|
"./utils": {
|
|
30
|
-
"types": "./
|
|
31
|
-
"default": "./
|
|
31
|
+
"types": "./x/dist/utils/index.d.ts",
|
|
32
|
+
"default": "./x/dist/utils/index.js"
|
|
32
33
|
},
|
|
33
34
|
"./loader": {
|
|
34
|
-
"types": "./
|
|
35
|
-
"default": "./
|
|
35
|
+
"types": "./x/dist/loader/index.d.ts",
|
|
36
|
+
"default": "./x/dist/loader/index.js"
|
|
36
37
|
},
|
|
37
38
|
"./loader/controller": {
|
|
38
|
-
"types": "./
|
|
39
|
-
"default": "./
|
|
39
|
+
"types": "./x/dist/loader/controller/index.d.ts",
|
|
40
|
+
"default": "./x/dist/loader/controller/index.js"
|
|
40
41
|
},
|
|
41
42
|
"./loader/dto": {
|
|
42
|
-
"types": "./
|
|
43
|
-
"default": "./
|
|
43
|
+
"types": "./x/dist/loader/dto/index.d.ts",
|
|
44
|
+
"default": "./x/dist/loader/dto/index.js"
|
|
44
45
|
},
|
|
45
46
|
"./project": {
|
|
46
|
-
"types": "./
|
|
47
|
-
"default": "./
|
|
47
|
+
"types": "./x/dist/project/index.d.ts",
|
|
48
|
+
"default": "./x/dist/project/index.js"
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
"type": "module",
|
|
@@ -54,16 +55,18 @@
|
|
|
54
55
|
"tmp": "./x/bin/main-cli.js"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|
|
57
|
-
"dev": "
|
|
58
|
-
"build": "
|
|
58
|
+
"dev": "node x/bin/main-cli.js dev",
|
|
59
|
+
"build": "node x/bin/main-cli.js build",
|
|
59
60
|
"test": "bun test x/tests",
|
|
60
61
|
"lint": "eslint source",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"build:
|
|
64
|
-
"
|
|
62
|
+
"prepublishOnly": "bun run release:prepare && node x/bin/scripts/verify-publish-config.mjs",
|
|
63
|
+
"release:prepare": "bun run lint && bun run build && bun test x/tests",
|
|
64
|
+
"build:prod": "bun run release:prepare && node x/bin/scripts/clean-source-types.mjs",
|
|
65
|
+
"build:dev": "node x/bin/main-cli.js dev",
|
|
66
|
+
"start": "node x/bin/main-cli.js start",
|
|
65
67
|
"tag": "node x/bin/scripts/tag.mjs",
|
|
66
|
-
"version:check": "node x/bin/scripts/version-check.mjs"
|
|
68
|
+
"version:check": "node x/bin/scripts/version-check.mjs",
|
|
69
|
+
"hooks:install": "node x/bin/scripts/install-git-hooks.mjs"
|
|
67
70
|
},
|
|
68
71
|
"dependencies": {
|
|
69
72
|
"@xrystal/dto": "^26.6.28-v1",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"baseUrl": ".",
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"noImplicitAny": true,
|
|
12
|
+
"noEmitOnError": false,
|
|
13
|
+
"declarationMap": false
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -13,14 +13,30 @@ import {
|
|
|
13
13
|
resolveMainFolderPath,
|
|
14
14
|
} from '../helpers/tmp-layout.mjs'
|
|
15
15
|
import { formatLoaderSummary, summarizeLoaders } from '../helpers/tmp-config.mjs'
|
|
16
|
+
import { formatCreateHelp, formatCreateCommandHelp, LIST_BULLET } from '../helpers/cli-help.mjs'
|
|
17
|
+
import { setupProjectGitHooks } from '../scripts/install-git-hooks.mjs'
|
|
16
18
|
|
|
17
|
-
export function registerCreateCommand(cli, { runtimeName, packageManager, installCommand, devCommand }) {
|
|
19
|
+
export function registerCreateCommand(cli, { cliName = 'xcore', runtimeName, packageManager, installCommand, devCommand }) {
|
|
18
20
|
cli
|
|
19
|
-
.command('create
|
|
20
|
-
.description(
|
|
21
|
+
.command('create <project-name> [target-path]')
|
|
22
|
+
.description('Scaffold new service from GitHub template')
|
|
21
23
|
.option('-f, --force', 'Allow creating in a non-empty directory')
|
|
22
24
|
.action(async (projectName, targetDir, options) => {
|
|
23
|
-
const
|
|
25
|
+
const name = projectName?.trim()
|
|
26
|
+
if (!name) {
|
|
27
|
+
console.error(chalk.red('\n✗ project-name is required\n'))
|
|
28
|
+
console.log(formatCreateHelp({ cliName }))
|
|
29
|
+
process.exit(1)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let targetPath
|
|
33
|
+
let isCurrentDir
|
|
34
|
+
try {
|
|
35
|
+
;({ targetPath, isCurrentDir } = resolveCreateTarget(name, targetDir))
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.error(chalk.red(`\n✗ ${error.message}\n`))
|
|
38
|
+
process.exit(1)
|
|
39
|
+
}
|
|
24
40
|
|
|
25
41
|
if (fs.existsSync(targetPath)) {
|
|
26
42
|
const entries = fs.readdirSync(targetPath)
|
|
@@ -65,6 +81,19 @@ export function registerCreateCommand(cli, { runtimeName, packageManager, instal
|
|
|
65
81
|
|
|
66
82
|
execSync(installCommand, { cwd: targetPath, stdio: 'inherit' })
|
|
67
83
|
|
|
84
|
+
try {
|
|
85
|
+
const hookResult = setupProjectGitHooks(targetPath, { cliName })
|
|
86
|
+
console.log(
|
|
87
|
+
hookResult.refreshed
|
|
88
|
+
? chalk.yellow(' pre-commit hook refreshed')
|
|
89
|
+
: chalk.green(' pre-commit hook installed'),
|
|
90
|
+
)
|
|
91
|
+
console.log(chalk.gray(` hook: ${hookResult.hookPath}`))
|
|
92
|
+
} catch (hookError) {
|
|
93
|
+
console.log(chalk.yellow(` pre-commit hook skipped: ${hookError.message}`))
|
|
94
|
+
console.log(chalk.gray(` run later: ${cliName} hooks install`))
|
|
95
|
+
}
|
|
96
|
+
|
|
68
97
|
let loaderSummary = null
|
|
69
98
|
try {
|
|
70
99
|
loaderSummary = summarizeLoaders(resolvedTmp)
|
|
@@ -78,7 +107,7 @@ export function registerCreateCommand(cli, { runtimeName, packageManager, instal
|
|
|
78
107
|
console.log(chalk.cyan.bold('\n Loaders & config\n'))
|
|
79
108
|
for (const line of formatLoaderSummary(loaderSummary)) {
|
|
80
109
|
const [key, ...rest] = line.split(': ')
|
|
81
|
-
console.log(` ${
|
|
110
|
+
console.log(` ${LIST_BULLET} ${chalk.white(key)}${rest.length ? chalk.gray(`: ${rest.join(': ')}`) : ''}`)
|
|
82
111
|
}
|
|
83
112
|
console.log('')
|
|
84
113
|
console.log(chalk.dim(' HTTP → dtoMiddleware() + ctr()'))
|
|
@@ -1,59 +1,149 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import { printCommandHeader } from '../helpers/banner.mjs'
|
|
4
|
+
import { resolveDistLayout } from '../helpers/project-artifacts.mjs'
|
|
2
5
|
import {
|
|
3
6
|
getInstalledCoreVersion,
|
|
4
7
|
getProjectRoot,
|
|
5
8
|
readCliPackageJson,
|
|
6
9
|
readProjectPackageJson,
|
|
7
10
|
} from '../helpers/project-root.mjs'
|
|
8
|
-
import {
|
|
11
|
+
import { listRuntimeInventory, resolveRuntimeInfo } from '../helpers/runtime-info.mjs'
|
|
12
|
+
import { evaluateVersionBump, getLatestTagVersion, getVersionState, VERSION_PATTERN } from '../scripts/version-check.mjs'
|
|
13
|
+
import { auditTsconfigAlignment, resolveToolchainPathsFromProject } from '../helpers/toolchain-config.mjs'
|
|
14
|
+
import { isGitHookInstalled } from '../scripts/install-git-hooks.mjs'
|
|
15
|
+
|
|
16
|
+
function statusValue(value, okLabel = null) {
|
|
17
|
+
if (value == null || value === '') return chalk.gray('—')
|
|
18
|
+
return okLabel ?? value
|
|
19
|
+
}
|
|
9
20
|
|
|
10
|
-
|
|
21
|
+
function printSection(title) {
|
|
22
|
+
console.log(chalk.bold.cyan(`\n ${title}`))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function registerDoctorCommand(cli, { cliName = 'xcore' } = {}) {
|
|
11
26
|
cli
|
|
12
27
|
.command('doctor')
|
|
13
|
-
.description('
|
|
28
|
+
.description('Check runtime, git, and @xrystal/core alignment')
|
|
14
29
|
.action(async () => {
|
|
15
30
|
const root = getProjectRoot()
|
|
16
31
|
const cliPkg = readCliPackageJson()
|
|
17
32
|
const projectPkg = readProjectPackageJson(root)
|
|
18
33
|
const core = getInstalledCoreVersion(root)
|
|
34
|
+
const runtime = resolveRuntimeInfo(root)
|
|
35
|
+
let distLayout = null
|
|
19
36
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
try {
|
|
38
|
+
distLayout = resolveDistLayout(root)
|
|
39
|
+
} catch {
|
|
40
|
+
distLayout = null
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
printCommandHeader({ cliName, command: 'doctor', version: cliPkg.version })
|
|
44
|
+
|
|
45
|
+
const inventory = listRuntimeInventory(runtime)
|
|
46
|
+
|
|
47
|
+
function printRuntimeRow(item) {
|
|
48
|
+
const label = item.label.padEnd(18)
|
|
49
|
+
if (!item.version && !item.path) {
|
|
50
|
+
console.log(` ${label}${chalk.gray('—')}`)
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
const versionText = item.version ? chalk.white(item.version) : chalk.gray('—')
|
|
54
|
+
const activeMark = item.active ? chalk.green(' · active') : ''
|
|
55
|
+
const pathText = item.path ? chalk.gray(` · ${item.path}`) : ''
|
|
56
|
+
console.log(` ${label}${versionText}${activeMark}${pathText}`)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
printSection('Environment')
|
|
60
|
+
console.log(` ${'platform'.padEnd(18)}${chalk.bold(runtime.platform)} ${chalk.gray(`(${runtime.osRelease})`)}`)
|
|
61
|
+
console.log(` ${'CLI host'.padEnd(18)}${chalk.bold(`${runtime.cliHostLabel} ${runtime.cliHostVersion}`)} ${chalk.gray(`(${runtime.cliHost})`)}`)
|
|
62
|
+
console.log(` ${'git'.padEnd(18)}${statusValue(runtime.git, runtime.git ? chalk.gray(runtime.git) : null)}`)
|
|
63
|
+
console.log(` ${'package manager'.padEnd(18)}${chalk.bold(runtime.packageManager)} ${chalk.gray('(lockfile)')}`)
|
|
64
|
+
|
|
65
|
+
printSection('Runtimes (PATH)')
|
|
66
|
+
for (const item of inventory.executables) printRuntimeRow(item)
|
|
67
|
+
|
|
68
|
+
printSection('Node version managers')
|
|
69
|
+
for (const item of inventory.managers) printRuntimeRow(item)
|
|
70
|
+
|
|
71
|
+
printSection('Project')
|
|
72
|
+
console.log(` ${'root'.padEnd(18)}${chalk.bold(root)}`)
|
|
73
|
+
if (distLayout) {
|
|
74
|
+
console.log(` ${'tmp root'.padEnd(18)}${chalk.bold(distLayout.rootFolderPath)} ${chalk.gray('(paths.root)')}`)
|
|
75
|
+
console.log(` ${'source'.padEnd(18)}${chalk.bold(distLayout.layout.mainFolderPath)} ${chalk.gray('(paths.source)')}`)
|
|
76
|
+
console.log(` ${'dist'.padEnd(18)}${chalk.bold(distLayout.distPrefix)} ${chalk.gray('(paths.special.dist)')}`)
|
|
77
|
+
} else {
|
|
78
|
+
console.log(chalk.yellow(' layout: tmp.yml not resolved — run xcore tmp'))
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
printSection('CLI (tool)')
|
|
82
|
+
console.log(` ${'@xrystal/core'.padEnd(18)}${chalk.bold(`${cliPkg.name}@${cliPkg.version}`)}`)
|
|
83
|
+
|
|
84
|
+
printSection('Package')
|
|
85
|
+
console.log(` ${'name'.padEnd(18)}${chalk.bold(projectPkg.name)}`)
|
|
86
|
+
console.log(` ${'version'.padEnd(18)}${chalk.bold(projectPkg.version)}`)
|
|
87
|
+
console.log(` ${'semver'.padEnd(18)}${VERSION_PATTERN.test(projectPkg.version) ? chalk.green('valid') : chalk.yellow('check format')}`)
|
|
31
88
|
|
|
32
89
|
if (core.declared) {
|
|
33
|
-
console.log(`
|
|
90
|
+
console.log(` ${'dependency'.padEnd(18)}${core.declared}`)
|
|
34
91
|
}
|
|
35
92
|
if (core.installed) {
|
|
36
93
|
const latestHint = core.installed === cliPkg.version ? chalk.green('matches CLI') : chalk.yellow(`CLI is ${cliPkg.version}`)
|
|
37
|
-
console.log(`
|
|
94
|
+
console.log(` ${'node_modules'.padEnd(18)}${chalk.bold(core.installed)} ${latestHint}`)
|
|
38
95
|
} else if (!core.isWorkspace) {
|
|
39
|
-
console.log(chalk.yellow('
|
|
96
|
+
console.log(chalk.yellow(` ${'node_modules'.padEnd(18)}not installed`))
|
|
97
|
+
}
|
|
98
|
+
if (core.installed && core.installed !== cliPkg.version && !core.isWorkspace) {
|
|
99
|
+
console.log('')
|
|
100
|
+
console.log(chalk.bold.red(' ⚠ CLI / node_modules version mismatch'))
|
|
101
|
+
console.log(chalk.yellow(` CLI (this binary): ${cliPkg.version}`))
|
|
102
|
+
console.log(chalk.yellow(` node_modules installed: ${core.installed}`))
|
|
103
|
+
console.log(chalk.gray(` fix: bun add @xrystal/core@${cliPkg.version}`))
|
|
40
104
|
}
|
|
41
105
|
|
|
42
|
-
|
|
43
|
-
console.log(chalk.gray(' Git'))
|
|
106
|
+
printSection('Git')
|
|
44
107
|
|
|
45
108
|
try {
|
|
46
109
|
const state = getVersionState('HEAD', root)
|
|
47
|
-
console.log(` branch
|
|
48
|
-
console.log(` HEAD version
|
|
49
|
-
console.log(` disk version
|
|
50
|
-
console.log(` version match
|
|
51
|
-
console.log(` package.json
|
|
52
|
-
|
|
110
|
+
console.log(` ${'branch'.padEnd(18)}${state.branch}`)
|
|
111
|
+
console.log(` ${'HEAD version'.padEnd(18)}${state.committed.version}`)
|
|
112
|
+
console.log(` ${'disk version'.padEnd(18)}${state.disk.version}`)
|
|
113
|
+
console.log(` ${'version match'.padEnd(18)}${state.versionMatch ? chalk.green('yes') : chalk.red('no')}`)
|
|
114
|
+
console.log(` ${'package.json'.padEnd(18)}${state.isPackageJsonClean ? chalk.green('committed') : chalk.yellow('dirty')}`)
|
|
115
|
+
const latestTag = getLatestTagVersion(root)
|
|
116
|
+
console.log(` ${'latest tag'.padEnd(18)}${latestTag ? `v${latestTag}` : chalk.gray('none')}`)
|
|
117
|
+
const evaluation = evaluateVersionBump(state.committed.version, 'HEAD', root)
|
|
118
|
+
if (evaluation.baselineVersion) {
|
|
119
|
+
const bumpText = evaluation.ok
|
|
120
|
+
? chalk.green(`ok (${evaluation.status})`)
|
|
121
|
+
: chalk.red(`must be > ${evaluation.baselineVersion}`)
|
|
122
|
+
console.log(` bump vs ${evaluation.baselineLabel}: ${bumpText}`)
|
|
123
|
+
} else {
|
|
124
|
+
console.log(` ${'bump check'.padEnd(18)}${chalk.green('first release baseline')}`)
|
|
125
|
+
}
|
|
126
|
+
console.log(` ${'working tree'.padEnd(18)}${state.isClean ? chalk.green('clean') : chalk.yellow('dirty')}`)
|
|
127
|
+
const hookOk = isGitHookInstalled(root)
|
|
128
|
+
console.log(` ${'pre-commit hook'.padEnd(18)}${hookOk ? chalk.green('installed') : chalk.yellow('missing')} ${chalk.gray('· xcore hooks install')}`)
|
|
53
129
|
} catch (error) {
|
|
54
130
|
console.log(chalk.yellow(` git: ${error.message}`))
|
|
55
131
|
}
|
|
56
132
|
|
|
133
|
+
printSection('Toolchain')
|
|
134
|
+
const toolchain = resolveToolchainPathsFromProject(root)
|
|
135
|
+
console.log(` ${'source'.padEnd(18)}${chalk.bold(toolchain.mainSourceRel)}`)
|
|
136
|
+
console.log(` ${'outDir'.padEnd(18)}${chalk.bold(toolchain.outDir)}`)
|
|
137
|
+
const tsAudit = auditTsconfigAlignment(root)
|
|
138
|
+
if (tsAudit.missing) {
|
|
139
|
+
console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}missing · run xcore sync-toolchain`))
|
|
140
|
+
} else if (tsAudit.ok) {
|
|
141
|
+
console.log(chalk.green(` ${'tsconfig'.padEnd(18)}aligned with tmp.yml`))
|
|
142
|
+
} else {
|
|
143
|
+
console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}drift from tmp.yml`))
|
|
144
|
+
for (const note of tsAudit.notes) console.log(chalk.gray(` · ${note}`))
|
|
145
|
+
}
|
|
146
|
+
console.log(` ${'eslint'.padEnd(18)}${toolchain.eslintFiles.join(', ')}`)
|
|
57
147
|
console.log('')
|
|
58
148
|
})
|
|
59
149
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import chalk from 'chalk'
|
|
2
|
+
|
|
3
|
+
import { printCommandHeader } from '../helpers/banner.mjs'
|
|
4
|
+
import { readCliPackageJson } from '../helpers/project-root.mjs'
|
|
5
|
+
import { installGitHooks, isGitHookInstalled } from '../scripts/install-git-hooks.mjs'
|
|
6
|
+
import { getProjectRoot } from '../helpers/project-root.mjs'
|
|
7
|
+
|
|
8
|
+
export function registerHooksCommand(cli, { cliName = 'xcore' } = {}) {
|
|
9
|
+
const hooks = cli
|
|
10
|
+
.command('hooks')
|
|
11
|
+
.description('Install git hooks for version bump checks')
|
|
12
|
+
.addHelpText(
|
|
13
|
+
'after',
|
|
14
|
+
`
|
|
15
|
+
${chalk.gray('Examples:')}
|
|
16
|
+
${cliName} hooks install
|
|
17
|
+
${cliName} hooks status
|
|
18
|
+
`,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
hooks
|
|
22
|
+
.command('install')
|
|
23
|
+
.description('Write pre-commit hook to .git/hooks (core repo + services)')
|
|
24
|
+
.action(() => {
|
|
25
|
+
try {
|
|
26
|
+
const root = getProjectRoot()
|
|
27
|
+
printCommandHeader({ cliName, command: 'hooks install', version: readCliPackageJson().version })
|
|
28
|
+
|
|
29
|
+
if (isGitHookInstalled(root)) {
|
|
30
|
+
console.log(chalk.yellow(' pre-commit hook already installed — refreshing'))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const result = installGitHooks(root)
|
|
34
|
+
console.log(chalk.green('\n✓ pre-commit hook installed\n'))
|
|
35
|
+
console.log(chalk.gray(` project: ${result.root}`))
|
|
36
|
+
console.log(chalk.gray(` hook: ${result.hookPath}`))
|
|
37
|
+
console.log(chalk.gray(` checker: ${result.scriptPath}`))
|
|
38
|
+
console.log(chalk.dim('\n Runs on git commit when package.json version changes.\n'))
|
|
39
|
+
} catch (error) {
|
|
40
|
+
console.error(chalk.red(`\n✗ ${error.message}\n`))
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
hooks
|
|
46
|
+
.command('status')
|
|
47
|
+
.description('Show whether @xrystal/core pre-commit hook is installed')
|
|
48
|
+
.action(() => {
|
|
49
|
+
const root = getProjectRoot()
|
|
50
|
+
printCommandHeader({ cliName, command: 'hooks status', version: readCliPackageJson().version })
|
|
51
|
+
const installed = isGitHookInstalled(root)
|
|
52
|
+
console.log(` pre-commit: ${installed ? chalk.green('installed') : chalk.yellow('not installed')}`)
|
|
53
|
+
console.log(chalk.gray(` fix: ${cliName} hooks install\n`))
|
|
54
|
+
})
|
|
55
|
+
}
|
|
@@ -2,29 +2,26 @@ import { execSync } from 'node:child_process'
|
|
|
2
2
|
import fs from 'node:fs'
|
|
3
3
|
import path from 'node:path'
|
|
4
4
|
import chalk from 'chalk'
|
|
5
|
-
import { getProjectRoot, projectHasPath } from '../helpers/project-root.mjs'
|
|
6
|
-
import { ensureTmpFile, relativeFromRoot } from '../helpers/tmp-layout.mjs'
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
6
|
+
import {
|
|
7
|
+
isCorePackageName,
|
|
8
|
+
readTmpBuildContext,
|
|
9
|
+
resolveCoreBuildSteps,
|
|
10
|
+
resolveDevEntry,
|
|
11
|
+
resolveDistEntryAbs,
|
|
12
|
+
resolveEnvFiles,
|
|
13
|
+
resolveServiceBuildSteps,
|
|
14
|
+
shouldDelegatePackageBuild,
|
|
15
|
+
summarizeBuildPlan,
|
|
16
|
+
} from '../helpers/build-config.mjs'
|
|
17
|
+
import { getProjectRoot } from '../helpers/project-root.mjs'
|
|
18
|
+
import { printCommandHeader } from '../helpers/banner.mjs'
|
|
19
|
+
import { readCliPackageJson } from '../helpers/project-root.mjs'
|
|
20
|
+
import { ensureTmpFile, relativeFromRoot } from '../helpers/tmp-layout.mjs'
|
|
21
|
+
import { ensureProjectArtifacts } from '../helpers/project-artifacts.mjs'
|
|
20
22
|
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
const candidates = [
|
|
24
|
-
path.join(layout.pathsAbs.environments, '.global.env'),
|
|
25
|
-
path.join(layout.pathsAbs.environments, '.dev.env'),
|
|
26
|
-
]
|
|
27
|
-
return candidates.filter((file) => fs.existsSync(file))
|
|
23
|
+
function runInProject(root, command) {
|
|
24
|
+
execSync(command, { cwd: root, stdio: 'inherit', env: process.env })
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
function resolveTestTarget(root) {
|
|
@@ -37,57 +34,93 @@ function resolveTestTarget(root) {
|
|
|
37
34
|
)
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
function runInProject(root, command) {
|
|
41
|
-
execSync(command, { cwd: root, stdio: 'inherit', env: process.env })
|
|
42
|
-
}
|
|
43
|
-
|
|
44
37
|
export function registerProjectCommands(cli, { cliName = 'xcore' } = {}) {
|
|
45
38
|
cli
|
|
46
39
|
.command('dev')
|
|
47
|
-
.description('
|
|
40
|
+
.description('Watch source/index.ts with dev env files')
|
|
48
41
|
.action(() => {
|
|
49
42
|
const root = getProjectRoot()
|
|
50
|
-
const
|
|
51
|
-
const
|
|
43
|
+
const { layout } = readTmpBuildContext(root)
|
|
44
|
+
const entry = resolveDevEntry(root, layout)
|
|
45
|
+
const envFiles = resolveEnvFiles(layout.pathsAbs.environments, ['.global.env', '.dev.env'])
|
|
52
46
|
const envArgs = envFiles.map((file) => `--env-file=${file}`).join(' ')
|
|
53
47
|
|
|
54
|
-
|
|
48
|
+
printCommandHeader({ cliName, command: 'dev', version: readCliPackageJson().version })
|
|
49
|
+
console.log(chalk.gray(` root: ${root}`))
|
|
50
|
+
console.log(chalk.gray(` entry: ${entry} (.ts)\n`))
|
|
55
51
|
runInProject(root, `bun --watch ${envArgs} ${entry}`.trim())
|
|
56
52
|
})
|
|
57
53
|
|
|
58
54
|
cli
|
|
59
55
|
.command('build')
|
|
60
|
-
.description('
|
|
56
|
+
.description('Bundle to dist/ (Bun + optional tsc)')
|
|
61
57
|
.action(() => {
|
|
62
58
|
const root = getProjectRoot()
|
|
59
|
+
ensureProjectArtifacts(root, { writeToolchain: true, writeManifest: true })
|
|
63
60
|
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
printCommandHeader({ cliName, command: 'build', version: readCliPackageJson().version })
|
|
63
|
+
console.log(chalk.gray(` root: ${root}`))
|
|
66
64
|
|
|
67
|
-
if (pkg
|
|
65
|
+
if (shouldDelegatePackageBuild(pkg)) {
|
|
68
66
|
runInProject(root, 'bun run build')
|
|
69
67
|
return
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
const layout =
|
|
73
|
-
const
|
|
70
|
+
const { layout, build } = readTmpBuildContext(root)
|
|
71
|
+
const plan = summarizeBuildPlan(root, layout, build)
|
|
72
|
+
const steps = isCorePackageName(pkg.name)
|
|
73
|
+
? resolveCoreBuildSteps(root, plan.distRel, build)
|
|
74
|
+
: resolveServiceBuildSteps(root, layout, build)
|
|
75
|
+
console.log(chalk.gray(` mode: ${isCorePackageName(pkg.name) ? 'core entries' : 'service tsconfig + tmp overrides'}`))
|
|
76
|
+
if (plan.tsconfigRel) {
|
|
77
|
+
console.log(chalk.gray(` tsconfig: ${plan.tsconfigRel}`))
|
|
78
|
+
}
|
|
79
|
+
console.log(chalk.gray(` dist: ${plan.distRel}/ (${plan.distSource})`))
|
|
80
|
+
console.log(chalk.gray(` glob: ${plan.entryGlobs.join(', ')} (${plan.globSource})`))
|
|
81
|
+
if (plan.typecheck) console.log(chalk.gray(' typecheck: tsc --noEmit'))
|
|
82
|
+
if (plan.declarations) console.log(chalk.gray(' declarations: tsc --emitDeclarationOnly'))
|
|
83
|
+
if (plan.sourcemap !== 'false') console.log(chalk.gray(` sourcemap: ${plan.sourcemap}`))
|
|
84
|
+
if (plan.minify && plan.minify !== 'off') console.log(chalk.gray(` minify: ${plan.minify}`))
|
|
85
|
+
console.log('')
|
|
86
|
+
|
|
87
|
+
runInProject(root, steps.join(' && '))
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
cli
|
|
91
|
+
.command('start')
|
|
92
|
+
.alias('start:dist')
|
|
93
|
+
.description('Run dist/index.js with prod env files')
|
|
94
|
+
.action(() => {
|
|
95
|
+
const root = getProjectRoot()
|
|
96
|
+
const { layout, build } = readTmpBuildContext(root)
|
|
97
|
+
const entryAbs = resolveDistEntryAbs(root, layout, build)
|
|
98
|
+
|
|
99
|
+
if (!fs.existsSync(entryAbs)) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
`Build output not found: ${path.relative(root, entryAbs)}. Run ${cliName} build first.`,
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const entry = relativeFromRoot(root, entryAbs)
|
|
106
|
+
const envFiles = resolveEnvFiles(layout.pathsAbs.environments, ['.global.env', '.prod.env'])
|
|
107
|
+
const envArgs = envFiles.map((file) => `--env-file=${file}`).join(' ')
|
|
74
108
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
'bunx tsc-alias -p tsconfig.json',
|
|
80
|
-
].join(' && '))
|
|
109
|
+
printCommandHeader({ cliName, command: 'start', version: readCliPackageJson().version })
|
|
110
|
+
console.log(chalk.gray(` root: ${root}`))
|
|
111
|
+
console.log(chalk.gray(` entry: ${entry} (.js)\n`))
|
|
112
|
+
runInProject(root, `bun ${envArgs} ${entry}`.trim())
|
|
81
113
|
})
|
|
82
114
|
|
|
83
115
|
cli
|
|
84
116
|
.command('test')
|
|
85
|
-
.description('Run
|
|
117
|
+
.description('Run tests from tmp.yml paths')
|
|
86
118
|
.action(() => {
|
|
87
119
|
const root = getProjectRoot()
|
|
88
120
|
const target = resolveTestTarget(root)
|
|
89
121
|
|
|
90
|
-
|
|
122
|
+
printCommandHeader({ cliName, command: 'test', version: readCliPackageJson().version })
|
|
123
|
+
console.log(chalk.gray(` target: ${target}\n`))
|
|
91
124
|
runInProject(root, `bun test ${target}`)
|
|
92
125
|
})
|
|
93
126
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import chalk from 'chalk'
|
|
2
2
|
import { readCliPackageJson, readProjectPackageJson, getProjectRoot } from '../helpers/project-root.mjs'
|
|
3
|
-
import { getVersionState, runTagRelease } from '../scripts/version-check.mjs'
|
|
3
|
+
import { compareSemver, getVersionState, resolveVersionBaseline, runTagRelease } from '../scripts/version-check.mjs'
|
|
4
4
|
|
|
5
5
|
export function registerTagCommand(cli, { cliName = 'xcore' } = {}) {
|
|
6
6
|
cli
|
|
7
7
|
.command('tag')
|
|
8
|
-
.description('
|
|
8
|
+
.description('Git tag from package.json (+ npm publish for core)')
|
|
9
9
|
.option('--dry-run', 'Print commands without executing')
|
|
10
10
|
.option('--strict-clean', 'Require fully clean working tree (default: only package.json must be committed)')
|
|
11
11
|
.option('--skip-prepare', 'Skip lint, test, and build:prod (core only)')
|
|
@@ -30,7 +30,7 @@ export function registerTagCommand(cli, { cliName = 'xcore' } = {}) {
|
|
|
30
30
|
export function registerVersionCommand(cli, { cliName = 'xcore' } = {}) {
|
|
31
31
|
cli
|
|
32
32
|
.command('version')
|
|
33
|
-
.description('Show CLI
|
|
33
|
+
.description('Show CLI and project package versions')
|
|
34
34
|
.action(() => {
|
|
35
35
|
try {
|
|
36
36
|
const root = getProjectRoot()
|
|
@@ -51,6 +51,11 @@ export function registerVersionCommand(cli, { cliName = 'xcore' } = {}) {
|
|
|
51
51
|
console.log(` branch: ${state.branch}`)
|
|
52
52
|
console.log(` version match: ${state.versionMatch ? chalk.green('yes') : chalk.red('no')}`)
|
|
53
53
|
console.log(` package.json committed: ${state.isPackageJsonClean ? chalk.green('yes') : chalk.red('no')}`)
|
|
54
|
+
const { baselineVersion, baselineLabel } = resolveVersionBaseline(root)
|
|
55
|
+
if (baselineVersion) {
|
|
56
|
+
const bumpOk = compareSemver(state.committed.version, baselineVersion) > 0
|
|
57
|
+
console.log(` bump vs ${baselineLabel}: ${bumpOk ? chalk.green('ok') : chalk.red('must be > ' + baselineVersion)}`)
|
|
58
|
+
}
|
|
54
59
|
console.log(` working tree: ${state.isClean ? chalk.green('clean') : chalk.yellow('dirty')}`)
|
|
55
60
|
console.log('')
|
|
56
61
|
} catch (error) {
|