qunitx-cli 0.9.3 → 0.9.7
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/bin/qunitx.js +71 -0
- package/dist/cli.js +2009 -0
- package/package.json +16 -8
- package/cli.ts +0 -39
- package/deno.json +0 -18
- package/deno.lock +0 -648
- package/lib/commands/generate.ts +0 -33
- package/lib/commands/help.ts +0 -37
- package/lib/commands/init.ts +0 -77
- package/lib/commands/run/tests-in-browser.ts +0 -221
- package/lib/commands/run.ts +0 -279
- package/lib/servers/http.ts +0 -321
- package/lib/setup/bind-server-to-port.ts +0 -14
- package/lib/setup/browser.ts +0 -101
- package/lib/setup/config.ts +0 -55
- package/lib/setup/default-project-config-values.ts +0 -9
- package/lib/setup/file-watcher.ts +0 -134
- package/lib/setup/fs-tree.ts +0 -64
- package/lib/setup/keyboard-events.ts +0 -38
- package/lib/setup/test-file-paths.ts +0 -92
- package/lib/setup/web-server.ts +0 -274
- package/lib/setup/write-output-static-files.ts +0 -33
- package/lib/tap/display-final-result.ts +0 -25
- package/lib/tap/display-test-result.ts +0 -109
- package/lib/tap/dump-yaml.ts +0 -84
- package/lib/types.ts +0 -61
- package/lib/utils/chromium-args.ts +0 -18
- package/lib/utils/color.ts +0 -66
- package/lib/utils/early-chrome.ts +0 -39
- package/lib/utils/find-chrome.ts +0 -38
- package/lib/utils/find-internal-assets-from-html.ts +0 -18
- package/lib/utils/find-project-root.ts +0 -20
- package/lib/utils/indent-string.ts +0 -24
- package/lib/utils/listen-to-keyboard-key.ts +0 -57
- package/lib/utils/parse-cli-flags.ts +0 -95
- package/lib/utils/path-exists.ts +0 -21
- package/lib/utils/perf-logger.ts +0 -25
- package/lib/utils/pre-launch-chrome.ts +0 -45
- package/lib/utils/read-boilerplate.ts +0 -15
- package/lib/utils/resolve-port-number-for.ts +0 -29
- package/lib/utils/run-user-module.ts +0 -28
- package/lib/utils/search-in-parent-directories.ts +0 -25
- package/lib/utils/time-counter.ts +0 -19
package/bin/qunitx.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// npm bin entry for qunitx-cli.
|
|
3
|
+
// Prefers a pre-built SEA binary from the matching optional platform package
|
|
4
|
+
// (qunitx-cli-linux-x64, qunitx-cli-darwin-arm64, etc.) when available.
|
|
5
|
+
// Falls back to the bundled JS CLI (dist/cli.js) which requires Node.js + node_modules.
|
|
6
|
+
import { spawn } from 'node:child_process';
|
|
7
|
+
import { access, constants } from 'node:fs/promises';
|
|
8
|
+
import { createRequire } from 'node:module';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { dirname, join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const require = createRequire(import.meta.url);
|
|
14
|
+
|
|
15
|
+
const platformMap = {
|
|
16
|
+
'linux-x64': { seaPkg: 'qunitx-cli-linux-x64', esbuildPkg: '@esbuild/linux-x64', bin: 'qunitx' },
|
|
17
|
+
'linux-arm64': {
|
|
18
|
+
seaPkg: 'qunitx-cli-linux-arm64',
|
|
19
|
+
esbuildPkg: '@esbuild/linux-arm64',
|
|
20
|
+
bin: 'qunitx',
|
|
21
|
+
},
|
|
22
|
+
'darwin-x64': {
|
|
23
|
+
seaPkg: 'qunitx-cli-darwin-x64',
|
|
24
|
+
esbuildPkg: '@esbuild/darwin-x64',
|
|
25
|
+
bin: 'qunitx',
|
|
26
|
+
},
|
|
27
|
+
'darwin-arm64': {
|
|
28
|
+
seaPkg: 'qunitx-cli-darwin-arm64',
|
|
29
|
+
esbuildPkg: '@esbuild/darwin-arm64',
|
|
30
|
+
bin: 'qunitx',
|
|
31
|
+
},
|
|
32
|
+
'win32-x64': {
|
|
33
|
+
seaPkg: 'qunitx-cli-windows-x64',
|
|
34
|
+
esbuildPkg: '@esbuild/win32-x64',
|
|
35
|
+
bin: 'qunitx.exe',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const target = platformMap[`${process.platform}-${process.arch}`];
|
|
40
|
+
|
|
41
|
+
async function trySeaBinary() {
|
|
42
|
+
if (!target) return false;
|
|
43
|
+
try {
|
|
44
|
+
const pkgDir = dirname(require.resolve(`${target.seaPkg}/package.json`));
|
|
45
|
+
const binaryPath = join(pkgDir, 'bin', target.bin);
|
|
46
|
+
await access(binaryPath, constants.X_OK);
|
|
47
|
+
|
|
48
|
+
let env = process.env;
|
|
49
|
+
if (!env.ESBUILD_BINARY_PATH) {
|
|
50
|
+
try {
|
|
51
|
+
const esbuildBin = require.resolve(
|
|
52
|
+
`${target.esbuildPkg}/bin/esbuild${process.platform === 'win32' ? '.exe' : ''}`,
|
|
53
|
+
);
|
|
54
|
+
env = { ...env, ESBUILD_BINARY_PATH: esbuildBin };
|
|
55
|
+
} catch (_) {}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await new Promise((resolve, reject) => {
|
|
59
|
+
const child = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit', env });
|
|
60
|
+
child.on('close', (code) => process.exit(code ?? 1));
|
|
61
|
+
child.on('error', reject);
|
|
62
|
+
});
|
|
63
|
+
} catch (_) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!(await trySeaBinary())) {
|
|
69
|
+
// Fallback: run bundled JS CLI via Node.js (uses node_modules for deps)
|
|
70
|
+
await import('../dist/cli.js');
|
|
71
|
+
}
|