create-plasmic-app 0.0.167 → 0.0.169
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/README.internal.md +6 -4
- package/cpa-out/gatsby-codegen-js/package.json +3 -2
- package/cpa-out/gatsby-codegen-js/plasmic.json +5 -8
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicButton.jsx +12 -12
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +18 -18
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +12 -16
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.jsx +1 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.jsx +2 -2
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/{plasmic.module.css → plasmic.css} +89 -73
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/{plasmic__default_style.module.css → plasmic__default_style.css} +16 -0
- package/cpa-out/gatsby-codegen-ts/package.json +3 -2
- package/cpa-out/gatsby-codegen-ts/plasmic.json +5 -8
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicButton.tsx +12 -12
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +18 -18
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +12 -16
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicRandomDynamicPageButton.tsx +1 -1
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicStyleTokensProvider.tsx +2 -2
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/{plasmic.module.css → plasmic.css} +89 -73
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/{plasmic__default_style.module.css → plasmic__default_style.css} +16 -0
- package/cpa-out/gatsby-loader-js/package.json +1 -1
- package/cpa-out/gatsby-loader-ts/package.json +1 -1
- package/cpa-out/nextjs-app-codegen-js/app/dynamic/[slug]/page.jsx +5 -5
- package/cpa-out/nextjs-app-codegen-js/app/robots.js +24 -0
- package/cpa-out/nextjs-app-codegen-js/app/sitemap.js +38 -0
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.jsx +2 -2
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/nextjs-app-codegen-js/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/nextjs-app-codegen-js/package.json +7 -6
- package/cpa-out/nextjs-app-codegen-js/plasmic.json +3 -6
- package/cpa-out/nextjs-app-codegen-ts/app/dynamic/[slug]/page.tsx +8 -11
- package/cpa-out/nextjs-app-codegen-ts/app/page.tsx +4 -4
- package/cpa-out/nextjs-app-codegen-ts/app/robots.ts +25 -0
- package/cpa-out/nextjs-app-codegen-ts/app/sitemap.ts +41 -0
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPageServer.tsx +7 -13
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepageServer.tsx +5 -11
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/nextjs-app-codegen-ts/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/nextjs-app-codegen-ts/package.json +7 -6
- package/cpa-out/nextjs-app-codegen-ts/plasmic.json +3 -6
- package/cpa-out/nextjs-app-loader-js/app/robots.js +24 -0
- package/cpa-out/nextjs-app-loader-js/app/sitemap.js +29 -0
- package/cpa-out/nextjs-app-loader-js/package.json +5 -5
- package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +1 -5
- package/cpa-out/nextjs-app-loader-ts/app/robots.ts +25 -0
- package/cpa-out/nextjs-app-loader-ts/app/sitemap.ts +30 -0
- package/cpa-out/nextjs-app-loader-ts/package.json +5 -5
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/nextjs-pages-codegen-js/package.json +7 -6
- package/cpa-out/nextjs-pages-codegen-js/pages/robots.txt.js +25 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/sitemap.xml.js +53 -0
- package/cpa-out/nextjs-pages-codegen-js/plasmic.json +3 -6
- package/cpa-out/nextjs-pages-codegen-js/styles/Home.module.css +8 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/nextjs-pages-codegen-ts/package.json +7 -6
- package/cpa-out/nextjs-pages-codegen-ts/pages/robots.txt.ts +27 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/sitemap.xml.ts +56 -0
- package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +3 -6
- package/cpa-out/nextjs-pages-codegen-ts/styles/Home.module.css +8 -0
- package/cpa-out/nextjs-pages-loader-js/package.json +5 -5
- package/cpa-out/nextjs-pages-loader-js/pages/robots.txt.js +25 -0
- package/cpa-out/nextjs-pages-loader-js/pages/sitemap.xml.js +46 -0
- package/cpa-out/nextjs-pages-loader-js/styles/Home.module.css +8 -0
- package/cpa-out/nextjs-pages-loader-ts/package.json +5 -5
- package/cpa-out/nextjs-pages-loader-ts/pages/robots.txt.ts +27 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/sitemap.xml.ts +47 -0
- package/cpa-out/nextjs-pages-loader-ts/styles/Home.module.css +8 -0
- package/cpa-out/react-codegen-js/package.json +3 -2
- package/cpa-out/react-codegen-js/plasmic.json +3 -6
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.jsx +2 -2
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/react-codegen-js/src/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/react-codegen-ts/package.json +3 -2
- package/cpa-out/react-codegen-ts/plasmic.json +3 -6
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +2 -2
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/plasmic.css +16 -0
- package/cpa-out/react-codegen-ts/src/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/tanstack-codegen-ts/package.json +8 -13
- package/cpa-out/tanstack-codegen-ts/plasmic.json +3 -6
- package/cpa-out/tanstack-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicDynamicPage.tsx +3 -3
- package/cpa-out/tanstack-codegen-ts/src/components/plasmic/plasmic__default_style.css +16 -0
- package/cpa-out/tanstack-codegen-ts/src/routeTree.gen.ts +13 -13
- package/cpa-out/tanstack-codegen-ts/src/routes/dynamic/$slug/index.tsx +2 -2
- package/dist/gatsby/gatsby.js +23 -17
- package/dist/index.js +6 -0
- package/dist/lib.d.ts +2 -1
- package/dist/lib.js +9 -4
- package/dist/nextjs/nextjs.js +30 -6
- package/dist/nextjs/templates/app-seo.d.ts +4 -0
- package/dist/nextjs/templates/app-seo.js +92 -0
- package/dist/nextjs/templates/pages-seo.d.ts +4 -0
- package/dist/nextjs/templates/pages-seo.js +121 -0
- package/dist/react/react.js +9 -4
- package/dist/tanstack/tanstack.js +12 -5
- package/dist/utils/codegen.d.ts +3 -0
- package/dist/utils/codegen.js +17 -4
- package/dist/utils/file-utils.d.ts +2 -2
- package/dist/utils/file-utils.js +2 -1
- package/dist/utils/npm-utils.d.ts +24 -9
- package/dist/utils/npm-utils.js +66 -21
- package/dist/utils/strategy.d.ts +5 -1
- package/dist/utils/types.d.ts +1 -0
- package/package.json +2 -4
- package/run-cpa.ts +17 -6
- package/src/gatsby/gatsby.ts +40 -22
- package/src/index.ts +9 -0
- package/src/lib.ts +18 -6
- package/src/nextjs/nextjs.ts +85 -7
- package/src/nextjs/templates/app-seo.ts +104 -0
- package/src/nextjs/templates/pages-seo.ts +131 -0
- package/src/react/react.ts +11 -4
- package/src/tanstack/tanstack.ts +19 -6
- package/src/utils/codegen.ts +28 -6
- package/src/utils/file-utils.ts +6 -2
- package/src/utils/npm-utils.ts +76 -23
- package/src/utils/strategy.ts +10 -1
- package/src/utils/types.ts +1 -0
package/dist/utils/npm-utils.js
CHANGED
|
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
35
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
36
|
};
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.
|
|
38
|
+
exports.initYarnBerryProject = exports.packageManagerExec = exports.packageManagerCommand = exports.resolvePackageManager = exports.installUpgrade = exports.spawn = exports.checkEngineStrict = exports.updateNotify = void 0;
|
|
39
39
|
/*eslint
|
|
40
40
|
@typescript-eslint/no-var-requires: 0,
|
|
41
41
|
*/
|
|
@@ -97,7 +97,7 @@ exports.spawn = spawn;
|
|
|
97
97
|
* @param opts
|
|
98
98
|
* @returns
|
|
99
99
|
*/
|
|
100
|
-
function installUpgrade(pkg, opts
|
|
100
|
+
function installUpgrade(pkg, opts) {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
const cmd = installCommand(pkg, opts);
|
|
103
103
|
const r = yield spawn(cmd, opts.workingDir);
|
|
@@ -118,8 +118,8 @@ exports.installUpgrade = installUpgrade;
|
|
|
118
118
|
* @param opts
|
|
119
119
|
* @returns
|
|
120
120
|
*/
|
|
121
|
-
function installCommand(pkg, opts
|
|
122
|
-
const mgr =
|
|
121
|
+
function installCommand(pkg, opts) {
|
|
122
|
+
const mgr = opts.packageManager;
|
|
123
123
|
if (mgr === "yarn") {
|
|
124
124
|
if (opts.global) {
|
|
125
125
|
return `yarn global add ${pkg}`;
|
|
@@ -131,6 +131,17 @@ function installCommand(pkg, opts = {}) {
|
|
|
131
131
|
return `yarn add --ignore-scripts -W ${pkg}`;
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
+
else if (mgr === "yarn2") {
|
|
135
|
+
if (opts.global) {
|
|
136
|
+
return `npm install -g ${pkg}`;
|
|
137
|
+
}
|
|
138
|
+
else if (opts.dev) {
|
|
139
|
+
return `yarn add -D ${pkg}`;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return `yarn add ${pkg}`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
134
145
|
else if (mgr === "pnpm") {
|
|
135
146
|
if (opts.global) {
|
|
136
147
|
return `pnpm add -g ${pkg}`;
|
|
@@ -155,25 +166,59 @@ function installCommand(pkg, opts = {}) {
|
|
|
155
166
|
}
|
|
156
167
|
}
|
|
157
168
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
169
|
+
* The package manager to install with: the one requested, else the one we were run
|
|
170
|
+
* with. `npx` overwrites npm_config_user_agent, so this must be read before spawning
|
|
171
|
+
* nested create commands.
|
|
161
172
|
*/
|
|
162
|
-
function
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const pnpmLock = (0, fs_1.existsSync)(path_1.default.join(dir ? dir : "", "pnpm-lock.yaml"));
|
|
169
|
-
if (yarnLock) {
|
|
170
|
-
return "yarn";
|
|
173
|
+
function resolvePackageManager(requested) {
|
|
174
|
+
var _a;
|
|
175
|
+
if (requested) {
|
|
176
|
+
return requested === "yarn"
|
|
177
|
+
? yarnVariant(installedYarnVersion())
|
|
178
|
+
: requested;
|
|
171
179
|
}
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
const [name, version] = ((_a = process.env.npm_config_user_agent) !== null && _a !== void 0 ? _a : "")
|
|
181
|
+
.split(" ")[0]
|
|
182
|
+
.split("/");
|
|
183
|
+
if (name === "yarn") {
|
|
184
|
+
return yarnVariant(version);
|
|
174
185
|
}
|
|
175
|
-
|
|
176
|
-
|
|
186
|
+
return name === "pnpm" ? "pnpm" : "npm";
|
|
187
|
+
}
|
|
188
|
+
exports.resolvePackageManager = resolvePackageManager;
|
|
189
|
+
function yarnVariant(version) {
|
|
190
|
+
const parsed = version ? semver.coerce(version) : null;
|
|
191
|
+
return parsed && parsed.major >= 2 ? "yarn2" : "yarn";
|
|
192
|
+
}
|
|
193
|
+
function installedYarnVersion() {
|
|
194
|
+
try {
|
|
195
|
+
return execa.commandSync("yarn --version").stdout.trim();
|
|
196
|
+
}
|
|
197
|
+
catch (_a) {
|
|
198
|
+
return undefined;
|
|
177
199
|
}
|
|
178
200
|
}
|
|
179
|
-
|
|
201
|
+
/** Scaffolders and run scripts only know the `yarn` command. */
|
|
202
|
+
function packageManagerCommand(mgr) {
|
|
203
|
+
return mgr === "yarn2" ? "yarn" : mgr;
|
|
204
|
+
}
|
|
205
|
+
exports.packageManagerCommand = packageManagerCommand;
|
|
206
|
+
/** Run a locally installed bin. `npx` can't see Yarn Berry's PnP installs. */
|
|
207
|
+
function packageManagerExec(mgr) {
|
|
208
|
+
const cmd = packageManagerCommand(mgr);
|
|
209
|
+
return cmd === "yarn" ? "yarn" : cmd === "pnpm" ? "pnpm exec" : "npx";
|
|
210
|
+
}
|
|
211
|
+
exports.packageManagerExec = packageManagerExec;
|
|
212
|
+
/**
|
|
213
|
+
* Make a freshly scaffolded app its own Yarn Berry project. Without a lockfile Berry
|
|
214
|
+
* claims the app for the nearest ancestor project, and its default PnP linker can't
|
|
215
|
+
* load CommonJS from Node 24's ESM resolver (EBADF), which breaks every framework we
|
|
216
|
+
* scaffold. Must run before anything invokes yarn in `projectPath`.
|
|
217
|
+
*/
|
|
218
|
+
function initYarnBerryProject(projectPath) {
|
|
219
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
220
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, "yarn.lock"), "");
|
|
221
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, ".yarnrc.yml"), "nodeLinker: node-modules\n");
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
exports.initYarnBerryProject = initYarnBerryProject;
|
package/dist/utils/strategy.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { JsOrTs, PlatformOptions, SchemeType } from "./types";
|
|
1
|
+
import { JsOrTs, PackageManagerType, PlatformOptions, SchemeType } from "./types";
|
|
2
2
|
export interface CreateArgs {
|
|
3
3
|
projectPath: string;
|
|
4
|
+
projectId: string;
|
|
4
5
|
template?: string;
|
|
5
6
|
jsOrTs: JsOrTs;
|
|
6
7
|
platformOptions: PlatformOptions;
|
|
8
|
+
packageManager: PackageManagerType;
|
|
7
9
|
}
|
|
8
10
|
export interface ConfigArgs {
|
|
9
11
|
projectId: string;
|
|
@@ -20,6 +22,7 @@ export interface GenerateFilesArgs {
|
|
|
20
22
|
projectId: string;
|
|
21
23
|
projectApiToken: string | undefined;
|
|
22
24
|
platformOptions: PlatformOptions;
|
|
25
|
+
packageManager: PackageManagerType;
|
|
23
26
|
}
|
|
24
27
|
export interface BuildArgs {
|
|
25
28
|
projectPath: string;
|
|
@@ -29,6 +32,7 @@ export interface InstallArgs {
|
|
|
29
32
|
scheme: SchemeType;
|
|
30
33
|
projectPath: string;
|
|
31
34
|
jsOrTs: JsOrTs;
|
|
35
|
+
packageManager: PackageManagerType;
|
|
32
36
|
}
|
|
33
37
|
export interface CPAStrategy {
|
|
34
38
|
create: (args: CreateArgs) => Promise<void>;
|
package/dist/utils/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-plasmic-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.169",
|
|
4
4
|
"description": "Create Plasmic-powered React apps",
|
|
5
5
|
"homepage": "https://www.plasmic.app",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
"prepublishOnly": "npm run build"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@types/findup-sync": "^2.0.2",
|
|
30
29
|
"@types/glob": "^7.2.0",
|
|
31
30
|
"@types/inquirer": "^8.2.13",
|
|
32
31
|
"@types/jest": "^26.0.24",
|
|
@@ -43,7 +42,6 @@
|
|
|
43
42
|
"@sentry/node": "^6.2.2",
|
|
44
43
|
"chalk": "^4.1.0",
|
|
45
44
|
"execa": "^5.0.0",
|
|
46
|
-
"findup-sync": "^4.0.0",
|
|
47
45
|
"glob": "^7.1.6",
|
|
48
46
|
"inquirer": "^8.2.7",
|
|
49
47
|
"lodash": "^4.17.21",
|
|
@@ -53,5 +51,5 @@
|
|
|
53
51
|
"validate-npm-package-name": "^3.0.0",
|
|
54
52
|
"yargs": "^16.2.2"
|
|
55
53
|
},
|
|
56
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "7f76620882c336ba308f271d23136b42a2ac1744"
|
|
57
55
|
}
|
package/run-cpa.ts
CHANGED
|
@@ -3,7 +3,11 @@ import * as inquirer from "inquirer";
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import yargs from "yargs";
|
|
5
5
|
import { spawnOrFail } from "./src/utils/cmd-utils";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
PackageManagerType,
|
|
8
|
+
PlatformType,
|
|
9
|
+
SchemeType,
|
|
10
|
+
} from "./src/utils/types";
|
|
7
11
|
|
|
8
12
|
// https://studio.plasmic.app/projects/47tFXWjN2C4NyHFGGpaYQ3
|
|
9
13
|
const projectId = "47tFXWjN2C4NyHFGGpaYQ3";
|
|
@@ -60,12 +64,17 @@ async function run() {
|
|
|
60
64
|
`Runs create-plasmic-app with predefined sets of args for you.
|
|
61
65
|
|
|
62
66
|
Valid arg sets:\n\tall\n\t${allArgSetNames.join("\n\t")}`,
|
|
63
|
-
(yargs2) =>
|
|
67
|
+
(yargs2) =>
|
|
68
|
+
yargs2.option("package-manager", {
|
|
69
|
+
describe: "Package manager to scaffold and build with",
|
|
70
|
+
choices: ["npm", "yarn", "pnpm"],
|
|
71
|
+
default: "npm",
|
|
72
|
+
})
|
|
64
73
|
);
|
|
65
74
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
const cliArgv = yargsCommand.strict().argv;
|
|
76
|
+
const packageManager = cliArgv["package-manager"] as PackageManagerType;
|
|
77
|
+
const cliArgSetNames = cliArgv["arg-sets"] as string[] | undefined;
|
|
69
78
|
|
|
70
79
|
// If arg sets were not passed in via CLI args, prompt for them.
|
|
71
80
|
const selectedArgSetNames =
|
|
@@ -123,11 +132,13 @@ Valid arg sets:\n\tall\n\t${allArgSetNames.join("\n\t")}`,
|
|
|
123
132
|
`--scheme=${argSet.scheme}`,
|
|
124
133
|
`--typescript=${argSet.typescript}`,
|
|
125
134
|
`--projectId=${projectId}`,
|
|
135
|
+
`--packageManager=${packageManager}`,
|
|
126
136
|
].join(" ");
|
|
127
137
|
|
|
128
138
|
const cpa = path.resolve("dist/index.js");
|
|
129
139
|
// this probably only works on *nix systems, sorry :(
|
|
130
|
-
const
|
|
140
|
+
const runCmd = packageManager === "yarn" ? "yarn" : `${packageManager} run`;
|
|
141
|
+
const cmd = `mkdir -p ${tmpOutDir} && cd ${tmpOutDir} && node ${cpa} ${projectName} ${options} && cd ${projectName} && ${runCmd} build`;
|
|
131
142
|
await spawnOrFail(cmd);
|
|
132
143
|
|
|
133
144
|
const tmpProjectDir = path.join(tmpOutDir, projectName);
|
package/src/gatsby/gatsby.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getPlasmicConfig,
|
|
10
10
|
} from "../utils/file-utils";
|
|
11
11
|
import { ensure } from "../utils/lang-utils";
|
|
12
|
-
import { installUpgrade } from "../utils/npm-utils";
|
|
12
|
+
import { initYarnBerryProject, installUpgrade } from "../utils/npm-utils";
|
|
13
13
|
import { CPAStrategy } from "../utils/strategy";
|
|
14
14
|
import {
|
|
15
15
|
GATSBY_404,
|
|
@@ -29,7 +29,7 @@ export const GATSBY_TEMPLATES = {
|
|
|
29
29
|
|
|
30
30
|
export const gatsbyStrategy: CPAStrategy = {
|
|
31
31
|
create: async (args) => {
|
|
32
|
-
const { projectPath, template, jsOrTs } = args;
|
|
32
|
+
const { projectPath, projectId, template, jsOrTs, packageManager } = args;
|
|
33
33
|
if (template) {
|
|
34
34
|
console.log(
|
|
35
35
|
`Warning: Ignoring template '${template}' (argument is not supported by Gatsby).`
|
|
@@ -38,24 +38,47 @@ export const gatsbyStrategy: CPAStrategy = {
|
|
|
38
38
|
const gatsbyTemplate = GATSBY_TEMPLATES[jsOrTs];
|
|
39
39
|
const createCommand = `git clone ${gatsbyTemplate} ${projectPath} --recursive --depth 1 --quiet`;
|
|
40
40
|
await spawnOrFail(`${createCommand}`);
|
|
41
|
-
// Remove .
|
|
42
|
-
await spawnOrFail(
|
|
43
|
-
|
|
41
|
+
// Remove package-lock.json since the user might be using a different package manager
|
|
42
|
+
await spawnOrFail(
|
|
43
|
+
`rm -rf ${projectPath}/.git ${projectPath}/LICENSE ${projectPath}/package-lock.json`
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Rename before installing; Yarn Berry rejects `yarn run` once the lockfile's
|
|
47
|
+
// workspace name no longer matches package.json
|
|
48
|
+
const packageJsonPath = path.join(projectPath, "package.json");
|
|
49
|
+
const packageJsonObject = JSON.parse(
|
|
50
|
+
await fs.readFile(packageJsonPath, "utf8")
|
|
51
|
+
);
|
|
52
|
+
packageJsonObject.name = path.basename(projectPath);
|
|
53
|
+
packageJsonObject.description = `Plasmic app for ${projectId}`;
|
|
54
|
+
delete packageJsonObject.license;
|
|
55
|
+
delete packageJsonObject.author;
|
|
56
|
+
await fs.writeFile(
|
|
57
|
+
packageJsonPath,
|
|
58
|
+
JSON.stringify(packageJsonObject, null, 2)
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (packageManager === "yarn2") {
|
|
62
|
+
await initYarnBerryProject(projectPath);
|
|
63
|
+
}
|
|
44
64
|
},
|
|
45
|
-
installDeps: async ({ projectPath, scheme, jsOrTs }) => {
|
|
65
|
+
installDeps: async ({ projectPath, scheme, jsOrTs, packageManager }) => {
|
|
46
66
|
const installedHelmet = await installUpgrade("react-helmet", {
|
|
47
67
|
workingDir: projectPath,
|
|
68
|
+
packageManager,
|
|
48
69
|
});
|
|
49
70
|
const installedHelmetTypes =
|
|
50
71
|
jsOrTs === "js" ||
|
|
51
72
|
(await installUpgrade("@types/react-helmet", {
|
|
52
73
|
workingDir: projectPath,
|
|
53
74
|
dev: true,
|
|
75
|
+
packageManager,
|
|
54
76
|
}));
|
|
55
77
|
const installedHelmetPlugin = await installUpgrade(
|
|
56
78
|
"gatsby-plugin-react-helmet",
|
|
57
79
|
{
|
|
58
80
|
workingDir: projectPath,
|
|
81
|
+
packageManager,
|
|
59
82
|
}
|
|
60
83
|
);
|
|
61
84
|
if (!installedHelmet || !installedHelmetPlugin || !installedHelmetTypes) {
|
|
@@ -65,27 +88,14 @@ export const gatsbyStrategy: CPAStrategy = {
|
|
|
65
88
|
if (scheme === "loader") {
|
|
66
89
|
return await installUpgrade("@plasmicapp/loader-gatsby", {
|
|
67
90
|
workingDir: projectPath,
|
|
91
|
+
packageManager,
|
|
68
92
|
});
|
|
69
93
|
} else {
|
|
70
|
-
return await installCodegenDeps({ projectPath });
|
|
94
|
+
return await installCodegenDeps({ projectPath, packageManager });
|
|
71
95
|
}
|
|
72
96
|
},
|
|
73
97
|
overwriteConfig: async (args) => {
|
|
74
98
|
const { projectId, projectPath, projectApiToken, jsOrTs, scheme } = args;
|
|
75
|
-
const packageName = path.basename(projectPath);
|
|
76
|
-
|
|
77
|
-
// Update package.json: adding name and description, removing license and author
|
|
78
|
-
const packageJsonPath = path.join(projectPath, "package.json");
|
|
79
|
-
const packageJson = await fs.readFile(packageJsonPath, "utf8");
|
|
80
|
-
const packageJsonObject = JSON.parse(packageJson);
|
|
81
|
-
packageJsonObject.name = packageName;
|
|
82
|
-
packageJsonObject.description = `Plasmic app for ${projectId}`;
|
|
83
|
-
delete packageJsonObject.license;
|
|
84
|
-
delete packageJsonObject.author;
|
|
85
|
-
await fs.writeFile(
|
|
86
|
-
packageJsonPath,
|
|
87
|
-
JSON.stringify(packageJsonObject, null, 2)
|
|
88
|
-
);
|
|
89
99
|
|
|
90
100
|
if (scheme === "loader") {
|
|
91
101
|
const gatsbyConfigFile = path.join(
|
|
@@ -105,7 +115,14 @@ export const gatsbyStrategy: CPAStrategy = {
|
|
|
105
115
|
generateFiles: async (args) => {
|
|
106
116
|
// in gatsby we can delete all existing pages/components, since all pages are going
|
|
107
117
|
// to be handled by templates/defaultPlasmicPage
|
|
108
|
-
const {
|
|
118
|
+
const {
|
|
119
|
+
projectId,
|
|
120
|
+
projectApiToken,
|
|
121
|
+
projectPath,
|
|
122
|
+
jsOrTs,
|
|
123
|
+
scheme,
|
|
124
|
+
packageManager,
|
|
125
|
+
} = args;
|
|
109
126
|
|
|
110
127
|
deleteGlob(path.join(projectPath, "src/@(pages|components|templates)/*.*"));
|
|
111
128
|
|
|
@@ -157,6 +174,7 @@ export const gatsbyStrategy: CPAStrategy = {
|
|
|
157
174
|
projectId,
|
|
158
175
|
projectApiToken,
|
|
159
176
|
projectPath,
|
|
177
|
+
packageManager,
|
|
160
178
|
});
|
|
161
179
|
|
|
162
180
|
// Special case: remove all Gatsby components (due to conflicting file names)
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { ensure } from "./utils/lang-utils";
|
|
|
10
10
|
import { checkEngineStrict, updateNotify } from "./utils/npm-utils";
|
|
11
11
|
import {
|
|
12
12
|
JsOrTs,
|
|
13
|
+
PackageManagerType,
|
|
13
14
|
PlatformOptions,
|
|
14
15
|
PlatformType,
|
|
15
16
|
SchemeType,
|
|
@@ -64,6 +65,10 @@ const argv = yargs
|
|
|
64
65
|
describe: "(Next.js) Use app directory?",
|
|
65
66
|
boolean: true,
|
|
66
67
|
})
|
|
68
|
+
.option("packageManager", {
|
|
69
|
+
describe: "Package manager to scaffold and install with",
|
|
70
|
+
choices: ["", "npm", "yarn", "pnpm"],
|
|
71
|
+
})
|
|
67
72
|
.strict()
|
|
68
73
|
.help("h")
|
|
69
74
|
.alias("h", "help")
|
|
@@ -256,6 +261,9 @@ What is the URL of your project?`,
|
|
|
256
261
|
|
|
257
262
|
const template = argv["template"];
|
|
258
263
|
const projectApiToken = argv["projectApiToken"];
|
|
264
|
+
const packageManager = (argv["packageManager"] || undefined) as
|
|
265
|
+
| PackageManagerType
|
|
266
|
+
| undefined;
|
|
259
267
|
|
|
260
268
|
// Set the metadata environment variable to tag the future Segment codegen event
|
|
261
269
|
setMetadataEnv({
|
|
@@ -270,6 +278,7 @@ What is the URL of your project?`,
|
|
|
270
278
|
jsOrTs,
|
|
271
279
|
projectApiToken,
|
|
272
280
|
template,
|
|
281
|
+
packageManager,
|
|
273
282
|
});
|
|
274
283
|
}
|
|
275
284
|
|
package/src/lib.ts
CHANGED
|
@@ -3,10 +3,15 @@ import chalk from "chalk";
|
|
|
3
3
|
import * as path from "upath";
|
|
4
4
|
import validateProjectName from "validate-npm-package-name";
|
|
5
5
|
import { ensureTsconfig, overwriteReadme } from "./utils/file-utils";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
packageManagerCommand,
|
|
8
|
+
packageManagerExec,
|
|
9
|
+
resolvePackageManager,
|
|
10
|
+
} from "./utils/npm-utils";
|
|
7
11
|
import { CPAStrategy } from "./utils/strategy";
|
|
8
12
|
import {
|
|
9
13
|
JsOrTs,
|
|
14
|
+
PackageManagerType,
|
|
10
15
|
PlatformOptions,
|
|
11
16
|
PlatformType,
|
|
12
17
|
SchemeType,
|
|
@@ -34,6 +39,7 @@ export interface CreatePlasmicAppArgs {
|
|
|
34
39
|
jsOrTs: JsOrTs;
|
|
35
40
|
projectApiToken?: string;
|
|
36
41
|
template?: string;
|
|
42
|
+
packageManager?: PackageManagerType;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
@@ -47,6 +53,7 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
|
47
53
|
template,
|
|
48
54
|
} = args;
|
|
49
55
|
let { projectApiToken } = args;
|
|
56
|
+
const packageManager = resolvePackageManager(args.packageManager);
|
|
50
57
|
console.log("Let's get started! Here's what we'll do: ");
|
|
51
58
|
console.log("1. Authenticate with Plasmic");
|
|
52
59
|
console.log("2. Create a React/Next/Gatsby repo");
|
|
@@ -87,16 +94,18 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
|
87
94
|
// Create project using strategy for platform
|
|
88
95
|
await cpaStrategy.create({
|
|
89
96
|
projectPath: resolvedProjectPath,
|
|
97
|
+
projectId,
|
|
90
98
|
jsOrTs,
|
|
91
99
|
template,
|
|
92
100
|
platformOptions,
|
|
101
|
+
packageManager,
|
|
93
102
|
});
|
|
94
103
|
|
|
95
104
|
// Ensure that we have a empty tsconfig and @types packages.
|
|
96
105
|
// Gatsby and Next.js by default support typescript handling internally
|
|
97
106
|
// tsconfig so we don't have to ensure it.
|
|
98
107
|
if (jsOrTs === "ts" && platform === "react") {
|
|
99
|
-
await ensureTsconfig(resolvedProjectPath);
|
|
108
|
+
await ensureTsconfig(resolvedProjectPath, packageManager);
|
|
100
109
|
}
|
|
101
110
|
|
|
102
111
|
// Make sure we have an api token for loader
|
|
@@ -113,6 +122,7 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
|
113
122
|
scheme,
|
|
114
123
|
projectPath: resolvedProjectPath,
|
|
115
124
|
jsOrTs,
|
|
125
|
+
packageManager,
|
|
116
126
|
});
|
|
117
127
|
|
|
118
128
|
if (!installResult) {
|
|
@@ -137,14 +147,14 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
|
137
147
|
projectId,
|
|
138
148
|
projectApiToken,
|
|
139
149
|
platformOptions,
|
|
150
|
+
packageManager,
|
|
140
151
|
});
|
|
141
152
|
|
|
142
153
|
/**
|
|
143
154
|
* INSTRUCT USER ON NEXT STEPS
|
|
144
155
|
*/
|
|
145
|
-
const
|
|
146
|
-
const npmRunCmd =
|
|
147
|
-
pkgMgr === "yarn" ? "yarn" : pkgMgr === "pnpm" ? "pnpm run" : "npm run";
|
|
156
|
+
const pmCmd = packageManagerCommand(packageManager);
|
|
157
|
+
const npmRunCmd = pmCmd === "yarn" ? "yarn" : `${pmCmd} run`;
|
|
148
158
|
const command =
|
|
149
159
|
platform === "nextjs"
|
|
150
160
|
? `${npmRunCmd} dev`
|
|
@@ -183,7 +193,9 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
|
183
193
|
console.log(
|
|
184
194
|
"To watch for changes in Plasmic components, in a separate terminal run:"
|
|
185
195
|
);
|
|
186
|
-
console.log(
|
|
196
|
+
console.log(
|
|
197
|
+
chalk.bold(`${packageManagerExec(packageManager)} plasmic watch`)
|
|
198
|
+
);
|
|
187
199
|
}
|
|
188
200
|
}
|
|
189
201
|
|
package/src/nextjs/nextjs.ts
CHANGED
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
getPlasmicConfig,
|
|
11
11
|
} from "../utils/file-utils";
|
|
12
12
|
import { ensure } from "../utils/lang-utils";
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
initYarnBerryProject,
|
|
15
|
+
installUpgrade,
|
|
16
|
+
packageManagerCommand,
|
|
17
|
+
} from "../utils/npm-utils";
|
|
14
18
|
import { CPAStrategy, GenerateFilesArgs } from "../utils/strategy";
|
|
15
19
|
import { PlasmicCssImport } from "../utils/types";
|
|
16
20
|
import { makeLayout_app_codegen } from "./templates/app-codegen/layout";
|
|
@@ -20,36 +24,58 @@ import { makeCatchallPage_app_loader } from "./templates/app-loader/catchall-pag
|
|
|
20
24
|
import { makePlasmicHostPage_app_loader } from "./templates/app-loader/plasmic-host";
|
|
21
25
|
import { makePlasmicInit_app_loader } from "./templates/app-loader/plasmic-init";
|
|
22
26
|
import { makePlasmicInitClient_app_loader } from "./templates/app-loader/plasmic-init-client";
|
|
27
|
+
import {
|
|
28
|
+
makeRobots_app,
|
|
29
|
+
makeSitemap_app_codegen,
|
|
30
|
+
makeSitemap_app_loader,
|
|
31
|
+
} from "./templates/app-seo";
|
|
23
32
|
import { makeCustomApp_pages_codegen } from "./templates/pages-codegen/app";
|
|
24
33
|
import { makePlasmicHostPage_pages_codegen } from "./templates/pages-codegen/plasmic-host";
|
|
25
34
|
import { makeCatchallPage_pages_loader } from "./templates/pages-loader/catchall-page";
|
|
26
35
|
import { makePlasmicHostPage_pages_loader } from "./templates/pages-loader/plasmic-host";
|
|
27
36
|
import { makePlasmicInit_pages_loader } from "./templates/pages-loader/plasmic-init";
|
|
37
|
+
import {
|
|
38
|
+
makeRobots_pages,
|
|
39
|
+
makeSitemap_pages_codegen,
|
|
40
|
+
makeSitemap_pages_loader,
|
|
41
|
+
} from "./templates/pages-seo";
|
|
28
42
|
|
|
29
43
|
export const nextjsStrategy: CPAStrategy = {
|
|
30
44
|
create: async (args) => {
|
|
31
|
-
const { projectPath, template, jsOrTs, platformOptions } =
|
|
45
|
+
const { projectPath, template, jsOrTs, platformOptions, packageManager } =
|
|
46
|
+
args;
|
|
32
47
|
const typescriptArg = `--${jsOrTs}`;
|
|
33
48
|
const experimentalAppArg = platformOptions.nextjs?.appDir
|
|
34
49
|
? "--app"
|
|
35
50
|
: "--no-app";
|
|
36
51
|
const templateArg = template ? ` --example ${template}` : "";
|
|
52
|
+
const isYarnBerry = packageManager === "yarn2";
|
|
37
53
|
// NOTE: Not using create-next-app@latest to keep major version bumps deliberate
|
|
38
54
|
const createCommand =
|
|
39
55
|
`npx create-next-app@16 ${projectPath} ${typescriptArg} ${experimentalAppArg} ${templateArg}` +
|
|
40
|
-
` --
|
|
56
|
+
` --use-${packageManagerCommand(
|
|
57
|
+
packageManager
|
|
58
|
+
)} --eslint --no-src-dir --import-alias "@/*" --no-tailwind` +
|
|
59
|
+
// Berry must install into the project we set up below, not the default PnP one
|
|
60
|
+
(isYarnBerry ? " --skip-install" : "");
|
|
41
61
|
|
|
42
62
|
// Default Next.js starter already supports Typescript
|
|
43
63
|
// See where we `touch tsconfig.json` later on
|
|
44
64
|
await spawnOrFail(createCommand);
|
|
65
|
+
|
|
66
|
+
if (isYarnBerry) {
|
|
67
|
+
await initYarnBerryProject(projectPath);
|
|
68
|
+
await spawnOrFail("yarn install", projectPath);
|
|
69
|
+
}
|
|
45
70
|
},
|
|
46
|
-
installDeps: async ({ scheme, projectPath }) => {
|
|
71
|
+
installDeps: async ({ scheme, projectPath, packageManager }) => {
|
|
47
72
|
if (scheme === "loader") {
|
|
48
73
|
return await installUpgrade("@plasmicapp/loader-nextjs", {
|
|
49
74
|
workingDir: projectPath,
|
|
75
|
+
packageManager,
|
|
50
76
|
});
|
|
51
77
|
} else {
|
|
52
|
-
return await installCodegenDeps({ projectPath });
|
|
78
|
+
return await installCodegenDeps({ projectPath, packageManager });
|
|
53
79
|
}
|
|
54
80
|
},
|
|
55
81
|
overwriteConfig: async (args) => {
|
|
@@ -119,11 +145,24 @@ a {
|
|
|
119
145
|
}
|
|
120
146
|
|
|
121
147
|
async function generateFilesAppDir(args: GenerateFilesArgs) {
|
|
122
|
-
const {
|
|
148
|
+
const {
|
|
149
|
+
projectPath,
|
|
150
|
+
scheme,
|
|
151
|
+
jsOrTs,
|
|
152
|
+
projectId,
|
|
153
|
+
projectApiToken,
|
|
154
|
+
packageManager,
|
|
155
|
+
} = args;
|
|
123
156
|
|
|
124
157
|
// Delete existing pages
|
|
125
158
|
deleteGlob(path.join(projectPath, "app", "page.*"));
|
|
126
159
|
|
|
160
|
+
// ./app/robots.ts
|
|
161
|
+
await fs.writeFile(
|
|
162
|
+
path.join(projectPath, "app", `robots.${jsOrTs}`),
|
|
163
|
+
makeRobots_app(jsOrTs)
|
|
164
|
+
);
|
|
165
|
+
|
|
127
166
|
if (scheme === "loader") {
|
|
128
167
|
// ./plasmic-init.ts
|
|
129
168
|
await fs.writeFile(
|
|
@@ -153,6 +192,12 @@ async function generateFilesAppDir(args: GenerateFilesArgs) {
|
|
|
153
192
|
path.join(projectPath, "app", "[[...catchall]]", `page.${jsOrTs}x`),
|
|
154
193
|
makeCatchallPage_app_loader(jsOrTs)
|
|
155
194
|
);
|
|
195
|
+
|
|
196
|
+
// ./app/sitemap.ts
|
|
197
|
+
await fs.writeFile(
|
|
198
|
+
path.join(projectPath, "app", `sitemap.${jsOrTs}`),
|
|
199
|
+
makeSitemap_app_loader(jsOrTs)
|
|
200
|
+
);
|
|
156
201
|
} else {
|
|
157
202
|
// ./plasmic-init-client.tsx
|
|
158
203
|
await fs.writeFile(
|
|
@@ -175,8 +220,15 @@ async function generateFilesAppDir(args: GenerateFilesArgs) {
|
|
|
175
220
|
projectId,
|
|
176
221
|
projectApiToken,
|
|
177
222
|
projectPath,
|
|
223
|
+
packageManager,
|
|
178
224
|
});
|
|
179
225
|
|
|
226
|
+
// ./app/sitemap.ts
|
|
227
|
+
await fs.writeFile(
|
|
228
|
+
path.join(projectPath, "app", `sitemap.${jsOrTs}`),
|
|
229
|
+
makeSitemap_app_codegen(jsOrTs)
|
|
230
|
+
);
|
|
231
|
+
|
|
180
232
|
// Read plasmic.json so we can wire each top-level project's plasmic.css
|
|
181
233
|
// import directly into the root layout template.
|
|
182
234
|
const config = await getPlasmicConfig(projectPath, "nextjs", scheme);
|
|
@@ -211,11 +263,24 @@ async function generateFilesAppDir(args: GenerateFilesArgs) {
|
|
|
211
263
|
}
|
|
212
264
|
|
|
213
265
|
async function generateFilesPagesDir(args: GenerateFilesArgs) {
|
|
214
|
-
const {
|
|
266
|
+
const {
|
|
267
|
+
projectPath,
|
|
268
|
+
scheme,
|
|
269
|
+
jsOrTs,
|
|
270
|
+
projectId,
|
|
271
|
+
projectApiToken,
|
|
272
|
+
packageManager,
|
|
273
|
+
} = args;
|
|
215
274
|
|
|
216
275
|
// Delete existing pages
|
|
217
276
|
deleteGlob(path.join(projectPath, "pages", "*.*"));
|
|
218
277
|
|
|
278
|
+
// ./pages/robots.txt.ts
|
|
279
|
+
await fs.writeFile(
|
|
280
|
+
path.join(projectPath, "pages", `robots.txt.${jsOrTs}`),
|
|
281
|
+
makeRobots_pages(jsOrTs)
|
|
282
|
+
);
|
|
283
|
+
|
|
219
284
|
if (scheme === "loader") {
|
|
220
285
|
// ./plasmic-init.ts
|
|
221
286
|
await fs.writeFile(
|
|
@@ -237,6 +302,12 @@ async function generateFilesPagesDir(args: GenerateFilesArgs) {
|
|
|
237
302
|
path.join(projectPath, "pages", `[[...catchall]].${jsOrTs}x`),
|
|
238
303
|
makeCatchallPage_pages_loader(jsOrTs)
|
|
239
304
|
);
|
|
305
|
+
|
|
306
|
+
// ./pages/sitemap.xml.ts
|
|
307
|
+
await fs.writeFile(
|
|
308
|
+
path.join(projectPath, "pages", `sitemap.xml.${jsOrTs}`),
|
|
309
|
+
makeSitemap_pages_loader(jsOrTs)
|
|
310
|
+
);
|
|
240
311
|
} else {
|
|
241
312
|
// ./pages/plasmic-host.tsx
|
|
242
313
|
await fs.writeFile(
|
|
@@ -252,8 +323,15 @@ async function generateFilesPagesDir(args: GenerateFilesArgs) {
|
|
|
252
323
|
projectId,
|
|
253
324
|
projectApiToken,
|
|
254
325
|
projectPath,
|
|
326
|
+
packageManager,
|
|
255
327
|
});
|
|
256
328
|
|
|
329
|
+
// ./pages/sitemap.xml.ts
|
|
330
|
+
await fs.writeFile(
|
|
331
|
+
path.join(projectPath, "pages", `sitemap.xml.${jsOrTs}`),
|
|
332
|
+
makeSitemap_pages_codegen(jsOrTs)
|
|
333
|
+
);
|
|
334
|
+
|
|
257
335
|
// Read plasmic.json so we can wire each top-level project's plasmic.css
|
|
258
336
|
// import directly into the _app template.
|
|
259
337
|
const config = await getPlasmicConfig(projectPath, "nextjs", scheme);
|