@pipelex/create-method-app 0.29.1 → 0.34.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 CHANGED
@@ -76,7 +76,7 @@ Before the verdict come the warnings `make create` printed, each once, and the g
76
76
 
77
77
  Everything the initializer prints goes to standard output, `make create`'s output included when `--quiet` is not given. Under `npm create`, a run that exits 1 is followed by npm's own `npm error` lines on standard error, so read the verdict from standard output rather than from the last line of everything printed. `npm create --loglevel=silent @pipelex/method-app@latest …` removes npm's lines and leaves the initializer's alone.
78
78
 
79
- A Python template gets its own initializer, run with `uvx create-pipelex-method-app`, and this one refuses it with `refused: other-ecosystem`.
79
+ A Python template, such as `cli-python`, is refused with `refused: other-ecosystem`. No initializer serves the Python templates yet, so the line points at the template's README, which shows how to copy it out of a release of `Pipelex/pipelex-sdk` and run its `make create`.
80
80
 
81
81
  ## License
82
82
 
package/lib/main.mjs CHANGED
@@ -138,10 +138,16 @@ function chooseTemplate(args, table) {
138
138
  const template = args.template ?? table.defaultTemplate;
139
139
  if (!Object.hasOwn(table.templates, template)) {
140
140
  const other = table.otherEcosystemOf(template);
141
- if (other !== null) {
141
+ if (other?.initializer !== undefined) {
142
142
  throw Verdict.refused(
143
143
  "other-ecosystem",
144
- `${template} is not a Node template, and ${other} serves it: run ${other} <dir> --template ${template} --method …`,
144
+ `${template} is not a Node template, and ${other.initializer} serves it: run ${other.initializer} <dir> --template ${template} --method …`,
145
+ );
146
+ }
147
+ if (other?.copyOut !== undefined) {
148
+ throw Verdict.refused(
149
+ "other-ecosystem",
150
+ `${template} is not a Node template, and no initializer serves it yet: copy it out of a release of Pipelex/pipelex-sdk as ${other.copyOut} shows, then run its make create`,
145
151
  );
146
152
  }
147
153
  throw Verdict.refused(
package/lib/templates.mjs CHANGED
@@ -11,6 +11,12 @@
11
11
  * `AUTHOR_EMAIL` is `--author-email`, and a switch such as `DRY_RUN` is
12
12
  * `--dry-run`, taking no value. Those are also the flags of a template's own
13
13
  * `npm run create`.
14
+ *
15
+ * `otherEcosystems` says, for each other language of the family, where a
16
+ * person asking this initializer for that language's template is sent: to
17
+ * `initializer`, the command of that language's own initializer, or, while it
18
+ * has none, to `copyOut`, the page showing how to copy the template out of a
19
+ * release, with `{template}` standing for the template asked for.
14
20
  */
15
21
 
16
22
  import fs from "node:fs";
@@ -50,11 +56,22 @@ export function loadTable(file = TABLE_FILE) {
50
56
  variablesOf(template) {
51
57
  return [...raw.create.shared, ...raw.templates[template].extras];
52
58
  },
53
- /** The command serving another ecosystem's template, or null. The suffix is the family's naming rule. */
59
+ /**
60
+ * Where another ecosystem's template comes from, or null: `{ initializer }`,
61
+ * the command of that ecosystem's initializer, or `{ copyOut }`, the page
62
+ * showing how to copy this template out of a release. The suffix is the
63
+ * family's naming rule.
64
+ */
54
65
  otherEcosystemOf(template) {
55
66
  const language = /-([a-z0-9]+)$/.exec(template)?.[1];
56
67
  if (language === undefined || language === raw.ecosystem) return null;
57
- return Object.hasOwn(raw.otherEcosystems, language) ? raw.otherEcosystems[language] : null;
68
+ if (!Object.hasOwn(raw.otherEcosystems, language)) return null;
69
+ const other = raw.otherEcosystems[language];
70
+ if (typeof other.initializer === "string") return { initializer: other.initializer };
71
+ if (typeof other.copyOut === "string") {
72
+ return { copyOut: other.copyOut.replaceAll("{template}", template) };
73
+ }
74
+ return null;
58
75
  },
59
76
  };
60
77
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelex/create-method-app",
3
- "version": "0.29.1",
3
+ "version": "0.34.0",
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
package/templates.json CHANGED
@@ -25,6 +25,8 @@
25
25
  "switches": ["DRY_RUN"]
26
26
  },
27
27
  "otherEcosystems": {
28
- "python": "uvx create-pipelex-method-app"
28
+ "python": {
29
+ "copyOut": "https://github.com/Pipelex/pipelex-sdk/tree/main/method-apps/{template}#start-a-project-from-the-template"
30
+ }
29
31
  }
30
32
  }