headlamp 0.1.6 → 0.1.8
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 +30 -2
- package/dist/cli.cjs +391 -257
- package/dist/cli.cjs.map +4 -4
- package/dist/index.js +395 -258
- package/dist/index.js.map +4 -4
- package/package.json +10 -4
- package/scripts/build.mjs +117 -0
- package/scripts/postinstall.mjs +13 -0
- package/scripts/print-publish-log.mjs +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "headlamp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Coverage-first, runner-agnostic test UX CLI for Jest",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
|
-
"dist-types"
|
|
14
|
+
"dist-types",
|
|
15
|
+
"scripts"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "node ./scripts/build.mjs",
|
|
19
|
+
"postinstall": "node ./scripts/postinstall.mjs",
|
|
18
20
|
"prepublishOnly": "npm run build",
|
|
19
21
|
"lint": "eslint .",
|
|
20
22
|
"typecheck": "tsc --noEmit",
|
|
21
23
|
"format": "prettier --write .",
|
|
22
24
|
"format:check": "prettier --check .",
|
|
23
|
-
"release": "npm publish --access public"
|
|
25
|
+
"release": "npm publish --access public",
|
|
26
|
+
"build:yalc": "npm run build && npx yalc publish && node ./scripts/print-publish-log.mjs",
|
|
27
|
+
"dev:yalc": "nodemon -w src -e ts,tsx,js,jsx -d 700ms -x \"npm run build:yalc\""
|
|
24
28
|
},
|
|
25
29
|
"keywords": [
|
|
26
30
|
"testing",
|
|
@@ -43,6 +47,7 @@
|
|
|
43
47
|
"vitest": "*"
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
50
|
+
"nodemon": "^3.1.10",
|
|
46
51
|
"@types/istanbul-reports": "^3.0.4",
|
|
47
52
|
"@types/picomatch": "^4.0.2",
|
|
48
53
|
"@typescript-eslint/eslint-plugin": "^8.37.0",
|
|
@@ -58,6 +63,7 @@
|
|
|
58
63
|
"eslint-plugin-promise": "^6.1.1",
|
|
59
64
|
"prettier": "^3.3.3",
|
|
60
65
|
"tslib": "^2.6.3",
|
|
61
|
-
"typescript": "^5.5.4"
|
|
66
|
+
"typescript": "^5.5.4",
|
|
67
|
+
"yalc": "^1.0.0-pre.53"
|
|
62
68
|
}
|
|
63
69
|
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { build } from 'esbuild';
|
|
2
|
+
import { rm, mkdir, writeFile, chmod } from 'node:fs/promises';
|
|
3
|
+
import { resolve } from 'node:path';
|
|
4
|
+
|
|
5
|
+
const root = resolve(new URL('.', import.meta.url).pathname, '..');
|
|
6
|
+
const src = resolve(root, 'src');
|
|
7
|
+
const dist = resolve(root, 'dist');
|
|
8
|
+
|
|
9
|
+
await rm(dist, { recursive: true, force: true });
|
|
10
|
+
await mkdir(dist, { recursive: true });
|
|
11
|
+
|
|
12
|
+
// Build ESM library output (index.js)
|
|
13
|
+
await build({
|
|
14
|
+
entryPoints: [resolve(src, 'index.ts')],
|
|
15
|
+
outdir: dist,
|
|
16
|
+
format: 'esm',
|
|
17
|
+
platform: 'node',
|
|
18
|
+
target: ['node18'],
|
|
19
|
+
bundle: true,
|
|
20
|
+
sourcemap: true,
|
|
21
|
+
external: [
|
|
22
|
+
'fs',
|
|
23
|
+
'path',
|
|
24
|
+
'os',
|
|
25
|
+
'crypto',
|
|
26
|
+
'stream',
|
|
27
|
+
'util',
|
|
28
|
+
'events',
|
|
29
|
+
'assert',
|
|
30
|
+
'buffer',
|
|
31
|
+
'querystring',
|
|
32
|
+
'url',
|
|
33
|
+
'http',
|
|
34
|
+
'https',
|
|
35
|
+
'zlib',
|
|
36
|
+
'child_process',
|
|
37
|
+
'cluster',
|
|
38
|
+
'dgram',
|
|
39
|
+
'dns',
|
|
40
|
+
'domain',
|
|
41
|
+
'http2',
|
|
42
|
+
'net',
|
|
43
|
+
'perf_hooks',
|
|
44
|
+
'process',
|
|
45
|
+
'punycode',
|
|
46
|
+
'readline',
|
|
47
|
+
'repl',
|
|
48
|
+
'string_decoder',
|
|
49
|
+
'tls',
|
|
50
|
+
'tty',
|
|
51
|
+
'v8',
|
|
52
|
+
'vm',
|
|
53
|
+
'worker_threads',
|
|
54
|
+
// Keep Istanbul libs external to avoid bundling CJS that requires('fs')
|
|
55
|
+
// which breaks in ESM bundles on Node 20+ with dynamic require shim
|
|
56
|
+
'istanbul-lib-coverage',
|
|
57
|
+
'istanbul-lib-report',
|
|
58
|
+
'istanbul-reports',
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// Build CJS CLI output (cli.cjs) to support CJS-only deps and dynamic require
|
|
63
|
+
await build({
|
|
64
|
+
entryPoints: [resolve(src, 'cli.ts')],
|
|
65
|
+
outfile: resolve(dist, 'cli.cjs'),
|
|
66
|
+
format: 'cjs',
|
|
67
|
+
platform: 'node',
|
|
68
|
+
target: ['node18'],
|
|
69
|
+
bundle: true,
|
|
70
|
+
sourcemap: true,
|
|
71
|
+
external: [
|
|
72
|
+
// keep Node core externals trivial
|
|
73
|
+
'fs',
|
|
74
|
+
'path',
|
|
75
|
+
'os',
|
|
76
|
+
'crypto',
|
|
77
|
+
'stream',
|
|
78
|
+
'util',
|
|
79
|
+
'events',
|
|
80
|
+
'assert',
|
|
81
|
+
'buffer',
|
|
82
|
+
'querystring',
|
|
83
|
+
'url',
|
|
84
|
+
'http',
|
|
85
|
+
'https',
|
|
86
|
+
'zlib',
|
|
87
|
+
'child_process',
|
|
88
|
+
'cluster',
|
|
89
|
+
'dgram',
|
|
90
|
+
'dns',
|
|
91
|
+
'domain',
|
|
92
|
+
'http2',
|
|
93
|
+
'net',
|
|
94
|
+
'perf_hooks',
|
|
95
|
+
'process',
|
|
96
|
+
'punycode',
|
|
97
|
+
'readline',
|
|
98
|
+
'repl',
|
|
99
|
+
'string_decoder',
|
|
100
|
+
'tls',
|
|
101
|
+
'tty',
|
|
102
|
+
'v8',
|
|
103
|
+
'vm',
|
|
104
|
+
'worker_threads',
|
|
105
|
+
// Externalize Istanbul + picomatch so their internal dynamic requires resolve correctly
|
|
106
|
+
'istanbul-lib-coverage',
|
|
107
|
+
'istanbul-lib-report',
|
|
108
|
+
'istanbul-reports',
|
|
109
|
+
'picomatch',
|
|
110
|
+
],
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Create a Node shebang for the CLI
|
|
114
|
+
const cliPath = resolve(dist, 'cli.cjs');
|
|
115
|
+
const cliContent = await (await import('node:fs/promises')).readFile(cliPath, 'utf8');
|
|
116
|
+
await writeFile(cliPath, `#!/usr/bin/env node\n${cliContent}`);
|
|
117
|
+
await chmod(cliPath, 0o755);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { chmod } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const EXECUTABLE_MODE = 0o755;
|
|
5
|
+
|
|
6
|
+
(async () => {
|
|
7
|
+
try {
|
|
8
|
+
const cli = resolve(new URL('.', import.meta.url).pathname, '..', 'dist', 'cli.cjs');
|
|
9
|
+
await chmod(cli, EXECUTABLE_MODE);
|
|
10
|
+
} catch {
|
|
11
|
+
// ignore (best-effort)
|
|
12
|
+
}
|
|
13
|
+
})();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const rootDir = resolve(__dirname, '..');
|
|
7
|
+
|
|
8
|
+
const pkgJsonPath = resolve(rootDir, 'package.json');
|
|
9
|
+
const pkgRaw = await readFile(pkgJsonPath, 'utf8');
|
|
10
|
+
const pkg = JSON.parse(pkgRaw);
|
|
11
|
+
|
|
12
|
+
const date = new Date();
|
|
13
|
+
// Detect the user's/system timezone; fall back to TZ env or UTC if unavailable
|
|
14
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone ?? process.env.TZ ?? 'UTC';
|
|
15
|
+
// Friendly: "5:58 PM" (narrow no-break space before AM/PM to prevent wrapping)
|
|
16
|
+
const ts = new Intl.DateTimeFormat('en-US', {
|
|
17
|
+
hour: 'numeric',
|
|
18
|
+
minute: '2-digit',
|
|
19
|
+
hour12: true,
|
|
20
|
+
timeZone: tz,
|
|
21
|
+
// If you want "CDT"/"CST", uncomment:
|
|
22
|
+
// timeZoneName: 'short',
|
|
23
|
+
})
|
|
24
|
+
.format(date)
|
|
25
|
+
.replace(' AM', '\u202FAM')
|
|
26
|
+
.replace(' PM', '\u202FPM');
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
console.log(`[${ts}] ${pkg.name}@${pkg.version} published in store.`);
|