@aedis/cli 0.1.2 → 0.1.4

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.
Files changed (3) hide show
  1. package/README.md +3 -3
  2. package/dist/aedis.js +53 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,9 +6,9 @@ before any file is written, npm dependencies are pinned to exact versions at lea
6
6
  script runs.
7
7
 
8
8
  ```bash
9
- npx @aedis/cli@0.1.2 init
10
- npx @aedis/cli@0.1.2 add button approval-card
11
- npx @aedis/cli@0.1.2 diff
9
+ npx @aedis/cli@0.1.4 init
10
+ npx @aedis/cli@0.1.4 add button approval-card
11
+ npx @aedis/cli@0.1.4 diff
12
12
  ```
13
13
 
14
14
  Always pin the version, as above. Never run `npx aedis`: the unscoped `aedis` package on npm is not this one.
package/dist/aedis.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { spawnSync } from "node:child_process";
3
2
  import { createInterface } from "node:readline/promises";
4
3
  import { verify } from "sigstore";
5
4
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
6
5
  import path from "node:path";
7
6
  import { gunzipSync } from "node:zlib";
8
7
  import { createHash } from "node:crypto";
8
+ import { spawnSync } from "node:child_process";
9
9
  //#region ../../apps/www/lib/untrusted.ts
10
10
  /**
11
11
  * Invisible code points that carry no visible text but can hide instructions from the person reading while an
@@ -202,9 +202,9 @@ const colors = {
202
202
  brand: "#f3ebd6"
203
203
  },
204
204
  ring: {
205
- light: "rgba(36,87,214,0.45)",
206
- dark: "rgba(122,162,255,0.50)",
207
- brand: "rgba(26,39,64,0.45)"
205
+ light: "#2457d6",
206
+ dark: "#7aa2ff",
207
+ brand: "#1a2740"
208
208
  },
209
209
  success: {
210
210
  light: "#18794e",
@@ -470,6 +470,21 @@ const contrastPairs = [
470
470
  "surface",
471
471
  3
472
472
  ],
473
+ [
474
+ "ring",
475
+ "surface",
476
+ 3
477
+ ],
478
+ [
479
+ "ring",
480
+ "background",
481
+ 3
482
+ ],
483
+ [
484
+ "ring",
485
+ "muted",
486
+ 3
487
+ ],
473
488
  [
474
489
  "foreground",
475
490
  "material-thick",
@@ -1573,7 +1588,7 @@ function planFiles(items, config, root) {
1573
1588
  }
1574
1589
  //#endregion
1575
1590
  //#region src/cli.ts
1576
- const VERSION = "0.1.2";
1591
+ const VERSION = "0.1.4";
1577
1592
  /** What `aedis init` installs: config, theme tokens, cn and the security primitives. */
1578
1593
  const INIT_ITEMS = [
1579
1594
  "theme",
@@ -1737,7 +1752,7 @@ async function run(argv, io) {
1737
1752
  }
1738
1753
  if (!existsSync(path.join(root, "package.json"))) throw new Error(`${root} has no package.json; run inside your app`);
1739
1754
  if (command === "init") {
1740
- const config = readConfig(root) ?? defaultConfig(root, flags.release ?? `v0.1.2`);
1755
+ const config = readConfig(root) ?? defaultConfig(root, flags.release ?? `v0.1.4`);
1741
1756
  if (!isRelease(config.release)) throw new Error(`invalid release ${config.release}`);
1742
1757
  const decoded = flags.preset === void 0 ? null : decodePreset(flags.preset);
1743
1758
  if (decoded && !decoded.ok) throw new Error(`preset refused: ${decoded.error}`);
@@ -1773,7 +1788,7 @@ ${themeToCss(theme)}
1773
1788
  }
1774
1789
  if (command === "theme" && args[0] === "import") {
1775
1790
  if (!args[1]) throw new Error("theme import: give the theme's JSON file");
1776
- const config = readConfig(root) ?? defaultConfig(root, `v0.1.2`);
1791
+ const config = readConfig(root) ?? defaultConfig(root, `v0.1.4`);
1777
1792
  const input = insideProject(root, path.relative(root, path.resolve(io.cwd, args[1])));
1778
1793
  const result = themeImport(readFileSync(input, "utf8"), path.basename(input));
1779
1794
  if (!result.ok) {
@@ -1797,20 +1812,43 @@ ${themeToCss(theme)}
1797
1812
  }
1798
1813
  }
1799
1814
  //#endregion
1800
- //#region src/main.ts
1801
- const code = await run(process.argv.slice(2), {
1802
- cwd: process.cwd(),
1803
- fetcher: fetch,
1804
- check: (bundle, options) => verify(bundle, options),
1805
- spawn: (command, args, { cwd, env }) => spawnSync(command, args, {
1815
+ //#region src/spawn.ts
1816
+ const PLAIN = /^[\w@./:=~-]+$/;
1817
+ /**
1818
+ * Runs a package manager without `shell: true` (Node's DEP0190). On Windows npm, pnpm and yarn are .cmd shims that
1819
+ * only cmd.exe can start (Node refuses to spawn a .cmd directly), so cmd.exe is spawned explicitly, and only with
1820
+ * arguments that hold no metacharacter; elsewhere the command is spawned directly.
1821
+ */
1822
+ function runPackageManager(command, args, { cwd, env }, spawn = spawnSync, platform = process.platform) {
1823
+ let file = command;
1824
+ let argv = args;
1825
+ if (platform === "win32") {
1826
+ for (const arg of [command, ...args]) if (!PLAIN.test(arg)) throw new Error(`refusing to pass ${JSON.stringify(arg)} to cmd.exe`);
1827
+ file = process.env.ComSpec ?? "cmd.exe";
1828
+ argv = [
1829
+ "/d",
1830
+ "/c",
1831
+ command,
1832
+ ...args
1833
+ ];
1834
+ }
1835
+ return spawn(file, argv, {
1806
1836
  cwd,
1807
1837
  env: {
1808
1838
  ...process.env,
1809
1839
  ...env
1810
1840
  },
1811
1841
  stdio: "inherit",
1812
- shell: process.platform === "win32"
1813
- }).status ?? 1,
1842
+ windowsHide: true
1843
+ }).status ?? 1;
1844
+ }
1845
+ //#endregion
1846
+ //#region src/main.ts
1847
+ const code = await run(process.argv.slice(2), {
1848
+ cwd: process.cwd(),
1849
+ fetcher: fetch,
1850
+ check: (bundle, options) => verify(bundle, options),
1851
+ spawn: runPackageManager,
1814
1852
  confirm: async (question) => {
1815
1853
  if (!process.stdin.isTTY) return false;
1816
1854
  const rl = createInterface({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aedis/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Add Aedis UI components to your app with verified provenance: signed releases, exact and aged dependencies, no install scripts.",
5
5
  "keywords": [
6
6
  "aedis",