@voxgig/create-sdkgen 0.27.0 → 0.28.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.
Files changed (69) hide show
  1. package/README.md +23 -0
  2. package/dist/project/standard/CreateRoot.js +40 -43
  3. package/dist/project/standard/CreateRoot.js.map +1 -1
  4. package/dist/project/standard/ModelSdk.js +2 -2
  5. package/dist/project/standard/ModelSdk.js.map +1 -1
  6. package/dist/project/standard/migrate.d.ts +9 -0
  7. package/dist/project/standard/migrate.js +137 -0
  8. package/dist/project/standard/migrate.js.map +1 -0
  9. package/dist/tsconfig.tsbuildinfo +1 -1
  10. package/package.json +4 -4
  11. package/project/standard/.sdk/model/.model-config/{model-config.aon → model-config.aontu} +1 -1
  12. package/project/standard/.sdk/model/{sdk.fragment.aon → sdk.fragment.aontu} +7 -7
  13. package/project/standard/.sdk/package.json +12 -12
  14. package/project/standard/.sdk/test/.model-config/model-config.aontu +4 -0
  15. package/project/standard/.sdk/test/feature/{feature-test-index.aon → feature-test-index.aontu} +1 -1
  16. package/project/standard/.sdk/test/primary/primary-test-index.aontu +30 -0
  17. package/project/standard/.sdk/test/struct/test.aontu +26 -0
  18. package/project/standard/.sdk/test/test.aontu +4 -0
  19. package/src/project/standard/CreateRoot.ts +45 -54
  20. package/src/project/standard/ModelSdk.ts +2 -2
  21. package/src/project/standard/migrate.ts +172 -0
  22. package/project/standard/.sdk/test/.model-config/model-config.aon +0 -4
  23. package/project/standard/.sdk/test/primary/primary-test-index.aon +0 -30
  24. package/project/standard/.sdk/test/struct/test.aon +0 -26
  25. package/project/standard/.sdk/test/test.aon +0 -4
  26. /package/project/standard/.sdk/model/{config.aon → config.aontu} +0 -0
  27. /package/project/standard/.sdk/model/edition/{edition-index.aon → edition-index.aontu} +0 -0
  28. /package/project/standard/.sdk/model/feature/{feature-index.aon → feature-index.aontu} +0 -0
  29. /package/project/standard/.sdk/model/target/{target-index.aon → target-index.aontu} +0 -0
  30. /package/project/standard/.sdk/test/feature/{cost.aon → cost.aontu} +0 -0
  31. /package/project/standard/.sdk/test/primary/{clean.aon → clean.aontu} +0 -0
  32. /package/project/standard/.sdk/test/primary/{done.aon → done.aontu} +0 -0
  33. /package/project/standard/.sdk/test/primary/{featureAdd.aon → featureAdd.aontu} +0 -0
  34. /package/project/standard/.sdk/test/primary/{featureHook.aon → featureHook.aontu} +0 -0
  35. /package/project/standard/.sdk/test/primary/{featureInit.aon → featureInit.aontu} +0 -0
  36. /package/project/standard/.sdk/test/primary/{fetcher.aon → fetcher.aontu} +0 -0
  37. /package/project/standard/.sdk/test/primary/{makeContext.aon → makeContext.aontu} +0 -0
  38. /package/project/standard/.sdk/test/primary/{makeError.aon → makeError.aontu} +0 -0
  39. /package/project/standard/.sdk/test/primary/{makeFetchDef.aon → makeFetchDef.aontu} +0 -0
  40. /package/project/standard/.sdk/test/primary/{makeOptions.aon → makeOptions.aontu} +0 -0
  41. /package/project/standard/.sdk/test/primary/{makePoint.aon → makePoint.aontu} +0 -0
  42. /package/project/standard/.sdk/test/primary/{makeRequest.aon → makeRequest.aontu} +0 -0
  43. /package/project/standard/.sdk/test/primary/{makeResponse.aon → makeResponse.aontu} +0 -0
  44. /package/project/standard/.sdk/test/primary/{makeResult.aon → makeResult.aontu} +0 -0
  45. /package/project/standard/.sdk/test/primary/{makeSpec.aon → makeSpec.aontu} +0 -0
  46. /package/project/standard/.sdk/test/primary/{makeUrl.aon → makeUrl.aontu} +0 -0
  47. /package/project/standard/.sdk/test/primary/{operator.aon → operator.aontu} +0 -0
  48. /package/project/standard/.sdk/test/primary/{param.aon → param.aontu} +0 -0
  49. /package/project/standard/.sdk/test/primary/{prepareAuth.aon → prepareAuth.aontu} +0 -0
  50. /package/project/standard/.sdk/test/primary/{prepareBody.aon → prepareBody.aontu} +0 -0
  51. /package/project/standard/.sdk/test/primary/{prepareHeaders.aon → prepareHeaders.aontu} +0 -0
  52. /package/project/standard/.sdk/test/primary/{prepareMethod.aon → prepareMethod.aontu} +0 -0
  53. /package/project/standard/.sdk/test/primary/{prepareParams.aon → prepareParams.aontu} +0 -0
  54. /package/project/standard/.sdk/test/primary/{preparePath.aon → preparePath.aontu} +0 -0
  55. /package/project/standard/.sdk/test/primary/{prepareQuery.aon → prepareQuery.aontu} +0 -0
  56. /package/project/standard/.sdk/test/primary/{resultBasic.aon → resultBasic.aontu} +0 -0
  57. /package/project/standard/.sdk/test/primary/{resultBody.aon → resultBody.aontu} +0 -0
  58. /package/project/standard/.sdk/test/primary/{resultHeaders.aon → resultHeaders.aontu} +0 -0
  59. /package/project/standard/.sdk/test/primary/{transformRequest.aon → transformRequest.aontu} +0 -0
  60. /package/project/standard/.sdk/test/primary/{transformResponse.aon → transformResponse.aontu} +0 -0
  61. /package/project/standard/.sdk/test/struct/{getpath.aon → getpath.aontu} +0 -0
  62. /package/project/standard/.sdk/test/struct/{inject.aon → inject.aontu} +0 -0
  63. /package/project/standard/.sdk/test/struct/{merge.aon → merge.aontu} +0 -0
  64. /package/project/standard/.sdk/test/struct/{minor.aon → minor.aontu} +0 -0
  65. /package/project/standard/.sdk/test/struct/{nullsem.aon → nullsem.aontu} +0 -0
  66. /package/project/standard/.sdk/test/struct/{select.aon → select.aontu} +0 -0
  67. /package/project/standard/.sdk/test/struct/{transform.aon → transform.aontu} +0 -0
  68. /package/project/standard/.sdk/test/struct/{validate.aon → validate.aontu} +0 -0
  69. /package/project/standard/.sdk/test/struct/{walk.aon → walk.aontu} +0 -0
package/README.md CHANGED
@@ -59,6 +59,29 @@ Packagist, RubyGems, LuaRocks, or a Go module tag).
59
59
  The step-by-step tutorial, the model reference, and the generator's CLI flags
60
60
  are in the [sdkgen documentation](https://github.com/voxgig/sdkgen/tree/main/docs).
61
61
 
62
+ ## Re-scaffold an existing project
63
+
64
+ Run the same command over the project's output directory to pick up a newer
65
+ scaffold:
66
+
67
+ ```sh
68
+ create-sdkgen my-api -d ./openapi.yaml -o ./my-api-sdk
69
+ ```
70
+
71
+ A re-scaffold rewrites the scaffold's own files and keeps the project's: the
72
+ guide in `.sdk/model/guide/`, the project overlay `.sdk/model/project.aontu`,
73
+ and the target, feature, and edition indexes with the files they name.
74
+
75
+ The same command brings a project from before the `.aontu` rename up to date,
76
+ which it needs, because `aontu` now refuses to include a `.aon` file. The
77
+ re-scaffold renames each `.aon` file under `.sdk/model/` and `.sdk/test/` to
78
+ `.aontu`, or removes it where the scaffold writes its replacement, and updates
79
+ every include that names a renamed file. Nothing else in a file changes. An
80
+ include the scaffold can't update, such as one pointing outside `.sdk/`, gets
81
+ a warning that names the file. Commit first, so the migration is a diff you
82
+ can read. [`test/create-sdkgen.test.ts`](./test/create-sdkgen.test.ts) builds
83
+ such a project and re-scaffolds it.
84
+
62
85
  ## The toolchain
63
86
 
64
87
  - **create-sdkgen** (this package) — scaffolds the project.
@@ -8,6 +8,7 @@ exports.sanitizeDefName = sanitizeDefName;
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const jostraca_1 = require("jostraca");
10
10
  const ModelSdk_1 = require("./ModelSdk");
11
+ const migrate_1 = require("./migrate");
11
12
  const GITIGNORE_TOP = `# Local config / secrets
12
13
  *.local.*
13
14
  *.local
@@ -47,15 +48,16 @@ log/
47
48
  # OS
48
49
  .DS_Store
49
50
  `;
50
- const PROJECT_FILE = 'project.aon';
51
+ const PROJECT_FILE = 'project.aontu';
51
52
  const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this file once and never
52
- # overwrites it, unlike every other file it writes.
53
+ # overwrites it.
53
54
  #
54
- # Everything else under model/ is toolchain-derived and is deliberately
55
- # regenerated so that toolchain fixes propagate. Put anything here that is a
56
- # decision about THIS project rather than a fact about the API.
55
+ # Most of model/ is toolchain-derived and is deliberately regenerated so that
56
+ # toolchain fixes propagate; this file, the guide, and the target, feature and
57
+ # edition indexes are kept. Put anything here that is a decision about THIS
58
+ # project rather than a fact about the API.
57
59
  #
58
- # Included LAST by sdk.aon, after target/target-index.aon, because a key
60
+ # Included LAST by sdk.aontu, after target/target-index.aontu, because a key
59
61
  # under main.kit.target.<t> can only refine a target that has already been
60
62
  # defined. Declared earlier, the model build fails with "Cannot unify value:
61
63
  # nil with value: string / key ext value was: nil", which names nothing that
@@ -75,28 +77,14 @@ const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this fil
75
77
  `;
76
78
  const GUIDE_FILE = 'guide.aontu';
77
79
  const GUIDE_REL = ['model', 'guide', GUIDE_FILE];
78
- function renameIncludes(src, from, to) {
79
- return src.replace(new RegExp(`(@['"][^'"]+)\\.${from}(['"])`, 'g'), `$1.${to}$2`);
80
- }
81
- // Only apidef's own files became .aontu; a project's own includes keep theirs.
82
- function migrateGuideIncludes(src) {
83
- return src.replace(/(@(['"])(?:@voxgig\/apidef\/model\/[^'"]+|(?:[^'"]*\/)?[^'"/]*base-guide))\.aon\2/g, '$1.aontu$2');
84
- }
85
- function migrateOverlay(fs, dir, name, from, to, rewrite = (src) => renameIncludes(src, from, to)) {
86
- const next = node_path_1.default.join(dir, name + '.' + to);
87
- const prev = node_path_1.default.join(dir, name + '.' + from);
88
- if (fs.existsSync(next) || !fs.existsSync(prev)) {
89
- return;
90
- }
91
- try {
92
- fs.writeFileSync(next, rewrite(String(fs.readFileSync(prev))));
93
- fs.unlinkSync(prev);
94
- }
95
- catch (_err) {
96
- // A failed migration must not fail the scaffold: the worst case is the
97
- // template being written fresh, which is what would have happened anyway.
98
- }
99
- }
80
+ const INDEX_KINDS = ['target', 'feature', 'edition'];
81
+ const indexFile = (kind) => kind + '-index.aontu';
82
+ // Written back from the project rather than from the template.
83
+ const KEPT = [
84
+ ['model', PROJECT_FILE],
85
+ GUIDE_REL,
86
+ ...INDEX_KINDS.map((kind) => ['model', kind, indexFile(kind)]),
87
+ ].map((rel) => rel.join('/'));
100
88
  function mergeGuide(existing, template) {
101
89
  if (null == existing) {
102
90
  return template;
@@ -138,9 +126,10 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
138
126
  (0, jostraca_1.Project)({ folder }, () => {
139
127
  const from = node_path_1.default.resolve(node_path_1.default.join(__dirname, '..', '..', '..', 'project', 'standard'));
140
128
  const guideExclude = [spec.sdk_folder, ...GUIDE_REL].join('/');
129
+ const indexExclude = INDEX_KINDS.map((kind) => [spec.sdk_folder, 'model', kind, indexFile(kind)].join('/'));
141
130
  (0, jostraca_1.Copy)({
142
131
  from,
143
- exclude: [/\.fragment\./, guideExclude, /^\.sdk\/admin\/.*\.sh$/]
132
+ exclude: [/\.fragment\./, guideExclude, ...indexExclude, /^\.sdk\/admin\/.*\.sh$/]
144
133
  });
145
134
  (0, jostraca_1.File)({ name: '.gitignore' }, () => {
146
135
  (0, jostraca_1.Content)(GITIGNORE_TOP);
@@ -149,6 +138,14 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
149
138
  const projdef = sanitizeDefName(node_path_1.default.basename(origdef));
150
139
  spec.def = projdef;
151
140
  (0, jostraca_1.Folder)({ name: spec.sdk_folder }, () => {
141
+ // Before anything reads the project's own files, so a project from the
142
+ // .aon era is read under the names it now has.
143
+ if (!spec.dryrun) {
144
+ const sdk = node_path_1.default.join(folder, spec.sdk_folder);
145
+ (0, migrate_1.migrateToAontu)(fs, sdk, (0, migrate_1.scaffoldFiles)(fs, node_path_1.default.join(from, spec.sdk_folder), KEPT), (file, note) => ctx$.log.warn({
146
+ point: 'migrate-aontu', file: node_path_1.default.join(sdk, file), note: file + ': ' + note,
147
+ }));
148
+ }
152
149
  (0, jostraca_1.Folder)({ name: 'admin' }, () => {
153
150
  const admin = node_path_1.default.join(from, spec.sdk_folder, 'admin');
154
151
  for (const name of fs.readdirSync(admin).filter((name) => name.endsWith('.sh')).sort()) {
@@ -174,30 +171,30 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
174
171
  // unchanged rather than skipped, so the write is a no-op instead of a
175
172
  // special case in the component tree.
176
173
  const projectPath = node_path_1.default.join(folder, spec.sdk_folder, 'model', PROJECT_FILE);
177
- // Same hazard, worse symptom: this file carries the release version,
178
- // so an ignored project.aontu silently resets every generated manifest
179
- // to the sdkgen default 0.0.1 — the exact bug fixed earlier this week.
180
- if (!spec.dryrun) {
181
- migrateOverlay(fs, node_path_1.default.dirname(projectPath), 'project', 'aontu', 'aon');
182
- }
183
174
  const existingProject = fs.existsSync(projectPath) ? fs.readFileSync(projectPath, 'utf8') : null;
184
175
  (0, jostraca_1.File)({ name: PROJECT_FILE }, () => {
185
176
  (0, jostraca_1.Content)(null == existingProject ? PROJECT_STUB : existingProject);
186
177
  });
178
+ // `target add`, `feature add` and docgen register their items here, and
179
+ // docgen bootstraps only once, so a reset index would lose them for good.
180
+ for (const kind of INDEX_KINDS) {
181
+ (0, jostraca_1.Folder)({ name: kind }, () => {
182
+ const name = indexFile(kind);
183
+ const indexPath = node_path_1.default.join(folder, spec.sdk_folder, 'model', kind, name);
184
+ (0, jostraca_1.File)({ name }, () => {
185
+ (0, jostraca_1.Content)(fs.existsSync(indexPath) ?
186
+ fs.readFileSync(indexPath, 'utf8') :
187
+ fs.readFileSync(node_path_1.default.join(from, spec.sdk_folder, 'model', kind, name), 'utf8'));
188
+ });
189
+ });
190
+ }
187
191
  // Re-emit the guide the Copy skipped, merged over whatever is already
188
192
  // there. On a fresh scaffold there is no existing file and this writes
189
193
  // the template unchanged; on a re-scaffold the user's overlay survives.
190
194
  (0, jostraca_1.Folder)({ name: 'guide' }, () => {
191
195
  const guideTemplate = fs.readFileSync(node_path_1.default.join(from, spec.sdk_folder, ...GUIDE_REL), 'utf8');
192
196
  const guidePath = node_path_1.default.join(folder, spec.sdk_folder, ...GUIDE_REL);
193
- // Before the merge looks for it — otherwise a project whose guide is
194
- // still named .aon reads as having no overlay at all.
195
- if (!spec.dryrun) {
196
- migrateOverlay(fs, node_path_1.default.dirname(guidePath), 'guide', 'aon', 'aontu', migrateGuideIncludes);
197
- }
198
- // An entry already named .aontu can still include a retired .aon file.
199
- const existingGuide = fs.existsSync(guidePath) ?
200
- migrateGuideIncludes(fs.readFileSync(guidePath, 'utf8')) : null;
197
+ const existingGuide = fs.existsSync(guidePath) ? fs.readFileSync(guidePath, 'utf8') : null;
201
198
  (0, jostraca_1.File)({ name: GUIDE_FILE }, () => {
202
199
  (0, jostraca_1.Content)(mergeGuide(existingGuide, guideTemplate));
203
200
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;;;;;QAkRE,eAAe;AAhRjB,0DAA4B;AAE5B,uCAUiB;AAGjB,yCAAqC;AAGrC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;CAkBrB,CAAA;AAGD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;CAmBrB,CAAA;AAGD,MAAM,YAAY,GAAG,aAAa,CAAA;AAClC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBpB,CAAA;AAGD,MAAM,UAAU,GAAG,aAAa,CAAA;AAChC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;AAGhD,SAAS,cAAc,CAAC,GAAW,EAAE,IAAY,EAAE,EAAU;IAC3D,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,mBAAmB,IAAI,QAAQ,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;AACpF,CAAC;AAGD,+EAA+E;AAC/E,SAAS,oBAAoB,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,OAAO,CAChB,oFAAoF,EACpF,YAAY,CAAC,CAAA;AACjB,CAAC;AAGD,SAAS,cAAc,CACrB,EAAO,EAAE,GAAW,EAAE,IAAY,EAAE,IAAY,EAAE,EAAU,EAC5D,OAAO,GAA4B,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC;IACzE,MAAM,IAAI,GAAG,mBAAI,CAAC,IAAI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CAAA;gBACJ,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IAEJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;QAIA,UAAU"}
@@ -9,9 +9,9 @@ const jostraca_1 = require("jostraca");
9
9
  const ModelSdk = (0, jostraca_1.cmp)(function ModelSdk(props) {
10
10
  const { spec } = props;
11
11
  const from = node_path_1.default.resolve(node_path_1.default.join(__dirname, '..', '..', '..', 'project', 'standard'));
12
- (0, jostraca_1.File)({ name: 'sdk.aon' }, () => {
12
+ (0, jostraca_1.File)({ name: 'sdk.aontu' }, () => {
13
13
  (0, jostraca_1.Fragment)({
14
- from: node_path_1.default.join(from, spec.sdk_folder, 'model', 'sdk.fragment.aon'),
14
+ from: node_path_1.default.join(from, spec.sdk_folder, 'model', 'sdk.fragment.aontu'),
15
15
  replace: {
16
16
  ProjectName: spec.name,
17
17
  NAME: spec.name,
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSdk.js","sourceRoot":"","sources":["../../../src/project/standard/ModelSdk.ts"],"names":[],"mappings":";;;;;;AACA,0DAA4B;AAG5B,uCAKiB;AAIjB,MAAM,QAAQ,GAAG,IAAA,cAAG,EAAC,SAAS,QAAQ,CAAC,KAAU;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IAEtB,MAAM,IAAI,GACR,mBAAI,CAAC,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAA;IAE7E,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE;QAC7B,IAAA,mBAAQ,EAAC;YACP,IAAI,EAAE,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,kBAAkB,CAAC;YACnE,OAAO,EAAE;gBACP,WAAW,EAAE,IAAI,CAAC,IAAI;gBACtB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,EAAE,IAAI,CAAC,GAAG;aACd;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAC,CAAA;QAIA,QAAQ"}
1
+ {"version":3,"file":"ModelSdk.js","sourceRoot":"","sources":["../../../src/project/standard/ModelSdk.ts"],"names":[],"mappings":";;;;;;AACA,0DAA4B;AAG5B,uCAKiB;AAIjB,MAAM,QAAQ,GAAG,IAAA,cAAG,EAAC,SAAS,QAAQ,CAAC,KAAU;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IAEtB,MAAM,IAAI,GACR,mBAAI,CAAC,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAA;IAE7E,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE;QAC/B,IAAA,mBAAQ,EAAC;YACP,IAAI,EAAE,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,EAAE,oBAAoB,CAAC;YACrE,OAAO,EAAE;gBACP,WAAW,EAAE,IAAI,CAAC,IAAI;gBACtB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,GAAG,EAAE,IAAI,CAAC,GAAG;aACd;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAC,CAAA;QAIA,QAAQ"}
@@ -0,0 +1,9 @@
1
+ type Warn = (file: string, note: string) => void;
2
+ type Scaffold = {
3
+ kept: Set<string>;
4
+ replaced: Set<string>;
5
+ };
6
+ declare function rewriteIncludes(src: string, rename: (path: string) => boolean): string;
7
+ declare function scaffoldFiles(fs: any, templateSdk: string, kept: string[]): Scaffold;
8
+ declare function migrateToAontu(fs: any, sdk: string, scaffold: Scaffold, warn: Warn): void;
9
+ export { migrateToAontu, rewriteIncludes, scaffoldFiles, };
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.migrateToAontu = migrateToAontu;
7
+ exports.rewriteIncludes = rewriteIncludes;
8
+ exports.scaffoldFiles = scaffoldFiles;
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const TREES = ['model', 'test'];
11
+ const LEGACY = '.aon';
12
+ const CURRENT = '.aontu';
13
+ const TOOLCHAIN_RE = /^@voxgig\//;
14
+ const APIDEF_WRITES_RE = /^model\/guide\/[^/]*base-guide\.aontu$/;
15
+ // Comments and strings are matched whole, so an include is only ever an `@`
16
+ // outside both: a `.aon` named in a comment or held as data is not rewritten.
17
+ const TOKEN_RE = /#[^\n]*|@([ \t]*)(["'`])([^"'`\n]*)\2|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g;
18
+ function rewriteIncludes(src, rename) {
19
+ return src.replace(TOKEN_RE, (token, space, quote, path) => null != quote && path.endsWith(LEGACY) && rename(path) ?
20
+ '@' + space + quote + path.slice(0, -LEGACY.length) + CURRENT + quote : token);
21
+ }
22
+ function legacyIncludes(src) {
23
+ return [...src.matchAll(TOKEN_RE)]
24
+ .filter((m) => null != m[2] && m[3].endsWith(LEGACY))
25
+ .map((m) => m[3]);
26
+ }
27
+ function modelFiles(fs, sdk, ext) {
28
+ const found = [];
29
+ const walk = (rel) => {
30
+ let entries;
31
+ try {
32
+ entries = fs.readdirSync(node_path_1.default.join(sdk, rel), { withFileTypes: true });
33
+ }
34
+ catch (_err) {
35
+ return;
36
+ }
37
+ for (const entry of entries) {
38
+ const child = rel + '/' + entry.name;
39
+ if (entry.isDirectory()) {
40
+ walk(child);
41
+ }
42
+ else if (entry.isFile() && entry.name.endsWith(ext)) {
43
+ found.push(child);
44
+ }
45
+ }
46
+ };
47
+ TREES.forEach(walk);
48
+ return found.sort();
49
+ }
50
+ function scaffoldFiles(fs, templateSdk, kept) {
51
+ const keep = new Set(kept);
52
+ const written = modelFiles(fs, templateSdk, CURRENT)
53
+ .map((rel) => rel.replace('.fragment.', '.'));
54
+ return { kept: keep, replaced: new Set(written.filter((rel) => !keep.has(rel))) };
55
+ }
56
+ // A failed step must not fail the scaffold: the file keeps the name it had.
57
+ function attempt(step) {
58
+ try {
59
+ step();
60
+ }
61
+ catch (_err) {
62
+ }
63
+ }
64
+ // Written beside the target and renamed over it, so a write that fails part
65
+ // way leaves the file it would have replaced whole.
66
+ function writeWhole(fs, path, data) {
67
+ const tmp = path + '.migrating';
68
+ try {
69
+ fs.writeFileSync(tmp, data);
70
+ fs.renameSync(tmp, path);
71
+ }
72
+ catch (err) {
73
+ attempt(() => fs.unlinkSync(tmp));
74
+ throw err;
75
+ }
76
+ }
77
+ function migrateFile(fs, prev, next) {
78
+ if (fs.existsSync(next) || !fs.existsSync(prev)) {
79
+ return;
80
+ }
81
+ attempt(() => {
82
+ writeWhole(fs, next, fs.readFileSync(prev));
83
+ fs.unlinkSync(prev);
84
+ });
85
+ }
86
+ function includeRenamer(fs, sdk, scaffold, from) {
87
+ const dir = node_path_1.default.dirname(node_path_1.default.join(sdk, from));
88
+ return (path) => {
89
+ if (TOOLCHAIN_RE.test(path)) {
90
+ return true;
91
+ }
92
+ if (path.startsWith('@')) {
93
+ return false;
94
+ }
95
+ const twin = node_path_1.default.resolve(dir, path.slice(0, -LEGACY.length) + CURRENT);
96
+ const rel = node_path_1.default.relative(sdk, twin).split(node_path_1.default.sep).join('/');
97
+ return fs.existsSync(twin) || scaffold.kept.has(rel) || scaffold.replaced.has(rel) ||
98
+ APIDEF_WRITES_RE.test(rel);
99
+ };
100
+ }
101
+ // Renames first and rewrites after, so an include changes only once the file
102
+ // it names is on disk as .aontu.
103
+ function migrateToAontu(fs, sdk, scaffold, warn) {
104
+ const legacy = modelFiles(fs, sdk, LEGACY);
105
+ const twin = (rel) => rel.slice(0, -LEGACY.length) + CURRENT;
106
+ const abs = (rel) => node_path_1.default.join(sdk, rel);
107
+ for (const rel of legacy.filter((rel) => !scaffold.replaced.has(twin(rel)))) {
108
+ migrateFile(fs, abs(rel), abs(twin(rel)));
109
+ }
110
+ const sources = modelFiles(fs, sdk, CURRENT).filter((rel) => !scaffold.replaced.has(rel));
111
+ for (const rel of sources) {
112
+ attempt(() => {
113
+ const src = String(fs.readFileSync(abs(rel)));
114
+ const out = rewriteIncludes(src, includeRenamer(fs, sdk, scaffold, rel));
115
+ if (out !== src) {
116
+ writeWhole(fs, abs(rel), out);
117
+ }
118
+ });
119
+ }
120
+ for (const rel of legacy.filter((rel) => scaffold.replaced.has(twin(rel)))) {
121
+ attempt(() => fs.unlinkSync(abs(rel)));
122
+ }
123
+ for (const rel of modelFiles(fs, sdk, LEGACY)) {
124
+ warn(rel, fs.existsSync(abs(twin(rel))) ?
125
+ 'left in place: ' + twin(rel) + ' exists, and is the file aontu reads' :
126
+ 'could not be migrated to ' + twin(rel));
127
+ }
128
+ for (const rel of sources) {
129
+ attempt(() => {
130
+ for (const path of legacyIncludes(String(fs.readFileSync(abs(rel))))) {
131
+ warn(rel, 'includes ' + path + ', which aontu refuses: rename that file ' +
132
+ 'to .aontu and update the include');
133
+ }
134
+ });
135
+ }
136
+ }
137
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../src/project/standard/migrate.ts"],"names":[],"mappings":";;;;;QAwKE,cAAc;QACd,eAAe;QACf,aAAa;AA1Kf,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;AAC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,CAAC,GAAG,sCAAsC,CAAC,CAAC;YACxE,2BAA2B,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5C,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,EAAE;YACX,KAAK,MAAM,IAAI,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrE,IAAI,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,GAAG,0CAA0C;oBACvE,kCAAkC,CAAC,CAAA;YACvC,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,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"],"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/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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/create-sdkgen",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "main": "dist/create-sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "types": "dist/create-sdkgen.d.ts",
@@ -27,8 +27,8 @@
27
27
  "watch": "tsc --build src test -w",
28
28
  "build": "tsc --build src test",
29
29
  "scan-prose": "python3 tools/check_prose.py",
30
- "test-model": "voxgig-model project/.sdk/test/test.aon",
31
- "test-model-watch": "voxgig-model -w project/.sdk/test/test.aon",
30
+ "test-model": "voxgig-model project/.sdk/test/test.aontu",
31
+ "test-model-watch": "voxgig-model -w project/.sdk/test/test.aontu",
32
32
  "clean": "rm -rf dist dist-test node_modules yarn.lock package-lock.json",
33
33
  "reset": "npm run clean && npm i && npm run build && npm test",
34
34
  "repo-bump": "npm version patch --no-git-tag-version && node -e \"console.log('bumped to v' + require('./package.json').version + ' (package.json only - commit via repo-tag / repo-release)')\"",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@voxgig/util": "0.5.4",
59
- "aontu": ">=0.68",
59
+ "aontu": ">=0.75.0",
60
60
  "chokidar": "5.0.0",
61
61
  "jostraca": "0.31.2",
62
62
  "shape": ">=10"
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- @'@voxgig/model/model/.model-config/model-config.aon'
3
+ @'@voxgig/model/model/.model-config/model-config.aontu'
4
4
 
5
5
  sys: model: action: {
6
6
  apidef: load: 'build/apidef.js'
@@ -1,7 +1,7 @@
1
1
 
2
2
  # Model definitions.
3
3
  @"@voxgig/apidef/model/apidef.aontu"
4
- @"@voxgig/sdkgen/model/sdkgen.aon"
4
+ @"@voxgig/sdkgen/model/sdkgen.aontu"
5
5
 
6
6
 
7
7
  name: 'NAME'
@@ -14,7 +14,7 @@ def: 'DEF'
14
14
 
15
15
 
16
16
  # SDK Configuration.
17
- @"./config.aon"
17
+ @"./config.aontu"
18
18
 
19
19
 
20
20
  # SDK Entities
@@ -22,18 +22,18 @@ def: 'DEF'
22
22
 
23
23
 
24
24
  # SDK Features.
25
- @"feature/feature-index.aon"
25
+ @"feature/feature-index.aontu"
26
26
 
27
27
 
28
28
  # SDK Targets.
29
- @"target/target-index.aon"
29
+ @"target/target-index.aontu"
30
30
 
31
31
 
32
32
  # Operation workflows.
33
33
  @"flow/flow-index.aontu"
34
34
 
35
35
 
36
- @"./project.aon"
36
+ @"./project.aontu"
37
37
 
38
- # Documentation editions. Settings belong in project.aon.
39
- @"edition/edition-index.aon"
38
+ # Documentation editions. Settings belong in project.aontu.
39
+ @"edition/edition-index.aontu"
@@ -3,12 +3,12 @@
3
3
  "version": "0.0.1",
4
4
  "description": "$$const.Name$$ SDK Project",
5
5
  "scripts": {
6
- "generate": "node build/docgen.js && tsc --build src && voxgig-model model/sdk.aon && voxgig-model test/test.aon",
7
- "watch-generate": "voxgig-model -w model/sdk.aon",
8
- "dry-generate": "tsc --build src && voxgig-model -y model/sdk.aon",
9
- "watch-dry-generate": "voxgig-model -w -y model/sdk.aon",
10
- "test-model": "voxgig-model test/test.aon",
11
- "watch-test-model": "voxgig-model -w test/test.aon",
6
+ "generate": "node build/docgen.js && tsc --build src && voxgig-model model/sdk.aontu && voxgig-model test/test.aontu",
7
+ "watch-generate": "voxgig-model -w model/sdk.aontu",
8
+ "dry-generate": "tsc --build src && voxgig-model -y model/sdk.aontu",
9
+ "watch-dry-generate": "voxgig-model -w -y model/sdk.aontu",
10
+ "test-model": "voxgig-model test/test.aontu",
11
+ "watch-test-model": "voxgig-model -w test/test.aontu",
12
12
  "watch": "tsc --build src -w",
13
13
  "build": "tsc --build src",
14
14
  "test": "echo no-test",
@@ -29,13 +29,13 @@
29
29
  "devDependencies": {
30
30
  "@types/node": ">=25.6",
31
31
  "typescript": ">=6.0",
32
- "@voxgig/apidef": ">=8.16.0",
33
- "@voxgig/model": ">=10.0",
34
- "@voxgig/sdkgen": ">=4.22.0",
32
+ "@voxgig/apidef": ">=8.17.0",
33
+ "@voxgig/model": ">=12.0.0",
34
+ "@voxgig/sdkgen": ">=4.25.0",
35
35
  "@voxgig/util": ">=0.5",
36
36
  "@voxgig/struct": ">=0.2",
37
- "jostraca": ">=0.33.1",
38
- "aontu": ">=0.68",
39
- "@voxgig/docgen": ">=0.23.0"
37
+ "jostraca": ">=0.39.0",
38
+ "aontu": ">=0.75.0",
39
+ "@voxgig/docgen": ">=0.27.0"
40
40
  }
41
41
  }
@@ -0,0 +1,4 @@
1
+
2
+ @"@voxgig/model/model/.model-config/model-config.aontu"
3
+
4
+ sys: model: builders: {}
@@ -1,2 +1,2 @@
1
1
  # Feature behaviour cases, one section per feature.
2
- feature: cost: @"./cost.aon"
2
+ feature: cost: @"./cost.aontu"
@@ -0,0 +1,30 @@
1
+ primary: clean: @"./clean.aontu"
2
+ primary: done: @"./done.aontu"
3
+ primary: featureAdd: @"./featureAdd.aontu"
4
+ primary: featureHook: @"./featureHook.aontu"
5
+ primary: featureInit: @"./featureInit.aontu"
6
+ primary: fetcher: @"./fetcher.aontu"
7
+ primary: makeContext: @"./makeContext.aontu"
8
+ primary: makeError: @"./makeError.aontu"
9
+ primary: makeFetchDef: @"./makeFetchDef.aontu"
10
+ primary: makeOptions: @"./makeOptions.aontu"
11
+ primary: makeRequest: @"./makeRequest.aontu"
12
+ primary: makeResponse: @"./makeResponse.aontu"
13
+ primary: makeResult: @"./makeResult.aontu"
14
+ primary: makeSpec: @"./makeSpec.aontu"
15
+ primary: makePoint: @"./makePoint.aontu"
16
+ primary: makeUrl: @"./makeUrl.aontu"
17
+ primary: operator: @"./operator.aontu"
18
+ primary: param: @"./param.aontu"
19
+ primary: prepareAuth: @"./prepareAuth.aontu"
20
+ primary: prepareBody: @"./prepareBody.aontu"
21
+ primary: prepareHeaders: @"./prepareHeaders.aontu"
22
+ primary: prepareMethod: @"./prepareMethod.aontu"
23
+ primary: prepareParams: @"./prepareParams.aontu"
24
+ primary: preparePath: @"./preparePath.aontu"
25
+ primary: prepareQuery: @"./prepareQuery.aontu"
26
+ primary: resultBasic: @"./resultBasic.aontu"
27
+ primary: resultBody: @"./resultBody.aontu"
28
+ primary: resultHeaders: @"./resultHeaders.aontu"
29
+ primary: transformRequest: @"./transformRequest.aontu"
30
+ primary: transformResponse: @"./transformResponse.aontu"
@@ -0,0 +1,26 @@
1
+
2
+ struct: &: {
3
+ name: key()
4
+ set: []
5
+ }
6
+
7
+ struct: minor: @"./minor.aontu"
8
+ struct: getpath: @"./getpath.aontu"
9
+ struct: inject: @"./inject.aontu"
10
+ struct: merge: @"./merge.aontu"
11
+ struct: transform: @"./transform.aontu"
12
+ struct: walk: @"./walk.aontu"
13
+ struct: validate: @"./validate.aontu"
14
+ struct: select: @"./select.aontu"
15
+ struct: nullsem: @"./nullsem.aontu"
16
+
17
+ primary: check: {
18
+ DEF: {
19
+ client:a:test:options:foo:1
20
+ }
21
+ basic: set: [
22
+ { ctx:meta:bar:BAR0, out:zed:ZED_BAR0 }
23
+ { ctx:meta:bar:BAR1, client:a, out:zed:ZED1_BAR1 }
24
+ ]
25
+ }
26
+
@@ -0,0 +1,4 @@
1
+
2
+ @"struct/test.aontu"
3
+ @"primary/primary-test-index.aontu"
4
+ @"feature/feature-test-index.aontu"
@@ -16,6 +16,7 @@ import {
16
16
 
17
17
 
18
18
  import { ModelSdk } from './ModelSdk'
19
+ import { migrateToAontu, scaffoldFiles } from './migrate'
19
20
 
20
21
 
21
22
  const GITIGNORE_TOP = `# Local config / secrets
@@ -61,15 +62,16 @@ log/
61
62
  `
62
63
 
63
64
 
64
- const PROJECT_FILE = 'project.aon'
65
+ const PROJECT_FILE = 'project.aontu'
65
66
  const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this file once and never
66
- # overwrites it, unlike every other file it writes.
67
+ # overwrites it.
67
68
  #
68
- # Everything else under model/ is toolchain-derived and is deliberately
69
- # regenerated so that toolchain fixes propagate. Put anything here that is a
70
- # decision about THIS project rather than a fact about the API.
69
+ # Most of model/ is toolchain-derived and is deliberately regenerated so that
70
+ # toolchain fixes propagate; this file, the guide, and the target, feature and
71
+ # edition indexes are kept. Put anything here that is a decision about THIS
72
+ # project rather than a fact about the API.
71
73
  #
72
- # Included LAST by sdk.aon, after target/target-index.aon, because a key
74
+ # Included LAST by sdk.aontu, after target/target-index.aontu, because a key
73
75
  # under main.kit.target.<t> can only refine a target that has already been
74
76
  # defined. Declared earlier, the model build fails with "Cannot unify value:
75
77
  # nil with value: string / key ext value was: nil", which names nothing that
@@ -92,37 +94,15 @@ const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this fil
92
94
  const GUIDE_FILE = 'guide.aontu'
93
95
  const GUIDE_REL = ['model', 'guide', GUIDE_FILE]
94
96
 
97
+ const INDEX_KINDS = ['target', 'feature', 'edition']
98
+ const indexFile = (kind: string) => kind + '-index.aontu'
95
99
 
96
- function renameIncludes(src: string, from: string, to: string): string {
97
- return src.replace(new RegExp(`(@['"][^'"]+)\\.${from}(['"])`, 'g'), `$1.${to}$2`)
98
- }
99
-
100
-
101
- // Only apidef's own files became .aontu; a project's own includes keep theirs.
102
- function migrateGuideIncludes(src: string): string {
103
- return src.replace(
104
- /(@(['"])(?:@voxgig\/apidef\/model\/[^'"]+|(?:[^'"]*\/)?[^'"/]*base-guide))\.aon\2/g,
105
- '$1.aontu$2')
106
- }
107
-
108
-
109
- function migrateOverlay(
110
- fs: any, dir: string, name: string, from: string, to: string,
111
- rewrite: (src: string) => string = (src) => renameIncludes(src, from, to)): void {
112
- const next = Path.join(dir, name + '.' + to)
113
- const prev = Path.join(dir, name + '.' + from)
114
- if (fs.existsSync(next) || !fs.existsSync(prev)) {
115
- return
116
- }
117
- try {
118
- fs.writeFileSync(next, rewrite(String(fs.readFileSync(prev))))
119
- fs.unlinkSync(prev)
120
- }
121
- catch (_err: any) {
122
- // A failed migration must not fail the scaffold: the worst case is the
123
- // template being written fresh, which is what would have happened anyway.
124
- }
125
- }
100
+ // Written back from the project rather than from the template.
101
+ const KEPT = [
102
+ ['model', PROJECT_FILE],
103
+ GUIDE_REL,
104
+ ...INDEX_KINDS.map((kind: string) => ['model', kind, indexFile(kind)]),
105
+ ].map((rel: string[]) => rel.join('/'))
126
106
 
127
107
 
128
108
  function mergeGuide(existing: string | null, template: string): string {
@@ -181,10 +161,12 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
181
161
 
182
162
 
183
163
  const guideExclude = [spec.sdk_folder, ...GUIDE_REL].join('/')
164
+ const indexExclude = INDEX_KINDS.map((kind: string) =>
165
+ [spec.sdk_folder, 'model', kind, indexFile(kind)].join('/'))
184
166
 
185
167
  Copy({
186
168
  from,
187
- exclude: [/\.fragment\./, guideExclude, /^\.sdk\/admin\/.*\.sh$/]
169
+ exclude: [/\.fragment\./, guideExclude, ...indexExclude, /^\.sdk\/admin\/.*\.sh$/]
188
170
  })
189
171
 
190
172
  File({ name: '.gitignore' }, () => {
@@ -196,6 +178,16 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
196
178
  spec.def = projdef
197
179
 
198
180
  Folder({ name: spec.sdk_folder }, () => {
181
+ // Before anything reads the project's own files, so a project from the
182
+ // .aon era is read under the names it now has.
183
+ if (!spec.dryrun) {
184
+ const sdk = Path.join(folder, spec.sdk_folder)
185
+ migrateToAontu(fs, sdk, scaffoldFiles(fs, Path.join(from, spec.sdk_folder), KEPT),
186
+ (file: string, note: string) => ctx$.log.warn({
187
+ point: 'migrate-aontu', file: Path.join(sdk, file), note: file + ': ' + note,
188
+ }))
189
+ }
190
+
199
191
  Folder({ name: 'admin' }, () => {
200
192
  const admin = Path.join(from, spec.sdk_folder, 'admin')
201
193
  for (const name of fs.readdirSync(admin).filter((name: string) => name.endsWith('.sh')).sort()) {
@@ -227,12 +219,6 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
227
219
  const projectPath =
228
220
  Path.join(folder, spec.sdk_folder, 'model', PROJECT_FILE)
229
221
 
230
- // Same hazard, worse symptom: this file carries the release version,
231
- // so an ignored project.aontu silently resets every generated manifest
232
- // to the sdkgen default 0.0.1 — the exact bug fixed earlier this week.
233
- if (!spec.dryrun) {
234
- migrateOverlay(fs, Path.dirname(projectPath), 'project', 'aontu', 'aon')
235
- }
236
222
  const existingProject =
237
223
  fs.existsSync(projectPath) ? fs.readFileSync(projectPath, 'utf8') : null
238
224
 
@@ -240,6 +226,20 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
240
226
  Content(null == existingProject ? PROJECT_STUB : existingProject)
241
227
  })
242
228
 
229
+ // `target add`, `feature add` and docgen register their items here, and
230
+ // docgen bootstraps only once, so a reset index would lose them for good.
231
+ for (const kind of INDEX_KINDS) {
232
+ Folder({ name: kind }, () => {
233
+ const name = indexFile(kind)
234
+ const indexPath = Path.join(folder, spec.sdk_folder, 'model', kind, name)
235
+ File({ name }, () => {
236
+ Content(fs.existsSync(indexPath) ?
237
+ fs.readFileSync(indexPath, 'utf8') :
238
+ fs.readFileSync(Path.join(from, spec.sdk_folder, 'model', kind, name), 'utf8'))
239
+ })
240
+ })
241
+ }
242
+
243
243
  // Re-emit the guide the Copy skipped, merged over whatever is already
244
244
  // there. On a fresh scaffold there is no existing file and this writes
245
245
  // the template unchanged; on a re-scaffold the user's overlay survives.
@@ -247,17 +247,8 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
247
247
  const guideTemplate =
248
248
  fs.readFileSync(Path.join(from, spec.sdk_folder, ...GUIDE_REL), 'utf8')
249
249
  const guidePath = Path.join(folder, spec.sdk_folder, ...GUIDE_REL)
250
-
251
- // Before the merge looks for it — otherwise a project whose guide is
252
- // still named .aon reads as having no overlay at all.
253
- if (!spec.dryrun) {
254
- migrateOverlay(fs, Path.dirname(guidePath), 'guide', 'aon', 'aontu',
255
- migrateGuideIncludes)
256
- }
257
-
258
- // An entry already named .aontu can still include a retired .aon file.
259
- const existingGuide = fs.existsSync(guidePath) ?
260
- migrateGuideIncludes(fs.readFileSync(guidePath, 'utf8')) : null
250
+ const existingGuide =
251
+ fs.existsSync(guidePath) ? fs.readFileSync(guidePath, 'utf8') : null
261
252
 
262
253
  File({ name: GUIDE_FILE }, () => {
263
254
  Content(mergeGuide(existingGuide, guideTemplate))
@@ -17,9 +17,9 @@ const ModelSdk = cmp(function ModelSdk(props: any) {
17
17
  const from =
18
18
  Path.resolve(Path.join(__dirname, '..', '..', '..', 'project', 'standard'))
19
19
 
20
- File({ name: 'sdk.aon' }, () => {
20
+ File({ name: 'sdk.aontu' }, () => {
21
21
  Fragment({
22
- from: Path.join(from, spec.sdk_folder, 'model', 'sdk.fragment.aon'),
22
+ from: Path.join(from, spec.sdk_folder, 'model', 'sdk.fragment.aontu'),
23
23
  replace: {
24
24
  ProjectName: spec.name,
25
25
  NAME: spec.name,
@@ -0,0 +1,172 @@
1
+ import Path from 'node:path'
2
+
3
+
4
+ const TREES = ['model', 'test']
5
+
6
+ const LEGACY = '.aon'
7
+ const CURRENT = '.aontu'
8
+
9
+ const TOOLCHAIN_RE = /^@voxgig\//
10
+ const APIDEF_WRITES_RE = /^model\/guide\/[^/]*base-guide\.aontu$/
11
+
12
+ // Comments and strings are matched whole, so an include is only ever an `@`
13
+ // outside both: a `.aon` named in a comment or held as data is not rewritten.
14
+ const TOKEN_RE =
15
+ /#[^\n]*|@([ \t]*)(["'`])([^"'`\n]*)\2|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g
16
+
17
+
18
+ type Warn = (file: string, note: string) => void
19
+
20
+ type Scaffold = {
21
+ kept: Set<string>
22
+ replaced: Set<string>
23
+ }
24
+
25
+
26
+ function rewriteIncludes(src: string, rename: (path: string) => boolean): string {
27
+ return src.replace(TOKEN_RE, (token: string, space: string, quote: string, path: string) =>
28
+ null != quote && path.endsWith(LEGACY) && rename(path) ?
29
+ '@' + space + quote + path.slice(0, -LEGACY.length) + CURRENT + quote : token)
30
+ }
31
+
32
+
33
+ function legacyIncludes(src: string): string[] {
34
+ return [...src.matchAll(TOKEN_RE)]
35
+ .filter((m) => null != m[2] && m[3].endsWith(LEGACY))
36
+ .map((m) => m[3])
37
+ }
38
+
39
+
40
+ function modelFiles(fs: any, sdk: string, ext: string): string[] {
41
+ const found: string[] = []
42
+ const walk = (rel: string) => {
43
+ let entries: any[]
44
+ try {
45
+ entries = fs.readdirSync(Path.join(sdk, rel), { withFileTypes: true })
46
+ }
47
+ catch (_err: any) {
48
+ return
49
+ }
50
+ for (const entry of entries) {
51
+ const child = rel + '/' + entry.name
52
+ if (entry.isDirectory()) {
53
+ walk(child)
54
+ }
55
+ else if (entry.isFile() && entry.name.endsWith(ext)) {
56
+ found.push(child)
57
+ }
58
+ }
59
+ }
60
+ TREES.forEach(walk)
61
+ return found.sort()
62
+ }
63
+
64
+
65
+ function scaffoldFiles(fs: any, templateSdk: string, kept: string[]): Scaffold {
66
+ const keep = new Set(kept)
67
+ const written = modelFiles(fs, templateSdk, CURRENT)
68
+ .map((rel: string) => rel.replace('.fragment.', '.'))
69
+ return { kept: keep, replaced: new Set(written.filter((rel) => !keep.has(rel))) }
70
+ }
71
+
72
+
73
+ // A failed step must not fail the scaffold: the file keeps the name it had.
74
+ function attempt(step: () => void): void {
75
+ try {
76
+ step()
77
+ }
78
+ catch (_err: any) {
79
+ }
80
+ }
81
+
82
+
83
+ // Written beside the target and renamed over it, so a write that fails part
84
+ // way leaves the file it would have replaced whole.
85
+ function writeWhole(fs: any, path: string, data: any): void {
86
+ const tmp = path + '.migrating'
87
+ try {
88
+ fs.writeFileSync(tmp, data)
89
+ fs.renameSync(tmp, path)
90
+ }
91
+ catch (err: any) {
92
+ attempt(() => fs.unlinkSync(tmp))
93
+ throw err
94
+ }
95
+ }
96
+
97
+
98
+ function migrateFile(fs: any, prev: string, next: string): void {
99
+ if (fs.existsSync(next) || !fs.existsSync(prev)) {
100
+ return
101
+ }
102
+ attempt(() => {
103
+ writeWhole(fs, next, fs.readFileSync(prev))
104
+ fs.unlinkSync(prev)
105
+ })
106
+ }
107
+
108
+
109
+ function includeRenamer(fs: any, sdk: string, scaffold: Scaffold, from: string) {
110
+ const dir = Path.dirname(Path.join(sdk, from))
111
+ return (path: string): boolean => {
112
+ if (TOOLCHAIN_RE.test(path)) {
113
+ return true
114
+ }
115
+ if (path.startsWith('@')) {
116
+ return false
117
+ }
118
+ const twin = Path.resolve(dir, path.slice(0, -LEGACY.length) + CURRENT)
119
+ const rel = Path.relative(sdk, twin).split(Path.sep).join('/')
120
+ return fs.existsSync(twin) || scaffold.kept.has(rel) || scaffold.replaced.has(rel) ||
121
+ APIDEF_WRITES_RE.test(rel)
122
+ }
123
+ }
124
+
125
+
126
+ // Renames first and rewrites after, so an include changes only once the file
127
+ // it names is on disk as .aontu.
128
+ function migrateToAontu(fs: any, sdk: string, scaffold: Scaffold, warn: Warn): void {
129
+ const legacy = modelFiles(fs, sdk, LEGACY)
130
+ const twin = (rel: string) => rel.slice(0, -LEGACY.length) + CURRENT
131
+ const abs = (rel: string) => Path.join(sdk, rel)
132
+
133
+ for (const rel of legacy.filter((rel) => !scaffold.replaced.has(twin(rel)))) {
134
+ migrateFile(fs, abs(rel), abs(twin(rel)))
135
+ }
136
+
137
+ const sources = modelFiles(fs, sdk, CURRENT).filter((rel) => !scaffold.replaced.has(rel))
138
+ for (const rel of sources) {
139
+ attempt(() => {
140
+ const src = String(fs.readFileSync(abs(rel)))
141
+ const out = rewriteIncludes(src, includeRenamer(fs, sdk, scaffold, rel))
142
+ if (out !== src) {
143
+ writeWhole(fs, abs(rel), out)
144
+ }
145
+ })
146
+ }
147
+
148
+ for (const rel of legacy.filter((rel) => scaffold.replaced.has(twin(rel)))) {
149
+ attempt(() => fs.unlinkSync(abs(rel)))
150
+ }
151
+
152
+ for (const rel of modelFiles(fs, sdk, LEGACY)) {
153
+ warn(rel, fs.existsSync(abs(twin(rel))) ?
154
+ 'left in place: ' + twin(rel) + ' exists, and is the file aontu reads' :
155
+ 'could not be migrated to ' + twin(rel))
156
+ }
157
+ for (const rel of sources) {
158
+ attempt(() => {
159
+ for (const path of legacyIncludes(String(fs.readFileSync(abs(rel))))) {
160
+ warn(rel, 'includes ' + path + ', which aontu refuses: rename that file ' +
161
+ 'to .aontu and update the include')
162
+ }
163
+ })
164
+ }
165
+ }
166
+
167
+
168
+ export {
169
+ migrateToAontu,
170
+ rewriteIncludes,
171
+ scaffoldFiles,
172
+ }
@@ -1,4 +0,0 @@
1
-
2
- @"@voxgig/model/model/.model-config/model-config.aon"
3
-
4
- sys: model: builders: {}
@@ -1,30 +0,0 @@
1
- primary: clean: @"./clean.aon"
2
- primary: done: @"./done.aon"
3
- primary: featureAdd: @"./featureAdd.aon"
4
- primary: featureHook: @"./featureHook.aon"
5
- primary: featureInit: @"./featureInit.aon"
6
- primary: fetcher: @"./fetcher.aon"
7
- primary: makeContext: @"./makeContext.aon"
8
- primary: makeError: @"./makeError.aon"
9
- primary: makeFetchDef: @"./makeFetchDef.aon"
10
- primary: makeOptions: @"./makeOptions.aon"
11
- primary: makeRequest: @"./makeRequest.aon"
12
- primary: makeResponse: @"./makeResponse.aon"
13
- primary: makeResult: @"./makeResult.aon"
14
- primary: makeSpec: @"./makeSpec.aon"
15
- primary: makePoint: @"./makePoint.aon"
16
- primary: makeUrl: @"./makeUrl.aon"
17
- primary: operator: @"./operator.aon"
18
- primary: param: @"./param.aon"
19
- primary: prepareAuth: @"./prepareAuth.aon"
20
- primary: prepareBody: @"./prepareBody.aon"
21
- primary: prepareHeaders: @"./prepareHeaders.aon"
22
- primary: prepareMethod: @"./prepareMethod.aon"
23
- primary: prepareParams: @"./prepareParams.aon"
24
- primary: preparePath: @"./preparePath.aon"
25
- primary: prepareQuery: @"./prepareQuery.aon"
26
- primary: resultBasic: @"./resultBasic.aon"
27
- primary: resultBody: @"./resultBody.aon"
28
- primary: resultHeaders: @"./resultHeaders.aon"
29
- primary: transformRequest: @"./transformRequest.aon"
30
- primary: transformResponse: @"./transformResponse.aon"
@@ -1,26 +0,0 @@
1
-
2
- struct: &: {
3
- name: key()
4
- set: []
5
- }
6
-
7
- struct: minor: @"./minor.aon"
8
- struct: getpath: @"./getpath.aon"
9
- struct: inject: @"./inject.aon"
10
- struct: merge: @"./merge.aon"
11
- struct: transform: @"./transform.aon"
12
- struct: walk: @"./walk.aon"
13
- struct: validate: @"./validate.aon"
14
- struct: select: @"./select.aon"
15
- struct: nullsem: @"./nullsem.aon"
16
-
17
- primary: check: {
18
- DEF: {
19
- client:a:test:options:foo:1
20
- }
21
- basic: set: [
22
- { ctx:meta:bar:BAR0, out:zed:ZED_BAR0 }
23
- { ctx:meta:bar:BAR1, client:a, out:zed:ZED1_BAR1 }
24
- ]
25
- }
26
-
@@ -1,4 +0,0 @@
1
-
2
- @"struct/test.aon"
3
- @"primary/primary-test-index.aon"
4
- @"feature/feature-test-index.aon"