create-plasmic-app 0.0.69 → 0.0.71
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/lib.js +1 -1
- package/dist/utils/file-utils.js +1 -1
- package/dist/utils/npm-utils.d.ts +1 -1
- package/dist/utils/npm-utils.js +15 -0
- package/package.json +2 -2
- package/src/lib.ts +2 -1
- package/src/utils/file-utils.ts +1 -1
- package/src/utils/npm-utils.ts +12 -1
package/dist/lib.js
CHANGED
|
@@ -141,7 +141,7 @@ function create(args) {
|
|
|
141
141
|
* INSTRUCT USER ON NEXT STEPS
|
|
142
142
|
*/
|
|
143
143
|
const pkgMgr = (0, npm_utils_1.detectPackageManager)(resolvedProjectPath);
|
|
144
|
-
const npmRunCmd = pkgMgr === "yarn" ? "yarn" : "npm run";
|
|
144
|
+
const npmRunCmd = pkgMgr === "yarn" ? "yarn" : pkgMgr === "pnpm" ? "pnpm run" : "npm run";
|
|
145
145
|
const command = platform === "nextjs"
|
|
146
146
|
? `${npmRunCmd} dev`
|
|
147
147
|
: platform === "gatsby"
|
package/dist/utils/file-utils.js
CHANGED
|
@@ -144,7 +144,7 @@ function generateWelcomePage(config, platform) {
|
|
|
144
144
|
// Format as an absolute path without the extension name
|
|
145
145
|
const relativeLink = "/" + stripExtension(relativePath);
|
|
146
146
|
if (platform === "nextjs") {
|
|
147
|
-
return `<li><Link href="${relativeLink}"
|
|
147
|
+
return `<li><Link href="${relativeLink}">${pc.name} - ${relativeLink}</Link></li>`;
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
150
|
return `<li><a style={{ color: "blue" }} href="${relativeLink}">${pc.name} - ${relativeLink}</a></li>`;
|
package/dist/utils/npm-utils.js
CHANGED
|
@@ -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 === "pnpm") {
|
|
135
|
+
if (opts.global) {
|
|
136
|
+
return `pnpm install -g ${pkg}`;
|
|
137
|
+
}
|
|
138
|
+
else if (opts.dev) {
|
|
139
|
+
return `pnpm install --dev --ignore-scripts ${pkg}`;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
return `pnpm install --ignore-scripts ${pkg}`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
134
145
|
else {
|
|
135
146
|
if (opts.global) {
|
|
136
147
|
return `npm install -g ${pkg}`;
|
|
@@ -154,9 +165,13 @@ function detectPackageManager(dir) {
|
|
|
154
165
|
// uses npm, so if the user has some yarn.lock in a parent directory it's
|
|
155
166
|
// going to run yarn commands, this is going to trigger an error with sharp
|
|
156
167
|
const yarnLock = (0, fs_1.existsSync)(path_1.default.join(dir ? dir : "", "yarn.lock"));
|
|
168
|
+
const pnpmLock = (0, fs_1.existsSync)(path_1.default.join(dir ? dir : "", "pnpm-lock.yaml"));
|
|
157
169
|
if (yarnLock) {
|
|
158
170
|
return "yarn";
|
|
159
171
|
}
|
|
172
|
+
else if (pnpmLock) {
|
|
173
|
+
return "pnpm";
|
|
174
|
+
}
|
|
160
175
|
else {
|
|
161
176
|
return "npm";
|
|
162
177
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-plasmic-app",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.71",
|
|
4
4
|
"description": "Create Plasmic-powered React apps",
|
|
5
5
|
"main": "./dist/lib.js",
|
|
6
6
|
"types": "./dist/lib.d.ts",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"validate-npm-package-name": "^3.0.0",
|
|
56
56
|
"yargs": "^16.2.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "98577cdd374585ea4ed032c13828316c6e2cf186"
|
|
59
59
|
}
|
package/src/lib.ts
CHANGED
|
@@ -141,7 +141,8 @@ export async function create(args: CreatePlasmicAppArgs): Promise<void> {
|
|
|
141
141
|
* INSTRUCT USER ON NEXT STEPS
|
|
142
142
|
*/
|
|
143
143
|
const pkgMgr = detectPackageManager(resolvedProjectPath);
|
|
144
|
-
const npmRunCmd =
|
|
144
|
+
const npmRunCmd =
|
|
145
|
+
pkgMgr === "yarn" ? "yarn" : pkgMgr === "pnpm" ? "pnpm run" : "npm run";
|
|
145
146
|
const command =
|
|
146
147
|
platform === "nextjs"
|
|
147
148
|
? `${npmRunCmd} dev`
|
package/src/utils/file-utils.ts
CHANGED
|
@@ -128,7 +128,7 @@ export function generateWelcomePage(config: any, platform: string): string {
|
|
|
128
128
|
// Format as an absolute path without the extension name
|
|
129
129
|
const relativeLink = "/" + stripExtension(relativePath);
|
|
130
130
|
if (platform === "nextjs") {
|
|
131
|
-
return `<li><Link href="${relativeLink}"
|
|
131
|
+
return `<li><Link href="${relativeLink}">${pc.name} - ${relativeLink}</Link></li>`;
|
|
132
132
|
} else {
|
|
133
133
|
return `<li><a style={{ color: "blue" }} href="${relativeLink}">${pc.name} - ${relativeLink}</a></li>`;
|
|
134
134
|
}
|
package/src/utils/npm-utils.ts
CHANGED
|
@@ -96,6 +96,14 @@ function installCommand(
|
|
|
96
96
|
} else {
|
|
97
97
|
return `yarn add --ignore-scripts -W ${pkg}`;
|
|
98
98
|
}
|
|
99
|
+
} else if (mgr === "pnpm") {
|
|
100
|
+
if (opts.global) {
|
|
101
|
+
return `pnpm install -g ${pkg}`;
|
|
102
|
+
} else if (opts.dev) {
|
|
103
|
+
return `pnpm install --dev --ignore-scripts ${pkg}`;
|
|
104
|
+
} else {
|
|
105
|
+
return `pnpm install --ignore-scripts ${pkg}`;
|
|
106
|
+
}
|
|
99
107
|
} else {
|
|
100
108
|
if (opts.global) {
|
|
101
109
|
return `npm install -g ${pkg}`;
|
|
@@ -112,15 +120,18 @@ function installCommand(
|
|
|
112
120
|
* @param dir
|
|
113
121
|
* @returns
|
|
114
122
|
*/
|
|
115
|
-
export function detectPackageManager(dir?: string): "yarn" | "npm" {
|
|
123
|
+
export function detectPackageManager(dir?: string): "yarn" | "pnpm" | "npm" {
|
|
116
124
|
// We should look only inside the directory instead of looking to the ancestors
|
|
117
125
|
// with findupSync, the reason for this is that the current gatsby template
|
|
118
126
|
// uses npm, so if the user has some yarn.lock in a parent directory it's
|
|
119
127
|
// going to run yarn commands, this is going to trigger an error with sharp
|
|
120
128
|
|
|
121
129
|
const yarnLock = existsSync(path.join(dir ? dir : "", "yarn.lock"));
|
|
130
|
+
const pnpmLock = existsSync(path.join(dir ? dir : "", "pnpm-lock.yaml"));
|
|
122
131
|
if (yarnLock) {
|
|
123
132
|
return "yarn";
|
|
133
|
+
} else if (pnpmLock) {
|
|
134
|
+
return "pnpm";
|
|
124
135
|
} else {
|
|
125
136
|
return "npm";
|
|
126
137
|
}
|