@jskit-ai/create-app 0.1.122 → 0.1.125
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/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -9,8 +9,10 @@ import { shellQuote } from "./cliEntrypoint.js";
|
|
|
9
9
|
const DEFAULT_TEMPLATE = "base-shell";
|
|
10
10
|
const MINIMAL_TEMPLATE = "minimal-shell";
|
|
11
11
|
const DEFAULT_INITIAL_BUNDLES = "none";
|
|
12
|
+
const DEFAULT_PLAYWRIGHT_VERSION = "1.61.1";
|
|
12
13
|
const INITIAL_BUNDLE_PRESETS = new Set(["none", "auth"]);
|
|
13
14
|
const TENANCY_MODES = new Set(["none", "personal", "workspaces"]);
|
|
15
|
+
const EXACT_SEMVER_PATTERN = /^\d+\.\d+\.\d+$/u;
|
|
14
16
|
const ALLOWED_EXISTING_TARGET_ENTRIES = new Set([".git"]);
|
|
15
17
|
const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
16
18
|
const TEMPLATES_ROOT = path.join(PACKAGE_ROOT, "templates");
|
|
@@ -49,6 +51,18 @@ function normalizeTenancyMode(value, { showUsage = true } = {}) {
|
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
function normalizePlaywrightVersion(value, { showUsage = true } = {}) {
|
|
55
|
+
const normalized = String(value || "").trim();
|
|
56
|
+
if (EXACT_SEMVER_PATTERN.test(normalized)) {
|
|
57
|
+
return normalized;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
throw createCliError(
|
|
61
|
+
`Invalid --playwright-version value "${value}". Expected an exact x.y.z version.`,
|
|
62
|
+
{ showUsage }
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
52
66
|
function buildInitialSetupCommands(initialBundles) {
|
|
53
67
|
const normalizedPreset = normalizeInitialBundlesPreset(initialBundles, { showUsage: false });
|
|
54
68
|
|
|
@@ -95,6 +109,7 @@ function parseCliArgs(argv) {
|
|
|
95
109
|
template: DEFAULT_TEMPLATE,
|
|
96
110
|
target: null,
|
|
97
111
|
initialBundles: DEFAULT_INITIAL_BUNDLES,
|
|
112
|
+
playwrightVersion: DEFAULT_PLAYWRIGHT_VERSION,
|
|
98
113
|
tenancyMode: null,
|
|
99
114
|
force: false,
|
|
100
115
|
dryRun: false,
|
|
@@ -180,6 +195,18 @@ function parseCliArgs(argv) {
|
|
|
180
195
|
continue;
|
|
181
196
|
}
|
|
182
197
|
|
|
198
|
+
if (arg === "--playwright-version") {
|
|
199
|
+
const { value, nextIndex } = parseOptionWithValue(args, index, "--playwright-version");
|
|
200
|
+
options.playwrightVersion = value;
|
|
201
|
+
index = nextIndex;
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (arg.startsWith("--playwright-version=")) {
|
|
206
|
+
options.playwrightVersion = arg.slice("--playwright-version=".length);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
|
|
183
210
|
if (arg === "--tenancy-mode") {
|
|
184
211
|
const { value, nextIndex } = parseOptionWithValue(args, index, "--tenancy-mode");
|
|
185
212
|
options.tenancyMode = value;
|
|
@@ -231,6 +258,7 @@ function printUsage(stream = process.stderr) {
|
|
|
231
258
|
stream.write(" --title <text> App title used for template replacements\n");
|
|
232
259
|
stream.write(" --target <path> Target directory (default: ./<app-name>)\n");
|
|
233
260
|
stream.write(" --initial-bundles <preset> Optional initial setup preset: none | auth (default: none)\n");
|
|
261
|
+
stream.write(` --playwright-version <x.y.z> Exact Playwright test version (default: ${DEFAULT_PLAYWRIGHT_VERSION})\n`);
|
|
234
262
|
stream.write(" --tenancy-mode <mode> Optional config seed: none | personal | workspaces\n");
|
|
235
263
|
stream.write(" --force Allow writing into a non-empty target directory\n");
|
|
236
264
|
stream.write(" --dry-run Print planned writes without changing the filesystem\n");
|
|
@@ -520,6 +548,7 @@ export async function createApp({
|
|
|
520
548
|
template = DEFAULT_TEMPLATE,
|
|
521
549
|
target = null,
|
|
522
550
|
initialBundles = DEFAULT_INITIAL_BUNDLES,
|
|
551
|
+
playwrightVersion = DEFAULT_PLAYWRIGHT_VERSION,
|
|
523
552
|
tenancyMode = null,
|
|
524
553
|
force = false,
|
|
525
554
|
dryRun = false,
|
|
@@ -530,6 +559,7 @@ export async function createApp({
|
|
|
530
559
|
|
|
531
560
|
const resolvedAppTitle = String(appTitle || "").trim() || toAppTitle(resolvedAppName);
|
|
532
561
|
const resolvedInitialBundles = normalizeInitialBundlesPreset(initialBundles);
|
|
562
|
+
const resolvedPlaywrightVersion = normalizePlaywrightVersion(playwrightVersion);
|
|
533
563
|
const resolvedTenancyMode =
|
|
534
564
|
tenancyMode == null || String(tenancyMode).trim() === ""
|
|
535
565
|
? null
|
|
@@ -547,6 +577,7 @@ export async function createApp({
|
|
|
547
577
|
const replacements = {
|
|
548
578
|
__APP_NAME__: resolvedAppName,
|
|
549
579
|
__APP_TITLE__: resolvedAppTitle,
|
|
580
|
+
__PLAYWRIGHT_VERSION__: resolvedPlaywrightVersion,
|
|
550
581
|
__TENANCY_MODE_LINE__: resolvedTenancyMode
|
|
551
582
|
? `config.tenancyMode = "${resolvedTenancyMode}";\n`
|
|
552
583
|
: ""
|
|
@@ -564,6 +595,7 @@ export async function createApp({
|
|
|
564
595
|
appTitle: resolvedAppTitle,
|
|
565
596
|
template: String(template),
|
|
566
597
|
initialBundles: resolvedInitialBundles,
|
|
598
|
+
playwrightVersion: resolvedPlaywrightVersion,
|
|
567
599
|
tenancyMode: resolvedTenancyMode,
|
|
568
600
|
selectedSetupCommands: buildInitialSetupCommands(resolvedInitialBundles),
|
|
569
601
|
targetDirectory,
|
|
@@ -609,6 +641,7 @@ export async function runCli(
|
|
|
609
641
|
template: resolvedOptions.template,
|
|
610
642
|
target: resolvedOptions.target,
|
|
611
643
|
initialBundles: resolvedOptions.initialBundles,
|
|
644
|
+
playwrightVersion: resolvedOptions.playwrightVersion,
|
|
612
645
|
tenancyMode: resolvedOptions.tenancyMode,
|
|
613
646
|
force: resolvedOptions.force,
|
|
614
647
|
dryRun: resolvedOptions.dryRun,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@jskit-ai/agent-docs": "0.x",
|
|
48
48
|
"@jskit-ai/config-eslint": "0.x",
|
|
49
49
|
"@jskit-ai/jskit-cli": "0.x",
|
|
50
|
-
"@playwright/test": "
|
|
50
|
+
"@playwright/test": "__PLAYWRIGHT_VERSION__",
|
|
51
51
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
52
52
|
"eslint": "^9.39.4",
|
|
53
53
|
"vite": "^8.0.16",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@jskit-ai/agent-docs": "0.x",
|
|
46
46
|
"@jskit-ai/config-eslint": "0.x",
|
|
47
47
|
"@jskit-ai/jskit-cli": "0.x",
|
|
48
|
-
"@playwright/test": "
|
|
48
|
+
"@playwright/test": "__PLAYWRIGHT_VERSION__",
|
|
49
49
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
50
50
|
"eslint": "^9.39.4",
|
|
51
51
|
"vite": "^8.0.16",
|