planche 0.7.18 → 0.7.19

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2337,6 +2337,14 @@ function npmEnv(node) {
2337
2337
  return env;
2338
2338
  }
2339
2339
  var VERSION_SPEC = /^(latest|next|\d+\.\d+\.\d+(-[0-9A-Za-z.]+)?)$/;
2340
+ function installedVersion(prefix) {
2341
+ try {
2342
+ const pkg = JSON.parse(readFileSync2(join5(prefix, "node_modules", "planche", "package.json"), "utf8"));
2343
+ return pkg.version ?? null;
2344
+ } catch {
2345
+ return null;
2346
+ }
2347
+ }
2340
2348
  function runUpgrade(target) {
2341
2349
  if (!VERSION_SPEC.test(target)) {
2342
2350
  console.error(`Not a version: ${target}. Use \`planche upgrade\` or \`planche upgrade 1.2.3\`.`);
@@ -2355,10 +2363,25 @@ function runUpgrade(target) {
2355
2363
  return 1;
2356
2364
  }
2357
2365
  const prefix = join5(root, "pkg");
2366
+ const before = installedVersion(prefix);
2358
2367
  console.log(`Installing planche@${target} into ${prefix} ...`);
2359
2368
  const result = spawnSync(
2360
2369
  npm.cmd,
2361
- [...npm.args, "install", "--prefix", prefix, "--omit=dev", "--no-audit", "--no-fund", "--loglevel=error", `planche@${target}`],
2370
+ [
2371
+ ...npm.args,
2372
+ "install",
2373
+ "--prefix",
2374
+ prefix,
2375
+ "--omit=dev",
2376
+ "--no-audit",
2377
+ "--no-fund",
2378
+ "--loglevel=error",
2379
+ // Without this npm resolves `latest` from its cached registry document,
2380
+ // which is exactly wrong in the minutes after a release: it reports "up
2381
+ // to date", exits 0, and leaves the old version in place.
2382
+ "--prefer-online",
2383
+ `planche@${target}`
2384
+ ],
2362
2385
  { stdio: "inherit", shell: npm.shell, env: npmEnv(npm.node) }
2363
2386
  );
2364
2387
  if (result.status !== 0) {
@@ -2366,12 +2389,7 @@ function runUpgrade(target) {
2366
2389
  console.error(" curl -fsSL https://planche.dev/install.sh | sh");
2367
2390
  return result.status ?? 1;
2368
2391
  }
2369
- let installed = target;
2370
- try {
2371
- const pkg = JSON.parse(readFileSync2(join5(prefix, "node_modules", "planche", "package.json"), "utf8"));
2372
- installed = pkg.version;
2373
- } catch {
2374
- }
2392
+ const installed = installedVersion(prefix) ?? target;
2375
2393
  try {
2376
2394
  writeFileSync(join5(root, MANIFEST), `${JSON.stringify({ ...manifest, modules: process.versions.modules, installedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
2377
2395
  `);
@@ -2379,7 +2397,7 @@ function runUpgrade(target) {
2379
2397
  }
2380
2398
  cached = null;
2381
2399
  clearUpdateCache();
2382
- console.log(`planche ${installed} installed. Start it with: planche`);
2400
+ console.log(before === installed ? `planche ${installed} was already installed; nothing changed.` : `planche ${installed} installed. Start it with: planche`);
2383
2401
  return 0;
2384
2402
  }
2385
2403
  async function runUninstall(assumeYes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "planche",
3
- "version": "0.7.18",
3
+ "version": "0.7.19",
4
4
  "description": "Local agent for Planche — lets the browser-based Planche SQL client reach MySQL/MariaDB/PostgreSQL/SQLite/SQL Server/Oracle/Neon/Supabase/Cloudflare D1 databases and local Durable Object storage from your machine.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://planche.dev",