create-plasmic-app 0.0.37 → 0.0.38
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.
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const
|
|
15
|
+
const fs_1 = require("fs");
|
|
16
16
|
const path_1 = __importDefault(require("path"));
|
|
17
17
|
const nextjs_1 = require("../templates/nextjs");
|
|
18
18
|
const cmd_utils_1 = require("../utils/cmd-utils");
|
|
@@ -43,7 +43,7 @@ const nextjsStrategy = {
|
|
|
43
43
|
const { projectPath, scheme } = args;
|
|
44
44
|
if (scheme === "codegen") {
|
|
45
45
|
const nextjsConfigFile = path_1.default.join(projectPath, "next.config.js");
|
|
46
|
-
yield
|
|
46
|
+
yield fs_1.promises.writeFile(nextjsConfigFile, `
|
|
47
47
|
module.exports = {
|
|
48
48
|
eslint: {
|
|
49
49
|
ignoreDuringBuilds: true,
|
|
@@ -62,13 +62,13 @@ module.exports = {
|
|
|
62
62
|
const pagesPath = path_1.default.join(projectPath, "pages");
|
|
63
63
|
file_utils_1.deleteGlob(path_1.default.join(pagesPath, `*.*`));
|
|
64
64
|
const hostPage = path_1.default.join(pagesPath, `plasmic-host.${useTypescript ? "tsx" : "jsx"}`);
|
|
65
|
-
yield
|
|
65
|
+
yield fs_1.promises.writeFile(hostPage, nextjs_1.makeNextjsHostPage(scheme));
|
|
66
66
|
if (scheme === "loader") {
|
|
67
67
|
const initFile = path_1.default.join(projectPath, `plasmic-init.${useTypescript ? "ts" : "js"}`);
|
|
68
|
-
yield
|
|
68
|
+
yield fs_1.promises.writeFile(initFile, nextjs_1.makeNextjsInitPage(projectId, lang_utils_1.ensure(projectApiToken)));
|
|
69
69
|
// Write catch-all page for loader
|
|
70
70
|
const loaderPage = path_1.default.join(pagesPath, `[[...catchall]].${useTypescript ? "tsx" : "jsx"}`);
|
|
71
|
-
yield
|
|
71
|
+
yield fs_1.promises.writeFile(loaderPage, nextjs_1.makeNextjsCatchallPage(useTypescript ? "ts" : "js"));
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
74
|
yield common_1.runCodegenSync({
|
|
@@ -80,7 +80,7 @@ module.exports = {
|
|
|
80
80
|
yield file_utils_1.overwriteIndex(projectPath, "nextjs", scheme);
|
|
81
81
|
// Overwrite the wrapper files to wrap PlasmicRootProvider
|
|
82
82
|
const appFilePath = path_1.default.join(projectPath, "pages", `_app.js`);
|
|
83
|
-
yield
|
|
83
|
+
yield fs_1.promises.writeFile(appFilePath, nextjs_1.wrapAppRootForCodegen());
|
|
84
84
|
}
|
|
85
85
|
}),
|
|
86
86
|
build: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
package/package.json
CHANGED
package/src/strategies/nextjs.ts
CHANGED