@alea-design/cli 0.6.0 → 0.7.0
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 +2 -0
- package/bin/alea.mjs +14 -2
- package/package.json +2 -2
- package/registry.json +1 -1
package/README.md
CHANGED
|
@@ -22,4 +22,6 @@ Replace `init` with `add button select`, `list` or any other command. `init` and
|
|
|
22
22
|
|
|
23
23
|
`init` installs the peers the components need, pinned to the ranges `@alea-design/ui` depends on (`react-aria-components`, `lucide-react@^0.525.0`, `@alea-design/motion`); with `--no-install` it prints the command instead. The copied components type-check with React 18 and React 19 types.
|
|
24
24
|
|
|
25
|
+
`alea audit` runs the quality audit of [`@alea-design/audit`](https://www.npmjs.com/package/@alea-design/audit) (`alea audit init`, `alea audit list`, `alea audit --shard 1/3`). The CLI does not depend on it or on Playwright: it finds the package in your project and tells you what to install when it is missing.
|
|
26
|
+
|
|
25
27
|
Docs: https://alea.alevasquez.dev/installation?utm_source=npm&utm_medium=readme&utm_campaign=alea-cli · MIT license
|
package/bin/alea.mjs
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
// that shares its name with a free one: the Pro media and work folders are media-pro and work-pro)
|
|
11
11
|
import fs from 'node:fs';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import { execSync } from 'node:child_process';
|
|
13
|
+
import { execSync, spawnSync } from 'node:child_process';
|
|
14
|
+
import { createRequire } from 'node:module';
|
|
14
15
|
import { fileURLToPath } from 'node:url';
|
|
15
16
|
|
|
16
17
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -142,7 +143,7 @@ const [cmd, ...rest] = argv.filter((a, i) => !a.startsWith('--') && !VALUE_FLAGS
|
|
|
142
143
|
if (flag('version') || argv.includes('-v') || cmd === 'version') {
|
|
143
144
|
say(JSON.parse(fs.readFileSync(path.resolve(here, '../package.json'), 'utf8')).version);
|
|
144
145
|
} else if (!cmd || cmd === 'help' || flag('help')) {
|
|
145
|
-
say(`Alea ${registry.version}\n\n alea init [--dir src/components/ui] [--no-install] set up alea.json, tokens and base styles\n alea add <component...> [--all] [--group] [--overwrite] [--update]\n copy a component and the files it uses; --group copies a whole folder;\n --update puts new versions next to yours\n alea add pro/media a Pro folder that shares its name with a free one (media-pro, work-pro)\n alea list what you can add (Pro needs ALEA_LICENSE_KEY)\n alea --version the CLI version\n`);
|
|
146
|
+
say(`Alea ${registry.version}\n\n alea init [--dir src/components/ui] [--no-install] set up alea.json, tokens and base styles\n alea add <component...> [--all] [--group] [--overwrite] [--update]\n copy a component and the files it uses; --group copies a whole folder;\n --update puts new versions next to yours\n alea add pro/media a Pro folder that shares its name with a free one (media-pro, work-pro)\n alea list what you can add (Pro needs ALEA_LICENSE_KEY)\n alea audit [init|list] [options] the quality audit (needs @alea-design/audit; alea audit --help)\n alea --version the CLI version\n`);
|
|
146
147
|
} else if (cmd === 'init') {
|
|
147
148
|
const dir = opt('dir', 'src/components/ui');
|
|
148
149
|
const conf = { $schema: 'https://alea.alevasquez.dev/alea.schema.json', dir, version: registry.version };
|
|
@@ -185,6 +186,17 @@ if (flag('version') || argv.includes('-v') || cmd === 'version') {
|
|
|
185
186
|
const withCount = [...closure].filter(pth => !roots.includes(pth)).length;
|
|
186
187
|
say(`✓ ${names.join(', ')}${withCount ? ` (with ${withCount} file${withCount === 1 ? '' : 's'} it uses)` : ''}: ${wrote} file${wrote === 1 ? '' : 's'} written${fresh ? `, ${fresh} new version${fresh === 1 ? '' : 's'} written as .new files next to yours` : ''}${kept ? `, ${kept} kept (use --overwrite to replace, --update to get the new version next to yours)` : ''}`);
|
|
187
188
|
install(['react-aria-components', 'lucide-react', '@alea-design/motion', ...[...closure].flatMap(pth => byPath.get(pth).f.npm || [])]);
|
|
189
|
+
} else if (cmd === 'audit') {
|
|
190
|
+
// A thin delegate: the audit lives in its own package (it needs Playwright, which this CLI must never depend on),
|
|
191
|
+
// so find it from the project, run it with the arguments as typed, and say what to install when it is missing.
|
|
192
|
+
let bin;
|
|
193
|
+
try {
|
|
194
|
+
const pkgFile = createRequire(path.join(cwd, 'noop.js')).resolve('@alea-design/audit/package.json');
|
|
195
|
+
bin = path.join(path.dirname(pkgFile), JSON.parse(fs.readFileSync(pkgFile, 'utf8')).bin['alea-audit']);
|
|
196
|
+
} catch { /* not installed */ }
|
|
197
|
+
if (!bin) die('alea audit needs @alea-design/audit, which is not installed here.\nInstall it with the browser tools it drives: npm i -D @alea-design/audit playwright-core axe-core\nor try it once without installing: npx @alea-design/audit init');
|
|
198
|
+
const result = spawnSync(process.execPath, [bin, ...argv.slice(argv.indexOf('audit') + 1)], { cwd, stdio: 'inherit' });
|
|
199
|
+
process.exit(result.status ?? 1);
|
|
188
200
|
} else if (cmd === 'list') {
|
|
189
201
|
for (const [g, def] of Object.entries(registry.groups)) say(`${g.padEnd(12)} ${def.exports.filter(listed).join(', ')}`);
|
|
190
202
|
for (const [g, exports] of Object.entries(registry.pro || {})) say(`${(g + ' (Pro)').padEnd(12)} ${exports.filter(listed).join(', ')}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alea-design/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Copy Alea components into your project: alea init, add, list.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test": "node scripts/build-registry.mjs && node --test test/*.test.mjs"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@alea-design/motion": "^0.
|
|
42
|
+
"@alea-design/motion": "^0.7.0",
|
|
43
43
|
"@types/react-18": "npm:@types/react@^18.3.31",
|
|
44
44
|
"@types/react-dom-18": "npm:@types/react-dom@^18.3.7",
|
|
45
45
|
"lucide-react": "^0.525.0",
|