@twin.org/ts-to-schema 0.0.1-next.8 → 0.0.1-next.9

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.
@@ -90,7 +90,10 @@ async function tsToSchema(config, outputFolder, workingDirectory) {
90
90
  content = content.replace(new RegExp(`#/definitions/${external}`, "g"), config.externalReferences[external]);
91
91
  }
92
92
  }
93
- content = content.replace(/#\/definitions\/I?/g, config.baseUrl);
93
+ // First replace all types that start with II to a single I with the new base url
94
+ content = content.replace(/#\/definitions\/II(.*)/g, `${config.baseUrl}I$1`);
95
+ // Then other types starting with capitals (optionally interfaces starting with I)
96
+ content = content.replace(/#\/definitions\/I?([A-Z].*)/g, `${config.baseUrl}$1`);
94
97
  const filename = path.join(outputFolder, `${core.StringHelper.stripPrefix(type)}.json`);
95
98
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.ts-to-schema.progress.writingSchema"), filename, 1);
96
99
  await promises.writeFile(filename, content);
@@ -235,7 +238,7 @@ class CLI extends cliCore.CLIBase {
235
238
  return this.execute({
236
239
  title: "TWIN TypeScript To Schema",
237
240
  appName: "ts-to-schema",
238
- version: "0.0.1-next.8",
241
+ version: "0.0.1-next.9",
239
242
  icon: "⚙️ ",
240
243
  supportsEnvFiles: false,
241
244
  overrideOutputWidth: options?.overrideOutputWidth
@@ -87,7 +87,10 @@ async function tsToSchema(config, outputFolder, workingDirectory) {
87
87
  content = content.replace(new RegExp(`#/definitions/${external}`, "g"), config.externalReferences[external]);
88
88
  }
89
89
  }
90
- content = content.replace(/#\/definitions\/I?/g, config.baseUrl);
90
+ // First replace all types that start with II to a single I with the new base url
91
+ content = content.replace(/#\/definitions\/II(.*)/g, `${config.baseUrl}I$1`);
92
+ // Then other types starting with capitals (optionally interfaces starting with I)
93
+ content = content.replace(/#\/definitions\/I?([A-Z].*)/g, `${config.baseUrl}$1`);
91
94
  const filename = path.join(outputFolder, `${StringHelper.stripPrefix(type)}.json`);
92
95
  CLIDisplay.value(I18n.formatMessage("commands.ts-to-schema.progress.writingSchema"), filename, 1);
93
96
  await writeFile(filename, content);
@@ -232,7 +235,7 @@ class CLI extends CLIBase {
232
235
  return this.execute({
233
236
  title: "TWIN TypeScript To Schema",
234
237
  appName: "ts-to-schema",
235
- version: "0.0.1-next.8",
238
+ version: "0.0.1-next.9",
236
239
  icon: "⚙️ ",
237
240
  supportsEnvFiles: false,
238
241
  overrideOutputWidth: options?.overrideOutputWidth
package/docs/changelog.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # @twin.org/ts-to-schema - Changelog
2
2
 
3
- ## v0.0.1-next.8
3
+ ## v0.0.1-next.9
4
4
 
5
5
  - Initial Release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/ts-to-schema",
3
- "version": "0.0.1-next.8",
3
+ "version": "0.0.1-next.9",
4
4
  "description": "Tool to convert TypeScript definitions to JSON schemas",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@twin.org/cli-core": "next",
18
18
  "@twin.org/core": "next",
19
- "@twin.org/nameof": "0.0.1-next.8",
19
+ "@twin.org/nameof": "0.0.1-next.9",
20
20
  "commander": "12.1.0",
21
21
  "glob": "11.0.0",
22
22
  "jsonschema": "1.4.1",