@plasmicapp/cli 0.1.319 → 0.1.320
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 +415 -408
- package/dist/lib.js +415 -408
- package/dist/utils/npm-utils.d.ts +1 -1
- package/package.json +2 -2
- package/src/actions/sync.ts +19 -12
- package/src/utils/config-utils.ts +3 -1
- package/src/utils/npm-utils.ts +5 -3
|
@@ -6,7 +6,7 @@ export declare function getCliVersion(): string;
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function checkEngineStrict(): boolean;
|
|
8
8
|
export declare function getParsedPackageJson(): any;
|
|
9
|
-
export declare function findInstalledVersion(config: PlasmicConfig, baseDir: string, pkg: string):
|
|
9
|
+
export declare function findInstalledVersion(config: PlasmicConfig, baseDir: string, pkg: string): string | undefined;
|
|
10
10
|
/**
|
|
11
11
|
* Detects if the cli is globally installed. `rootDir` is the folder
|
|
12
12
|
* where plasmic.json is
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicapp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.320",
|
|
4
4
|
"description": "plasmic cli for syncing local code with Plasmic designs",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"wrap-ansi": "^7.0.0",
|
|
84
84
|
"yargs": "^15.4.1"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "ab6157931bff1d2a253ee36b408f79cf92b6af9c"
|
|
87
87
|
}
|
package/src/actions/sync.ts
CHANGED
|
@@ -210,14 +210,16 @@ export async function sync(
|
|
|
210
210
|
|
|
211
211
|
const projectSyncParams = projectWithVersion.length
|
|
212
212
|
? projectWithVersion
|
|
213
|
-
: context.config.projects
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
213
|
+
: context.config.projects
|
|
214
|
+
.filter((p) => !p.indirect)
|
|
215
|
+
.map((p) => ({
|
|
216
|
+
projectId: p.projectId,
|
|
217
|
+
branchName: p.projectBranchName ?? "main",
|
|
218
|
+
versionRange: p.version,
|
|
219
|
+
componentIdOrNames: undefined, // Get all components!
|
|
220
|
+
projectApiToken: p.projectApiToken,
|
|
221
|
+
indirect: !!p.indirect,
|
|
222
|
+
}));
|
|
221
223
|
|
|
222
224
|
// Short-circuit if nothing to sync
|
|
223
225
|
if (projectSyncParams.length === 0) {
|
|
@@ -401,13 +403,18 @@ async function checkExternalPkgs(
|
|
|
401
403
|
opts: SyncArgs,
|
|
402
404
|
pkgs: string[]
|
|
403
405
|
) {
|
|
404
|
-
const missingPkgs = pkgs.filter((
|
|
405
|
-
const
|
|
406
|
-
|
|
406
|
+
const missingPkgs = pkgs.filter((pkgSpec) => {
|
|
407
|
+
const [pkg, version] = pkgSpec.split("@");
|
|
408
|
+
const installedVersion = findInstalledVersion(context.config, baseDir, pkg);
|
|
409
|
+
if (version) {
|
|
410
|
+
return version !== installedVersion;
|
|
411
|
+
} else {
|
|
412
|
+
return !installedVersion;
|
|
413
|
+
}
|
|
407
414
|
});
|
|
408
415
|
if (missingPkgs.length > 0) {
|
|
409
416
|
const upgrade = await confirmWithUser(
|
|
410
|
-
`The following packages aren't installed but are required by some projects
|
|
417
|
+
`The following packages aren't installed or are outdated, but are required by some projects; would you like to install them? ${missingPkgs.join(
|
|
411
418
|
", "
|
|
412
419
|
)}`,
|
|
413
420
|
opts.yes
|
|
@@ -215,7 +215,9 @@ export function createProjectConfig(base: {
|
|
|
215
215
|
projectId: base.projectId,
|
|
216
216
|
projectApiToken: base.projectApiToken,
|
|
217
217
|
projectName: base.projectName,
|
|
218
|
-
|
|
218
|
+
// Indirect dependencies will have an explicit base.version but
|
|
219
|
+
// we don't actually want to pin to that version in plasmic.json
|
|
220
|
+
version: base.indirect ? ">0.0.0" : base.version,
|
|
219
221
|
cssFilePath: base.cssFilePath,
|
|
220
222
|
components: [],
|
|
221
223
|
icons: [],
|
package/src/utils/npm-utils.ts
CHANGED
|
@@ -44,7 +44,7 @@ export function findInstalledVersion(
|
|
|
44
44
|
config: PlasmicConfig,
|
|
45
45
|
baseDir: string,
|
|
46
46
|
pkg: string
|
|
47
|
-
) {
|
|
47
|
+
): string | undefined {
|
|
48
48
|
const pm = detectPackageManager(config, baseDir);
|
|
49
49
|
try {
|
|
50
50
|
if (pm === "yarn2") {
|
|
@@ -74,8 +74,10 @@ export function findInstalledVersion(
|
|
|
74
74
|
} else if (pm === "pnpm") {
|
|
75
75
|
const output = execSync(`pnpm list --json ${pkg}`).toString().trim();
|
|
76
76
|
const info = JSON.parse(output);
|
|
77
|
-
return
|
|
78
|
-
info?.
|
|
77
|
+
return (
|
|
78
|
+
info?.dependencies?.[pkg]?.version ||
|
|
79
|
+
info?.[0]?.dependencies?.[pkg]?.version
|
|
80
|
+
);
|
|
79
81
|
} else {
|
|
80
82
|
// Unknown package manager (e.g. pnpm).
|
|
81
83
|
const output = execSync(`npm list --json ${pkg}`).toString().trim();
|