create-plasmic-app 0.0.101 → 0.0.103

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.
@@ -24,7 +24,21 @@ const root_1 = require("./templates/file-router/root");
24
24
  exports.tanstackStrategy = {
25
25
  create: (args) => __awaiter(void 0, void 0, void 0, function* () {
26
26
  const { projectPath } = args;
27
- const createCommand = `npx create-tsrouter-app@latest ${projectPath} --template file-router --add-ons start`;
27
+ /* create-tsrouter-app package receives the projectName as an argument, when we provide a fullProjectPath, it creates
28
+ package.json with name having the fullProjectPath causing illegal characters in the name field error.
29
+
30
+ To avoid this behaviour, we will ensure the fullProjectPath exists
31
+ 1. we get the projectName (tanstack-codegen-ts), and parentDir (/private/tmp/cpa-out)
32
+ 2. change directory to parentDir and execute the command with projectName
33
+ */
34
+ const fullProjectPath = path_1.default.isAbsolute(projectPath)
35
+ ? projectPath
36
+ : path_1.default.resolve(process.cwd(), projectPath);
37
+ yield fs_1.promises.mkdir(fullProjectPath, { recursive: true });
38
+ const projectName = path_1.default.basename(fullProjectPath);
39
+ const parentDir = path_1.default.dirname(fullProjectPath);
40
+ process.chdir(parentDir);
41
+ const createCommand = `npx create-tsrouter-app@latest ${projectName} --template file-router --add-ons start`;
28
42
  yield (0, cmd_utils_1.spawnOrFail)(createCommand);
29
43
  }),
30
44
  installDeps: ({ scheme, projectPath }) => __awaiter(void 0, void 0, void 0, function* () {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeCustomRoot_file_router_codegen = void 0;
4
4
  function makeCustomRoot_file_router_codegen(_jsOrTs) {
5
- return `import { createRootRoute, HeadContent, Outlet, Scripts, Link } from '@tanstack/react-router'
5
+ return `import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router'
6
6
  import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
7
7
  import { PlasmicRootProvider } from "@plasmicapp/react-web"
8
8
  import appCss from "../styles.css?url";
@@ -18,7 +18,7 @@ export const Route = createRootRoute({
18
18
  }),
19
19
  component: () => (
20
20
  <RootDocument>
21
- <PlasmicRootProvider Link={Link}>
21
+ <PlasmicRootProvider>
22
22
  <Outlet />
23
23
  <TanStackRouterDevtools />
24
24
  </PlasmicRootProvider>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.101",
3
+ "version": "0.0.103",
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": "7199e5b0c2c94b6e95c81c8120d9861faf98d7ee"
49
+ "gitHead": "74a85a4ad10be4a50c0fcc53f0d073763d018fb8"
50
50
  }
@@ -11,7 +11,25 @@ import { makeCustomRoot_file_router_codegen } from "./templates/file-router/root
11
11
  export const tanstackStrategy: CPAStrategy = {
12
12
  create: async (args) => {
13
13
  const { projectPath } = args;
14
- const createCommand = `npx create-tsrouter-app@latest ${projectPath} --template file-router --add-ons start`;
14
+
15
+ /* create-tsrouter-app package receives the projectName as an argument, when we provide a fullProjectPath, it creates
16
+ package.json with name having the fullProjectPath causing illegal characters in the name field error.
17
+
18
+ To avoid this behaviour, we will ensure the fullProjectPath exists
19
+ 1. we get the projectName (tanstack-codegen-ts), and parentDir (/private/tmp/cpa-out)
20
+ 2. change directory to parentDir and execute the command with projectName
21
+ */
22
+ const fullProjectPath = path.isAbsolute(projectPath)
23
+ ? projectPath
24
+ : path.resolve(process.cwd(), projectPath);
25
+
26
+ await fs.mkdir(fullProjectPath, { recursive: true });
27
+
28
+ const projectName = path.basename(fullProjectPath);
29
+ const parentDir = path.dirname(fullProjectPath);
30
+ process.chdir(parentDir);
31
+
32
+ const createCommand = `npx create-tsrouter-app@latest ${projectName} --template file-router --add-ons start`;
15
33
 
16
34
  await spawnOrFail(createCommand);
17
35
  },
@@ -1,7 +1,7 @@
1
1
  import { JsOrTs } from "../../../utils/types";
2
2
 
3
3
  export function makeCustomRoot_file_router_codegen(_jsOrTs: JsOrTs): string {
4
- return `import { createRootRoute, HeadContent, Outlet, Scripts, Link } from '@tanstack/react-router'
4
+ return `import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router'
5
5
  import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
6
6
  import { PlasmicRootProvider } from "@plasmicapp/react-web"
7
7
  import appCss from "../styles.css?url";
@@ -17,7 +17,7 @@ export const Route = createRootRoute({
17
17
  }),
18
18
  component: () => (
19
19
  <RootDocument>
20
- <PlasmicRootProvider Link={Link}>
20
+ <PlasmicRootProvider>
21
21
  <Outlet />
22
22
  <TanStackRouterDevtools />
23
23
  </PlasmicRootProvider>