@pipelex/create-method-app 0.29.1 → 0.32.1
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 +1 -1
- package/lib/main.mjs +8 -2
- package/lib/templates.mjs +19 -2
- package/package.json +1 -1
- package/templates/webapp-js.pack +0 -0
- package/templates.json +3 -1
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
|
|
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 !==
|
|
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
|
-
/**
|
|
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
|
-
|
|
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
package/templates/webapp-js.pack
CHANGED
|
Binary file
|
package/templates.json
CHANGED