create-plasmic-app 0.0.103 → 0.0.105

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 (29) hide show
  1. package/cpa-out/.gitignore +4 -0
  2. package/cpa-out/tanstack-codegen-ts/package.json +42 -0
  3. package/cpa-out/tanstack-codegen-ts/plasmic.json +136 -0
  4. package/cpa-out/tanstack-codegen-ts/src/components/Button.tsx +35 -0
  5. package/cpa-out/tanstack-codegen-ts/src/components/Header.tsx +21 -0
  6. package/cpa-out/tanstack-codegen-ts/src/components/RandomDynamicPageButton.tsx +44 -0
  7. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +870 -0
  8. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +309 -0
  9. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +28 -0
  10. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +351 -0
  11. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +279 -0
  12. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__CheckSvg.tsx +44 -0
  13. package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/icons/PlasmicIcon__Icon.tsx +41 -0
  14. package/cpa-out/tanstack-codegen-ts/src/routeTree.gen.ts +95 -0
  15. package/cpa-out/tanstack-codegen-ts/src/router.tsx +24 -0
  16. package/cpa-out/tanstack-codegen-ts/src/routes/__root.tsx +37 -0
  17. package/cpa-out/tanstack-codegen-ts/src/routes/dynamic/$slug/index.tsx +49 -0
  18. package/cpa-out/tanstack-codegen-ts/src/routes/index.tsx +49 -0
  19. package/cpa-out/tanstack-codegen-ts/src/routes/plasmic-host.tsx +20 -0
  20. package/cpa-out/tanstack-codegen-ts/tsconfig.json +28 -0
  21. package/cpa-out/tanstack-codegen-ts/vite.config.ts +26 -0
  22. package/dist/react/react.js +10 -12
  23. package/dist/tanstack/tanstack.js +1 -1
  24. package/dist/tanstack/templates/file-router/config.d.ts +1 -1
  25. package/dist/tanstack/templates/file-router/config.js +27 -27
  26. package/package.json +2 -2
  27. package/src/react/react.ts +14 -18
  28. package/src/tanstack/tanstack.ts +3 -3
  29. package/src/tanstack/templates/file-router/config.ts +25 -25
@@ -0,0 +1,26 @@
1
+ import { defineConfig } from 'vite'
2
+ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
3
+ import viteTsConfigPaths from 'vite-tsconfig-paths'
4
+ import tailwindcss from '@tailwindcss/vite'
5
+
6
+ const config = defineConfig({
7
+ ssr: {
8
+ noExternal: [
9
+ "@plasmicapp/data-sources",
10
+ "@plasmicapp/data-sources-context",
11
+ "@plasmicapp/prepass",
12
+ "@plasmicapp/query",
13
+ "@plasmicapp/react-web",
14
+ ],
15
+ },
16
+ plugins: [
17
+ // this is the plugin that enables path aliases
18
+ viteTsConfigPaths({
19
+ projects: ['./tsconfig.json'],
20
+ }),
21
+ tailwindcss(),
22
+ tanstackStart(),
23
+ ],
24
+ })
25
+
26
+ export default config
@@ -61,18 +61,16 @@ exports.reactStrategy = {
61
61
  overwriteConfig: (args) => __awaiter(void 0, void 0, void 0, function* () {
62
62
  const { projectPath, jsOrTs } = args;
63
63
  if (jsOrTs === "ts") {
64
- const tsConfigJsonPath = path_1.default.join(projectPath, "tsconfig.app.json");
65
- let tsConfigJson = yield fs_1.promises.readFile(tsConfigJsonPath, "utf8");
66
- /* tsconfig.app.json has comments such as /* Bundler mode */ /* Linting */
67
- /* We need to remove them before parsing the json */
68
- tsConfigJson = tsConfigJson.replace(/\/\*[\s\S]*?\*\//g, "");
69
- tsConfigJson = tsConfigJson.replace(/\/\/.*$/gm, "");
70
- const tsConfig = JSON.parse(tsConfigJson);
71
- /* In our codegen, we have components where React is imported but not used, we need to
72
- turn off the `noUnusedLocals` rule to ensure the project builds successfully.
73
- */
74
- tsConfig.compilerOptions = Object.assign(Object.assign({}, tsConfig.compilerOptions), { noUnusedLocals: false });
75
- yield fs_1.promises.writeFile(tsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
64
+ const tsconfigPath = path_1.default.join(projectPath, "tsconfig.app.json");
65
+ let tsconfigContent = yield fs_1.promises.readFile(tsconfigPath, "utf8");
66
+ tsconfigContent = tsconfigContent
67
+ // Disable verbatimModuleSyntax
68
+ .replace(`"verbatimModuleSyntax": true`, `"verbatimModuleSyntax": false`)
69
+ /* In our codegen, we have components where React is imported but not used, we need to
70
+ turn off the `noUnusedLocals` rule to ensure the project builds successfully.
71
+ */
72
+ .replace(`"noUnusedLocals": true`, `"noUnusedLocals": false`);
73
+ yield fs_1.promises.writeFile(tsconfigPath, tsconfigContent);
76
74
  }
77
75
  }),
78
76
  generateFiles: ({ scheme, projectApiToken, projectId, projectPath, jsOrTs, }) => __awaiter(void 0, void 0, void 0, function* () {
@@ -55,7 +55,7 @@ exports.tanstackStrategy = {
55
55
  * them to work properly during ssr phase.
56
56
  */
57
57
  if (jsOrTs === "ts") {
58
- yield fs_1.promises.writeFile(path_1.default.join(projectPath, "app.config.ts"), (0, config_1.makeCustomAppConfig_file_router_codegen)());
58
+ yield fs_1.promises.writeFile(path_1.default.join(projectPath, "vite.config.ts"), (0, config_1.makeCustomViteConfig_file_router_codegen)());
59
59
  }
60
60
  }),
61
61
  generateFiles: (args) => {
@@ -1 +1 @@
1
- export declare function makeCustomAppConfig_file_router_codegen(): string;
1
+ export declare function makeCustomViteConfig_file_router_codegen(): string;
@@ -1,33 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeCustomAppConfig_file_router_codegen = void 0;
4
- function makeCustomAppConfig_file_router_codegen() {
5
- return `import { defineConfig } from "@tanstack/react-start/config";
6
- import viteTsConfigPaths from "vite-tsconfig-paths";
7
- import tailwindcss from "@tailwindcss/vite";
3
+ exports.makeCustomViteConfig_file_router_codegen = void 0;
4
+ function makeCustomViteConfig_file_router_codegen() {
5
+ return `import { defineConfig } from 'vite'
6
+ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
7
+ import viteTsConfigPaths from 'vite-tsconfig-paths'
8
+ import tailwindcss from '@tailwindcss/vite'
8
9
 
9
- export default defineConfig({
10
- tsr: {
11
- appDirectory: "src",
12
- },
13
- vite: {
14
- plugins: [
15
- // this is the plugin that enables path aliases
16
- viteTsConfigPaths({
17
- projects: ["./tsconfig.json"],
18
- }),
19
- tailwindcss(),
10
+ const config = defineConfig({
11
+ ssr: {
12
+ noExternal: [
13
+ "@plasmicapp/data-sources",
14
+ "@plasmicapp/data-sources-context",
15
+ "@plasmicapp/prepass",
16
+ "@plasmicapp/query",
17
+ "@plasmicapp/react-web",
20
18
  ],
21
- ssr: {
22
- noExternal: [
23
- "@plasmicapp/data-sources",
24
- "@plasmicapp/data-sources-context",
25
- "@plasmicapp/prepass",
26
- "@plasmicapp/query",
27
- "@plasmicapp/react-web",
28
- ],
29
- },
30
19
  },
31
- })`;
20
+ plugins: [
21
+ // this is the plugin that enables path aliases
22
+ viteTsConfigPaths({
23
+ projects: ['./tsconfig.json'],
24
+ }),
25
+ tailwindcss(),
26
+ tanstackStart(),
27
+ ],
28
+ })
29
+
30
+ export default config
31
+ `;
32
32
  }
33
- exports.makeCustomAppConfig_file_router_codegen = makeCustomAppConfig_file_router_codegen;
33
+ exports.makeCustomViteConfig_file_router_codegen = makeCustomViteConfig_file_router_codegen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.103",
3
+ "version": "0.0.105",
4
4
  "description": "Create Plasmic-powered React apps",
5
5
  "main": "./dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
@@ -46,5 +46,5 @@
46
46
  "validate-npm-package-name": "^3.0.0",
47
47
  "yargs": "^16.2.0"
48
48
  },
49
- "gitHead": "74a85a4ad10be4a50c0fcc53f0d073763d018fb8"
49
+ "gitHead": "0c49eb5026b12b17d836be44234696d1f7560140"
50
50
  }
@@ -59,24 +59,20 @@ export const reactStrategy: CPAStrategy = {
59
59
  const { projectPath, jsOrTs } = args;
60
60
 
61
61
  if (jsOrTs === "ts") {
62
- const tsConfigJsonPath = path.join(projectPath, "tsconfig.app.json");
63
- let tsConfigJson = await fs.readFile(tsConfigJsonPath, "utf8");
64
-
65
- /* tsconfig.app.json has comments such as /* Bundler mode */ /* Linting */
66
- /* We need to remove them before parsing the json */
67
- tsConfigJson = tsConfigJson.replace(/\/\*[\s\S]*?\*\//g, "");
68
- tsConfigJson = tsConfigJson.replace(/\/\/.*$/gm, "");
69
-
70
- const tsConfig = JSON.parse(tsConfigJson);
71
- /* In our codegen, we have components where React is imported but not used, we need to
72
- turn off the `noUnusedLocals` rule to ensure the project builds successfully.
73
- */
74
- tsConfig.compilerOptions = {
75
- ...tsConfig.compilerOptions,
76
- noUnusedLocals: false,
77
- };
78
-
79
- await fs.writeFile(tsConfigJsonPath, JSON.stringify(tsConfig, null, 2));
62
+ const tsconfigPath = path.join(projectPath, "tsconfig.app.json");
63
+ let tsconfigContent = await fs.readFile(tsconfigPath, "utf8");
64
+ tsconfigContent = tsconfigContent
65
+ // Disable verbatimModuleSyntax
66
+ .replace(
67
+ `"verbatimModuleSyntax": true`,
68
+ `"verbatimModuleSyntax": false`
69
+ )
70
+ /* In our codegen, we have components where React is imported but not used, we need to
71
+ turn off the `noUnusedLocals` rule to ensure the project builds successfully.
72
+ */
73
+ .replace(`"noUnusedLocals": true`, `"noUnusedLocals": false`);
74
+
75
+ await fs.writeFile(tsconfigPath, tsconfigContent);
80
76
  }
81
77
  },
82
78
  generateFiles: async ({
@@ -4,7 +4,7 @@ import { spawnOrFail } from "../utils/cmd-utils";
4
4
  import { installCodegenDeps, runCodegenSync } from "../utils/codegen";
5
5
  import { deleteGlob } from "../utils/file-utils";
6
6
  import { CPAStrategy, GenerateFilesArgs } from "../utils/strategy";
7
- import { makeCustomAppConfig_file_router_codegen } from "./templates/file-router/config";
7
+ import { makeCustomViteConfig_file_router_codegen } from "./templates/file-router/config";
8
8
  import { makePlasmicHostPage_fileRouter_codegen } from "./templates/file-router/plasmic-host";
9
9
  import { makeCustomRoot_file_router_codegen } from "./templates/file-router/root";
10
10
 
@@ -50,8 +50,8 @@ export const tanstackStrategy: CPAStrategy = {
50
50
  */
51
51
  if (jsOrTs === "ts") {
52
52
  await fs.writeFile(
53
- path.join(projectPath, "app.config.ts"),
54
- makeCustomAppConfig_file_router_codegen()
53
+ path.join(projectPath, "vite.config.ts"),
54
+ makeCustomViteConfig_file_router_codegen()
55
55
  );
56
56
  }
57
57
  },
@@ -1,29 +1,29 @@
1
- export function makeCustomAppConfig_file_router_codegen(): string {
2
- return `import { defineConfig } from "@tanstack/react-start/config";
3
- import viteTsConfigPaths from "vite-tsconfig-paths";
4
- import tailwindcss from "@tailwindcss/vite";
1
+ export function makeCustomViteConfig_file_router_codegen(): string {
2
+ return `import { defineConfig } from 'vite'
3
+ import { tanstackStart } from '@tanstack/react-start/plugin/vite'
4
+ import viteTsConfigPaths from 'vite-tsconfig-paths'
5
+ import tailwindcss from '@tailwindcss/vite'
5
6
 
6
- export default defineConfig({
7
- tsr: {
8
- appDirectory: "src",
9
- },
10
- vite: {
11
- plugins: [
12
- // this is the plugin that enables path aliases
13
- viteTsConfigPaths({
14
- projects: ["./tsconfig.json"],
15
- }),
16
- tailwindcss(),
7
+ const config = defineConfig({
8
+ ssr: {
9
+ noExternal: [
10
+ "@plasmicapp/data-sources",
11
+ "@plasmicapp/data-sources-context",
12
+ "@plasmicapp/prepass",
13
+ "@plasmicapp/query",
14
+ "@plasmicapp/react-web",
17
15
  ],
18
- ssr: {
19
- noExternal: [
20
- "@plasmicapp/data-sources",
21
- "@plasmicapp/data-sources-context",
22
- "@plasmicapp/prepass",
23
- "@plasmicapp/query",
24
- "@plasmicapp/react-web",
25
- ],
26
- },
27
16
  },
28
- })`;
17
+ plugins: [
18
+ // this is the plugin that enables path aliases
19
+ viteTsConfigPaths({
20
+ projects: ['./tsconfig.json'],
21
+ }),
22
+ tailwindcss(),
23
+ tanstackStart(),
24
+ ],
25
+ })
26
+
27
+ export default config
28
+ `;
29
29
  }