jamdesk 1.1.100 → 1.1.101
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/dist/__tests__/unit/banner-art-sync.test.d.ts +2 -0
- package/dist/__tests__/unit/banner-art-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/banner-art-sync.test.js +56 -0
- package/dist/__tests__/unit/banner-art-sync.test.js.map +1 -0
- package/package.json +4 -2
- package/scripts/banner.txt +5 -0
- package/scripts/install-banner.js +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-art-sync.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/unit/banner-art-sync.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drift guard for the 3-place ASCII "Jamdesk" banner art.
|
|
3
|
+
*
|
|
4
|
+
* The same figlet art is emitted from three representations that cannot
|
|
5
|
+
* share a module — a raw text asset read by the npm postinstall, a bash
|
|
6
|
+
* here-string in the curl|bash bootstrap installer, and a PowerShell
|
|
7
|
+
* Write-Host block in the iwr|iex bootstrap installer:
|
|
8
|
+
*
|
|
9
|
+
* - builder/cli/scripts/banner.txt (npm postinstall asset)
|
|
10
|
+
* - builder/cli/scripts/install.sh print_banner (bash, backslash/backtick-escaped)
|
|
11
|
+
* - builder/cli/scripts/install.ps1 Write-Banner (PowerShell, backtick-escaped)
|
|
12
|
+
*
|
|
13
|
+
* Same rationale as the documented OpenAPI-patch trio (see
|
|
14
|
+
* openapi-schema-patch-sync.test.ts and builder/CLAUDE.md): comments alone
|
|
15
|
+
* don't stop drift, a test does. Edit the art in one place and forget the
|
|
16
|
+
* others and a user gets a different banner from `npm i -g` vs the curl
|
|
17
|
+
* installer.
|
|
18
|
+
*
|
|
19
|
+
* The snippets below are deliberately escaping-invariant: each contains no
|
|
20
|
+
* backslash, backtick, or quote, so it appears byte-identical in the raw
|
|
21
|
+
* asset, the bash-escaped string, and the PowerShell-escaped string. They
|
|
22
|
+
* are also interior substrings (not line-anchored), so per-line trailing
|
|
23
|
+
* whitespace and the `echo "`/`Write-Host "` prefixes don't matter — what
|
|
24
|
+
* is pinned is the art's shape, one fragment per line.
|
|
25
|
+
*/
|
|
26
|
+
import { describe, it, expect } from 'vitest';
|
|
27
|
+
import fs from 'fs-extra';
|
|
28
|
+
import path from 'path';
|
|
29
|
+
import { fileURLToPath } from 'url';
|
|
30
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
31
|
+
const scripts = path.join(here, '../../../scripts');
|
|
32
|
+
const SITES = {
|
|
33
|
+
'npm asset (banner.txt)': path.join(scripts, 'banner.txt'),
|
|
34
|
+
'bash installer (install.sh)': path.join(scripts, 'install.sh'),
|
|
35
|
+
'powershell installer (install.ps1)': path.join(scripts, 'install.ps1'),
|
|
36
|
+
};
|
|
37
|
+
// One fragment per art line. No \ ` " ' so escaping in any representation
|
|
38
|
+
// can't change them; internal whitespace IS the art and is preserved.
|
|
39
|
+
const ART_LINES = [
|
|
40
|
+
'_ _ _',
|
|
41
|
+
'| | __ _ _ __ ___ __| | ___ ___| | __',
|
|
42
|
+
'__| |/ /',
|
|
43
|
+
'(_| | | | | | | (_| | __',
|
|
44
|
+
'___||___',
|
|
45
|
+
];
|
|
46
|
+
describe('Jamdesk banner art sync (3-place drift guard)', () => {
|
|
47
|
+
for (const [name, file] of Object.entries(SITES)) {
|
|
48
|
+
it(`${name} carries the full art`, async () => {
|
|
49
|
+
const src = await fs.readFile(file, 'utf-8');
|
|
50
|
+
for (const line of ART_LINES) {
|
|
51
|
+
expect(src, `${name} art drifted — missing line: ${line}`).toContain(line);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=banner-art-sync.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner-art-sync.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/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AAgC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC7E,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jamdesk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.101",
|
|
4
4
|
"description": "CLI for Jamdesk — build, preview, and deploy documentation sites from MDX. Dev server with hot reload, 50+ components, OpenAPI support, AI search, and Mintlify migration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jamdesk",
|
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
"bin/",
|
|
61
61
|
"dist/",
|
|
62
62
|
"scripts/patch-openapi-schemas.js",
|
|
63
|
+
"scripts/install-banner.js",
|
|
64
|
+
"scripts/banner.txt",
|
|
63
65
|
"templates/",
|
|
64
66
|
"vendored/components/",
|
|
65
67
|
"vendored/contexts/",
|
|
@@ -96,7 +98,7 @@
|
|
|
96
98
|
"test:local": "node scripts/test-local.js",
|
|
97
99
|
"lint": "eslint src/",
|
|
98
100
|
"dev": "tsc --watch",
|
|
99
|
-
"postinstall": "node scripts/patch-openapi-schemas.js"
|
|
101
|
+
"postinstall": "node scripts/patch-openapi-schemas.js && node scripts/install-banner.js"
|
|
100
102
|
},
|
|
101
103
|
"dependencies": {
|
|
102
104
|
"@apidevtools/swagger-parser": "^12.1.0",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall banner for `npm install -g jamdesk`.
|
|
4
|
+
*
|
|
5
|
+
* Shows the same ASCII "Jamdesk" art the curl/iwr bootstrap installer prints,
|
|
6
|
+
* so a plain `npm i -g jamdesk` gets the same first-run experience.
|
|
7
|
+
*
|
|
8
|
+
* This is cosmetic and must NEVER fail an install: every branch is guarded
|
|
9
|
+
* and the process always exits 0, even on a read error.
|
|
10
|
+
*
|
|
11
|
+
* Zero-dependency by design: a postinstall runs before the package's own
|
|
12
|
+
* node_modules is guaranteed resolvable, so this inlines ANSI/TTY/version
|
|
13
|
+
* logic instead of importing from src/ (chalk/ora). Same constraint and
|
|
14
|
+
* precedent as the sibling scripts/patch-openapi-schemas.js — do not "DRY"
|
|
15
|
+
* this against src/lib/output.ts; it would break `npm install`.
|
|
16
|
+
*
|
|
17
|
+
* It deliberately stays quiet unless this is an interactive, global install:
|
|
18
|
+
* - JAMDESK_INSTALLER set → the bootstrap installer already showed a banner
|
|
19
|
+
* - not a global install → don't spam dependency installs / `npm ci`
|
|
20
|
+
* - CI / non-TTY / quiet → no banner in pipelines, Docker layers, logs
|
|
21
|
+
*/
|
|
22
|
+
import { readFileSync } from 'node:fs';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
import { dirname, join } from 'node:path';
|
|
25
|
+
|
|
26
|
+
// npm's default loglevel is `notice`; these are the only levels quieter than
|
|
27
|
+
// it (silent < error < warn < notice). A user on default still sees the
|
|
28
|
+
// banner; `npm i -g --quiet` (→ warn) or `--silent` suppresses it.
|
|
29
|
+
const QUIET_LOGLEVELS = ['silent', 'error', 'warn'];
|
|
30
|
+
|
|
31
|
+
function shouldShow() {
|
|
32
|
+
if (process.env.JAMDESK_INSTALLER) return false;
|
|
33
|
+
// npm sets npm_config_global=true for `npm install -g`.
|
|
34
|
+
if (process.env.npm_config_global !== 'true') return false;
|
|
35
|
+
if (process.env.CI) return false;
|
|
36
|
+
if (QUIET_LOGLEVELS.includes(process.env.npm_config_loglevel)) return false;
|
|
37
|
+
if (!process.stdout.isTTY) return false;
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
if (shouldShow()) {
|
|
43
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
44
|
+
const art = readFileSync(join(here, 'banner.txt'), 'utf8').replace(/\n$/, '');
|
|
45
|
+
const { version } = JSON.parse(
|
|
46
|
+
readFileSync(join(here, '..', 'package.json'), 'utf8'),
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const color = !process.env.NO_COLOR;
|
|
50
|
+
const blue = color ? '\x1b[34m' : '';
|
|
51
|
+
const green = color ? '\x1b[32m' : '';
|
|
52
|
+
const reset = color ? '\x1b[0m' : '';
|
|
53
|
+
|
|
54
|
+
process.stdout.write(
|
|
55
|
+
`\n${blue}${art}${reset}\n\n` +
|
|
56
|
+
`${green}[OK]${reset} Jamdesk CLI installed: ${version}\n\n` +
|
|
57
|
+
'Get started:\n' +
|
|
58
|
+
' jamdesk init # Create new docs project\n' +
|
|
59
|
+
' jamdesk dev # Start dev server\n' +
|
|
60
|
+
' jamdesk --help # See all commands\n\n',
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
} catch {
|
|
64
|
+
// Intentionally fully silent — unlike the sibling patch-openapi-schemas.js,
|
|
65
|
+
// which console.warn's on failure because a failed schema patch has
|
|
66
|
+
// functional consequences the user must know about. A missing decorative
|
|
67
|
+
// banner has none, so a `[jamdesk] …` warning here would be pure noise
|
|
68
|
+
// during install. Never worth failing (or even cluttering) `npm install`.
|
|
69
|
+
}
|