create-plasmic-app 0.0.103 → 0.0.104

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.
@@ -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* () {
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.104",
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": "c3c2b6066619e1581b3bbf22aa3de1acb58d7d33"
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 ({