@pipelex/create-method-app 0.74.0 → 0.74.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/README.md CHANGED
@@ -9,31 +9,31 @@ cd my-app
9
9
  npm run serve
10
10
  ```
11
11
 
12
- The first command writes the [`webapp-js`](https://github.com/Pipelex/pipelex-sdk/tree/main/method-apps/webapp-js) template of the [method-app family](https://github.com/Pipelex/pipelex-sdk/tree/main/method-apps), the `method-apps/` directory of `Pipelex/pipelex-sdk`, into `my-app/`, commits it as it came, and runs the copy's own `npm run create`, after the `npm install` it needs, which scaffolds the method, names the project after it and runs `npm run all`. The second starts the dev server in the background, proves that the page answers, and prints its URL; `npm run serve -- stop` stops it. `npm run dev` runs the same server in the foreground instead. None of it needs `make` or a POSIX shell, so the same commands run on macOS, Linux and Windows, in PowerShell and `cmd` as in any POSIX shell.
12
+ The first command writes the [`webapp-js`](https://github.com/Pipelex/pipelex-sdk/tree/main/method-apps/webapp-js) template of the [method-app family](https://github.com/Pipelex/pipelex-sdk/tree/main/method-apps), the `method-apps/` directory of `Pipelex/pipelex-sdk`, into `my-app/`, commits it as it came, and runs the copy's own `npm run create`, after the `npm install` it needs, which scaffolds the method, names the project after it and runs `npm run all`. The second starts the dev server in the background, proves that the page answers, and prints its URL; `npm run serve -- stop` stops it. `npm run dev` runs the same server in the foreground instead. None of it needs `make` or a POSIX shell, so the same commands run on macOS, Linux and Windows, in PowerShell and `cmd` as in any POSIX shell. In Windows PowerShell 5.1, whose default execution policy refuses a typed `npm`, type `npm.cmd` in its place, as in `npm.cmd create @pipelex/method-app@latest` and `npm.cmd run serve`, which run in every Windows shell; on Windows, the next steps a verdict names are spelled that way.
13
13
 
14
14
  `--method` takes a `.mthds` file or a directory of them, a method id from your organization's catalog (`mt_…`, or `mt_…@<version>` and `mt_…@draft` to pin a version or run the draft), or a published package address (`github.com/Pipelex/methods/text_stats@v0.2.0`). A path is read from where you typed the command.
15
15
 
16
16
  ## What it needs
17
17
 
18
18
  - **Node.js** at or above the template's floor (22.13 for `webapp-js`) with its npm, and `git` unless you pass `--no-git`. The initializer runs npm itself, the one that ran it under `npm create`, or, on Windows, the one the Node installer puts beside `node.exe`; `make` is not needed.
19
- - **A key**: `PIPELEX_API_KEY` in the environment, or else the one the Pipelex login saved. A fresh copy has no `.env.local` or `.env` for `npm run create` to read it from, so these are the two sources. The login, `npx -y @pipelex/mcp@latest login` (`npx.cmd` on Windows, which Windows PowerShell 5.1 runs whatever its execution policy), saves the key as `PIPELEX_API_KEY` in `~/.pipelex/.env`, or in the `.env` of the directory `PIPELEX_HOME` names, and the Pipelex plugin's tools read the same file, so one login serves both, including in an app such as Claude's desktop app, where a variable set in a terminal window never reaches the agent. The file is read only when the environment holds no key; `PIPELEX_HOME` must be absolute or start with `~/`, and a relative one is refused rather than read. `npm run create` runs with the key and never copies it into the project: the project's `.env.local` gets an empty `PIPELEX_API_KEY` line, where you put your own key before `npm run dev`, since the app itself does not read the login's file. When the login's key is the one it ran with, `npm run create` says so in a warning the initializer repeats at the end, so put your key in `.env.local`, or start `npm run serve` from a shell that exports it, before running a method. The initializer only checks that a key is there, and never prints it; when there is none, `refused: no-key` names the login first, with the file it looked in. `npm run create` reads the login's file again itself under the same rules, which both suites hold to one table of cases, the family's `initializers/login-key.json`.
19
+ - **A key**: `PIPELEX_API_KEY` in the environment, or else the one the Pipelex login saved. A fresh copy has no `.env.local` or `.env` for `npm run create` to read it from, so these are the two sources. The login, `npx -y @pipelex/mcp@latest login` (`npx.cmd` on Windows, which Windows PowerShell 5.1 runs whatever its execution policy), saves the key as `PIPELEX_API_KEY` in `~/.pipelex/.env`, or in the `.env` of the directory `PIPELEX_HOME` names, and the Pipelex plugin's tools read the same file, so one login serves both, including in an app such as Claude's desktop app, where a variable set in a terminal window never reaches the agent. The file is read only when the environment holds no key; `PIPELEX_HOME` must be absolute or start with `~/`, and a relative one is refused rather than read. `npm run create` runs with the key and never copies it into the project: the project's `.env.local` gets an empty `PIPELEX_API_KEY` line, for a key of your own. While that line stays empty and your shell exports no key, the app's local dev server, `npm run dev` or `npm run serve`, reads the login's file again when it starts and runs on that key; a production build (`npm run build`, then `npm run start`) and a deployment never read it. When the login's key is the one it ran with, `npm run create` says so in a warning the initializer repeats at the end: the dev server runs on the login's key, and production needs a `PIPELEX_API_KEY` of its own. The initializer only checks that a key is there, and never prints it; when there is none, `refused: no-key` names the login first, with the file it looked in. `npm run create` reads the login's file again itself under the same rules, which both suites hold to one table of cases, the family's `initializers/login-key.json`.
20
20
  - **A directory that is missing, empty, or holds only `.git`.** Anything else, `.DS_Store` included, is refused, and nothing is written.
21
21
 
22
22
  The package has no dependency. It carries the template inside it, packed from the family's repository at the commit it was published from, so `@X.Y.Z` writes exactly the X.Y.Z template and nothing is fetched from GitHub.
23
23
 
24
24
  ## Options
25
25
 
26
- | Option | What it does |
27
- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
- | `--method <m>` | The method the app runs. Required unless `--no-create`. |
29
- | `--name`, `--title`, `--description` | The project's package name, title and description, which `npm run create` otherwise derives from the method. |
30
- | `--pipe`, `--method-name`, `--label` | The pipe to run, the method's directory name and its tab label, when the method does not settle them. |
31
- | `--author-name`, `--author-email`, `--repo-url`, `--license`, `--license-holder`, `--license-year` | What the project says about who made it. Nothing is invented. |
32
- | `--dry-run` | `npm run create` plans and prints the identity without changing a file. The copy and its commit stand, and the verdict names the real `npm run create` to run. |
33
- | `--no-create` | Write the template and commit it, then stop. The verdict names the `npm install` and `npm run create` to run, after writing `.env.local` yourself, for instance. |
34
- | `--no-git` | Make no repository and no commit. |
35
- | `--quiet` | Write the output of `npm install` and `npm run create` to a log and print its path, so the summary stays in view. |
36
- | `--template <name>` | The template to write. `webapp-js` is the default and the only one. |
26
+ | Option | What it does |
27
+ | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
28
+ | `--method <m>` | The method the app runs. Required unless `--no-create`. |
29
+ | `--name`, `--title`, `--description` | The project's package name, title and description, which `npm run create` otherwise derives from the method. |
30
+ | `--pipe`, `--method-name`, `--label` | The pipe to run, the method's directory name and its tab label, when the method does not settle them. |
31
+ | `--author-name`, `--author-email`, `--repo-url`, `--license`, `--license-holder`, `--license-year` | What the project says about who made it. Nothing is invented. |
32
+ | `--dry-run` | Only `npm run create` is dry: it plans and prints the identity without changing a file. The copy, the dependencies `npm install` wrote into `node_modules` and the pristine commit stand, and the verdict says so, names the commands that discard them all and leave the destination as it stood, and names the real `npm run create` to run. |
33
+ | `--no-create` | Write the template and commit it, then stop. The verdict names the `npm install` and `npm run create` to run, after writing `.env.local` yourself, for instance. |
34
+ | `--no-git` | Make no repository and no commit. |
35
+ | `--quiet` | Write the output of `npm install` and `npm run create` to a log and print its path, so the summary stays in view. |
36
+ | `--template <name>` | The template to write. `webapp-js` is the default and the only one. |
37
37
 
38
38
  Each create option is named after the variable of the family's create contract it sets (`--author-email` is `AUTHOR_EMAIL`), which is also the flag of the template's own `npm run create`, and reaches it as one argument, `--method` as the first, so no value needs quoting beyond what your shell needs. A blank value is not passed on. Nothing is ever asked: a missing value is a refusal naming the option.
39
39
 
@@ -61,17 +61,17 @@ The pristine commit reads `Start from Pipelex/pipelex-sdk/method-apps/webapp-js
61
61
 
62
62
  A run ends with one verdict line, the last line it prints on standard output, whose first word is stable:
63
63
 
64
- | Verdict | Meaning |
65
- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
- | ``created <dir>; next: `cd <dir>`, then `npm run serve` `` | The copy, the git outcome, and a green `npm run create` |
67
- | `copied <dir>; next: …` | With `--no-create` or `--dry-run`: the copy and the git outcome, and the `npm run create` to run next, after `npm install` when it has not run |
68
- | `refused: not-empty` | The destination holds something other than a lone `.git`; nothing was written |
69
- | `refused: unusable-destination` | The destination cannot be read: a file stands where a directory of its path should be, or a directory on it cannot be read; nothing was written |
70
- | `refused: repository-has-history`, `refused: repository-has-staged-files`, `refused: inside-template-checkout` | The git reading above; nothing was written |
71
- | `refused: no-method`, `no-key`, `missing-tool`, `node-too-old`, `no-git-identity`, `unknown-option`, `unknown-template`, `other-ecosystem`, `usage` | The preflight; nothing was written, and the line names the fix |
72
- | `failed: write` | The copy failed or was interrupted, and everything the initializer had created was removed; nothing else was touched |
73
- | `failed: commit` | Git refused the pristine commit, for instance through a global hook; the copy stands, and the line says how to commit it and what to run next |
74
- | `failed: create` | `npm install` or `npm run create` did not succeed; the copy and its commit stand. After a failed install, the line names both commands to run once npm's message is dealt with; after a failed `npm run create`, its own message says what to run next: a refusal before it wrote anything can be fixed and run again, and a failure after it cannot |
64
+ | Verdict | Meaning |
65
+ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | ``created <dir>; next: `cd <dir>`, then `npm run serve` ``, with `npm.cmd` for `npm` on Windows | The copy, the git outcome, and a green `npm run create` |
67
+ | `copied <dir>; next: …` | With `--no-create` or `--dry-run`: the copy and the git outcome, and the `npm run create` to run next, after `npm install` when it has not run. After `--dry-run`, in parentheses before `next:`, what stands (its files, the dependencies `npm install` wrote into `node_modules`, and the pristine commit when one was made) and the commands that discard it and leave the destination as it stood, the same in every shell: `node -e "fs.rmSync(…)" <dir>` from outside a directory the run made, everything in it for an empty directory that was there, and for a lone `.git` everything but `.git`, then `git update-ref -d HEAD` and `git read-tree --empty` when the pristine commit went into that repository, and `git config --unset core.hooksPath .husky/_`, the hooks path the template's husky set; a missing destination is deleted from the highest directory the run created on the way to it |
68
+ | `refused: not-empty` | The destination holds something other than a lone `.git`; nothing was written |
69
+ | `refused: unusable-destination` | The destination cannot be read: a file stands where a directory of its path should be, or a directory on it cannot be read; nothing was written |
70
+ | `refused: repository-has-history`, `refused: repository-has-staged-files`, `refused: inside-template-checkout` | The git reading above; nothing was written |
71
+ | `refused: no-method`, `no-key`, `missing-tool`, `node-too-old`, `no-git-identity`, `unknown-option`, `unknown-template`, `other-ecosystem`, `usage` | The preflight; nothing was written, and the line names the fix |
72
+ | `failed: write` | The copy failed or was interrupted, and everything the initializer had created was removed; nothing else was touched |
73
+ | `failed: commit` | Git refused the pristine commit, for instance through a global hook; the copy stands, and the line says how to commit it and what to run next |
74
+ | `failed: create` | `npm install` or `npm run create` did not succeed; the copy and its commit stand. After a failed install, the line names both commands to run once npm's message is dealt with; after a failed `npm run create`, its own message says what to run next: a refusal before it wrote anything can be fixed and run again, and a failure after it cannot |
75
75
 
76
76
  Before the verdict come the warnings `npm run create` printed, each once, and the git outcome. A `next:` names its commands one after the other, each between backquotes, to run in turn: no separator reads the same in every shell, since Windows PowerShell 5.1 has no `&&` and `cmd` no `;`. Each word is quoted for the system the initializer ran on: in single quotes for a POSIX shell, and on Windows in double quotes, which PowerShell and `cmd` both read, or in PowerShell's single quotes for a word holding a `$` or a backquote. The exit code is 0 for `created` and `copied` and 1 otherwise, but the verdict is the line to read.
77
77
 
package/lib/login.mjs CHANGED
@@ -5,9 +5,10 @@
5
5
  * `~/.pipelex/.env`, or in the `.env` of `PIPELEX_HOME` when that is set, and
6
6
  * the Pipelex plugin's tools read that file on every call. The initializer's
7
7
  * preflight reads it too, after the environment, so one login serves the tools
8
- * and the method app. The copy's `npm run create` reads the same file under
9
- * the same rules, which the template's `scripts/lib/create.mts` restates
10
- * because a template may import nothing from outside its directory; both
8
+ * and the method app. The copy's `npm run create`, and its local dev server,
9
+ * read the same file under the same rules, which the template's
10
+ * `scripts/lib/login.mts` restates because a template may import nothing from
11
+ * outside its directory; both
11
12
  * suites execute the family's `initializers/login-key.json` to keep the two
12
13
  * readings identical, and both follow `pipelex-mcp`'s `src/credentials.ts`,
13
14
  * which owns the file.
@@ -42,6 +43,8 @@ import process from "node:process";
42
43
  // initializer could print its `refused: node-too-old`.
43
44
  import util from "node:util";
44
45
 
46
+ import { npmCommand } from "./verdict.mjs";
47
+
45
48
  /** The home directory's name under the user's home, when `PIPELEX_HOME` is not set. */
46
49
  export const HOME_DIR_NAME = ".pipelex";
47
50
 
@@ -131,8 +134,7 @@ export function displayPath(file, homedir = os.homedir) {
131
134
  */
132
135
  export function noKeyDetail(read, { homedir = os.homedir, platform = process.platform } = {}) {
133
136
  const login = loginCommand(platform);
134
- const rest =
135
- "export PIPELEX_API_KEY in this shell, or pass --no-create and write .env.local yourself before running npm run create; npm run create never copies the key into the project";
137
+ const rest = `export PIPELEX_API_KEY in this shell, or pass --no-create and write .env.local yourself before running ${npmCommand(platform)} run create; npm run create never copies the key into the project`;
136
138
  if (read.status === "relative-home") {
137
139
  return `PIPELEX_API_KEY is not set, and the login's saved key is not read because PIPELEX_HOME is neither an absolute path nor one starting with ~/: fix PIPELEX_HOME and run ${login}, ${rest}`;
138
140
  }
package/lib/main.mjs CHANGED
@@ -60,7 +60,7 @@ import {
60
60
  } from "./npm.mjs";
61
61
  import { decodePack, PackError } from "./pack.mjs";
62
62
  import { loadTable, PACKAGE_ROOT } from "./templates.mjs";
63
- import { EXIT_OK, inTurn, shellQuote, Verdict } from "./verdict.mjs";
63
+ import { EXIT_OK, inTurn, npmCommand, shellQuote, Verdict } from "./verdict.mjs";
64
64
  import { DestinationChanged, Interrupted, writeTree } from "./write.mjs";
65
65
 
66
66
  export const PACKS_DIR = path.join(PACKAGE_ROOT, "templates");
@@ -252,9 +252,16 @@ function planGit(args, dest, found, env) {
252
252
  /**
253
253
  * The commands to run next, without --dry-run, quoted for this system's shell
254
254
  * and in order: `cd` into the copy, then `npm run create`, after the
255
- * `npm install` it needs unless `installed`.
255
+ * `npm install` it needs unless `installed`, npm spelled as a person types it
256
+ * there (`npmCommand`).
256
257
  */
257
- function nextCreate(dest, table, template, values, { installed = false } = {}) {
258
+ export function nextCreate(
259
+ dest,
260
+ table,
261
+ template,
262
+ values,
263
+ { installed = false, platform = process.platform } = {},
264
+ ) {
258
265
  const forwarded = { ...values };
259
266
  delete forwarded.DRY_RUN;
260
267
  const words = createWords(
@@ -262,10 +269,106 @@ function nextCreate(dest, table, template, values, { installed = false } = {}) {
262
269
  forwarded,
263
270
  table.switches,
264
271
  table.required,
265
- ).map((word) => shellQuote(word));
272
+ ).map((word) => shellQuote(word, platform));
266
273
  if (values[table.required] === undefined) words.unshift("<method>");
267
- const create = `npm run create -- ${words.join(" ")}`;
268
- return inTurn([`cd ${shellQuote(dest)}`, ...(installed ? [] : ["npm install"]), create]);
274
+ const npm = npmCommand(platform);
275
+ const create = `${npm} run create -- ${words.join(" ")}`;
276
+ return inTurn([
277
+ `cd ${shellQuote(dest, platform)}`,
278
+ ...(installed ? [] : [`${npm} install`]),
279
+ create,
280
+ ]);
281
+ }
282
+
283
+ /** The highest of `dest` and its ancestors that does not exist yet. */
284
+ function highestMissing(dest) {
285
+ const existing = nearestExisting(dest);
286
+ return path.join(existing, path.relative(existing, dest).split(path.sep)[0]);
287
+ }
288
+
289
+ /** Node's recursive removal of `process.argv[1]`, or of one entry in it, as a script for `node -e`. */
290
+ const REMOVE = (target) => `fs.rmSync(${target}, { recursive: true, force: true })`;
291
+ const IN_DEST = "path.join(process.argv[1], entry)";
292
+
293
+ /**
294
+ * The commands that discard what a dry run left and put the destination back
295
+ * as it stood before, the same on every system: Node, which every run of the
296
+ * initializer has, and no `rm -rf`, which is no PowerShell command, and git
297
+ * for the one repository that was there before. What was there decides them
298
+ * (`existed`, `readDestination`'s kind):
299
+ *
300
+ * - `missing`: the directory, deleted whole from outside it, since Windows
301
+ * refuses to delete the directory a process stands in; `made`, the
302
+ * highest directory the run created on the way to it, is the one deleted,
303
+ * so no empty parent stays behind;
304
+ * - `empty`: everything in it, a repository the run made included, the
305
+ * directory itself kept;
306
+ * - `lone-git`: everything in it but `.git`, and, when the pristine commit
307
+ * went into that repository, the commit and the index it recorded, which
308
+ * leaves the repository with no commit and nothing staged, as it was; and
309
+ * the hooks path the template's husky set in that repository's config when
310
+ * npm install ran, which would otherwise disable its own hooks.
311
+ *
312
+ * No script holds a `!`, which an interactive bash would expand, nor a `$` or
313
+ * a backtick, which PowerShell would.
314
+ */
315
+ export function discardCommands({
316
+ dest,
317
+ made = dest,
318
+ existed,
319
+ committed,
320
+ platform = process.platform,
321
+ }) {
322
+ const quoted = shellQuote(dest, platform);
323
+ if (existed === "missing") {
324
+ return [`node -e "${REMOVE("process.argv[1]")}" ${shellQuote(made, platform)}`];
325
+ }
326
+ const keep = existed === "lone-git" ? "entry === '.git' || " : "";
327
+ const commands = [
328
+ `node -e "for (const entry of fs.readdirSync(process.argv[1])) ${keep}${REMOVE(IN_DEST)}" ${quoted}`,
329
+ ];
330
+ if (existed === "lone-git" && committed) {
331
+ commands.push(`git -C ${quoted} update-ref -d HEAD`, `git -C ${quoted} read-tree --empty`);
332
+ }
333
+ if (existed === "lone-git") {
334
+ commands.push(
335
+ `git -C ${quoted} config --unset core.hooksPath ${shellQuote(".husky/_", platform)}`,
336
+ );
337
+ }
338
+ return commands;
339
+ }
340
+
341
+ /**
342
+ * What a dry run's `copied` verdict says between its parentheses: that only
343
+ * `npm run create` was dry, what stands (the files, the dependencies npm
344
+ * install wrote, and the pristine commit when one was made), and the commands
345
+ * that discard it all and leave the destination as it was (`discardCommands`).
346
+ */
347
+ export function dryRunStands({
348
+ dest,
349
+ made = dest,
350
+ existed,
351
+ committed,
352
+ platform = process.platform,
353
+ }) {
354
+ const commit =
355
+ existed === "lone-git"
356
+ ? `, and the pristine commit, the first in the repository ${shellQuote(dest, platform)} held`
357
+ : ", and the pristine commit";
358
+ const stands = committed
359
+ ? `its files, the dependencies npm install wrote into node_modules${commit}`
360
+ : "its files and the dependencies npm install wrote into node_modules";
361
+ const commands = inTurn(discardCommands({ dest, made, existed, committed, platform }));
362
+ const how =
363
+ existed === "missing"
364
+ ? `to discard it, run ${commands} from outside ${shellQuote(made, platform)}`
365
+ : `to discard it and leave ${shellQuote(dest, platform)} as it was before, run ${commands}`;
366
+ return `only npm run create was dry and changed nothing; the copy stands, with ${stands}; ${how}`;
367
+ }
368
+
369
+ /** The commands to run once the app is created: `cd` into it, then `npm run serve`. */
370
+ export function nextServe(dest, platform = process.platform) {
371
+ return inTurn([`cd ${shellQuote(dest, platform)}`, `${npmCommand(platform)} run serve`]);
269
372
  }
270
373
 
271
374
  async function create(argv, d, say, state) {
@@ -332,6 +435,8 @@ async function create(argv, d, say, state) {
332
435
  const problem = destinationProblem(dest, found);
333
436
  if (problem !== null) throw Verdict.refused("not-empty", problem);
334
437
  const git = planGit(args, dest, found, d.env);
438
+ // The highest directory the write will create, which a dry run's discard deletes.
439
+ const made = found.kind === "missing" ? highestMissing(dest) : dest;
335
440
 
336
441
  const values = { ...args.values };
337
442
  if (values[table.required] !== undefined) {
@@ -477,11 +582,11 @@ async function create(argv, d, say, state) {
477
582
  }
478
583
  if (values.DRY_RUN) {
479
584
  return {
480
- line: `copied ${dest} (npm run create --dry-run changed nothing); next: ${nextCreate(dest, table, template, values, { installed: true })}`,
585
+ line: `copied ${dest} (${dryRunStands({ dest, made, existed: found.kind, committed: git.commit })}); next: ${nextCreate(dest, table, template, values, { installed: true })}`,
481
586
  };
482
587
  }
483
588
  stampInstall(dest);
484
- return { line: `created ${dest}; next: ${inTurn([`cd ${shellQuote(dest)}`, "npm run serve"])}` };
589
+ return { line: `created ${dest}; next: ${nextServe(dest)}` };
485
590
  }
486
591
 
487
592
  /**
package/lib/verdict.mjs CHANGED
@@ -7,7 +7,10 @@
7
7
  * is presentation: 0 for `created` and `copied`, 1 otherwise.
8
8
  *
9
9
  * created <dir> the copy, the git outcome, and a green npm run create
10
- * copied <dir> --no-create or --dry-run: the copy and the git outcome only
10
+ * copied <dir> --no-create or --dry-run: the copy and the git outcome only; after
11
+ * --dry-run it names what stands (the files, the installed
12
+ * dependencies, the commit) and the commands that discard it, leaving
13
+ * the destination as it stood before the run
11
14
  * refused: <why> the preflight stopped, and nothing was written
12
15
  * failed: write the copy failed or was interrupted, and what it created was removed
13
16
  * failed: commit git refused the pristine commit; the copy stands
@@ -73,3 +76,14 @@ export function shellQuote(word, platform = process.platform) {
73
76
  export function inTurn(commands) {
74
77
  return commands.map((command) => `\`${command}\``).join(", then ");
75
78
  }
79
+
80
+ /**
81
+ * The npm a person types on this system, as the verdicts name it: `npm.cmd` on
82
+ * Windows, `npm` elsewhere. Windows PowerShell 5.1, under the execution policy
83
+ * Windows sets by default and an IT department may pin, runs a typed `npm` as
84
+ * `npm.ps1` and refuses it, while `npm.cmd` runs there, in PowerShell 7 and in
85
+ * `cmd` alike. The template's `scripts/lib/npm.mts` names it the same way.
86
+ */
87
+ export function npmCommand(platform = process.platform) {
88
+ return platform === "win32" ? "npm.cmd" : "npm";
89
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelex/create-method-app",
3
- "version": "0.74.0",
3
+ "version": "0.74.2",
4
4
  "description": "Start a Pipelex method app: npm create @pipelex/method-app@latest my-app -- --method <bundle | mt_… | address>",
5
5
  "keywords": [
6
6
  "pipelex",
Binary file