create-plasmic-app 0.0.74 → 0.0.76
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.
- package/dist/index.js +6 -4
- package/dist/nextjs/nextjs.d.ts +1 -1
- package/dist/nextjs/nextjs.js +22 -27
- package/package.json +2 -2
- package/src/index.ts +7 -6
- package/src/nextjs/nextjs.ts +41 -46
package/dist/index.js
CHANGED
|
@@ -169,7 +169,8 @@ function run() {
|
|
|
169
169
|
type: "list",
|
|
170
170
|
choices: () => [
|
|
171
171
|
{
|
|
172
|
-
name: "Next.js",
|
|
172
|
+
name: "Next.js (recommended)",
|
|
173
|
+
short: "Next.js",
|
|
173
174
|
value: "nextjs",
|
|
174
175
|
},
|
|
175
176
|
{
|
|
@@ -177,7 +178,8 @@ function run() {
|
|
|
177
178
|
value: "gatsby",
|
|
178
179
|
},
|
|
179
180
|
{
|
|
180
|
-
name: "Create React App",
|
|
181
|
+
name: "Create React App (advanced)",
|
|
182
|
+
short: "Create React App",
|
|
181
183
|
value: "react",
|
|
182
184
|
},
|
|
183
185
|
],
|
|
@@ -192,12 +194,12 @@ function run() {
|
|
|
192
194
|
type: "list",
|
|
193
195
|
choices: () => [
|
|
194
196
|
{
|
|
195
|
-
name: "PlasmicLoader
|
|
197
|
+
name: "PlasmicLoader (recommended default for most websites)",
|
|
196
198
|
short: "PlasmicLoader",
|
|
197
199
|
value: "loader",
|
|
198
200
|
},
|
|
199
201
|
{
|
|
200
|
-
name: "Codegen
|
|
202
|
+
name: "Codegen (advanced feature for building complex stateful apps)",
|
|
201
203
|
short: "Codegen",
|
|
202
204
|
value: "codegen",
|
|
203
205
|
},
|
package/dist/nextjs/nextjs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CPAStrategy } from
|
|
1
|
+
import { CPAStrategy } from "../utils/strategy";
|
|
2
2
|
export declare const nextjsStrategy: CPAStrategy;
|
package/dist/nextjs/nextjs.js
CHANGED
|
@@ -36,9 +36,9 @@ exports.nextjsStrategy = {
|
|
|
36
36
|
const { projectPath, template, jsOrTs, platformOptions } = args;
|
|
37
37
|
const typescriptArg = `--${jsOrTs}`;
|
|
38
38
|
const experimentalAppArg = ((_a = platformOptions.nextjs) === null || _a === void 0 ? void 0 : _a.appDir)
|
|
39
|
-
?
|
|
40
|
-
:
|
|
41
|
-
const templateArg = template ? ` --template ${template}` :
|
|
39
|
+
? "--app"
|
|
40
|
+
: "--no-app";
|
|
41
|
+
const templateArg = template ? ` --template ${template}` : "";
|
|
42
42
|
const createCommand = `npx create-next-app@latest ${projectPath} ${typescriptArg} ${experimentalAppArg} ${templateArg}` +
|
|
43
43
|
` --eslint --no-src-dir --import-alias "@/*" --no-tailwind`;
|
|
44
44
|
// Default Next.js starter already supports Typescript
|
|
@@ -46,13 +46,8 @@ exports.nextjsStrategy = {
|
|
|
46
46
|
yield (0, cmd_utils_1.spawnOrFail)(createCommand);
|
|
47
47
|
}),
|
|
48
48
|
installDeps: ({ scheme, projectPath }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
yield (0, npm_utils_1.installUpgrade)('next@13.3.0', {
|
|
52
|
-
workingDir: projectPath,
|
|
53
|
-
});
|
|
54
|
-
if (scheme === 'loader') {
|
|
55
|
-
return yield (0, npm_utils_1.installUpgrade)('@plasmicapp/loader-nextjs', {
|
|
49
|
+
if (scheme === "loader") {
|
|
50
|
+
return yield (0, npm_utils_1.installUpgrade)("@plasmicapp/loader-nextjs", {
|
|
56
51
|
workingDir: projectPath,
|
|
57
52
|
});
|
|
58
53
|
}
|
|
@@ -63,14 +58,14 @@ exports.nextjsStrategy = {
|
|
|
63
58
|
overwriteConfig: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
59
|
var _b;
|
|
65
60
|
const { projectPath, scheme, platformOptions } = args;
|
|
66
|
-
const nextjsConfigFile = path_1.default.join(projectPath,
|
|
61
|
+
const nextjsConfigFile = path_1.default.join(projectPath, "next.config.js");
|
|
67
62
|
const appDirOption = ((_b = platformOptions.nextjs) === null || _b === void 0 ? void 0 : _b.appDir)
|
|
68
63
|
? `
|
|
69
64
|
experimental: {
|
|
70
65
|
appDir: true,
|
|
71
66
|
}`
|
|
72
|
-
:
|
|
73
|
-
if (scheme ===
|
|
67
|
+
: "";
|
|
68
|
+
if (scheme === "codegen") {
|
|
74
69
|
yield fs_1.promises.writeFile(nextjsConfigFile, `
|
|
75
70
|
/** @type {import('next').NextConfig} */
|
|
76
71
|
const nextConfig = {
|
|
@@ -113,37 +108,37 @@ function generateFilesAppDir(args) {
|
|
|
113
108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
109
|
const { projectPath, jsOrTs, projectId, projectApiToken } = args;
|
|
115
110
|
// Delete existing pages
|
|
116
|
-
(0, file_utils_1.deleteGlob)(path_1.default.join(projectPath,
|
|
111
|
+
(0, file_utils_1.deleteGlob)(path_1.default.join(projectPath, "app", "page.*"));
|
|
117
112
|
// ./plasmic-init.ts
|
|
118
113
|
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `plasmic-init.${jsOrTs}`), (0, plasmic_init_1.makePlasmicInit_app_loader)(projectId, (0, lang_utils_1.ensure)(projectApiToken)));
|
|
119
114
|
// ./plasmic-init-client.ts
|
|
120
115
|
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `plasmic-init-client.${jsOrTs}x`), (0, plasmic_init_client_1.makePlasmicInitClient_app_loader)(jsOrTs));
|
|
121
116
|
// ./app/plasmic-host/page.tsx
|
|
122
|
-
yield fs_1.promises.mkdir(path_1.default.join(projectPath,
|
|
123
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
117
|
+
yield fs_1.promises.mkdir(path_1.default.join(projectPath, "app", "plasmic-host"));
|
|
118
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "app", "plasmic-host", `page.${jsOrTs}x`), (0, plasmic_host_1.makePlasmicHostPage_app_loader)());
|
|
124
119
|
// ./app/[[...catchall]]/page.tsx
|
|
125
|
-
yield fs_1.promises.mkdir(path_1.default.join(projectPath,
|
|
126
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
120
|
+
yield fs_1.promises.mkdir(path_1.default.join(projectPath, "app", "[[...catchall]]"));
|
|
121
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "app", "[[...catchall]]", `page.${jsOrTs}x`), (0, catchall_page_1.makeCatchallPage_app_loader)(jsOrTs));
|
|
127
122
|
});
|
|
128
123
|
}
|
|
129
124
|
function generateFilesPagesDir(args) {
|
|
130
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
126
|
const { projectPath, scheme, jsOrTs, projectId, projectApiToken } = args;
|
|
132
127
|
// Delete existing pages
|
|
133
|
-
(0, file_utils_1.deleteGlob)(path_1.default.join(projectPath,
|
|
134
|
-
if (scheme ===
|
|
128
|
+
(0, file_utils_1.deleteGlob)(path_1.default.join(projectPath, "pages", "*.*"));
|
|
129
|
+
if (scheme === "loader") {
|
|
135
130
|
// ./plasmic-init.ts
|
|
136
131
|
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `plasmic-init.${jsOrTs}`), (0, plasmic_init_2.makePlasmicInit_pages_loader)(projectId, (0, lang_utils_1.ensure)(projectApiToken)));
|
|
137
132
|
// ./pages/plasmic-host.tsx
|
|
138
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
133
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "pages", `plasmic-host.${jsOrTs}x`), (0, plasmic_host_3.makePlasmicHostPage_pages_loader)());
|
|
139
134
|
// ./pages/[[...catchall]].tsx
|
|
140
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
135
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "pages", `[[...catchall]].${jsOrTs}x`), (0, catchall_page_2.makeCatchallPage_pages_loader)(jsOrTs));
|
|
141
136
|
}
|
|
142
137
|
else {
|
|
143
138
|
// ./pages/_app.tsx
|
|
144
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
139
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "pages", `_app.${jsOrTs}x`), (0, app_1.makeCustomApp_pages_codegen)(jsOrTs));
|
|
145
140
|
// ./pages/plasmic-host.tsx
|
|
146
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
141
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "pages", `plasmic-host.${jsOrTs}x`), (0, plasmic_host_2.makePlasmicHostPage_pages_codegen)());
|
|
147
142
|
// This should generate
|
|
148
143
|
// ./plasmic.json
|
|
149
144
|
// ./pages/index.tsx
|
|
@@ -154,10 +149,10 @@ function generateFilesPagesDir(args) {
|
|
|
154
149
|
projectPath,
|
|
155
150
|
});
|
|
156
151
|
// Make an index page if the project didn't have one.
|
|
157
|
-
const config = yield (0, file_utils_1.getPlasmicConfig)(projectPath,
|
|
152
|
+
const config = yield (0, file_utils_1.getPlasmicConfig)(projectPath, "nextjs", scheme);
|
|
158
153
|
const plasmicFiles = lodash_1.default.map(lodash_1.default.flatMap(config.projects, (p) => p.components), (c) => c.importSpec.modulePath);
|
|
159
|
-
if (!plasmicFiles.find((f) => f.includes(
|
|
160
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath,
|
|
154
|
+
if (!plasmicFiles.find((f) => f.includes("/index."))) {
|
|
155
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "pages", `index.${jsOrTs}x`), (0, file_utils_1.generateWelcomePage)(config, "nextjs"));
|
|
161
156
|
}
|
|
162
157
|
}
|
|
163
158
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-plasmic-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"description": "Create Plasmic-powered React apps",
|
|
5
5
|
"main": "./dist/lib.js",
|
|
6
6
|
"types": "./dist/lib.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"validate-npm-package-name": "^3.0.0",
|
|
55
55
|
"yargs": "^16.2.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "e9389d3457fefb5a2e1f3079956325912c556799"
|
|
58
58
|
}
|
package/src/index.ts
CHANGED
|
@@ -65,8 +65,7 @@ const argv = yargs
|
|
|
65
65
|
|
|
66
66
|
// Initialize Sentry
|
|
67
67
|
Sentry.init({
|
|
68
|
-
dsn:
|
|
69
|
-
"https://0d602108de7f44aa9470a41cc069395f@o328029.ingest.sentry.io/5679926",
|
|
68
|
+
dsn: "https://0d602108de7f44aa9470a41cc069395f@o328029.ingest.sentry.io/5679926",
|
|
70
69
|
});
|
|
71
70
|
Sentry.configureScope((scope) => {
|
|
72
71
|
//scope.setUser({ email: auth.user });
|
|
@@ -152,7 +151,8 @@ async function run(): Promise<void> {
|
|
|
152
151
|
type: "list",
|
|
153
152
|
choices: () => [
|
|
154
153
|
{
|
|
155
|
-
name: "Next.js",
|
|
154
|
+
name: "Next.js (recommended)",
|
|
155
|
+
short: "Next.js",
|
|
156
156
|
value: "nextjs",
|
|
157
157
|
},
|
|
158
158
|
{
|
|
@@ -160,7 +160,8 @@ async function run(): Promise<void> {
|
|
|
160
160
|
value: "gatsby",
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
-
name: "Create React App",
|
|
163
|
+
name: "Create React App (advanced)",
|
|
164
|
+
short: "Create React App",
|
|
164
165
|
value: "react",
|
|
165
166
|
},
|
|
166
167
|
],
|
|
@@ -177,12 +178,12 @@ async function run(): Promise<void> {
|
|
|
177
178
|
type: "list",
|
|
178
179
|
choices: () => [
|
|
179
180
|
{
|
|
180
|
-
name: "PlasmicLoader
|
|
181
|
+
name: "PlasmicLoader (recommended default for most websites)",
|
|
181
182
|
short: "PlasmicLoader",
|
|
182
183
|
value: "loader",
|
|
183
184
|
},
|
|
184
185
|
{
|
|
185
|
-
name: "Codegen
|
|
186
|
+
name: "Codegen (advanced feature for building complex stateful apps)",
|
|
186
187
|
short: "Codegen",
|
|
187
188
|
value: "codegen",
|
|
188
189
|
},
|
package/src/nextjs/nextjs.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { promises as fs } from
|
|
2
|
-
import L from
|
|
3
|
-
import path from
|
|
4
|
-
import { spawnOrFail } from
|
|
5
|
-
import { installCodegenDeps, runCodegenSync } from
|
|
1
|
+
import { promises as fs } from "fs";
|
|
2
|
+
import L from "lodash";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { spawnOrFail } from "../utils/cmd-utils";
|
|
5
|
+
import { installCodegenDeps, runCodegenSync } from "../utils/codegen";
|
|
6
6
|
import {
|
|
7
7
|
deleteGlob,
|
|
8
8
|
generateWelcomePage,
|
|
9
9
|
getPlasmicConfig,
|
|
10
|
-
} from
|
|
11
|
-
import { ensure } from
|
|
12
|
-
import { installUpgrade } from
|
|
13
|
-
import { CPAStrategy, GenerateFilesArgs } from
|
|
14
|
-
import { makeCatchallPage_app_loader } from
|
|
15
|
-
import { makePlasmicHostPage_app_loader } from
|
|
16
|
-
import { makePlasmicInit_app_loader } from
|
|
17
|
-
import { makePlasmicInitClient_app_loader } from
|
|
18
|
-
import { makeCustomApp_pages_codegen } from
|
|
19
|
-
import { makePlasmicHostPage_pages_codegen } from
|
|
20
|
-
import { makeCatchallPage_pages_loader } from
|
|
21
|
-
import { makePlasmicHostPage_pages_loader } from
|
|
22
|
-
import { makePlasmicInit_pages_loader } from
|
|
10
|
+
} from "../utils/file-utils";
|
|
11
|
+
import { ensure } from "../utils/lang-utils";
|
|
12
|
+
import { installUpgrade } from "../utils/npm-utils";
|
|
13
|
+
import { CPAStrategy, GenerateFilesArgs } from "../utils/strategy";
|
|
14
|
+
import { makeCatchallPage_app_loader } from "./templates/app-loader/catchall-page";
|
|
15
|
+
import { makePlasmicHostPage_app_loader } from "./templates/app-loader/plasmic-host";
|
|
16
|
+
import { makePlasmicInit_app_loader } from "./templates/app-loader/plasmic-init";
|
|
17
|
+
import { makePlasmicInitClient_app_loader } from "./templates/app-loader/plasmic-init-client";
|
|
18
|
+
import { makeCustomApp_pages_codegen } from "./templates/pages-codegen/app";
|
|
19
|
+
import { makePlasmicHostPage_pages_codegen } from "./templates/pages-codegen/plasmic-host";
|
|
20
|
+
import { makeCatchallPage_pages_loader } from "./templates/pages-loader/catchall-page";
|
|
21
|
+
import { makePlasmicHostPage_pages_loader } from "./templates/pages-loader/plasmic-host";
|
|
22
|
+
import { makePlasmicInit_pages_loader } from "./templates/pages-loader/plasmic-init";
|
|
23
23
|
|
|
24
24
|
export const nextjsStrategy: CPAStrategy = {
|
|
25
25
|
create: async (args) => {
|
|
26
26
|
const { projectPath, template, jsOrTs, platformOptions } = args;
|
|
27
27
|
const typescriptArg = `--${jsOrTs}`;
|
|
28
28
|
const experimentalAppArg = platformOptions.nextjs?.appDir
|
|
29
|
-
?
|
|
30
|
-
:
|
|
31
|
-
const templateArg = template ? ` --template ${template}` :
|
|
29
|
+
? "--app"
|
|
30
|
+
: "--no-app";
|
|
31
|
+
const templateArg = template ? ` --template ${template}` : "";
|
|
32
32
|
const createCommand =
|
|
33
33
|
`npx create-next-app@latest ${projectPath} ${typescriptArg} ${experimentalAppArg} ${templateArg}` +
|
|
34
34
|
` --eslint --no-src-dir --import-alias "@/*" --no-tailwind`;
|
|
@@ -38,13 +38,8 @@ export const nextjsStrategy: CPAStrategy = {
|
|
|
38
38
|
await spawnOrFail(createCommand);
|
|
39
39
|
},
|
|
40
40
|
installDeps: async ({ scheme, projectPath }) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
await installUpgrade('next@13.3.0', {
|
|
44
|
-
workingDir: projectPath,
|
|
45
|
-
});
|
|
46
|
-
if (scheme === 'loader') {
|
|
47
|
-
return await installUpgrade('@plasmicapp/loader-nextjs', {
|
|
41
|
+
if (scheme === "loader") {
|
|
42
|
+
return await installUpgrade("@plasmicapp/loader-nextjs", {
|
|
48
43
|
workingDir: projectPath,
|
|
49
44
|
});
|
|
50
45
|
} else {
|
|
@@ -53,14 +48,14 @@ export const nextjsStrategy: CPAStrategy = {
|
|
|
53
48
|
},
|
|
54
49
|
overwriteConfig: async (args) => {
|
|
55
50
|
const { projectPath, scheme, platformOptions } = args;
|
|
56
|
-
const nextjsConfigFile = path.join(projectPath,
|
|
51
|
+
const nextjsConfigFile = path.join(projectPath, "next.config.js");
|
|
57
52
|
const appDirOption = platformOptions.nextjs?.appDir
|
|
58
53
|
? `
|
|
59
54
|
experimental: {
|
|
60
55
|
appDir: true,
|
|
61
56
|
}`
|
|
62
|
-
:
|
|
63
|
-
if (scheme ===
|
|
57
|
+
: "";
|
|
58
|
+
if (scheme === "codegen") {
|
|
64
59
|
await fs.writeFile(
|
|
65
60
|
nextjsConfigFile,
|
|
66
61
|
`
|
|
@@ -107,7 +102,7 @@ async function generateFilesAppDir(args: GenerateFilesArgs) {
|
|
|
107
102
|
const { projectPath, jsOrTs, projectId, projectApiToken } = args;
|
|
108
103
|
|
|
109
104
|
// Delete existing pages
|
|
110
|
-
deleteGlob(path.join(projectPath,
|
|
105
|
+
deleteGlob(path.join(projectPath, "app", "page.*"));
|
|
111
106
|
|
|
112
107
|
// ./plasmic-init.ts
|
|
113
108
|
await fs.writeFile(
|
|
@@ -122,16 +117,16 @@ async function generateFilesAppDir(args: GenerateFilesArgs) {
|
|
|
122
117
|
);
|
|
123
118
|
|
|
124
119
|
// ./app/plasmic-host/page.tsx
|
|
125
|
-
await fs.mkdir(path.join(projectPath,
|
|
120
|
+
await fs.mkdir(path.join(projectPath, "app", "plasmic-host"));
|
|
126
121
|
await fs.writeFile(
|
|
127
|
-
path.join(projectPath,
|
|
122
|
+
path.join(projectPath, "app", "plasmic-host", `page.${jsOrTs}x`),
|
|
128
123
|
makePlasmicHostPage_app_loader()
|
|
129
124
|
);
|
|
130
125
|
|
|
131
126
|
// ./app/[[...catchall]]/page.tsx
|
|
132
|
-
await fs.mkdir(path.join(projectPath,
|
|
127
|
+
await fs.mkdir(path.join(projectPath, "app", "[[...catchall]]"));
|
|
133
128
|
await fs.writeFile(
|
|
134
|
-
path.join(projectPath,
|
|
129
|
+
path.join(projectPath, "app", "[[...catchall]]", `page.${jsOrTs}x`),
|
|
135
130
|
makeCatchallPage_app_loader(jsOrTs)
|
|
136
131
|
);
|
|
137
132
|
}
|
|
@@ -140,9 +135,9 @@ async function generateFilesPagesDir(args: GenerateFilesArgs) {
|
|
|
140
135
|
const { projectPath, scheme, jsOrTs, projectId, projectApiToken } = args;
|
|
141
136
|
|
|
142
137
|
// Delete existing pages
|
|
143
|
-
deleteGlob(path.join(projectPath,
|
|
138
|
+
deleteGlob(path.join(projectPath, "pages", "*.*"));
|
|
144
139
|
|
|
145
|
-
if (scheme ===
|
|
140
|
+
if (scheme === "loader") {
|
|
146
141
|
// ./plasmic-init.ts
|
|
147
142
|
await fs.writeFile(
|
|
148
143
|
path.join(projectPath, `plasmic-init.${jsOrTs}`),
|
|
@@ -151,25 +146,25 @@ async function generateFilesPagesDir(args: GenerateFilesArgs) {
|
|
|
151
146
|
|
|
152
147
|
// ./pages/plasmic-host.tsx
|
|
153
148
|
await fs.writeFile(
|
|
154
|
-
path.join(projectPath,
|
|
149
|
+
path.join(projectPath, "pages", `plasmic-host.${jsOrTs}x`),
|
|
155
150
|
makePlasmicHostPage_pages_loader()
|
|
156
151
|
);
|
|
157
152
|
|
|
158
153
|
// ./pages/[[...catchall]].tsx
|
|
159
154
|
await fs.writeFile(
|
|
160
|
-
path.join(projectPath,
|
|
155
|
+
path.join(projectPath, "pages", `[[...catchall]].${jsOrTs}x`),
|
|
161
156
|
makeCatchallPage_pages_loader(jsOrTs)
|
|
162
157
|
);
|
|
163
158
|
} else {
|
|
164
159
|
// ./pages/_app.tsx
|
|
165
160
|
await fs.writeFile(
|
|
166
|
-
path.join(projectPath,
|
|
161
|
+
path.join(projectPath, "pages", `_app.${jsOrTs}x`),
|
|
167
162
|
makeCustomApp_pages_codegen(jsOrTs)
|
|
168
163
|
);
|
|
169
164
|
|
|
170
165
|
// ./pages/plasmic-host.tsx
|
|
171
166
|
await fs.writeFile(
|
|
172
|
-
path.join(projectPath,
|
|
167
|
+
path.join(projectPath, "pages", `plasmic-host.${jsOrTs}x`),
|
|
173
168
|
makePlasmicHostPage_pages_codegen()
|
|
174
169
|
);
|
|
175
170
|
|
|
@@ -184,15 +179,15 @@ async function generateFilesPagesDir(args: GenerateFilesArgs) {
|
|
|
184
179
|
});
|
|
185
180
|
|
|
186
181
|
// Make an index page if the project didn't have one.
|
|
187
|
-
const config = await getPlasmicConfig(projectPath,
|
|
182
|
+
const config = await getPlasmicConfig(projectPath, "nextjs", scheme);
|
|
188
183
|
const plasmicFiles = L.map(
|
|
189
184
|
L.flatMap(config.projects, (p) => p.components),
|
|
190
185
|
(c) => c.importSpec.modulePath
|
|
191
186
|
);
|
|
192
|
-
if (!plasmicFiles.find((f) => f.includes(
|
|
187
|
+
if (!plasmicFiles.find((f) => f.includes("/index."))) {
|
|
193
188
|
await fs.writeFile(
|
|
194
|
-
path.join(projectPath,
|
|
195
|
-
generateWelcomePage(config,
|
|
189
|
+
path.join(projectPath, "pages", `index.${jsOrTs}x`),
|
|
190
|
+
generateWelcomePage(config, "nextjs")
|
|
196
191
|
);
|
|
197
192
|
}
|
|
198
193
|
}
|