@plasmicapp/cli 0.1.321 → 0.1.322

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 CHANGED
@@ -504502,11 +504502,11 @@ async function readCurStyleMap(context) {
504502
504502
  // src/actions/sync.ts
504503
504503
  async function ensureRequiredPackages(context, baseDir, yes) {
504504
504504
  const requireds = await context.api.requiredPackages();
504505
- const confirmInstall = async (pkg, requiredVersion, opts) => {
504505
+ const confirmInstall = async (pkg, requiredVersion, currentVersion, opts) => {
504506
504506
  let success = false;
504507
504507
  const command = installCommand(context.config, pkg, baseDir, opts);
504508
504508
  const upgrade = await confirmWithUser(
504509
- `A more recent version of ${pkg} >=${requiredVersion} is required. Would you like to upgrade via "${command}"?`,
504509
+ currentVersion ? `A more recent version of ${pkg} >=${requiredVersion} is required (you currently have ${currentVersion}). Would you like to upgrade via "${command}"?` : `You need ${pkg} >=${requiredVersion} to proceed. Would you like to install via "${command}"?`,
504510
504510
  yes
504511
504511
  );
504512
504512
  if (upgrade) {
@@ -504521,10 +504521,15 @@ async function ensureRequiredPackages(context, baseDir, yes) {
504521
504521
  const cliVersion = getCliVersion();
504522
504522
  if (!cliVersion || gt2(requireds["@plasmicapp/cli"], cliVersion)) {
504523
504523
  const isGlobal = isCliGloballyInstalled(context.rootDir);
504524
- await confirmInstall("@plasmicapp/cli", requireds["@plasmicapp/cli"], {
504525
- global: isGlobal,
504526
- dev: true
504527
- });
504524
+ await confirmInstall(
504525
+ "@plasmicapp/cli",
504526
+ requireds["@plasmicapp/cli"],
504527
+ cliVersion,
504528
+ {
504529
+ global: isGlobal,
504530
+ dev: true
504531
+ }
504532
+ );
504528
504533
  logger.info(
504529
504534
  import_chalk6.default.bold("@plasmicapp/cli has been upgraded; please try again!")
504530
504535
  );
@@ -504539,6 +504544,7 @@ async function ensureRequiredPackages(context, baseDir, yes) {
504539
504544
  await confirmInstall(
504540
504545
  "@plasmicapp/react-web",
504541
504546
  requireds["@plasmicapp/react-web"],
504547
+ reactWebVersion,
504542
504548
  { global: false, dev: false }
504543
504549
  );
504544
504550
  }
@@ -504552,6 +504558,7 @@ async function ensureRequiredPackages(context, baseDir, yes) {
504552
504558
  await confirmInstall(
504553
504559
  "@plasmicapp/react-web-runtime",
504554
504560
  requireds["@plasmicapp/react-web-runtime"],
504561
+ runtimeVersion,
504555
504562
  { global: false, dev: false }
504556
504563
  );
504557
504564
  }
@@ -504731,15 +504738,21 @@ async function sync(opts, metadataDefaults) {
504731
504738
  }
504732
504739
  }
504733
504740
  async function checkExternalPkgs(context, baseDir, opts, pkgs) {
504734
- const missingPkgs = pkgs.filter((pkgSpec) => {
504741
+ const missingPkgs = pkgs.map((pkgSpec) => {
504735
504742
  const [pkg, version] = pkgSpec.split("@");
504736
- const installedVersion = findInstalledVersion(context.config, baseDir, pkg);
504737
- if (version) {
504738
- return version !== installedVersion;
504743
+ const installedVersion = findInstalledVersion(
504744
+ context.config,
504745
+ baseDir,
504746
+ pkg
504747
+ );
504748
+ if (!installedVersion) {
504749
+ return pkg;
504750
+ } else if (version) {
504751
+ return gt2(version, installedVersion) ? pkg : void 0;
504739
504752
  } else {
504740
- return !installedVersion;
504753
+ return void 0;
504741
504754
  }
504742
- });
504755
+ }).filter((x) => !!x);
504743
504756
  if (missingPkgs.length > 0) {
504744
504757
  const upgrade = await confirmWithUser(
504745
504758
  `The following packages aren't installed or are outdated, but are required by some projects; would you like to install them? ${missingPkgs.join(
package/dist/lib.js CHANGED
@@ -499800,11 +499800,11 @@ async function readCurStyleMap(context) {
499800
499800
  // src/actions/sync.ts
499801
499801
  async function ensureRequiredPackages(context, baseDir, yes) {
499802
499802
  const requireds = await context.api.requiredPackages();
499803
- const confirmInstall = async (pkg, requiredVersion, opts) => {
499803
+ const confirmInstall = async (pkg, requiredVersion, currentVersion, opts) => {
499804
499804
  let success = false;
499805
499805
  const command = installCommand(context.config, pkg, baseDir, opts);
499806
499806
  const upgrade = await confirmWithUser(
499807
- `A more recent version of ${pkg} >=${requiredVersion} is required. Would you like to upgrade via "${command}"?`,
499807
+ currentVersion ? `A more recent version of ${pkg} >=${requiredVersion} is required (you currently have ${currentVersion}). Would you like to upgrade via "${command}"?` : `You need ${pkg} >=${requiredVersion} to proceed. Would you like to install via "${command}"?`,
499808
499808
  yes
499809
499809
  );
499810
499810
  if (upgrade) {
@@ -499819,10 +499819,15 @@ async function ensureRequiredPackages(context, baseDir, yes) {
499819
499819
  const cliVersion = getCliVersion();
499820
499820
  if (!cliVersion || gt2(requireds["@plasmicapp/cli"], cliVersion)) {
499821
499821
  const isGlobal = isCliGloballyInstalled(context.rootDir);
499822
- await confirmInstall("@plasmicapp/cli", requireds["@plasmicapp/cli"], {
499823
- global: isGlobal,
499824
- dev: true
499825
- });
499822
+ await confirmInstall(
499823
+ "@plasmicapp/cli",
499824
+ requireds["@plasmicapp/cli"],
499825
+ cliVersion,
499826
+ {
499827
+ global: isGlobal,
499828
+ dev: true
499829
+ }
499830
+ );
499826
499831
  logger.info(
499827
499832
  import_chalk6.default.bold("@plasmicapp/cli has been upgraded; please try again!")
499828
499833
  );
@@ -499837,6 +499842,7 @@ async function ensureRequiredPackages(context, baseDir, yes) {
499837
499842
  await confirmInstall(
499838
499843
  "@plasmicapp/react-web",
499839
499844
  requireds["@plasmicapp/react-web"],
499845
+ reactWebVersion,
499840
499846
  { global: false, dev: false }
499841
499847
  );
499842
499848
  }
@@ -499850,6 +499856,7 @@ async function ensureRequiredPackages(context, baseDir, yes) {
499850
499856
  await confirmInstall(
499851
499857
  "@plasmicapp/react-web-runtime",
499852
499858
  requireds["@plasmicapp/react-web-runtime"],
499859
+ runtimeVersion,
499853
499860
  { global: false, dev: false }
499854
499861
  );
499855
499862
  }
@@ -500029,15 +500036,21 @@ async function sync(opts, metadataDefaults) {
500029
500036
  }
500030
500037
  }
500031
500038
  async function checkExternalPkgs(context, baseDir, opts, pkgs) {
500032
- const missingPkgs = pkgs.filter((pkgSpec) => {
500039
+ const missingPkgs = pkgs.map((pkgSpec) => {
500033
500040
  const [pkg, version] = pkgSpec.split("@");
500034
- const installedVersion = findInstalledVersion(context.config, baseDir, pkg);
500035
- if (version) {
500036
- return version !== installedVersion;
500041
+ const installedVersion = findInstalledVersion(
500042
+ context.config,
500043
+ baseDir,
500044
+ pkg
500045
+ );
500046
+ if (!installedVersion) {
500047
+ return pkg;
500048
+ } else if (version) {
500049
+ return gt2(version, installedVersion) ? pkg : void 0;
500037
500050
  } else {
500038
- return !installedVersion;
500051
+ return void 0;
500039
500052
  }
500040
- });
500053
+ }).filter((x) => !!x);
500041
500054
  if (missingPkgs.length > 0) {
500042
500055
  const upgrade = await confirmWithUser(
500043
500056
  `The following packages aren't installed or are outdated, but are required by some projects; would you like to install them? ${missingPkgs.join(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/cli",
3
- "version": "0.1.321",
3
+ "version": "0.1.322",
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": "1089fbd93d2ac0d2ac7e0e8f755ba98d5c21f0eb"
86
+ "gitHead": "38d7f209c6f5ac131c4d34395166ea5eafcc733b"
87
87
  }
@@ -84,12 +84,15 @@ async function ensureRequiredPackages(
84
84
  const confirmInstall = async (
85
85
  pkg: string,
86
86
  requiredVersion: string,
87
+ currentVersion: string | undefined,
87
88
  opts: { global: boolean; dev: boolean }
88
89
  ) => {
89
90
  let success = false;
90
91
  const command = installCommand(context.config, pkg, baseDir, opts);
91
92
  const upgrade = await confirmWithUser(
92
- `A more recent version of ${pkg} >=${requiredVersion} is required. Would you like to upgrade via "${command}"?`,
93
+ currentVersion
94
+ ? `A more recent version of ${pkg} >=${requiredVersion} is required (you currently have ${currentVersion}). Would you like to upgrade via "${command}"?`
95
+ : `You need ${pkg} >=${requiredVersion} to proceed. Would you like to install via "${command}"?`,
93
96
  yes
94
97
  );
95
98
  if (upgrade) {
@@ -106,10 +109,15 @@ async function ensureRequiredPackages(
106
109
  const cliVersion = getCliVersion();
107
110
  if (!cliVersion || semver.gt(requireds["@plasmicapp/cli"], cliVersion)) {
108
111
  const isGlobal = isCliGloballyInstalled(context.rootDir);
109
- await confirmInstall("@plasmicapp/cli", requireds["@plasmicapp/cli"], {
110
- global: isGlobal,
111
- dev: true,
112
- });
112
+ await confirmInstall(
113
+ "@plasmicapp/cli",
114
+ requireds["@plasmicapp/cli"],
115
+ cliVersion,
116
+ {
117
+ global: isGlobal,
118
+ dev: true,
119
+ }
120
+ );
113
121
 
114
122
  logger.info(
115
123
  chalk.bold("@plasmicapp/cli has been upgraded; please try again!")
@@ -131,6 +139,7 @@ async function ensureRequiredPackages(
131
139
  await confirmInstall(
132
140
  "@plasmicapp/react-web",
133
141
  requireds["@plasmicapp/react-web"],
142
+ reactWebVersion,
134
143
  { global: false, dev: false }
135
144
  );
136
145
  }
@@ -149,6 +158,7 @@ async function ensureRequiredPackages(
149
158
  await confirmInstall(
150
159
  "@plasmicapp/react-web-runtime",
151
160
  requireds["@plasmicapp/react-web-runtime"],
161
+ runtimeVersion,
152
162
  { global: false, dev: false }
153
163
  );
154
164
  }
@@ -403,15 +413,26 @@ async function checkExternalPkgs(
403
413
  opts: SyncArgs,
404
414
  pkgs: string[]
405
415
  ) {
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
- }
414
- });
416
+ const missingPkgs = pkgs
417
+ .map((pkgSpec) => {
418
+ const [pkg, version] = pkgSpec.split("@");
419
+ const installedVersion = findInstalledVersion(
420
+ context.config,
421
+ baseDir,
422
+ pkg
423
+ );
424
+ if (!installedVersion) {
425
+ // Not installed
426
+ return pkg;
427
+ } else if (version) {
428
+ // Installed, so check against requested version; upgrade if
429
+ // requested version is greater than installed version
430
+ return semver.gt(version, installedVersion) ? pkg : undefined;
431
+ } else {
432
+ return undefined;
433
+ }
434
+ })
435
+ .filter((x): x is string => !!x);
415
436
  if (missingPkgs.length > 0) {
416
437
  const upgrade = await confirmWithUser(
417
438
  `The following packages aren't installed or are outdated, but are required by some projects; would you like to install them? ${missingPkgs.join(