diff --git a/.changeset/config.json b/.changeset/config.json index 69674ca2f..03d801ff3 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -4,7 +4,8 @@ "commit": false, "fixed": [ ["@osdk/foundry.*", "@osdk/foundry"], - ["@osdk/client.api", "@osdk/client"] + ["@osdk/client.api", "@osdk/client"], + ["@osdk/create-app", "@osdk/create-app.template.*"] ], "linked": [], "access": "restricted", @@ -12,9 +13,9 @@ "updateInternalDependencies": "patch", "ignore": [ "@osdk/examples.*", + "@osdk/monorepo.*", "@osdk/tests.*", - "@osdk/version-updater", - "@osdk/monorepo.*" + "@osdk/version-updater" ], "bumpVersionsWithWorkspaceProtocolOnly": true, "snapshot": { diff --git a/.changeset/old-deers-chew.md b/.changeset/old-deers-chew.md new file mode 100644 index 000000000..dfcc1f1dd --- /dev/null +++ b/.changeset/old-deers-chew.md @@ -0,0 +1,5 @@ +--- +"@osdk/create-app": minor +--- + +Makes the templates get embedded create-app instead of referencing them diff --git a/.monorepolint.config.mjs b/.monorepolint.config.mjs index 59f7943c9..80bdf1837 100644 --- a/.monorepolint.config.mjs +++ b/.monorepolint.config.mjs @@ -420,6 +420,14 @@ function standardPackageRules(shared, options) { */ export default { rules: [ + packageEntry({ + includePackages: ["@osdk/create-app.template.*"], + options: { + entries: { + private: true, + }, + }, + }), fileContents({ includePackages: ["@osdk/create-app.template.*"], options: { diff --git a/packages/create-app.template-packager/package.json b/packages/create-app.template-packager/package.json index 74f552486..8b60b92e0 100644 --- a/packages/create-app.template-packager/package.json +++ b/packages/create-app.template-packager/package.json @@ -1,5 +1,6 @@ { "name": "@osdk/create-app.template-packager", + "private": true, "version": "0.0.0", "license": "Apache-2.0", "repository": { diff --git a/packages/create-app.template.next-static-export/package.json b/packages/create-app.template.next-static-export/package.json index 4755adbe9..fcdbd10a4 100644 --- a/packages/create-app.template.next-static-export/package.json +++ b/packages/create-app.template.next-static-export/package.json @@ -1,5 +1,6 @@ { "name": "@osdk/create-app.template.next-static-export", + "private": true, "version": "0.17.0", "license": "Apache-2.0", "repository": { diff --git a/packages/create-app.template.react/package.json b/packages/create-app.template.react/package.json index 175798d2c..27a583c71 100644 --- a/packages/create-app.template.react/package.json +++ b/packages/create-app.template.react/package.json @@ -1,5 +1,6 @@ { "name": "@osdk/create-app.template.react", + "private": true, "version": "0.17.0", "license": "Apache-2.0", "repository": { diff --git a/packages/create-app.template.tutorial-todo-aip-app/package.json b/packages/create-app.template.tutorial-todo-aip-app/package.json index ec29d0ba6..6cc8ca130 100644 --- a/packages/create-app.template.tutorial-todo-aip-app/package.json +++ b/packages/create-app.template.tutorial-todo-aip-app/package.json @@ -1,5 +1,6 @@ { "name": "@osdk/create-app.template.tutorial-todo-aip-app", + "private": true, "version": "0.17.0", "license": "Apache-2.0", "repository": { diff --git a/packages/create-app.template.tutorial-todo-app/package.json b/packages/create-app.template.tutorial-todo-app/package.json index 6a6539184..4a3927ca4 100644 --- a/packages/create-app.template.tutorial-todo-app/package.json +++ b/packages/create-app.template.tutorial-todo-app/package.json @@ -1,5 +1,6 @@ { "name": "@osdk/create-app.template.tutorial-todo-app", + "private": true, "version": "0.17.0", "license": "Apache-2.0", "repository": { diff --git a/packages/create-app.template.vue/package.json b/packages/create-app.template.vue/package.json index ed421eb0c..3c18aa9eb 100644 --- a/packages/create-app.template.vue/package.json +++ b/packages/create-app.template.vue/package.json @@ -1,5 +1,6 @@ { "name": "@osdk/create-app.template.vue", + "private": true, "version": "0.17.0", "license": "Apache-2.0", "repository": { diff --git a/packages/create-app/package.json b/packages/create-app/package.json index ba0bd47fa..f285e2ea6 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -31,17 +31,17 @@ "typecheck": "monorepo.tool.typecheck esm" }, "dependencies": { - "@osdk/create-app.template.next-static-export": "workspace:*", - "@osdk/create-app.template.react": "workspace:*", - "@osdk/create-app.template.tutorial-todo-aip-app": "workspace:*", - "@osdk/create-app.template.tutorial-todo-app": "workspace:*", - "@osdk/create-app.template.vue": "workspace:*", "consola": "^3.2.3", "find-up": "^7.0.0", "handlebars": "^4.7.8", "yargs": "^17.7.2" }, "devDependencies": { + "@osdk/create-app.template.next-static-export": "workspace:*", + "@osdk/create-app.template.react": "workspace:*", + "@osdk/create-app.template.tutorial-todo-aip-app": "workspace:*", + "@osdk/create-app.template.tutorial-todo-app": "workspace:*", + "@osdk/create-app.template.vue": "workspace:*", "@osdk/monorepo.api-extractor": "workspace:~", "@osdk/monorepo.tsconfig": "workspace:~", "@osdk/monorepo.tsup": "workspace:~", diff --git a/packages/create-app/src/run.ts b/packages/create-app/src/run.ts index 96d01fd47..0a35d3c35 100644 --- a/packages/create-app/src/run.ts +++ b/packages/create-app/src/run.ts @@ -82,9 +82,7 @@ export async function run( const files: Map< string, { type: "base64"; body: string } | { type: "raw"; body: string } - > = (await import( - `@osdk/create-app.template.${template.id.replace(/^template-/, "")}` - )).files; + > = await template.getFiles(); for (const [filePath, contents] of files) { const finalPath = path.join(root, filePath); diff --git a/packages/create-app/src/templates.ts b/packages/create-app/src/templates.ts index e624ea862..253829283 100644 --- a/packages/create-app/src/templates.ts +++ b/packages/create-app/src/templates.ts @@ -20,6 +20,12 @@ export interface Template { envPrefix: string; buildDirectory: string; hidden?: boolean; + getFiles: () => Promise< + Map< + string, + { type: "base64"; body: string } | { type: "raw"; body: string } + > + >; } export interface TemplateContext { @@ -35,18 +41,27 @@ export const TEMPLATES: readonly Template[] = [ label: "React", envPrefix: "VITE_", buildDirectory: "./dist", + getFiles: async () => ((await import( + `@osdk/create-app.template.react` + )).files), }, { id: "template-vue", label: "Vue", envPrefix: "VITE_", buildDirectory: "./dist", + getFiles: async () => ((await import( + `@osdk/create-app.template.vue` + )).files), }, { id: "template-next-static-export", label: "Next (static export)", envPrefix: "NEXT_PUBLIC_", buildDirectory: "./out", + getFiles: async () => ((await import( + `@osdk/create-app.template.next-static-export` + )).files), }, { id: "template-tutorial-todo-app", @@ -54,6 +69,9 @@ export const TEMPLATES: readonly Template[] = [ envPrefix: "VITE_", buildDirectory: "./dist", hidden: true, + getFiles: async () => ((await import( + `@osdk/create-app.template.tutorial-todo-app` + )).files), }, { id: "template-tutorial-todo-aip-app", @@ -61,5 +79,8 @@ export const TEMPLATES: readonly Template[] = [ envPrefix: "VITE_", buildDirectory: "./dist", hidden: true, + getFiles: async () => ((await import( + `@osdk/create-app.template.tutorial-todo-aip-app` + )).files), }, ]; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8b60187fd..3aa1e3fb7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -815,6 +815,19 @@ importers: packages/create-app: dependencies: + consola: + specifier: ^3.2.3 + version: 3.2.3 + find-up: + specifier: ^7.0.0 + version: 7.0.0 + handlebars: + specifier: ^4.7.8 + version: 4.7.8 + yargs: + specifier: ^17.7.2 + version: 17.7.2 + devDependencies: '@osdk/create-app.template.next-static-export': specifier: workspace:* version: link:../create-app.template.next-static-export @@ -830,19 +843,6 @@ importers: '@osdk/create-app.template.vue': specifier: workspace:* version: link:../create-app.template.vue - consola: - specifier: ^3.2.3 - version: 3.2.3 - find-up: - specifier: ^7.0.0 - version: 7.0.0 - handlebars: - specifier: ^4.7.8 - version: 4.7.8 - yargs: - specifier: ^17.7.2 - version: 17.7.2 - devDependencies: '@osdk/monorepo.api-extractor': specifier: workspace:~ version: link:../monorepo.api-extractor