@plasmicapp/cli 0.1.258 → 0.1.260
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/utils/npm-utils.js +22 -2
- package/package.json +3 -3
- package/src/utils/npm-utils.ts +16 -0
package/dist/utils/npm-utils.js
CHANGED
|
@@ -46,7 +46,7 @@ function getParsedPackageJson() {
|
|
|
46
46
|
}
|
|
47
47
|
exports.getParsedPackageJson = getParsedPackageJson;
|
|
48
48
|
function findInstalledVersion(config, baseDir, pkg) {
|
|
49
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
49
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
50
50
|
const pm = detectPackageManager(config, baseDir);
|
|
51
51
|
try {
|
|
52
52
|
if (pm === "yarn2") {
|
|
@@ -73,11 +73,16 @@ function findInstalledVersion(config, baseDir, pkg) {
|
|
|
73
73
|
const info = JSON.parse(output);
|
|
74
74
|
return (_g = (_f = info === null || info === void 0 ? void 0 : info.dependencies) === null || _f === void 0 ? void 0 : _f[pkg]) === null || _g === void 0 ? void 0 : _g.version;
|
|
75
75
|
}
|
|
76
|
+
else if (pm === "pnpm") {
|
|
77
|
+
const output = child_process_1.execSync(`pnpm list --json ${pkg}`).toString().trim();
|
|
78
|
+
const info = JSON.parse(output);
|
|
79
|
+
return (_j = (_h = info === null || info === void 0 ? void 0 : info.dependencies) === null || _h === void 0 ? void 0 : _h[pkg]) === null || _j === void 0 ? void 0 : _j.version;
|
|
80
|
+
}
|
|
76
81
|
else {
|
|
77
82
|
// Unknown package manager (e.g. pnpm).
|
|
78
83
|
const output = child_process_1.execSync(`npm list --json ${pkg}`).toString().trim();
|
|
79
84
|
const info = JSON.parse(output);
|
|
80
|
-
return (
|
|
85
|
+
return (_l = (_k = info === null || info === void 0 ? void 0 : info.dependencies) === null || _k === void 0 ? void 0 : _k[pkg]) === null || _l === void 0 ? void 0 : _l.version;
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
catch (err) {
|
|
@@ -168,6 +173,17 @@ function installCommand(config, pkg, baseDir, opts = {}) {
|
|
|
168
173
|
return `yarn add ${pkg}`;
|
|
169
174
|
}
|
|
170
175
|
}
|
|
176
|
+
else if (mgr === "pnpm") {
|
|
177
|
+
if (opts.global) {
|
|
178
|
+
return `pnpm install -g ${pkg}`;
|
|
179
|
+
}
|
|
180
|
+
else if (opts.dev) {
|
|
181
|
+
return `pnpm install --dev --ignore-scripts ${pkg}`;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
return `pnpm install --ignore-scripts ${pkg}`;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
171
187
|
else {
|
|
172
188
|
if (opts.global) {
|
|
173
189
|
return `npm install -g ${pkg}`;
|
|
@@ -195,6 +211,10 @@ function detectPackageManager(config, baseDir) {
|
|
|
195
211
|
return "yarn";
|
|
196
212
|
}
|
|
197
213
|
}
|
|
214
|
+
const pnpmLock = findup_sync_1.default("pnpm-lock.yaml", { cwd: baseDir });
|
|
215
|
+
if (pnpmLock) {
|
|
216
|
+
return "pnpm";
|
|
217
|
+
}
|
|
198
218
|
const npmLock = findup_sync_1.default("package-lock.json", { cwd: baseDir });
|
|
199
219
|
if (npmLock) {
|
|
200
220
|
return "npm";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.260",
|
|
4
4
|
"description": "plasmic cli for syncing local code with Plasmic designs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@babel/preset-typescript": "^7.12.1",
|
|
23
|
-
"@plasmicapp/react-web": "0.2.
|
|
23
|
+
"@plasmicapp/react-web": "0.2.195",
|
|
24
24
|
"@types/cli-progress": "^3.11.0",
|
|
25
25
|
"@types/findup-sync": "^2.0.2",
|
|
26
26
|
"@types/glob": "^7.1.3",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"wrap-ansi": "^7.0.0",
|
|
82
82
|
"yargs": "^15.4.1"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "98577cdd374585ea4ed032c13828316c6e2cf186"
|
|
85
85
|
}
|
package/src/utils/npm-utils.ts
CHANGED
|
@@ -71,6 +71,10 @@ export function findInstalledVersion(
|
|
|
71
71
|
.trim();
|
|
72
72
|
const info = JSON.parse(output);
|
|
73
73
|
return info?.dependencies?.[pkg]?.version;
|
|
74
|
+
} else if (pm === "pnpm") {
|
|
75
|
+
const output = execSync(`pnpm list --json ${pkg}`).toString().trim();
|
|
76
|
+
const info = JSON.parse(output);
|
|
77
|
+
return info?.dependencies?.[pkg]?.version;
|
|
74
78
|
} else {
|
|
75
79
|
// Unknown package manager (e.g. pnpm).
|
|
76
80
|
const output = execSync(`npm list --json ${pkg}`).toString().trim();
|
|
@@ -175,6 +179,14 @@ export function installCommand(
|
|
|
175
179
|
} else {
|
|
176
180
|
return `yarn add ${pkg}`;
|
|
177
181
|
}
|
|
182
|
+
} else if (mgr === "pnpm") {
|
|
183
|
+
if (opts.global) {
|
|
184
|
+
return `pnpm install -g ${pkg}`;
|
|
185
|
+
} else if (opts.dev) {
|
|
186
|
+
return `pnpm install --dev --ignore-scripts ${pkg}`;
|
|
187
|
+
} else {
|
|
188
|
+
return `pnpm install --ignore-scripts ${pkg}`;
|
|
189
|
+
}
|
|
178
190
|
} else {
|
|
179
191
|
if (opts.global) {
|
|
180
192
|
return `npm install -g ${pkg}`;
|
|
@@ -199,6 +211,10 @@ export function detectPackageManager(config: PlasmicConfig, baseDir: string) {
|
|
|
199
211
|
return "yarn";
|
|
200
212
|
}
|
|
201
213
|
}
|
|
214
|
+
const pnpmLock = findupSync("pnpm-lock.yaml", { cwd: baseDir });
|
|
215
|
+
if (pnpmLock) {
|
|
216
|
+
return "pnpm";
|
|
217
|
+
}
|
|
202
218
|
|
|
203
219
|
const npmLock = findupSync("package-lock.json", { cwd: baseDir });
|
|
204
220
|
if (npmLock) {
|