@voxgig/create-sdkgen 0.30.7 → 0.30.8
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 +21 -4
- package/bin/create-sdkgen +20 -4
- package/dist/args.d.ts +4 -0
- package/dist/args.js +40 -0
- package/dist/args.js.map +1 -0
- package/dist/create-sdkgen.d.ts +16 -2
- package/dist/create-sdkgen.js +51 -5
- package/dist/create-sdkgen.js.map +1 -1
- package/dist/project/standard/CreateRoot.js +26 -1
- package/dist/project/standard/CreateRoot.js.map +1 -1
- package/dist/project/standard/migrate.d.ts +2 -1
- package/dist/project/standard/migrate.js +34 -19
- package/dist/project/standard/migrate.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/standard/.github/workflows/ci.yml +44 -7
- package/project/standard/.sdk/.gitattributes +2 -0
- package/project/standard/.sdk/admin/README.md +10 -0
- package/project/standard/.sdk/model/sdk.fragment.aontu +7 -6
- package/project/standard/.sdk/package.json +5 -5
- package/project/standard/.sdk/test/test.aontu +3 -3
- package/src/args.ts +52 -0
- package/src/create-sdkgen.ts +80 -5
- package/src/project/standard/CreateRoot.ts +32 -1
- package/src/project/standard/migrate.ts +46 -19
package/README.md
CHANGED
|
@@ -37,9 +37,23 @@ generated output and is overwritten on each regenerate.
|
|
|
37
37
|
| `-o, --folder <dir>` | output directory (default `<name>-sdk`) |
|
|
38
38
|
| `-t, --target <langs>` | targets to add during scaffold (e.g. `ts,py,go`) |
|
|
39
39
|
| `-f, --feature <feats>` | features to add (e.g. `test`) |
|
|
40
|
+
| `-p, --project <name>` | project template, by name or folder (default `standard`) |
|
|
40
41
|
| `--no-install` | skip `npm install` |
|
|
42
|
+
| `--dryrun` | report what the scaffold would write, and write nothing |
|
|
43
|
+
| `--debug <level>` | log level: `trace`, `debug`, `info`, `warn`, `error` or `fatal` (default `info`) |
|
|
41
44
|
| `-h`, `-v` | help, version |
|
|
42
45
|
|
|
46
|
+
Through `npm create`, the options follow `--`. Without it, npm reads `-d`,
|
|
47
|
+
`-o`, `-t`, `-f`, `--dryrun` and `--no-install` as its own settings and passes
|
|
48
|
+
on only their values, which create-sdkgen then refuses:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm create @voxgig/sdkgen@latest my-api -- -d ./openapi.yaml -t ts,py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`npx @voxgig/create-sdkgen` and an installed `create-sdkgen` take the options
|
|
55
|
+
as written.
|
|
56
|
+
|
|
43
57
|
## After the scaffold
|
|
44
58
|
|
|
45
59
|
The loop from here is:
|
|
@@ -70,15 +84,18 @@ create-sdkgen my-api -d ./openapi.yaml -o ./my-api-sdk
|
|
|
70
84
|
|
|
71
85
|
A re-scaffold rewrites the scaffold's own files and keeps the project's: the
|
|
72
86
|
guide in `.sdk/model/guide/`, the project overlay `.sdk/model/project.aontu`,
|
|
73
|
-
and the target, feature, and
|
|
87
|
+
the README wording in `.sdk/model/text.aontu`, and the target, feature, and
|
|
88
|
+
edition indexes with the files they name.
|
|
74
89
|
|
|
75
90
|
The same command brings a project from before the `.aontu` rename up to date,
|
|
76
91
|
which it needs, because `aontu` now refuses to include a `.aon` file. The
|
|
77
92
|
re-scaffold renames each `.aon` file under `.sdk/model/` and `.sdk/test/` to
|
|
78
93
|
`.aontu`, or removes it where the scaffold writes its replacement, and updates
|
|
79
|
-
every include that names a renamed file.
|
|
80
|
-
|
|
81
|
-
a
|
|
94
|
+
every include that names a renamed file. An include of a local file that has
|
|
95
|
+
no `./` prefix, such as `@"entity/entity-index.aontu"`, gains one, since
|
|
96
|
+
`aontu` reads a path without it as a package path first. Nothing else in a
|
|
97
|
+
file changes. An include the scaffold can't update, such as one pointing
|
|
98
|
+
outside `.sdk/`, gets a warning that names the file. Commit first, so the migration is a diff you
|
|
82
99
|
can read. [`test/create-sdkgen.test.ts`](./test/create-sdkgen.test.ts) builds
|
|
83
100
|
such a project and re-scaffolds it.
|
|
84
101
|
|
package/bin/create-sdkgen
CHANGED
|
@@ -8,7 +8,7 @@ const { Shape, Fault, One } = require('shape')
|
|
|
8
8
|
|
|
9
9
|
const Pkg = require('../package.json')
|
|
10
10
|
|
|
11
|
-
const { CreateSdkGen } = require('../dist/create-sdkgen.js')
|
|
11
|
+
const { CreateSdkGen, forwardingError } = require('../dist/create-sdkgen.js')
|
|
12
12
|
|
|
13
13
|
// const rootpath = require.resolve('../dist/standard/CreateRoot')
|
|
14
14
|
|
|
@@ -193,7 +193,14 @@ function resolveOptions() {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
let features = args.values.feature || []
|
|
196
|
-
|
|
196
|
+
|
|
197
|
+
if (!args.values.help && !args.values.version) {
|
|
198
|
+
const misplaced = forwardingError(name, args.positionals.slice(1), process.env)
|
|
199
|
+
if (misplaced) {
|
|
200
|
+
handleError(misplaced)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
197
204
|
const options = {
|
|
198
205
|
name,
|
|
199
206
|
def: args.values.def,
|
|
@@ -270,13 +277,16 @@ function help() {
|
|
|
270
277
|
let s = `
|
|
271
278
|
Create a Voxgig SDK Generator project.
|
|
272
279
|
|
|
273
|
-
Usage: npm create @voxgig/sdkgen@latest <name> <args>
|
|
280
|
+
Usage: npm create @voxgig/sdkgen@latest <name> -- <args>
|
|
281
|
+
create-sdkgen <name> <args>
|
|
274
282
|
|
|
275
283
|
<name> is the name of the SDK project. This is also used to
|
|
276
284
|
create a project folder. If run against an existing folder
|
|
277
285
|
generated files will be overwritten.
|
|
278
286
|
|
|
279
|
-
<args> are the command arguments
|
|
287
|
+
<args> are the command arguments. npm create keeps the options
|
|
288
|
+
it reads itself (-d, -o, -t, -f, --dryrun, --no-install) unless
|
|
289
|
+
they follow --, so put -- before them.
|
|
280
290
|
|
|
281
291
|
--def Path to the OpenAPI definition file (optional).
|
|
282
292
|
-d
|
|
@@ -314,6 +324,12 @@ Examples:
|
|
|
314
324
|
> npm create @voxgig/sdkgen@latest foo
|
|
315
325
|
# Creates the SDK Project in the folder ./foo-sdk
|
|
316
326
|
|
|
327
|
+
# From a spec, with targets: the options follow --
|
|
328
|
+
> npm create @voxgig/sdkgen@latest foo -- -d ./openapi.yaml -t ts,py
|
|
329
|
+
|
|
330
|
+
# npx passes the options on as written
|
|
331
|
+
> npx @voxgig/create-sdkgen foo -d ./openapi.yaml -t ts,py
|
|
332
|
+
|
|
317
333
|
See also: https://voxgig.com/sdkgen
|
|
318
334
|
`
|
|
319
335
|
|
package/dist/args.d.ts
ADDED
package/dist/args.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2026 Richard Rodger, MIT License */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TARGETS = void 0;
|
|
5
|
+
exports.forwardingError = forwardingError;
|
|
6
|
+
// The targets sdkgen and its language packages add.
|
|
7
|
+
const TARGETS = [
|
|
8
|
+
'ts', 'js', 'py', 'py-data', 'go', 'go-cli', 'go-mcp', 'rb', 'php', 'lua',
|
|
9
|
+
'csharp', 'java', 'kotlin', 'scala', 'swift', 'dart', 'rust', 'c', 'cpp',
|
|
10
|
+
'zig', 'perl', 'clojure', 'elixir', 'ocaml', 'haskell', 'lean',
|
|
11
|
+
];
|
|
12
|
+
exports.TARGETS = TARGETS;
|
|
13
|
+
// `npm create` reads these as its own configuration, and records them in the
|
|
14
|
+
// environment, when no `--` precedes them.
|
|
15
|
+
const NPM_KEPT_FLAGS = {
|
|
16
|
+
dryrun: '--dryrun',
|
|
17
|
+
install: '--no-install',
|
|
18
|
+
};
|
|
19
|
+
// `npm create <name> -d spec.yaml -t ts` hands the initializer
|
|
20
|
+
// `<name> spec.yaml ts`: npm keeps each flag and passes its value on.
|
|
21
|
+
function forwardingError(name, positionalTargets, env) {
|
|
22
|
+
const notTargets = positionalTargets
|
|
23
|
+
.flatMap((arg) => arg.split(','))
|
|
24
|
+
.filter((arg) => '' !== arg && !TARGETS.includes(arg));
|
|
25
|
+
const kept = Object.keys(NPM_KEPT_FLAGS)
|
|
26
|
+
.filter((key) => undefined !== env['npm_config_' + key])
|
|
27
|
+
.map((key) => NPM_KEPT_FLAGS[key]);
|
|
28
|
+
if (0 === notTargets.length && 0 === kept.length) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return [
|
|
32
|
+
0 < notTargets.length ? 'Not a target: ' + notTargets.join(', ') + '.' : '',
|
|
33
|
+
0 < kept.length ? 'npm kept ' + kept.join(' and ') + ' for itself.' : '',
|
|
34
|
+
'npm create passes options on only after a --, as in:',
|
|
35
|
+
' npm create @voxgig/sdkgen@latest ' + (name || '<name>') +
|
|
36
|
+
' -- -d ./openapi.yaml -t ts',
|
|
37
|
+
'Targets: ' + TARGETS.join(', ') + '. Add any other with -t.',
|
|
38
|
+
].filter(Boolean).join('\n');
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":";AAAA,oDAAoD;;;QAkDlD,eAAe;AA/CjB,oDAAoD;AACpD,MAAM,OAAO,GAAG;IACd,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK;IACzE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK;IACxE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;CAC/D,CAAA;QAyCC,OAAO;AAvCT,6EAA6E;AAC7E,2CAA2C;AAC3C,MAAM,cAAc,GAA2B;IAC7C,MAAM,EAAE,UAAU;IAClB,OAAO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CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC"}
|
package/dist/create-sdkgen.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Pino } from '@voxgig/util';
|
|
2
|
+
import { TARGETS, forwardingError } from './args';
|
|
2
3
|
type FullCreateSdkGenOptions = {
|
|
3
4
|
fs?: any;
|
|
4
5
|
debug?: boolean | string;
|
|
@@ -21,5 +22,18 @@ type GenerateSpec = {
|
|
|
21
22
|
declare function CreateSdkGen(opts: FullCreateSdkGenOptions): {
|
|
22
23
|
generate: (spec: GenerateSpec) => Promise<void>;
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
type Host = {
|
|
26
|
+
platform: string;
|
|
27
|
+
env: Record<string, string | undefined>;
|
|
28
|
+
execPath: string;
|
|
29
|
+
exists: (path: string) => boolean;
|
|
30
|
+
};
|
|
31
|
+
type NpmLaunch = {
|
|
32
|
+
command: string;
|
|
33
|
+
args: string[];
|
|
34
|
+
shell?: boolean;
|
|
35
|
+
};
|
|
36
|
+
declare function npmLaunch(args: string[], host?: Host): NpmLaunch;
|
|
37
|
+
declare function npmEnv(host?: Host): Record<string, string | undefined>;
|
|
38
|
+
export type { CreateSdkGenOptions, Host, NpmLaunch, };
|
|
39
|
+
export { CreateSdkGen, TARGETS, forwardingError, npmEnv, npmLaunch, };
|
package/dist/create-sdkgen.js
CHANGED
|
@@ -37,7 +37,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.forwardingError = exports.TARGETS = void 0;
|
|
40
41
|
exports.CreateSdkGen = CreateSdkGen;
|
|
42
|
+
exports.npmEnv = npmEnv;
|
|
43
|
+
exports.npmLaunch = npmLaunch;
|
|
41
44
|
const Fs = __importStar(require("node:fs"));
|
|
42
45
|
const Os = __importStar(require("node:os"));
|
|
43
46
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -45,6 +48,9 @@ const child_process_1 = require("child_process");
|
|
|
45
48
|
const JostracaModule = __importStar(require("jostraca"));
|
|
46
49
|
const util_1 = require("@voxgig/util");
|
|
47
50
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
51
|
+
const args_1 = require("./args");
|
|
52
|
+
Object.defineProperty(exports, "TARGETS", { enumerable: true, get: function () { return args_1.TARGETS; } });
|
|
53
|
+
Object.defineProperty(exports, "forwardingError", { enumerable: true, get: function () { return args_1.forwardingError; } });
|
|
48
54
|
const { names, Jostraca } = JostracaModule;
|
|
49
55
|
const SDK_FOLDER = '.sdk';
|
|
50
56
|
function CreateSdkGen(opts) {
|
|
@@ -179,10 +185,53 @@ function CreateSdkGen(opts) {
|
|
|
179
185
|
generate,
|
|
180
186
|
};
|
|
181
187
|
}
|
|
188
|
+
const HOST = {
|
|
189
|
+
platform: process.platform,
|
|
190
|
+
env: process.env,
|
|
191
|
+
execPath: process.execPath,
|
|
192
|
+
exists: (path) => Fs.existsSync(path),
|
|
193
|
+
};
|
|
194
|
+
const NPM_CLI_RE = /[\\/]npm-cli\.js$/;
|
|
195
|
+
const CMD_UNSAFE_RE = /["%\r\n]/;
|
|
196
|
+
// On Windows npm is npm.cmd, which spawn cannot find without a shell and
|
|
197
|
+
// refuses to run without one, so npm's own script runs on this node instead.
|
|
198
|
+
function npmLaunch(args, host = HOST) {
|
|
199
|
+
if ('win32' !== host.platform) {
|
|
200
|
+
return { command: 'npm', args };
|
|
201
|
+
}
|
|
202
|
+
const bundled = node_path_1.default.win32.join(node_path_1.default.win32.dirname(host.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js');
|
|
203
|
+
const cli = [host.env.npm_execpath, bundled]
|
|
204
|
+
.find((file) => null != file && NPM_CLI_RE.test(file) && host.exists(file));
|
|
205
|
+
if (null != cli) {
|
|
206
|
+
return { command: host.execPath, args: [cli, ...args] };
|
|
207
|
+
}
|
|
208
|
+
// A command string, so cmd.exe sees each argument quoted, and only quoted.
|
|
209
|
+
const unsafe = args.find((arg) => CMD_UNSAFE_RE.test(arg));
|
|
210
|
+
if (null != unsafe) {
|
|
211
|
+
throw new Error(`Cannot pass ${JSON.stringify(unsafe)} to npm.cmd through cmd.exe.`);
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
command: ['npm.cmd', ...args.map((arg) => '"' + arg + '"')].join(' '),
|
|
215
|
+
args: [],
|
|
216
|
+
shell: true,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
// The child resolves `node` to this one. Windows spells the key `Path`, and a
|
|
220
|
+
// second spelling beside it would leave the choice to key order.
|
|
221
|
+
function npmEnv(host = HOST) {
|
|
222
|
+
const win = 'win32' === host.platform;
|
|
223
|
+
const P = win ? node_path_1.default.win32 : node_path_1.default.posix;
|
|
224
|
+
const key = (win ?
|
|
225
|
+
Object.keys(host.env).find((name) => 'PATH' === name.toUpperCase()) :
|
|
226
|
+
undefined) ?? 'PATH';
|
|
227
|
+
const dirs = [P.dirname(host.execPath), host.env[key]].filter(Boolean);
|
|
228
|
+
return { ...host.env, [key]: dirs.join(P.delimiter) };
|
|
229
|
+
}
|
|
182
230
|
// Run `npm <args>` to completion, rejecting on spawn error or non-zero exit.
|
|
183
231
|
function runNpm(args, spawn_opts) {
|
|
184
232
|
return new Promise((resolve, reject) => {
|
|
185
|
-
const
|
|
233
|
+
const launch = npmLaunch(args);
|
|
234
|
+
const child = (0, child_process_1.spawn)(launch.command, launch.args, launch.shell ? { ...spawn_opts, shell: true } : spawn_opts);
|
|
186
235
|
child.on('error', (err) => reject(new Error(`Failed to start npm: ${err.message}`)));
|
|
187
236
|
child.on('close', (code) => {
|
|
188
237
|
if (code !== 0) {
|
|
@@ -198,10 +247,7 @@ async function installNpm(spec, opts, model) {
|
|
|
198
247
|
const folder = opts.folder;
|
|
199
248
|
const log = opts.log;
|
|
200
249
|
const cwd = node_path_1.default.resolve(folder, SDK_FOLDER);
|
|
201
|
-
const env =
|
|
202
|
-
...process.env,
|
|
203
|
-
PATH: `${node_path_1.default.dirname(process.execPath)}${node_path_1.default.delimiter}${process.env.PATH}`,
|
|
204
|
-
};
|
|
250
|
+
const env = npmEnv();
|
|
205
251
|
const spawn_opts = {
|
|
206
252
|
cwd,
|
|
207
253
|
env,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-sdkgen.js","sourceRoot":"","sources":["../src/create-sdkgen.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA4UvD,YAAY;AA1Ud,MAAY,EAAE,oCAAe;AAC7B,MAAY,EAAE,oCAAe;AAC7B,0DAA4B;AAC5B,iDAAqC;AAErC,MAAY,cAAc,qCAAgB;AAE1C,uCAA4D;AAE5D,mEAAiC;AA8BjC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAA;AAG1C,MAAM,UAAU,GAAG,MAAM,CAAA;AAGzB,SAAS,YAAY,CAAC,IAA6B;IACjD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;IAExB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACxB,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAA;IAEzC,MAAM,QAAQ,GAAG,QAAQ,EAAE,CAAA;IAE3B,KAAK,UAAU,QAAQ,CAAC,IAAkB;QACxC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAExB,IAAI,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAA;QAE1B,GAAG,CAAC,IAAI,CAAC;YACP,KAAK,EAAE,gBAAgB;YACvB,KAAK;YACL,IAAI,EAAE,IAAI,CAAC,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MAAM,CAAC,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,CAAA;AAC/D,CAAC"}
|
|
@@ -75,6 +75,24 @@ const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this fil
|
|
|
75
75
|
#
|
|
76
76
|
# main: kit: target: ts: publish: registry: package: '@scope/name'
|
|
77
77
|
`;
|
|
78
|
+
const TEXT_FILE = 'text.aontu';
|
|
79
|
+
const TEXT_STUB = `# README wording — YOURS. The scaffold creates this file once and never
|
|
80
|
+
# overwrites it.
|
|
81
|
+
#
|
|
82
|
+
# A slot set here words the generated README files over the same slot of
|
|
83
|
+
# main.kit.info, where apidef puts the spec's metadata. A slot left out keeps
|
|
84
|
+
# the spec's wording. Text edited into a generated README is lost on the next
|
|
85
|
+
# generate; text here is not.
|
|
86
|
+
#
|
|
87
|
+
# main: kit: text: {
|
|
88
|
+
# tagline: 'Payments, invoices and refunds from TypeScript, Go and Python.'
|
|
89
|
+
# summary: 'Acme Pay is a payments API for marketplaces.'
|
|
90
|
+
# entity_desc: { invoice: 'A bill sent to a customer.' }
|
|
91
|
+
# }
|
|
92
|
+
#
|
|
93
|
+
# The slots are title, summary, website, tagline, about_md, homepage,
|
|
94
|
+
# docs_url, meta_source and entity_desc. Any other key fails the model build.
|
|
95
|
+
`;
|
|
78
96
|
const GUIDE_FILE = 'guide.aontu';
|
|
79
97
|
const GUIDE_REL = ['model', 'guide', GUIDE_FILE];
|
|
80
98
|
const INDEX_KINDS = ['target', 'feature', 'edition'];
|
|
@@ -82,6 +100,7 @@ const indexFile = (kind) => kind + '-index.aontu';
|
|
|
82
100
|
// Written back from the project rather than from the template.
|
|
83
101
|
const KEPT = [
|
|
84
102
|
['model', PROJECT_FILE],
|
|
103
|
+
['model', TEXT_FILE],
|
|
85
104
|
GUIDE_REL,
|
|
86
105
|
...INDEX_KINDS.map((kind) => ['model', kind, indexFile(kind)]),
|
|
87
106
|
].map((rel) => rel.join('/'));
|
|
@@ -155,8 +174,9 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
|
|
|
155
174
|
}
|
|
156
175
|
(0, jostraca_1.Folder)({ name: 'admin' }, () => {
|
|
157
176
|
const admin = node_path_1.default.join(from, spec.sdk_folder, 'admin');
|
|
177
|
+
// bash fails on a CRLF line ending, which a Windows checkout gives.
|
|
158
178
|
for (const name of fs.readdirSync(admin).filter((name) => name.endsWith('.sh')).sort()) {
|
|
159
|
-
(0, jostraca_1.File)({ name, mode: 0o755 }, () => (0, jostraca_1.Content)(fs.readFileSync(node_path_1.default.join(admin, name), 'utf8')));
|
|
179
|
+
(0, jostraca_1.File)({ name, mode: 0o755 }, () => (0, jostraca_1.Content)(fs.readFileSync(node_path_1.default.join(admin, name), 'utf8').replace(/\r\n/g, '\n')));
|
|
160
180
|
}
|
|
161
181
|
});
|
|
162
182
|
(0, jostraca_1.File)({ name: '.gitignore' }, () => {
|
|
@@ -182,6 +202,11 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
|
|
|
182
202
|
(0, jostraca_1.File)({ name: PROJECT_FILE }, () => {
|
|
183
203
|
(0, jostraca_1.Content)(null == existingProject ? PROJECT_STUB : existingProject);
|
|
184
204
|
});
|
|
205
|
+
const textPath = node_path_1.default.join(folder, spec.sdk_folder, 'model', TEXT_FILE);
|
|
206
|
+
const existingText = fs.existsSync(textPath) ? fs.readFileSync(textPath, 'utf8') : null;
|
|
207
|
+
(0, jostraca_1.File)({ name: TEXT_FILE }, () => {
|
|
208
|
+
(0, jostraca_1.Content)(null == existingText ? TEXT_STUB : existingText);
|
|
209
|
+
});
|
|
185
210
|
// `target add`, `feature add` and docgen register their items here, and
|
|
186
211
|
// docgen bootstraps only once, so a reset index would lose them for good.
|
|
187
212
|
for (const kind of INDEX_KINDS) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;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AuE;gBACvE,wEAAwE;gBACxE,IAAA,iBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE;oBAC7B,MAAM,aAAa,GACjB,EAAE,CAAC,YAAY,CAAC,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,EAAE,MAAM,CAAC,CAAA;oBACzE,MAAM,SAAS,GAAG,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,CAAA;oBAClE,MAAM,aAAa,GACjB,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;oBAEtE,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE;wBAC9B,IAAA,kBAAO,EAAC,UAAU,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAA;oBACnD,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IAEJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;QAIA,UAAU"}
|
|
@@ -3,7 +3,8 @@ type Scaffold = {
|
|
|
3
3
|
kept: Set<string>;
|
|
4
4
|
replaced: Set<string>;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
type Include = (path: string) => boolean;
|
|
7
|
+
declare function rewriteIncludes(src: string, rename: Include, local?: Include): string;
|
|
7
8
|
declare function scaffoldFiles(fs: any, templateSdk: string, kept: string[]): Scaffold;
|
|
8
9
|
declare function migrateToAontu(fs: any, sdk: string, scaffold: Scaffold, warn: Warn): void;
|
|
9
10
|
export { migrateToAontu, rewriteIncludes, scaffoldFiles, };
|
|
@@ -15,16 +15,22 @@ const APIDEF_WRITES_RE = /^model\/guide\/[^/]*base-guide\.aontu$/;
|
|
|
15
15
|
// Comments and strings are matched whole, so an include is only ever an `@`
|
|
16
16
|
// outside both: a `.aon` named in a comment or held as data is not rewritten.
|
|
17
17
|
const TOKEN_RE = /#[^\n]*|@([ \t]*)(["'`])([^"'`\n]*)\2|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g;
|
|
18
|
-
// A
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
// A local file needs a `./`, `../` or `/` prefix. Without one, aontu reads the
|
|
19
|
+
// path as a package path first, and refuses a bare filename outright.
|
|
20
|
+
function isBare(path) {
|
|
21
|
+
return !/^(\.{1,2}\/|\/|@)/.test(path) && !path.includes(':');
|
|
22
|
+
}
|
|
22
23
|
function localPrefix(path) {
|
|
23
|
-
return path
|
|
24
|
+
return isBare(path) ? './' + path : path;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const NONE = () => false;
|
|
27
|
+
// A `.aon` include is renamed when `rename` holds, and a bare one is prefixed
|
|
28
|
+
// when `local` holds, so each says it names a local file.
|
|
29
|
+
function rewriteIncludes(src, rename, local = NONE) {
|
|
30
|
+
return src.replace(TOKEN_RE, (token, space, quote, path) => null == quote ? token :
|
|
31
|
+
path.endsWith(LEGACY) && rename(path) ?
|
|
32
|
+
'@' + space + quote + localPrefix(path.slice(0, -LEGACY.length) + CURRENT) + quote :
|
|
33
|
+
isBare(path) && local(path) ? '@' + space + quote + './' + path + quote : token);
|
|
28
34
|
}
|
|
29
35
|
function legacyIncludes(src) {
|
|
30
36
|
return [...src.matchAll(TOKEN_RE)]
|
|
@@ -60,6 +66,14 @@ function scaffoldFiles(fs, templateSdk, kept) {
|
|
|
60
66
|
.map((rel) => rel.replace('.fragment.', '.'));
|
|
61
67
|
return { kept: keep, replaced: new Set(written.filter((rel) => !keep.has(rel))) };
|
|
62
68
|
}
|
|
69
|
+
function isFile(fs, path) {
|
|
70
|
+
try {
|
|
71
|
+
return fs.statSync(path).isFile();
|
|
72
|
+
}
|
|
73
|
+
catch (_err) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
63
77
|
// A failed step must not fail the scaffold: the file keeps the name it had.
|
|
64
78
|
function attempt(step) {
|
|
65
79
|
try {
|
|
@@ -90,21 +104,22 @@ function migrateFile(fs, prev, next) {
|
|
|
90
104
|
fs.unlinkSync(prev);
|
|
91
105
|
});
|
|
92
106
|
}
|
|
93
|
-
|
|
107
|
+
// Whether `path`, read from the file `from`, names a file that is, or will be
|
|
108
|
+
// once the scaffold and apidef have run, under the .sdk folder.
|
|
109
|
+
function localFile(fs, sdk, scaffold, from) {
|
|
94
110
|
const dir = node_path_1.default.dirname(node_path_1.default.join(sdk, from));
|
|
95
111
|
return (path) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (path.startsWith('@')) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
const twin = node_path_1.default.resolve(dir, path.slice(0, -LEGACY.length) + CURRENT);
|
|
103
|
-
const rel = node_path_1.default.relative(sdk, twin).split(node_path_1.default.sep).join('/');
|
|
104
|
-
return fs.existsSync(twin) || scaffold.kept.has(rel) || scaffold.replaced.has(rel) ||
|
|
112
|
+
const full = node_path_1.default.resolve(dir, path);
|
|
113
|
+
const rel = node_path_1.default.relative(sdk, full).split(node_path_1.default.sep).join('/');
|
|
114
|
+
return isFile(fs, full) || scaffold.kept.has(rel) || scaffold.replaced.has(rel) ||
|
|
105
115
|
APIDEF_WRITES_RE.test(rel);
|
|
106
116
|
};
|
|
107
117
|
}
|
|
118
|
+
function includeRenamer(fs, sdk, scaffold, from) {
|
|
119
|
+
const local = localFile(fs, sdk, scaffold, from);
|
|
120
|
+
return (path) => TOOLCHAIN_RE.test(path) ||
|
|
121
|
+
(!path.startsWith('@') && local(path.slice(0, -LEGACY.length) + CURRENT));
|
|
122
|
+
}
|
|
108
123
|
// Renames first and rewrites after, so an include changes only once the file
|
|
109
124
|
// it names is on disk as .aontu.
|
|
110
125
|
function migrateToAontu(fs, sdk, scaffold, warn) {
|
|
@@ -118,7 +133,7 @@ function migrateToAontu(fs, sdk, scaffold, warn) {
|
|
|
118
133
|
for (const rel of sources) {
|
|
119
134
|
attempt(() => {
|
|
120
135
|
const src = String(fs.readFileSync(abs(rel)));
|
|
121
|
-
const out = rewriteIncludes(src, includeRenamer(fs, sdk, scaffold, rel));
|
|
136
|
+
const out = rewriteIncludes(src, includeRenamer(fs, sdk, scaffold, rel), localFile(fs, sdk, scaffold, rel));
|
|
122
137
|
if (out !== src) {
|
|
123
138
|
writeWhole(fs, abs(rel), out);
|
|
124
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/project/standard/migrate.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/project/standard/migrate.ts"],"names":[],"mappings":";;;;;QA4ME,cAAc;QACd,eAAe;QACf,aAAa;AA9Mf,0DAA4B;AAG5B,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAE/B,MAAM,MAAM,GAAG,MAAM,CAAA;AACrB,MAAM,OAAO,GAAG,QAAQ,CAAA;AAExB,MAAM,YAAY,GAAG,YAAY,CAAA;AACjC,MAAM,gBAAgB,GAAG,wCAAwC,CAAA;AAEjE,4EAA4E;AAC5E,8EAA8E;AAC9E,MAAM,QAAQ,GACZ,kGAAkG,CAAA;AAWpG,+EAA+E;AAC/E,sEAAsE;AACtE,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AAC/D,CAAC;AAGD,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO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J,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"7.0.2","root":["../src/create-sdkgen.ts","../src/project/standard/CreateRoot.ts","../src/project/standard/ModelSdk.ts","../src/project/standard/migrate.ts"],"packageJsons":["../node_modules/@types/node/package.json","../node_modules/@voxgig/util/package.json","../node_modules/jostraca/package.json","../node_modules/memfs/package.json","../node_modules/pino-pretty/package.json","../node_modules/pino-std-serializers/package.json","../node_modules/pino/package.json","../node_modules/shape/package.json","../node_modules/sonic-boom/package.json","../node_modules/thread-stream/package.json","../node_modules/undici-types/package.json","../package.json"],"missingPackageJsons":["../node_modules/@types/assert/package.json","../node_modules/@types/assert/strict/package.json","../node_modules/@types/async_hooks/package.json","../node_modules/@types/buffer/package.json","../node_modules/@types/child_process/package.json","../node_modules/@types/cluster/package.json","../node_modules/@types/console/package.json","../node_modules/@types/constants/package.json","../node_modules/@types/crypto/package.json","../node_modules/@types/dgram/package.json","../node_modules/@types/diagnostics_channel/package.json","../node_modules/@types/dns/package.json","../node_modules/@types/dns/promises/package.json","../node_modules/@types/domain/package.json","../node_modules/@types/events/package.json","../node_modules/@types/fs/package.json","../node_modules/@types/fs/promises/package.json","../node_modules/@types/http/package.json","../node_modules/@types/http2/package.json","../node_modules/@types/https/package.json","../node_modules/@types/inspector/package.json","../node_modules/@types/inspector/promises/package.json","../node_modules/@types/module/package.json","../node_modules/@types/net/package.json","../node_modules/@types/node/assert/package.json","../node_modules/@types/node/dns/package.json","../node_modules/@types/node/fs/package.json","../node_modules/@types/node/inspector/package.json","../node_modules/@types/node/path/package.json","../node_modules/@types/node/readline/package.json","../node_modules/@types/node/stream/package.json","../node_modules/@types/node/test/package.json","../node_modules/@types/node/timers/package.json","../node_modules/@types/node/util/package.json","../node_modules/@types/node/web-globals/package.json","../node_modules/@types/node/zlib/package.json","../node_modules/@types/os/package.json","../node_modules/@types/path/package.json","../node_modules/@types/path/posix/package.json","../node_modules/@types/path/win32/package.json","../node_modules/@types/perf_hooks/package.json","../node_modules/@types/process/package.json","../node_modules/@types/punycode/package.json","../node_modules/@types/querystring/package.json","../node_modules/@types/readline/package.json","../node_modules/@types/readline/promises/package.json","../node_modules/@types/repl/package.json","../node_modules/@types/stream/consumers/package.json","../node_modules/@types/stream/iter/package.json","../node_modules/@types/stream/package.json","../node_modules/@types/stream/promises/package.json","../node_modules/@types/stream/web/package.json","../node_modules/@types/string_decoder/package.json","../node_modules/@types/timers/package.json","../node_modules/@types/timers/promises/package.json","../node_modules/@types/tls/package.json","../node_modules/@types/trace_events/package.json","../node_modules/@types/tty/package.json","../node_modules/@types/url/package.json","../node_modules/@types/util/package.json","../node_modules/@types/util/types/package.json","../node_modules/@types/v8/package.json","../node_modules/@types/vm/package.json","../node_modules/@types/wasi/package.json","../node_modules/@types/worker_threads/package.json","../node_modules/@types/zlib/package.json","../node_modules/@voxgig/util/dist/package.json","../node_modules/assert/package.json","../node_modules/assert/strict/package.json","../node_modules/async_hooks/package.json","../node_modules/buffer/package.json","../node_modules/child_process/package.json","../node_modules/cluster/package.json","../node_modules/console/package.json","../node_modules/constants/package.json","../node_modules/crypto/package.json","../node_modules/dgram/package.json","../node_modules/diagnostics_channel/package.json","../node_modules/dns/package.json","../node_modules/dns/promises/package.json","../node_modules/domain/package.json","../node_modules/events/package.json","../node_modules/fs/package.json","../node_modules/fs/promises/package.json","../node_modules/http/package.json","../node_modules/http2/package.json","../node_modules/https/package.json","../node_modules/inspector/package.json","../node_modules/inspector/promises/package.json","../node_modules/jostraca/dist/build/package.json","../node_modules/jostraca/dist/cmp/package.json","../node_modules/jostraca/dist/package.json","../node_modules/jostraca/dist/util/package.json","../node_modules/module/package.json","../node_modules/net/package.json","../node_modules/os/package.json","../node_modules/path/package.json","../node_modules/path/posix/package.json","../node_modules/path/win32/package.json","../node_modules/perf_hooks/package.json","../node_modules/process/package.json","../node_modules/punycode/package.json","../node_modules/querystring/package.json","../node_modules/readline/package.json","../node_modules/readline/promises/package.json","../node_modules/repl/package.json","../node_modules/shape/dist/package.json","../node_modules/sonic-boom/types/package.json","../node_modules/stream/consumers/package.json","../node_modules/stream/iter/package.json","../node_modules/stream/package.json","../node_modules/stream/promises/package.json","../node_modules/stream/web/package.json","../node_modules/string_decoder/package.json","../node_modules/thread-stream/node_modules/events/package.json","../node_modules/thread-stream/node_modules/worker_threads/package.json","../node_modules/timers/package.json","../node_modules/timers/promises/package.json","../node_modules/tls/package.json","../node_modules/trace_events/package.json","../node_modules/tty/package.json","../node_modules/url/package.json","../node_modules/util/package.json","../node_modules/util/types/package.json","../node_modules/v8/package.json","../node_modules/vm/package.json","../node_modules/wasi/package.json","../node_modules/worker_threads/package.json","../node_modules/zlib/package.json"]}
|
|
1
|
+
{"version":"7.0.2","root":["../src/args.ts","../src/create-sdkgen.ts","../src/project/standard/CreateRoot.ts","../src/project/standard/ModelSdk.ts","../src/project/standard/migrate.ts"],"packageJsons":["../node_modules/@types/node/package.json","../node_modules/@voxgig/util/package.json","../node_modules/jostraca/package.json","../node_modules/memfs/package.json","../node_modules/pino-pretty/package.json","../node_modules/pino-std-serializers/package.json","../node_modules/pino/package.json","../node_modules/shape/package.json","../node_modules/sonic-boom/package.json","../node_modules/thread-stream/package.json","../node_modules/undici-types/package.json","../package.json"],"missingPackageJsons":["../node_modules/@types/assert/package.json","../node_modules/@types/assert/strict/package.json","../node_modules/@types/async_hooks/package.json","../node_modules/@types/buffer/package.json","../node_modules/@types/child_process/package.json","../node_modules/@types/cluster/package.json","../node_modules/@types/console/package.json","../node_modules/@types/constants/package.json","../node_modules/@types/crypto/package.json","../node_modules/@types/dgram/package.json","../node_modules/@types/diagnostics_channel/package.json","../node_modules/@types/dns/package.json","../node_modules/@types/dns/promises/package.json","../node_modules/@types/domain/package.json","../node_modules/@types/events/package.json","../node_modules/@types/fs/package.json","../node_modules/@types/fs/promises/package.json","../node_modules/@types/http/package.json","../node_modules/@types/http2/package.json","../node_modules/@types/https/package.json","../node_modules/@types/inspector/package.json","../node_modules/@types/inspector/promises/package.json","../node_modules/@types/module/package.json","../node_modules/@types/net/package.json","../node_modules/@types/node/assert/package.json","../node_modules/@types/node/dns/package.json","../node_modules/@types/node/fs/package.json","../node_modules/@types/node/inspector/package.json","../node_modules/@types/node/path/package.json","../node_modules/@types/node/readline/package.json","../node_modules/@types/node/stream/package.json","../node_modules/@types/node/test/package.json","../node_modules/@types/node/timers/package.json","../node_modules/@types/node/util/package.json","../node_modules/@types/node/web-globals/package.json","../node_modules/@types/node/zlib/package.json","../node_modules/@types/os/package.json","../node_modules/@types/path/package.json","../node_modules/@types/path/posix/package.json","../node_modules/@types/path/win32/package.json","../node_modules/@types/perf_hooks/package.json","../node_modules/@types/process/package.json","../node_modules/@types/punycode/package.json","../node_modules/@types/querystring/package.json","../node_modules/@types/readline/package.json","../node_modules/@types/readline/promises/package.json","../node_modules/@types/repl/package.json","../node_modules/@types/stream/consumers/package.json","../node_modules/@types/stream/iter/package.json","../node_modules/@types/stream/package.json","../node_modules/@types/stream/promises/package.json","../node_modules/@types/stream/web/package.json","../node_modules/@types/string_decoder/package.json","../node_modules/@types/timers/package.json","../node_modules/@types/timers/promises/package.json","../node_modules/@types/tls/package.json","../node_modules/@types/trace_events/package.json","../node_modules/@types/tty/package.json","../node_modules/@types/url/package.json","../node_modules/@types/util/package.json","../node_modules/@types/util/types/package.json","../node_modules/@types/v8/package.json","../node_modules/@types/vm/package.json","../node_modules/@types/wasi/package.json","../node_modules/@types/worker_threads/package.json","../node_modules/@types/zlib/package.json","../node_modules/@voxgig/util/dist/package.json","../node_modules/assert/package.json","../node_modules/assert/strict/package.json","../node_modules/async_hooks/package.json","../node_modules/buffer/package.json","../node_modules/child_process/package.json","../node_modules/cluster/package.json","../node_modules/console/package.json","../node_modules/constants/package.json","../node_modules/crypto/package.json","../node_modules/dgram/package.json","../node_modules/diagnostics_channel/package.json","../node_modules/dns/package.json","../node_modules/dns/promises/package.json","../node_modules/domain/package.json","../node_modules/events/package.json","../node_modules/fs/package.json","../node_modules/fs/promises/package.json","../node_modules/http/package.json","../node_modules/http2/package.json","../node_modules/https/package.json","../node_modules/inspector/package.json","../node_modules/inspector/promises/package.json","../node_modules/jostraca/dist/build/package.json","../node_modules/jostraca/dist/cmp/package.json","../node_modules/jostraca/dist/package.json","../node_modules/jostraca/dist/util/package.json","../node_modules/module/package.json","../node_modules/net/package.json","../node_modules/os/package.json","../node_modules/path/package.json","../node_modules/path/posix/package.json","../node_modules/path/win32/package.json","../node_modules/perf_hooks/package.json","../node_modules/process/package.json","../node_modules/punycode/package.json","../node_modules/querystring/package.json","../node_modules/readline/package.json","../node_modules/readline/promises/package.json","../node_modules/repl/package.json","../node_modules/shape/dist/package.json","../node_modules/sonic-boom/types/package.json","../node_modules/stream/consumers/package.json","../node_modules/stream/iter/package.json","../node_modules/stream/package.json","../node_modules/stream/promises/package.json","../node_modules/stream/web/package.json","../node_modules/string_decoder/package.json","../node_modules/thread-stream/node_modules/events/package.json","../node_modules/thread-stream/node_modules/worker_threads/package.json","../node_modules/timers/package.json","../node_modules/timers/promises/package.json","../node_modules/tls/package.json","../node_modules/trace_events/package.json","../node_modules/tty/package.json","../node_modules/url/package.json","../node_modules/util/package.json","../node_modules/util/types/package.json","../node_modules/v8/package.json","../node_modules/vm/package.json","../node_modules/wasi/package.json","../node_modules/worker_threads/package.json","../node_modules/zlib/package.json"]}
|
package/package.json
CHANGED
|
@@ -12,11 +12,10 @@ name: ci
|
|
|
12
12
|
# ---------------------------------------------------------------------------
|
|
13
13
|
# COVERAGE TIERS
|
|
14
14
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# by hand.
|
|
15
|
+
# This workflow used to have jobs for eight targets (go, go-cli, go-mcp, ts,
|
|
16
|
+
# py, rb, php, lua). The other targets sdkgen and its language packages
|
|
17
|
+
# generate went into SDK repos and were never compiled or tested there, so a
|
|
18
|
+
# template regression in, say, rust or swift could only be found by hand.
|
|
20
19
|
#
|
|
21
20
|
# BLOCKING — proven jobs. A failure here fails the build.
|
|
22
21
|
# go, go-cli, go-mcp, ts, py, rb, php, lua
|
|
@@ -26,8 +25,8 @@ name: ci
|
|
|
26
25
|
# blocking a release; promote a job to blocking (drop continue-on-error) once
|
|
27
26
|
# it has passed. Do not leave one advisory indefinitely — an advisory job that
|
|
28
27
|
# is always red is the same blind spot in a different costume.
|
|
29
|
-
# js, csharp, java, kotlin, scala, swift, dart, rust, c, cpp, zig,
|
|
30
|
-
# clojure, elixir, ocaml, haskell
|
|
28
|
+
# js, py-data, csharp, java, kotlin, scala, swift, dart, rust, c, cpp, zig,
|
|
29
|
+
# perl, clojure, elixir, ocaml, haskell, lean
|
|
31
30
|
#
|
|
32
31
|
# Every target exposes `make -C <lang> test`, so the jobs differ only in
|
|
33
32
|
# toolchain setup.
|
|
@@ -179,6 +178,22 @@ jobs:
|
|
|
179
178
|
- if: hashFiles('js/Makefile') != ''
|
|
180
179
|
run: make -C js test
|
|
181
180
|
|
|
181
|
+
py-data:
|
|
182
|
+
runs-on: ubuntu-latest
|
|
183
|
+
continue-on-error: true
|
|
184
|
+
steps:
|
|
185
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
186
|
+
- if: hashFiles('py-data/Makefile') != ''
|
|
187
|
+
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7
|
|
188
|
+
with:
|
|
189
|
+
python-version: '3.13'
|
|
190
|
+
# The suite reaches the py SDK through py-data/test/conftest.py, which
|
|
191
|
+
# puts ../py on sys.path; the SDK imports requests only for a live call.
|
|
192
|
+
- if: hashFiles('py-data/Makefile') != ''
|
|
193
|
+
run: pip install pytest pandas
|
|
194
|
+
- if: hashFiles('py-data/Makefile') != ''
|
|
195
|
+
run: make -C py-data test
|
|
196
|
+
|
|
182
197
|
csharp:
|
|
183
198
|
runs-on: ubuntu-latest
|
|
184
199
|
continue-on-error: true
|
|
@@ -407,3 +422,25 @@ jobs:
|
|
|
407
422
|
ghc-version: '9.6'
|
|
408
423
|
- if: hashFiles('haskell/Makefile') != ''
|
|
409
424
|
run: make -C haskell test
|
|
425
|
+
|
|
426
|
+
lean:
|
|
427
|
+
runs-on: ubuntu-latest
|
|
428
|
+
continue-on-error: true
|
|
429
|
+
steps:
|
|
430
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
431
|
+
# elan from its release tarball. lake then installs the toolchain the
|
|
432
|
+
# generated lean/lean-toolchain names. The secrets feature's C stubs
|
|
433
|
+
# need the curl and ssl headers, as in the c job.
|
|
434
|
+
- if: hashFiles('lean/Makefile') != ''
|
|
435
|
+
run: |
|
|
436
|
+
set -euo pipefail
|
|
437
|
+
version=v4.2.4
|
|
438
|
+
curl -fsSL --retry 5 --retry-all-errors -o /tmp/elan.tar.gz \
|
|
439
|
+
"https://github.com/leanprover/elan/releases/download/${version}/elan-x86_64-unknown-linux-gnu.tar.gz"
|
|
440
|
+
tar -xzf /tmp/elan.tar.gz -C /tmp
|
|
441
|
+
/tmp/elan-init -y --default-toolchain none
|
|
442
|
+
echo "$HOME/.elan/bin" >> "$GITHUB_PATH"
|
|
443
|
+
- if: hashFiles('lean/Makefile') != ''
|
|
444
|
+
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libssl-dev
|
|
445
|
+
- if: hashFiles('lean/Makefile') != ''
|
|
446
|
+
run: make -C lean test
|
|
@@ -8,6 +8,10 @@ Run these scripts from any working directory:
|
|
|
8
8
|
.sdk/admin/status.sh --github
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
`npm run status` from `.sdk` runs the same report through node alone, so it
|
|
12
|
+
works in any shell, `cmd.exe` included; pass the options after `--`, as in
|
|
13
|
+
`npm run status -- --json`.
|
|
14
|
+
|
|
11
15
|
`status.sh` reads the compiled SDK model, repository state, target directories,
|
|
12
16
|
publication settings, tool versions, and documentation outputs. It does not run
|
|
13
17
|
builds or tests, contact package registries, fetch Git refs, or change files.
|
|
@@ -50,6 +54,12 @@ changing the model or the toolchain. It is deliberately not in CI: it
|
|
|
50
54
|
regenerates every target, which is minutes of work and needs the `.sdk`
|
|
51
55
|
dependencies installed.
|
|
52
56
|
|
|
57
|
+
`check-drift.sh` and `status.sh` are bash scripts. On Windows, run them from
|
|
58
|
+
Git Bash, inside the checkout: `npm run check-drift` hands the script to the
|
|
59
|
+
first `bash` on the PATH, and from `cmd.exe` or PowerShell that can be WSL's,
|
|
60
|
+
which runs it in Linux rather than in the checkout. `.sdk/.gitattributes`
|
|
61
|
+
keeps every `.sh` file at LF line endings, which bash needs.
|
|
62
|
+
|
|
53
63
|
When a GitHub Pages edition and its CI workflow are enabled, docgen generates
|
|
54
64
|
`setup-github-pages.sh` here. Preview its changes, then configure Pages:
|
|
55
65
|
|
|
@@ -10,7 +10,8 @@ def: 'DEF'
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
# API Information
|
|
13
|
-
@"api/api-info.aontu"
|
|
13
|
+
@"./api/api-info.aontu"
|
|
14
|
+
@"./text.aontu"
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
# SDK Configuration.
|
|
@@ -18,22 +19,22 @@ def: 'DEF'
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
# SDK Entities
|
|
21
|
-
@"entity/entity-index.aontu"
|
|
22
|
+
@"./entity/entity-index.aontu"
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
# SDK Features.
|
|
25
|
-
@"feature/feature-index.aontu"
|
|
26
|
+
@"./feature/feature-index.aontu"
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
# SDK Targets.
|
|
29
|
-
@"target/target-index.aontu"
|
|
30
|
+
@"./target/target-index.aontu"
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
# Operation workflows.
|
|
33
|
-
@"flow/flow-index.aontu"
|
|
34
|
+
@"./flow/flow-index.aontu"
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
@"./project.aontu"
|
|
37
38
|
|
|
38
39
|
# Documentation editions. Settings belong in project.aontu.
|
|
39
|
-
@"edition/edition-index.aontu"
|
|
40
|
+
@"./edition/edition-index.aontu"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"watch": "tsc --build src -w",
|
|
13
13
|
"build": "tsc --build src",
|
|
14
14
|
"test": "echo no-test",
|
|
15
|
-
"clean": "
|
|
15
|
+
"clean": "node -e \"for (const p of process.argv.slice(1)) require('fs').rmSync(p, { recursive: true, force: true })\" dist dist-test node_modules yarn.lock package-lock.json",
|
|
16
16
|
"reset": "npm run clean && npm i && npm run build && npm test",
|
|
17
17
|
"add-target": "voxgig-sdkgen target add",
|
|
18
18
|
"dry-add-target": "voxgig-sdkgen -y target add",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"add-edition": "voxgig-sdkgen edition add",
|
|
22
22
|
"text-qa": "cd .. && voxgig-docgen qa",
|
|
23
23
|
"postinstall": "node build/docgen.js",
|
|
24
|
-
"status": "
|
|
24
|
+
"status": "node -e \"require('fs').existsSync('node_modules/@voxgig/sdkgen/dist/admin/status.js') || (console.error('Install or update the .sdk dependencies to use the status report.'), process.exit(1))\" && node node_modules/@voxgig/sdkgen/dist/admin/status.js ..",
|
|
25
25
|
"check-drift": "bash admin/check-drift.sh"
|
|
26
26
|
},
|
|
27
27
|
"author": "$$const.Name$$",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": ">=25.6",
|
|
31
31
|
"typescript": ">=6.0",
|
|
32
|
-
"@voxgig/apidef": "~8.25.
|
|
32
|
+
"@voxgig/apidef": "~8.25.3",
|
|
33
33
|
"@voxgig/model": "~12.0.1",
|
|
34
|
-
"@voxgig/sdkgen": "~4.
|
|
34
|
+
"@voxgig/sdkgen": "~4.35.0",
|
|
35
35
|
"@voxgig/util": ">=0.5",
|
|
36
36
|
"@voxgig/struct": ">=0.2",
|
|
37
37
|
"jostraca": ">=0.39.0",
|
|
38
38
|
"aontu": ">=0.75.0",
|
|
39
|
-
"@voxgig/docgen": "~0.30.
|
|
39
|
+
"@voxgig/docgen": "~0.30.2"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
@"struct/test.aontu"
|
|
3
|
-
@"primary/primary-test-index.aontu"
|
|
4
|
-
@"feature/feature-test-index.aontu"
|
|
2
|
+
@"./struct/test.aontu"
|
|
3
|
+
@"./primary/primary-test-index.aontu"
|
|
4
|
+
@"./feature/feature-test-index.aontu"
|
package/src/args.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* Copyright (c) 2026 Richard Rodger, MIT License */
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// The targets sdkgen and its language packages add.
|
|
5
|
+
const TARGETS = [
|
|
6
|
+
'ts', 'js', 'py', 'py-data', 'go', 'go-cli', 'go-mcp', 'rb', 'php', 'lua',
|
|
7
|
+
'csharp', 'java', 'kotlin', 'scala', 'swift', 'dart', 'rust', 'c', 'cpp',
|
|
8
|
+
'zig', 'perl', 'clojure', 'elixir', 'ocaml', 'haskell', 'lean',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
// `npm create` reads these as its own configuration, and records them in the
|
|
12
|
+
// environment, when no `--` precedes them.
|
|
13
|
+
const NPM_KEPT_FLAGS: Record<string, string> = {
|
|
14
|
+
dryrun: '--dryrun',
|
|
15
|
+
install: '--no-install',
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
type Env = Record<string, string | undefined>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// `npm create <name> -d spec.yaml -t ts` hands the initializer
|
|
23
|
+
// `<name> spec.yaml ts`: npm keeps each flag and passes its value on.
|
|
24
|
+
function forwardingError(name: string, positionalTargets: string[], env: Env):
|
|
25
|
+
string | undefined {
|
|
26
|
+
const notTargets = positionalTargets
|
|
27
|
+
.flatMap((arg: string) => arg.split(','))
|
|
28
|
+
.filter((arg: string) => '' !== arg && !TARGETS.includes(arg))
|
|
29
|
+
|
|
30
|
+
const kept = Object.keys(NPM_KEPT_FLAGS)
|
|
31
|
+
.filter((key: string) => undefined !== env['npm_config_' + key])
|
|
32
|
+
.map((key: string) => NPM_KEPT_FLAGS[key])
|
|
33
|
+
|
|
34
|
+
if (0 === notTargets.length && 0 === kept.length) {
|
|
35
|
+
return undefined
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return [
|
|
39
|
+
0 < notTargets.length ? 'Not a target: ' + notTargets.join(', ') + '.' : '',
|
|
40
|
+
0 < kept.length ? 'npm kept ' + kept.join(' and ') + ' for itself.' : '',
|
|
41
|
+
'npm create passes options on only after a --, as in:',
|
|
42
|
+
' npm create @voxgig/sdkgen@latest ' + (name || '<name>') +
|
|
43
|
+
' -- -d ./openapi.yaml -t ts',
|
|
44
|
+
'Targets: ' + TARGETS.join(', ') + '. Add any other with -t.',
|
|
45
|
+
].filter(Boolean).join('\n')
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
TARGETS,
|
|
51
|
+
forwardingError,
|
|
52
|
+
}
|
package/src/create-sdkgen.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { showChanges, prettyPino, Pino } from '@voxgig/util'
|
|
|
11
11
|
|
|
12
12
|
import Pkg from '../package.json'
|
|
13
13
|
|
|
14
|
+
import { TARGETS, forwardingError } from './args'
|
|
15
|
+
|
|
14
16
|
|
|
15
17
|
type FullCreateSdkGenOptions = {
|
|
16
18
|
fs?: any
|
|
@@ -225,10 +227,80 @@ function CreateSdkGen(opts: FullCreateSdkGenOptions) {
|
|
|
225
227
|
|
|
226
228
|
|
|
227
229
|
|
|
230
|
+
type Host = {
|
|
231
|
+
platform: string
|
|
232
|
+
env: Record<string, string | undefined>
|
|
233
|
+
execPath: string
|
|
234
|
+
exists: (path: string) => boolean
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
type NpmLaunch = {
|
|
238
|
+
command: string
|
|
239
|
+
args: string[]
|
|
240
|
+
shell?: boolean
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
const HOST: Host = {
|
|
245
|
+
platform: process.platform,
|
|
246
|
+
env: process.env,
|
|
247
|
+
execPath: process.execPath,
|
|
248
|
+
exists: (path: string) => Fs.existsSync(path),
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const NPM_CLI_RE = /[\\/]npm-cli\.js$/
|
|
252
|
+
|
|
253
|
+
const CMD_UNSAFE_RE = /["%\r\n]/
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
// On Windows npm is npm.cmd, which spawn cannot find without a shell and
|
|
257
|
+
// refuses to run without one, so npm's own script runs on this node instead.
|
|
258
|
+
function npmLaunch(args: string[], host: Host = HOST): NpmLaunch {
|
|
259
|
+
if ('win32' !== host.platform) {
|
|
260
|
+
return { command: 'npm', args }
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const bundled = Path.win32.join(
|
|
264
|
+
Path.win32.dirname(host.execPath), 'node_modules', 'npm', 'bin', 'npm-cli.js')
|
|
265
|
+
const cli = [host.env.npm_execpath, bundled]
|
|
266
|
+
.find((file) => null != file && NPM_CLI_RE.test(file) && host.exists(file))
|
|
267
|
+
|
|
268
|
+
if (null != cli) {
|
|
269
|
+
return { command: host.execPath, args: [cli, ...args] }
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// A command string, so cmd.exe sees each argument quoted, and only quoted.
|
|
273
|
+
const unsafe = args.find((arg: string) => CMD_UNSAFE_RE.test(arg))
|
|
274
|
+
if (null != unsafe) {
|
|
275
|
+
throw new Error(`Cannot pass ${JSON.stringify(unsafe)} to npm.cmd through cmd.exe.`)
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
command: ['npm.cmd', ...args.map((arg: string) => '"' + arg + '"')].join(' '),
|
|
279
|
+
args: [],
|
|
280
|
+
shell: true,
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
// The child resolves `node` to this one. Windows spells the key `Path`, and a
|
|
286
|
+
// second spelling beside it would leave the choice to key order.
|
|
287
|
+
function npmEnv(host: Host = HOST): Record<string, string | undefined> {
|
|
288
|
+
const win = 'win32' === host.platform
|
|
289
|
+
const P = win ? Path.win32 : Path.posix
|
|
290
|
+
const key = (win ?
|
|
291
|
+
Object.keys(host.env).find((name: string) => 'PATH' === name.toUpperCase()) :
|
|
292
|
+
undefined) ?? 'PATH'
|
|
293
|
+
const dirs = [P.dirname(host.execPath), host.env[key]].filter(Boolean)
|
|
294
|
+
return { ...host.env, [key]: dirs.join(P.delimiter) }
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
|
|
228
298
|
// Run `npm <args>` to completion, rejecting on spawn error or non-zero exit.
|
|
229
299
|
function runNpm(args: string[], spawn_opts: any): Promise<null> {
|
|
230
300
|
return new Promise((resolve, reject) => {
|
|
231
|
-
const
|
|
301
|
+
const launch = npmLaunch(args)
|
|
302
|
+
const child = spawn(launch.command, launch.args,
|
|
303
|
+
launch.shell ? { ...spawn_opts, shell: true } : spawn_opts)
|
|
232
304
|
|
|
233
305
|
child.on('error', (err) => reject(new Error(`Failed to start npm: ${err.message}`)))
|
|
234
306
|
|
|
@@ -250,10 +322,7 @@ async function installNpm(spec: GenerateSpec, opts: any, model: any) {
|
|
|
250
322
|
|
|
251
323
|
const cwd = Path.resolve(folder, SDK_FOLDER)
|
|
252
324
|
|
|
253
|
-
const env =
|
|
254
|
-
...process.env,
|
|
255
|
-
PATH: `${Path.dirname(process.execPath)}${Path.delimiter}${process.env.PATH}`,
|
|
256
|
-
}
|
|
325
|
+
const env = npmEnv()
|
|
257
326
|
|
|
258
327
|
const spawn_opts: any = {
|
|
259
328
|
cwd,
|
|
@@ -325,10 +394,16 @@ async function installFeatures(spec: GenerateSpec, opts: any, model: any, spawn_
|
|
|
325
394
|
|
|
326
395
|
export type {
|
|
327
396
|
CreateSdkGenOptions,
|
|
397
|
+
Host,
|
|
398
|
+
NpmLaunch,
|
|
328
399
|
}
|
|
329
400
|
|
|
330
401
|
|
|
331
402
|
|
|
332
403
|
export {
|
|
333
404
|
CreateSdkGen,
|
|
405
|
+
TARGETS,
|
|
406
|
+
forwardingError,
|
|
407
|
+
npmEnv,
|
|
408
|
+
npmLaunch,
|
|
334
409
|
}
|
|
@@ -91,6 +91,26 @@ const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this fil
|
|
|
91
91
|
`
|
|
92
92
|
|
|
93
93
|
|
|
94
|
+
const TEXT_FILE = 'text.aontu'
|
|
95
|
+
const TEXT_STUB = `# README wording — YOURS. The scaffold creates this file once and never
|
|
96
|
+
# overwrites it.
|
|
97
|
+
#
|
|
98
|
+
# A slot set here words the generated README files over the same slot of
|
|
99
|
+
# main.kit.info, where apidef puts the spec's metadata. A slot left out keeps
|
|
100
|
+
# the spec's wording. Text edited into a generated README is lost on the next
|
|
101
|
+
# generate; text here is not.
|
|
102
|
+
#
|
|
103
|
+
# main: kit: text: {
|
|
104
|
+
# tagline: 'Payments, invoices and refunds from TypeScript, Go and Python.'
|
|
105
|
+
# summary: 'Acme Pay is a payments API for marketplaces.'
|
|
106
|
+
# entity_desc: { invoice: 'A bill sent to a customer.' }
|
|
107
|
+
# }
|
|
108
|
+
#
|
|
109
|
+
# The slots are title, summary, website, tagline, about_md, homepage,
|
|
110
|
+
# docs_url, meta_source and entity_desc. Any other key fails the model build.
|
|
111
|
+
`
|
|
112
|
+
|
|
113
|
+
|
|
94
114
|
const GUIDE_FILE = 'guide.aontu'
|
|
95
115
|
const GUIDE_REL = ['model', 'guide', GUIDE_FILE]
|
|
96
116
|
|
|
@@ -100,6 +120,7 @@ const indexFile = (kind: string) => kind + '-index.aontu'
|
|
|
100
120
|
// Written back from the project rather than from the template.
|
|
101
121
|
const KEPT = [
|
|
102
122
|
['model', PROJECT_FILE],
|
|
123
|
+
['model', TEXT_FILE],
|
|
103
124
|
GUIDE_REL,
|
|
104
125
|
...INDEX_KINDS.map((kind: string) => ['model', kind, indexFile(kind)]),
|
|
105
126
|
].map((rel: string[]) => rel.join('/'))
|
|
@@ -199,8 +220,10 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
|
|
|
199
220
|
|
|
200
221
|
Folder({ name: 'admin' }, () => {
|
|
201
222
|
const admin = Path.join(from, spec.sdk_folder, 'admin')
|
|
223
|
+
// bash fails on a CRLF line ending, which a Windows checkout gives.
|
|
202
224
|
for (const name of fs.readdirSync(admin).filter((name: string) => name.endsWith('.sh')).sort()) {
|
|
203
|
-
File({ name, mode: 0o755 }, () =>
|
|
225
|
+
File({ name, mode: 0o755 }, () =>
|
|
226
|
+
Content(fs.readFileSync(Path.join(admin, name), 'utf8').replace(/\r\n/g, '\n')))
|
|
204
227
|
}
|
|
205
228
|
})
|
|
206
229
|
|
|
@@ -235,6 +258,14 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
|
|
|
235
258
|
Content(null == existingProject ? PROJECT_STUB : existingProject)
|
|
236
259
|
})
|
|
237
260
|
|
|
261
|
+
const textPath = Path.join(folder, spec.sdk_folder, 'model', TEXT_FILE)
|
|
262
|
+
const existingText =
|
|
263
|
+
fs.existsSync(textPath) ? fs.readFileSync(textPath, 'utf8') : null
|
|
264
|
+
|
|
265
|
+
File({ name: TEXT_FILE }, () => {
|
|
266
|
+
Content(null == existingText ? TEXT_STUB : existingText)
|
|
267
|
+
})
|
|
268
|
+
|
|
238
269
|
// `target add`, `feature add` and docgen register their items here, and
|
|
239
270
|
// docgen bootstraps only once, so a reset index would lose them for good.
|
|
240
271
|
for (const kind of INDEX_KINDS) {
|
|
@@ -23,19 +23,31 @@ type Scaffold = {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
// A
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// A local file needs a `./`, `../` or `/` prefix. Without one, aontu reads the
|
|
27
|
+
// path as a package path first, and refuses a bare filename outright.
|
|
28
|
+
function isBare(path: string): boolean {
|
|
29
|
+
return !/^(\.{1,2}\/|\/|@)/.test(path) && !path.includes(':')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
30
33
|
function localPrefix(path: string): string {
|
|
31
|
-
return path
|
|
34
|
+
return isBare(path) ? './' + path : path
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
type Include = (path: string) => boolean
|
|
39
|
+
|
|
40
|
+
const NONE: Include = () => false
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// A `.aon` include is renamed when `rename` holds, and a bare one is prefixed
|
|
44
|
+
// when `local` holds, so each says it names a local file.
|
|
45
|
+
function rewriteIncludes(src: string, rename: Include, local: Include = NONE): string {
|
|
36
46
|
return src.replace(TOKEN_RE, (token: string, space: string, quote: string, path: string) =>
|
|
37
|
-
null
|
|
38
|
-
|
|
47
|
+
null == quote ? token :
|
|
48
|
+
path.endsWith(LEGACY) && rename(path) ?
|
|
49
|
+
'@' + space + quote + localPrefix(path.slice(0, -LEGACY.length) + CURRENT) + quote :
|
|
50
|
+
isBare(path) && local(path) ? '@' + space + quote + './' + path + quote : token)
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
|
|
@@ -79,6 +91,16 @@ function scaffoldFiles(fs: any, templateSdk: string, kept: string[]): Scaffold {
|
|
|
79
91
|
}
|
|
80
92
|
|
|
81
93
|
|
|
94
|
+
function isFile(fs: any, path: string): boolean {
|
|
95
|
+
try {
|
|
96
|
+
return fs.statSync(path).isFile()
|
|
97
|
+
}
|
|
98
|
+
catch (_err: any) {
|
|
99
|
+
return false
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
82
104
|
// A failed step must not fail the scaffold: the file keeps the name it had.
|
|
83
105
|
function attempt(step: () => void): void {
|
|
84
106
|
try {
|
|
@@ -115,23 +137,27 @@ function migrateFile(fs: any, prev: string, next: string): void {
|
|
|
115
137
|
}
|
|
116
138
|
|
|
117
139
|
|
|
118
|
-
|
|
140
|
+
// Whether `path`, read from the file `from`, names a file that is, or will be
|
|
141
|
+
// once the scaffold and apidef have run, under the .sdk folder.
|
|
142
|
+
function localFile(fs: any, sdk: string, scaffold: Scaffold, from: string): Include {
|
|
119
143
|
const dir = Path.dirname(Path.join(sdk, from))
|
|
120
144
|
return (path: string): boolean => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (path.startsWith('@')) {
|
|
125
|
-
return false
|
|
126
|
-
}
|
|
127
|
-
const twin = Path.resolve(dir, path.slice(0, -LEGACY.length) + CURRENT)
|
|
128
|
-
const rel = Path.relative(sdk, twin).split(Path.sep).join('/')
|
|
129
|
-
return fs.existsSync(twin) || scaffold.kept.has(rel) || scaffold.replaced.has(rel) ||
|
|
145
|
+
const full = Path.resolve(dir, path)
|
|
146
|
+
const rel = Path.relative(sdk, full).split(Path.sep).join('/')
|
|
147
|
+
return isFile(fs, full) || scaffold.kept.has(rel) || scaffold.replaced.has(rel) ||
|
|
130
148
|
APIDEF_WRITES_RE.test(rel)
|
|
131
149
|
}
|
|
132
150
|
}
|
|
133
151
|
|
|
134
152
|
|
|
153
|
+
function includeRenamer(fs: any, sdk: string, scaffold: Scaffold, from: string): Include {
|
|
154
|
+
const local = localFile(fs, sdk, scaffold, from)
|
|
155
|
+
return (path: string): boolean =>
|
|
156
|
+
TOOLCHAIN_RE.test(path) ||
|
|
157
|
+
(!path.startsWith('@') && local(path.slice(0, -LEGACY.length) + CURRENT))
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
135
161
|
// Renames first and rewrites after, so an include changes only once the file
|
|
136
162
|
// it names is on disk as .aontu.
|
|
137
163
|
function migrateToAontu(fs: any, sdk: string, scaffold: Scaffold, warn: Warn): void {
|
|
@@ -147,7 +173,8 @@ function migrateToAontu(fs: any, sdk: string, scaffold: Scaffold, warn: Warn): v
|
|
|
147
173
|
for (const rel of sources) {
|
|
148
174
|
attempt(() => {
|
|
149
175
|
const src = String(fs.readFileSync(abs(rel)))
|
|
150
|
-
const out = rewriteIncludes(src, includeRenamer(fs, sdk, scaffold, rel)
|
|
176
|
+
const out = rewriteIncludes(src, includeRenamer(fs, sdk, scaffold, rel),
|
|
177
|
+
localFile(fs, sdk, scaffold, rel))
|
|
151
178
|
if (out !== src) {
|
|
152
179
|
writeWhole(fs, abs(rel), out)
|
|
153
180
|
}
|