basalt-ui 1.0.0 → 1.0.2
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/AGENTS.md +12 -12
- package/CHANGELOG.md +19 -0
- package/README.md +31 -44
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-mantine.md +3 -3
- package/agent/rules/basalt-router.md +1 -1
- package/agent/rules/basalt-state.md +2 -2
- package/agent/rules/basalt-tokens.md +3 -3
- package/agent/skills/basalt-app/SKILL.md +137 -0
- package/agent/skills/basalt-charts/SKILL.md +179 -0
- package/agent/skills/basalt-design/SKILL.md +249 -0
- package/agent/templates/CLAUDE-block.md.tpl +8 -5
- package/agent/templates/__root.tpl +1 -1
- package/agent/templates/query-client.ts.tpl +1 -1
- package/configs/check.yml +8 -8
- package/configs/lefthook.yml +9 -5
- package/configs/oxlint-plugin.js +119 -7
- package/configs/oxlint-plugin.test.ts +73 -3
- package/configs/oxlint.json +2 -71
- package/dist/cli/index.d.ts +71 -28
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +134 -121
- package/dist/surfaces.d.ts +41 -17
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +37 -38
- package/dist/tokens/index.d.ts +1 -0
- package/dist/tokens/index.d.ts.map +1 -1
- package/dist/tokens/index.js +3 -0
- package/llms.txt +2 -2
- package/package.json +2 -2
- package/src/cli/check-theme.test.ts +12 -2
- package/src/cli/help.test.ts +93 -0
- package/src/cli/index.ts +332 -184
- package/src/cli/placement-engine.test.ts +194 -0
- package/src/cli/tarball-parity.test.ts +44 -0
- package/src/cli/template-format.test.ts +64 -0
- package/src/cli/template-ledger.test.ts +219 -0
- package/src/surfaces.ts +78 -43
- package/src/tokens/index.ts +6 -0
- /package/bin/{basalt.mjs → basalt-ui.mjs} +0 -0
package/dist/surfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../src/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,eAAe,GACf,UAAU,GACV,MAAM,GACN,OAAO,GACP,SAAS,CAAA;AAEb
|
|
1
|
+
{"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../src/surfaces.ts"],"names":[],"mappings":"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"}
|
package/dist/surfaces.js
CHANGED
|
@@ -39,13 +39,10 @@ const SURFACES = {
|
|
|
39
39
|
shipped: ["**/charts/**"],
|
|
40
40
|
repo: ["packages/basalt-ui/src/charts/**"]
|
|
41
41
|
},
|
|
42
|
-
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
v("@visx/tooltip", "Use ChartTooltip + TooltipHeader/Row/Body from {ctx}.")
|
|
47
|
-
// LOAD-BEARING ABSENCE: no @visx/* group ban here — charts uniquely permits @visx/*.
|
|
48
|
-
],
|
|
42
|
+
// The @visx/*-only-in-charts and Mantine-free boundaries are enforced by the
|
|
43
|
+
// `basalt/import-boundary` oxlint plugin rule (configs/oxlint-plugin.js), not
|
|
44
|
+
// no-restricted-imports — see that file's header comment for why.
|
|
45
|
+
forbiddenImports: [],
|
|
49
46
|
ruleOverrides: [{ rule: "no-underscore-dangle", level: "off", target: "repo" }]
|
|
50
47
|
},
|
|
51
48
|
"./tokens": {
|
|
@@ -59,11 +56,8 @@ const SURFACES = {
|
|
|
59
56
|
shipped: ["**/tokens/**"],
|
|
60
57
|
repo: ["packages/basalt-ui/src/tokens/**"]
|
|
61
58
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
|
|
65
|
-
]
|
|
66
|
-
// shipped tokens override is MISSING today → this projection EMITS it (closes D2)
|
|
59
|
+
// Mantine-free + @visx/* boundaries enforced by `basalt/import-boundary` (see ./charts above).
|
|
60
|
+
forbiddenImports: []
|
|
67
61
|
},
|
|
68
62
|
"./theme-lab": {
|
|
69
63
|
kind: "tooling",
|
|
@@ -85,10 +79,8 @@ const SURFACES = {
|
|
|
85
79
|
shipped: [],
|
|
86
80
|
repo: ["packages/basalt-ui/src/guard/**"]
|
|
87
81
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
|
|
91
|
-
]
|
|
82
|
+
// @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
|
|
83
|
+
forbiddenImports: [...MANTINE_BANS]
|
|
92
84
|
},
|
|
93
85
|
// 6th JS subpath
|
|
94
86
|
"./query": {
|
|
@@ -103,10 +95,8 @@ const SURFACES = {
|
|
|
103
95
|
shipped: [],
|
|
104
96
|
repo: ["packages/basalt-ui/src/query/**"]
|
|
105
97
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
|
|
109
|
-
]
|
|
98
|
+
// @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
|
|
99
|
+
forbiddenImports: [...MANTINE_BANS]
|
|
110
100
|
},
|
|
111
101
|
"./router-tanstack": {
|
|
112
102
|
kind: "doctrine",
|
|
@@ -120,10 +110,8 @@ const SURFACES = {
|
|
|
120
110
|
shipped: [],
|
|
121
111
|
repo: ["packages/basalt-ui/src/router-tanstack/**"]
|
|
122
112
|
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
|
|
126
|
-
]
|
|
113
|
+
// @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
|
|
114
|
+
forbiddenImports: [...MANTINE_BANS]
|
|
127
115
|
},
|
|
128
116
|
"./forms": {
|
|
129
117
|
kind: "doctrine",
|
|
@@ -197,10 +185,8 @@ const SURFACES = {
|
|
|
197
185
|
shipped: [],
|
|
198
186
|
repo: ["packages/basalt-ui/src/agent/**"]
|
|
199
187
|
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
|
|
203
|
-
]
|
|
188
|
+
// @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
|
|
189
|
+
forbiddenImports: [...MANTINE_BANS]
|
|
204
190
|
},
|
|
205
191
|
"./content": {
|
|
206
192
|
kind: "doctrine",
|
|
@@ -235,10 +221,8 @@ const SURFACES = {
|
|
|
235
221
|
shipped: [],
|
|
236
222
|
repo: ["packages/basalt-ui/src/state.ts"]
|
|
237
223
|
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx}).")
|
|
241
|
-
]
|
|
224
|
+
// @visx/* ban dropped — `basalt/import-boundary` now bans it universally outside charts.
|
|
225
|
+
forbiddenImports: [...MANTINE_BANS]
|
|
242
226
|
},
|
|
243
227
|
"./connectivity": {
|
|
244
228
|
kind: "doctrine",
|
|
@@ -279,9 +263,11 @@ const SURFACES = {
|
|
|
279
263
|
guardKinds: [],
|
|
280
264
|
globs: {
|
|
281
265
|
// Shipped is a catch-all (not just src/**+app/**) so consumer code under components/, lib/,
|
|
282
|
-
// features/, etc. is also covered
|
|
283
|
-
//
|
|
284
|
-
//
|
|
266
|
+
// features/, etc. is also covered. The @visx/*-only-in-charts and Mantine-free charts/tokens
|
|
267
|
+
// boundaries used to live here too and need last-writer-wins EMIT_ORDER games against the
|
|
268
|
+
// narrower ./tokens/./charts overrides — they're now enforced by `basalt/import-boundary`
|
|
269
|
+
// (a plugin rule, immune to that class of clobbering) instead, so the bans left below (antd,
|
|
270
|
+
// framer-motion) are plain global bans with no narrower override to out-order.
|
|
285
271
|
shipped: ["**/*.{ts,tsx}"],
|
|
286
272
|
repo: ["packages/basalt-ui/src/**", "apps/playground/src/**"]
|
|
287
273
|
},
|
|
@@ -289,8 +275,6 @@ const SURFACES = {
|
|
|
289
275
|
// cli/bin/scripts, repo-local only
|
|
290
276
|
forbiddenImports: [
|
|
291
277
|
v("antd", "Use Mantine \u2014 antd is not part of the basalt-ui stack.", { shippedOnly: true }),
|
|
292
|
-
v("@visx/tooltip", "Use ChartTooltip + TooltipHeader/Row/Body from {ctx}."),
|
|
293
|
-
vg("@visx/*", "Direct @visx/* imports are only allowed inside the charts boundary ({ctx})."),
|
|
294
278
|
v("framer-motion", "Import from 'motion/react', not the raw framer-motion package.")
|
|
295
279
|
]
|
|
296
280
|
}
|
|
@@ -300,7 +284,22 @@ const RULE_NAMES = [
|
|
|
300
284
|
Object.values(SURFACES).filter((s) => s.kind === "doctrine").map((s) => s.rule)
|
|
301
285
|
)
|
|
302
286
|
];
|
|
287
|
+
const SKILL_NAMES = [
|
|
288
|
+
...new Set(
|
|
289
|
+
Object.values(SURFACES).filter((s) => s.kind === "doctrine").flatMap((s) => [...s.skill])
|
|
290
|
+
)
|
|
291
|
+
];
|
|
292
|
+
const MANTINE_FREE_VIA_IMPORT_BOUNDARY = /* @__PURE__ */ new Set([
|
|
293
|
+
"./charts",
|
|
294
|
+
"./tokens"
|
|
295
|
+
]);
|
|
296
|
+
function hasImportBoundaryRuleRegistered(rules) {
|
|
297
|
+
return rules?.["basalt/import-boundary"] === "error";
|
|
298
|
+
}
|
|
303
299
|
export {
|
|
300
|
+
MANTINE_FREE_VIA_IMPORT_BOUNDARY,
|
|
304
301
|
RULE_NAMES,
|
|
305
|
-
|
|
302
|
+
SKILL_NAMES,
|
|
303
|
+
SURFACES,
|
|
304
|
+
hasImportBoundaryRuleRegistered
|
|
306
305
|
};
|
package/dist/tokens/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Grounded in argo `packages/charts/src/{tokens,palette,theme-vars,utils/color}.ts`.
|
|
10
10
|
*/
|
|
11
|
+
export { BP, p } from './palette.js';
|
|
11
12
|
/** A per-theme color pair: a hue keeps its identity but shifts shade across schemes. */
|
|
12
13
|
export type ColorPair = {
|
|
13
14
|
light: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tokens/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,WAAW,CAAA;AAEjC,wFAAwF;AACxF,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvD,8FAA8F;AAC9F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,GAAG,MAAM,KAAG,MACoB,CAAA;AAsCrE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoHL,CAAA;AAuGV;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EACpD,GAAG,EAAE,CAAC,EACN,MAAM,SAAK,GACV;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,CAI5B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAEjE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,EACnD,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CAAC,GACL;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAAE,CAE5B;AAED,2CAA2C;AAC3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,+GAA+G;IAC/G,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;IAClC,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,IAAI,GAAE,gBAAqB,GAAG,MAAM,CAqBnE"}
|
package/dist/tokens/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ACCENT, FILL, INK, NEUTRAL, SEMANTIC, SHADOW, STATUS, SURFACE } from "./palette.js";
|
|
2
|
+
import { BP, p } from "./palette.js";
|
|
2
3
|
const alpha = (token, a) => `color-mix(in srgb, ${token} ${Math.round(a * 100)}%, transparent)`;
|
|
3
4
|
const TEXT = {
|
|
4
5
|
micro: 11,
|
|
@@ -237,10 +238,12 @@ ${side("light")}
|
|
|
237
238
|
}`;
|
|
238
239
|
}
|
|
239
240
|
export {
|
|
241
|
+
BP,
|
|
240
242
|
VX,
|
|
241
243
|
alpha,
|
|
242
244
|
buildPaletteCss,
|
|
243
245
|
defineSeries,
|
|
244
246
|
groupTokens,
|
|
247
|
+
p,
|
|
245
248
|
seriesTokens
|
|
246
249
|
};
|
package/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# basalt-ui v1.0.
|
|
1
|
+
# basalt-ui v1.0.1
|
|
2
2
|
# Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets
|
|
3
3
|
#
|
|
4
4
|
# basalt-ui is an opinionated framework for Mantine-based React apps.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# Optional peers are listed per subpath; install only what you use.
|
|
16
16
|
|
|
17
17
|
Package: basalt-ui
|
|
18
|
-
Version: 1.0.
|
|
18
|
+
Version: 1.0.1
|
|
19
19
|
|
|
20
20
|
## basalt-ui
|
|
21
21
|
Import: import { ... } from 'basalt-ui'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basalt-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Opinionated framework for Mantine-based React apps — theme, app shell, visx charts, toolchain presets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"charts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"directory": "packages/basalt-ui"
|
|
27
27
|
},
|
|
28
28
|
"bin": {
|
|
29
|
-
"basalt": "./bin/basalt.mjs"
|
|
29
|
+
"basalt-ui": "./bin/basalt-ui.mjs"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist/",
|
|
@@ -601,8 +601,8 @@ describe('check-theme sub-16-input-font', () => {
|
|
|
601
601
|
|
|
602
602
|
describe('check-theme roots fail-loud', () => {
|
|
603
603
|
it('exits non-zero when the built-in default roots match zero files', () => {
|
|
604
|
-
// No "basalt.roots" in package.json — falls back to the built-in
|
|
605
|
-
//
|
|
604
|
+
// No "basalt.roots" in package.json — falls back to the built-in default (`src`), which
|
|
605
|
+
// doesn't exist under this fixture at all (the fixture dir has no src/ of its own here).
|
|
606
606
|
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture' }))
|
|
607
607
|
const { code, err } = run()
|
|
608
608
|
expect(code).toBe(1)
|
|
@@ -624,6 +624,16 @@ describe('check-theme roots fail-loud', () => {
|
|
|
624
624
|
const { code } = run()
|
|
625
625
|
expect(code).toBe(0)
|
|
626
626
|
})
|
|
627
|
+
|
|
628
|
+
it('scans a plain src/ layout by default with no "basalt.roots" configured', () => {
|
|
629
|
+
// The built-in default root is `src` (a generic single-app layout), not an argo-shaped path
|
|
630
|
+
// like `apps/dashboard/src` — a bare consumer with a normal src/ tree scans out of the box.
|
|
631
|
+
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture' }))
|
|
632
|
+
mkdirSync(resolve(dir, 'src'), { recursive: true })
|
|
633
|
+
writeFileSync(resolve(dir, 'src', 'Card.tsx'), `export const C = () => <Box p="md" />\n`)
|
|
634
|
+
const { code } = run()
|
|
635
|
+
expect(code).toBe(0)
|
|
636
|
+
})
|
|
627
637
|
})
|
|
628
638
|
|
|
629
639
|
describe('check-theme comment skipping', () => {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `--help` / `-h` / `help` must short-circuit BEFORE any subcommand dispatch — a read request must
|
|
3
|
+
* never mutate. Regression: `bunx basalt-ui sync --help` used to run `sync` in full (the switch
|
|
4
|
+
* matched `cmd === 'sync'` first and `--help` was just another item in `flags`, ignored).
|
|
5
|
+
*/
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it } from 'bun:test'
|
|
7
|
+
import { existsSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
8
|
+
import { tmpdir } from 'node:os'
|
|
9
|
+
import { resolve } from 'node:path'
|
|
10
|
+
|
|
11
|
+
import { MANIFEST_PATH, run } from './index'
|
|
12
|
+
|
|
13
|
+
let dir: string
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
dir = mkdtempSync(resolve(tmpdir(), 'basalt-help-'))
|
|
17
|
+
writeFileSync(resolve(dir, 'package.json'), JSON.stringify({ name: 'fixture' }))
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
rmSync(dir, { recursive: true, force: true })
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
/** Captures console.log/console.error so assertions don't depend on terminal state. */
|
|
25
|
+
function capture(fn: () => number | Promise<number>): { code: number; log: string } {
|
|
26
|
+
const originalLog = console.log
|
|
27
|
+
const originalError = console.error
|
|
28
|
+
let log = ''
|
|
29
|
+
console.log = (...args: unknown[]) => {
|
|
30
|
+
log += `${args.join(' ')}\n`
|
|
31
|
+
}
|
|
32
|
+
console.error = (...args: unknown[]) => {
|
|
33
|
+
log += `${args.join(' ')}\n`
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const result = fn()
|
|
37
|
+
if (result instanceof Promise) throw new TypeError('run() returned a Promise in a sync test')
|
|
38
|
+
return { code: result, log }
|
|
39
|
+
} finally {
|
|
40
|
+
console.log = originalLog
|
|
41
|
+
console.error = originalError
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
describe('run() --help short-circuits before dispatch', () => {
|
|
46
|
+
it('`sync --help` prints usage and exits 0 without writing the manifest or any managed file', () => {
|
|
47
|
+
const { code, log } = capture(() => run(['sync', '--help'], dir))
|
|
48
|
+
expect(code).toBe(0)
|
|
49
|
+
expect(log).toContain('Usage: basalt')
|
|
50
|
+
expect(existsSync(resolve(dir, MANIFEST_PATH))).toBe(false)
|
|
51
|
+
// No managed files scaffolded either — a genuinely inert run.
|
|
52
|
+
expect(readdirSync(dir)).toEqual(['package.json'])
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('`init --help` prints usage and exits 0 without scaffolding anything', () => {
|
|
56
|
+
const { code, log } = capture(() => run(['init', '--help'], dir))
|
|
57
|
+
expect(code).toBe(0)
|
|
58
|
+
expect(log).toContain('Usage: basalt')
|
|
59
|
+
expect(existsSync(resolve(dir, MANIFEST_PATH))).toBe(false)
|
|
60
|
+
expect(readdirSync(dir)).toEqual(['package.json'])
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('`sync -h` (short flag) also short-circuits', () => {
|
|
64
|
+
const { code, log } = capture(() => run(['sync', '-h'], dir))
|
|
65
|
+
expect(code).toBe(0)
|
|
66
|
+
expect(log).toContain('Usage: basalt')
|
|
67
|
+
expect(existsSync(resolve(dir, MANIFEST_PATH))).toBe(false)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('the bare `help` command prints usage and exits 0', () => {
|
|
71
|
+
const { code, log } = capture(() => run(['help'], dir))
|
|
72
|
+
expect(code).toBe(0)
|
|
73
|
+
expect(log).toContain('Usage: basalt')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
it('`--help` with no subcommand prints usage and exits 0', () => {
|
|
77
|
+
const { code, log } = capture(() => run(['--help'], dir))
|
|
78
|
+
expect(code).toBe(0)
|
|
79
|
+
expect(log).toContain('Usage: basalt')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('an unknown command (no --help) still prints usage but exits 1', () => {
|
|
83
|
+
const { code, log } = capture(() => run(['bogus'], dir))
|
|
84
|
+
expect(code).toBe(1)
|
|
85
|
+
expect(log).toContain('Usage: basalt')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('`sync` without --help still runs for real and writes the manifest (control case)', () => {
|
|
89
|
+
const { code } = capture(() => run(['sync'], dir))
|
|
90
|
+
expect(code).toBe(0)
|
|
91
|
+
expect(existsSync(resolve(dir, MANIFEST_PATH))).toBe(true)
|
|
92
|
+
})
|
|
93
|
+
})
|