create-octane-xplat 0.19.0 → 0.20.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 +2 -147
- package/compatibility.json +74 -61
- package/compatibility.ts +134 -79
- package/dist/compatibility.js +45 -13
- package/dist/index.js +127 -64
- package/dist/package-manager.js +62 -0
- package/dist/scaffold.js +362 -57
- package/index.ts +256 -156
- package/library-template/AGENTS.md +1 -1
- package/library-template/README.md +4 -3
- package/library-template/bunfig +4 -0
- package/library-template/package.json +73 -70
- package/library-template/patches/@nativescript-community__octane@0.2.5.patch +161 -24
- package/library-template/patches/@nativescript__core@9.1.3.patch +98 -0
- package/library-template/patches/@nativescript__vite@8.0.20.patch +532 -17
- package/library-template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
- package/library-template/patches/octane@0.16.3.patch +56 -2
- package/library-template/src/Badge.tsx +5 -5
- package/library-template/src/Badge.web.tsx +5 -5
- package/library-template/src/Welcome.stories.tsx +12 -0
- package/library-template/src/normalizeBadgeLabel.ts +1 -1
- package/library-template/src/props.ts +11 -11
- package/library-template/tests/normalizeBadgeLabel.test.ts +1 -1
- package/library-template/tests/packed-consumer.mjs +140 -123
- package/library-template/tsconfig.envs.json +1 -0
- package/library-template/tsconfig.json +1 -0
- package/library-template/tsconfig.types.json +15 -1
- package/library-template/tsrx-typegen.json +1 -1
- package/library-template/workshop.config.ts +3 -0
- package/package-manager.ts +93 -0
- package/package.json +10 -5
- package/scaffold.ts +1061 -449
- package/template/.agents/skills/xplat/SKILL.md +1 -1
- package/template/.agents/skills/xplat/references/styling.md +10 -10
- package/template/AGENTS.md +2 -2
- package/template/bunfig +4 -0
- package/template/nativescript.config.ts +13 -13
- package/template/package.json +69 -64
- package/template/patches/@nativescript-community__octane@0.2.5.patch +161 -24
- package/template/patches/@nativescript__core@9.1.3.patch +98 -0
- package/template/patches/@nativescript__vite@8.0.20.patch +532 -17
- package/template/patches/@octane-xplat__nativescript-mason-core@1.0.0-beta.7.patch +65 -0
- package/template/patches/octane@0.16.3.patch +56 -2
- package/template/src/App.tsrx +66 -64
- package/template/src/Welcome.stories.tsx +22 -0
- package/template/src/app.spec.tsrx +168 -158
- package/template/src/app.web.test.tsx +18 -13
- package/template/src/failure-reporting.spec.ts +3 -3
- package/template/src/main.ts +14 -13
- package/template/src/main.tsrx +2 -0
- package/template/src/native-runtime.spec.ts +13 -11
- package/template/src/test-setup.web.ts +9 -8
- package/template/src/test.ts +6 -6
- package/template/tsconfig.json +17 -1
- package/template/vite.config.native.mts +1 -2
- package/template/vite.config.ts +29 -23
- package/template/vitest.config.mts +17 -17
- package/template/vitest.web.config.mts +7 -7
- package/template/workshop.config.ts +3 -0
- package/library-template/patches/@tsrx__typescript-plugin@0.4.11.patch +0 -11
- package/template/patches/@tsrx__typescript-plugin@0.4.11.patch +0 -11
- /package/library-template/patches/{@octanejs__tiptap@0.0.61.patch → @octanejs__tiptap@0.0.62.patch} +0 -0
- /package/template/patches/{@octanejs__tiptap@0.0.61.patch → @octanejs__tiptap@0.0.62.patch} +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// Package-manager selection for the creator: --package-manager > the
|
|
2
|
+
// invoking tool's user agent > the installed-manager probe > prompt/fallback.
|
|
3
|
+
// Bun is the historical default, so it wins every tie.
|
|
4
|
+
import { spawnSync } from 'node:child_process'
|
|
5
|
+
import { tmpdir } from 'node:os'
|
|
6
|
+
|
|
7
|
+
export type PackageManager = 'bun' | 'pnpm'
|
|
8
|
+
|
|
9
|
+
export type ManagerSource = 'flag' | 'user-agent' | 'only-installed' | 'prompt' | 'fallback'
|
|
10
|
+
|
|
11
|
+
export type ManagerDecision =
|
|
12
|
+
| {
|
|
13
|
+
kind: 'use'
|
|
14
|
+
manager: PackageManager
|
|
15
|
+
source: Exclude<ManagerSource, 'prompt'>
|
|
16
|
+
installed: PackageManager[]
|
|
17
|
+
}
|
|
18
|
+
// Both managers installed, interactive, no flag/user-agent — the caller
|
|
19
|
+
// joins a clack session and asks.
|
|
20
|
+
| { kind: 'prompt'; options: PackageManager[] }
|
|
21
|
+
// Neither installed — scaffold the Bun variant, skip install, warn.
|
|
22
|
+
| { kind: 'missing'; manager: 'bun' }
|
|
23
|
+
|
|
24
|
+
const managers: PackageManager[] = ['bun', 'pnpm']
|
|
25
|
+
|
|
26
|
+
/** The tool that launched the creator (`bun create`, `pnpm dlx`, `npx`, …). */
|
|
27
|
+
export function managerFromUserAgent(ua: string | undefined): PackageManager | undefined {
|
|
28
|
+
const tool = ua?.split(' ')[0]?.split('/')[0]
|
|
29
|
+
|
|
30
|
+
return tool === 'bun' || tool === 'pnpm' ? tool : undefined
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The manager's version, or undefined when it is not runnable on PATH. */
|
|
34
|
+
export function managerVersion(manager: PackageManager): string | undefined {
|
|
35
|
+
const result = spawnSync(manager, ['--version'], {
|
|
36
|
+
encoding: 'utf8',
|
|
37
|
+
// A manager pinned by the caller's cwd package.json can refuse to run;
|
|
38
|
+
// probe from a neutral directory.
|
|
39
|
+
cwd: tmpdir(),
|
|
40
|
+
shell: process.platform === 'win32',
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
if (result.error || result.status !== 0) {
|
|
44
|
+
return undefined
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result.stdout.trim()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Managers runnable on this machine, in fixed order. */
|
|
51
|
+
export function installedManagers(): PackageManager[] {
|
|
52
|
+
return managers.filter((manager) => managerVersion(manager) !== undefined)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function decidePackageManager(input: {
|
|
56
|
+
flag?: string
|
|
57
|
+
userAgent?: string
|
|
58
|
+
installed: PackageManager[]
|
|
59
|
+
interactive: boolean
|
|
60
|
+
}): ManagerDecision {
|
|
61
|
+
if (input.flag !== undefined) {
|
|
62
|
+
if (input.flag !== 'bun' && input.flag !== 'pnpm') {
|
|
63
|
+
throw new Error('--package-manager must be bun or pnpm')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return { kind: 'use', manager: input.flag, source: 'flag', installed: input.installed }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const fromAgent = managerFromUserAgent(input.userAgent)
|
|
70
|
+
|
|
71
|
+
if (fromAgent) {
|
|
72
|
+
return { kind: 'use', manager: fromAgent, source: 'user-agent', installed: input.installed }
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (input.installed.length === 0) {
|
|
76
|
+
return { kind: 'missing', manager: 'bun' }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (input.installed.length === 1) {
|
|
80
|
+
return {
|
|
81
|
+
kind: 'use',
|
|
82
|
+
manager: input.installed[0],
|
|
83
|
+
source: 'only-installed',
|
|
84
|
+
installed: input.installed,
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (input.interactive) {
|
|
89
|
+
return { kind: 'prompt', options: [...managers] }
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return { kind: 'use', manager: 'bun', source: 'fallback', installed: input.installed }
|
|
93
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-octane-xplat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Scaffold Octane Xplat apps and cross-platform libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component-library",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"index.ts",
|
|
28
28
|
"scaffold.ts",
|
|
29
29
|
"compatibility.ts",
|
|
30
|
+
"package-manager.ts",
|
|
30
31
|
"compatibility.json",
|
|
31
32
|
"dist",
|
|
32
33
|
"template",
|
|
@@ -52,15 +53,19 @@
|
|
|
52
53
|
"scripts": {
|
|
53
54
|
"build": "vite build",
|
|
54
55
|
"prepack": "bun run build",
|
|
55
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
56
|
-
"test:library": "node test/library-guide.mjs"
|
|
56
|
+
"typecheck": "tsc --runExternalCode -p tsconfig.json",
|
|
57
|
+
"test:library": "node test/library-guide.mjs",
|
|
58
|
+
"test": "node --test test/*.test.mjs",
|
|
59
|
+
"test:scaffold": "node --test test/scaffold.test.mjs"
|
|
57
60
|
},
|
|
58
61
|
"dependencies": {
|
|
59
62
|
"@clack/prompts": "1.8.1",
|
|
60
63
|
"yaml": "2.9.1"
|
|
61
64
|
},
|
|
62
65
|
"devDependencies": {
|
|
63
|
-
"@types/node": "
|
|
64
|
-
"
|
|
66
|
+
"@types/node": "26.6.6",
|
|
67
|
+
"typescript": "7.1.0-beta",
|
|
68
|
+
"vite": "8.3.6",
|
|
69
|
+
"@tsrx/content-mapper": "0.1.2"
|
|
65
70
|
}
|
|
66
71
|
}
|