@pipelex/create-method-app 0.5.7 → 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 CHANGED
@@ -8,7 +8,7 @@ npm create @pipelex/method-app@latest my-app -- --method ./receipt_review.mthds
8
8
  make -C my-app serve
9
9
  ```
10
10
 
11
- The first command writes the [`webapp-js`](https://github.com/Pipelex/pipelex-method-apps/tree/main/webapp-js) template of [`pipelex-method-apps`](https://github.com/Pipelex/pipelex-method-apps) into `my-app/`, commits it as it came, and runs the copy's own `make create`, which scaffolds the method, names the project after it and runs `make all`. The second starts the dev server in the background, proves that the page answers, and prints its URL; `make stop` stops it. `make dev` runs the same server in the foreground instead.
11
+ 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 `make create`, which scaffolds the method, names the project after it and runs `make all`. The second starts the dev server in the background, proves that the page answers, and prints its URL; `make stop` stops it. `make dev` runs the same server in the foreground instead.
12
12
 
13
13
  `--method` takes a `.mthds` file or a directory of them, a method id from your organization's catalog (`mt_…`), or a published package address (`github.com/Pipelex/methods/text_stats@v0.1.1`). A path is read from where you typed the command.
14
14
 
@@ -48,13 +48,13 @@ The initializer reads git before it writes anything:
48
48
  | A repository with commits, holding only `.git` | Refused: every tracked file would show as deleted, and the commit would record that |
49
49
  | Inside another repository's work tree, at a path it ignores | A new repository on `main`, then the pristine commit: that repository does not see the project |
50
50
  | Inside another repository's work tree | No repository and no commit: the project is new files in that repository. `--no-create` lets you commit the template there first |
51
- | Inside a checkout of `pipelex-method-apps` or of a starter | Refused, `--no-git` included whenever git is on the PATH |
51
+ | Inside a checkout of `pipelex-sdk`, of `pipelex-method-apps` or of a starter | Refused, `--no-git` included whenever git is on the PATH |
52
52
 
53
53
  A path the enclosing repository ignores, such as a `tmp/` its `.gitignore` lists or anywhere under a home directory kept as a repository that ignores `*`, is one it does not version, so a project there gets a repository of its own rather than no version control at all. Every source git reads counts: the enclosing repository's `.gitignore` files, its `.git/info/exclude`, and your `core.excludesFile`. What counts is the directory itself, which a missing destination is made for a moment to let git read: a directory the enclosing repository does not ignore gets no repository even when every file in it is ignored, as under `*` followed by `!*/`, since a repository there would still show in the enclosing one's `git status`, and the `git:` line then says the project is under no version control. A destination that is a symlink is read where it points: the repository whose work tree holds its target is the one whose ignores count.
54
54
 
55
55
  A commit needs a git identity, and a missing one is refused before anything is written. When git shows none outside a repository, the initializer asks again inside a throwaway repository at the destination, which it removes before going on, so an identity given only by an `includeIf "gitdir:…"` section is found. At a path another repository ignores, it always asks inside that throwaway repository, since an identity set in the enclosing repository's own configuration does not reach the new one.
56
56
 
57
- The pristine commit reads `Start from Pipelex/pipelex-method-apps/webapp-js <version> (<sha>)`, so `make create`'s changes are a diff you can read before committing them. `make create` itself commits nothing.
57
+ The pristine commit reads `Start from Pipelex/pipelex-sdk/method-apps/webapp-js <version> (<sha>)`, so `make create`'s changes are a diff you can read before committing them. `make create` itself commits nothing.
58
58
 
59
59
  ## What it prints
60
60
 
@@ -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/git.mjs CHANGED
@@ -34,11 +34,13 @@ import path from "node:path";
34
34
 
35
35
  /**
36
36
  * The repositories whose checkouts are templates, read from `origin`: the
37
- * family's own, and the starters. Running the initializer inside one would
38
- * make a project of a template's checkout.
37
+ * family's own, `pipelex-sdk`, and `pipelex-method-apps`, where the family
38
+ * lived before, whose clones still hold the templates; and the starters.
39
+ * Running the initializer inside one would make a project of a template's
40
+ * checkout.
39
41
  */
40
42
  export const TEMPLATE_ORIGINS =
41
- /[/:](pipelex\/(pipelex-method-apps|pipelex-starter-js|pipelex-starter-python)|mthds-ai\/mthds-starter-js)(\.git)?\/?$/i;
43
+ /[/:](pipelex\/(pipelex-sdk|pipelex-method-apps|pipelex-starter-js|pipelex-starter-python)|mthds-ai\/mthds-starter-js)(\.git)?\/?$/i;
42
44
 
43
45
  /**
44
46
  * Variables that point git at a repository other than the one it would find
@@ -240,7 +242,7 @@ export function hasIdentityForInit({ dest, from, enclosed, env }) {
240
242
 
241
243
  /** The pristine commit's message, in the scaffold skill's format. */
242
244
  export function pristineMessage({ template, version, source }) {
243
- return `Start from Pipelex/pipelex-method-apps/${template} ${version} (${source})`;
245
+ return `Start from Pipelex/pipelex-sdk/method-apps/${template} ${version} (${source})`;
244
246
  }
245
247
 
246
248
  /**
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/pack.mjs CHANGED
@@ -14,8 +14,8 @@
14
14
  * {"format":1,"template":"webapp-js","version":"0.4.0","source":"<sha>",
15
15
  * "files":[{"path":"package.json","mode":"100644","size":2345}, …]}
16
16
  *
17
- * `version` is the family's, and `source` the commit the tree was packed from,
18
- * both named by the pristine commit. `mode` is git's: a plain or an executable
17
+ * `version` is the repository's, from `VERSION` at its root, and `source` the
18
+ * commit the tree was packed from, both named by the pristine commit. `mode` is git's: a plain or an executable
19
19
  * file, and nothing else. A path is relative to the template's directory.
20
20
  */
21
21
 
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.5.7",
3
+ "version": "0.32.1",
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",
@@ -24,11 +24,13 @@
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "git+https://github.com/Pipelex/pipelex-method-apps.git",
28
- "directory": "initializers/js"
27
+ "url": "git+https://github.com/Pipelex/pipelex-sdk.git",
28
+ "directory": "method-apps/initializers/js"
29
+ },
30
+ "homepage": "https://github.com/Pipelex/pipelex-sdk/tree/main/method-apps/initializers/js#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/Pipelex/pipelex-sdk/issues"
29
33
  },
30
- "homepage": "https://github.com/Pipelex/pipelex-method-apps/tree/main/initializers/js#readme",
31
- "bugs": "https://github.com/Pipelex/pipelex-method-apps/issues",
32
34
  "publishConfig": {
33
35
  "access": "public",
34
36
  "provenance": true
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
  }