@plasmicapp/cli
Advanced tools
Comparing version 0.1.319 to 0.1.320
@@ -9,3 +9,3 @@ import { PlasmicConfig } from "./config-utils"; | ||
export declare function getParsedPackageJson(): any; | ||
export declare function findInstalledVersion(config: PlasmicConfig, baseDir: string, pkg: string): any; | ||
export declare function findInstalledVersion(config: PlasmicConfig, baseDir: string, pkg: string): string | undefined; | ||
/** | ||
@@ -12,0 +12,0 @@ * Detects if the cli is globally installed. `rootDir` is the folder |
{ | ||
"name": "@plasmicapp/cli", | ||
"version": "0.1.319", | ||
"version": "0.1.320", | ||
"description": "plasmic cli for syncing local code with Plasmic designs", | ||
@@ -86,3 +86,3 @@ "engines": { | ||
}, | ||
"gitHead": "6db50a6b3e9ffd747e4a6521b42fcc0a8f32e97c" | ||
"gitHead": "ab6157931bff1d2a253ee36b408f79cf92b6af9c" | ||
} |
@@ -213,10 +213,12 @@ import chalk from "chalk"; | ||
? projectWithVersion | ||
: context.config.projects.map((p) => ({ | ||
projectId: p.projectId, | ||
branchName: p.projectBranchName ?? "main", | ||
versionRange: p.version, | ||
componentIdOrNames: undefined, // Get all components! | ||
projectApiToken: p.projectApiToken, | ||
indirect: !!p.indirect, | ||
})); | ||
: context.config.projects | ||
.filter((p) => !p.indirect) | ||
.map((p) => ({ | ||
projectId: p.projectId, | ||
branchName: p.projectBranchName ?? "main", | ||
versionRange: p.version, | ||
componentIdOrNames: undefined, // Get all components! | ||
projectApiToken: p.projectApiToken, | ||
indirect: !!p.indirect, | ||
})); | ||
@@ -405,9 +407,14 @@ // Short-circuit if nothing to sync | ||
) { | ||
const missingPkgs = pkgs.filter((pkg) => { | ||
const installedPkg = findInstalledVersion(context.config, baseDir, pkg); | ||
return !installedPkg; | ||
const missingPkgs = pkgs.filter((pkgSpec) => { | ||
const [pkg, version] = pkgSpec.split("@"); | ||
const installedVersion = findInstalledVersion(context.config, baseDir, pkg); | ||
if (version) { | ||
return version !== installedVersion; | ||
} else { | ||
return !installedVersion; | ||
} | ||
}); | ||
if (missingPkgs.length > 0) { | ||
const upgrade = await confirmWithUser( | ||
`The following packages aren't installed but are required by some projects, would you like to install them? ${missingPkgs.join( | ||
`The following packages aren't installed or are outdated, but are required by some projects; would you like to install them? ${missingPkgs.join( | ||
", " | ||
@@ -414,0 +421,0 @@ )}`, |
@@ -218,3 +218,5 @@ import L from "lodash"; | ||
projectName: base.projectName, | ||
version: base.version, | ||
// Indirect dependencies will have an explicit base.version but | ||
// we don't actually want to pin to that version in plasmic.json | ||
version: base.indirect ? ">0.0.0" : base.version, | ||
cssFilePath: base.cssFilePath, | ||
@@ -221,0 +223,0 @@ components: [], |
@@ -47,3 +47,3 @@ import { execSync, spawnSync } from "child_process"; | ||
pkg: string | ||
) { | ||
): string | undefined { | ||
const pm = detectPackageManager(config, baseDir); | ||
@@ -78,4 +78,6 @@ try { | ||
const info = JSON.parse(output); | ||
return info?.dependencies?.[pkg]?.version || | ||
info?.[0]?.dependencies?.[pkg]?.version; | ||
return ( | ||
info?.dependencies?.[pkg]?.version || | ||
info?.[0]?.dependencies?.[pkg]?.version | ||
); | ||
} else { | ||
@@ -82,0 +84,0 @@ // Unknown package manager (e.g. pnpm). |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
13877
48439340