create-plasmic-app 0.0.70 → 0.0.72

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 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"
@@ -31,4 +31,4 @@ export declare function installUpgrade(pkg: string, opts?: {
31
31
  * @param dir
32
32
  * @returns
33
33
  */
34
- export declare function detectPackageManager(dir?: string): "yarn" | "npm";
34
+ export declare function detectPackageManager(dir?: string): "yarn" | "pnpm" | "npm";
@@ -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.70",
3
+ "version": "0.0.72",
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": "e7ac38522d82c384338bd6f681e3b0f3a046e120"
58
+ "gitHead": "361c3f2e99d74b4feaeca0f27a9e8875718fcaee"
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 = pkgMgr === "yarn" ? "yarn" : "npm run";
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`
@@ -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
  }