basklee-nuxt 0.8.1 → 0.9.0

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/README.md CHANGED
@@ -764,25 +764,6 @@ Updates require the existing `basklee/settings.json` and `.generated.json`.
764
764
  Conflicting untracked files stop the source update before any writes. If dependency
765
765
  installation fails after source generation, run `npm install` and retry `update`.
766
766
 
767
-
768
- ### Projects made with orionplace-nuxt
769
-
770
- The package was called `orionplace-nuxt` until November 2026. In such a project
771
- run the same command:
772
-
773
- ```bash
774
- npx basklee-nuxt update
775
- ```
776
-
777
- Before the usual update it renames the project's own files: the `orionplace/`
778
- folders, `Orionplace*` components, types and composables, `--orionplace-*` CSS
779
- variables, `ORIONPLACE_*` keys in `.env`, the `orionplace:*` scripts and the
780
- dependency in `package.json`. Files you edited stay edited; every file it changes
781
- is copied first, at its old path, into `.basklee-backup-<date>/`. Your
782
- `*.orionplace.app` backend address keeps its name. `--dry-run` lists the
783
- renames without changing anything. A server set up before the rename keeps its
784
- `orionplace` service names.
785
-
786
767
  ## Representative product actions
787
768
 
788
769
  The Nuxt header forwards cart, wishlist, availability-notification and preorder
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basklee-nuxt",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Nuxt 4 storefront for your Basklee marketplace: setup CLI, server API gateway, typed store and ready-made catalog, cart, checkout and account components in English, Russian and Spanish, plus an Android app build.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/install.mjs CHANGED
@@ -19,13 +19,10 @@ export const framework = {
19
19
  environment: {},
20
20
  };
21
21
 
22
- // Servers set up before the rename to Basklee (2026-11) keep their names: /etc/orionplace, /srv/orionplace,
23
- // orionplace-<app> services and the "orionplace" server tool. New servers use basklee.
24
- export const serverName = (process.env.ORIONPLACE_ETC
25
- || (!process.env.BASKLEE_ETC && !existsSync('/etc/basklee') && existsSync('/etc/orionplace'))) ? 'orionplace' : 'basklee';
22
+ export const serverName = 'basklee';
26
23
 
27
24
  export const defaultPaths = {
28
- etc: process.env.BASKLEE_ETC || process.env.ORIONPLACE_ETC || `/etc/${serverName}`,
25
+ etc: process.env.BASKLEE_ETC || `/etc/${serverName}`,
29
26
  systemd: '/etc/systemd/system',
30
27
  openrc: '/etc/init.d',
31
28
  logs: `/var/log/${serverName}`,
package/src/update.mjs CHANGED
@@ -1,16 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { readFileSync } from 'node:fs';
3
2
  import { resolve } from 'node:path';
4
- import { migrateLegacyProject } from './migrate.mjs';
5
3
  import { setupProject } from './setup.mjs';
6
4
 
7
- const PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
8
-
9
- function printMigration(done, dryRun) {
10
- console.log(`${dryRun ? 'Would rename' : 'Renamed'} this project from the old orionplace names to Basklee (${done.files.length} files changed, ${done.moved} moved; dependency ${done.dependency}).`);
11
- if (done.backup) console.log(`Backup of every changed file, at its old path: ${done.backup}/ (delete it after checking).`);
12
- }
13
-
14
5
  export function runNpm(args, cwd) {
15
6
  const npmCli = process.env.npm_execpath;
16
7
  const command = npmCli ? process.execPath : 'npm';
@@ -26,24 +17,15 @@ export function runNpm(args, cwd) {
26
17
 
27
18
  export async function updateProject({ cwd = process.cwd(), dryRun = false, local = false, npm = runNpm } = {}) {
28
19
  cwd = resolve(cwd);
29
- // A project made before the rename to Basklee is renamed first (migrate.mjs); the latest CLI does it.
30
- const legacy = await migrateLegacyProject({ cwd, dryRun: true, packageName: PACKAGE.name, version: PACKAGE.version });
31
20
  // Validate before downloading or writing; the latest CLI repeats preflight with its own templates.
32
- const preview = legacy ? null : await setupProject({ cwd, action: 'update', dryRun: true });
21
+ const preview = await setupProject({ cwd, action: 'update', dryRun: true });
33
22
  if (!local) {
34
23
  console.log('Checking the latest Basklee Nuxt release…');
35
24
  await npm(['exec', '--yes', '--prefer-online', '--package=basklee-nuxt@latest', '--',
36
25
  'basklee-nuxt', 'update', '--local', '--cwd', cwd, ...(dryRun ? ['--dry-run'] : [])], cwd);
37
26
  return null; // The latest CLI reports its own changes.
38
27
  }
39
- if (legacy && dryRun) {
40
- printMigration(legacy, true);
41
- for (const file of legacy.files) console.log(` ${file}`);
42
- console.log('The template update is planned after the rename: run update without --dry-run, then update --dry-run again.');
43
- return null;
44
- }
45
28
  if (dryRun) return preview;
46
- if (legacy) printMigration(await migrateLegacyProject({ cwd, packageName: PACKAGE.name, version: PACKAGE.version }), false);
47
29
  const result = await setupProject({ cwd, action: 'update' });
48
30
  try {
49
31
  await npm(['install', '--no-audit', '--no-fund'], cwd);
package/src/migrate.mjs DELETED
@@ -1,124 +0,0 @@
1
- // Projects made before the rename to Basklee (2026-11) use the orionplace-<framework> package, the orionplace/
2
- // folders, Orionplace* names and ORIONPLACE_* settings. update renames them in the project's own files first, so
3
- // the template update that follows sees an ordinary Basklee project. Domains *.orionplace.app keep their name.
4
- import { createHash } from 'node:crypto';
5
- import { existsSync } from 'node:fs';
6
- import { mkdir, readdir, readFile, rm, rmdir, stat, writeFile } from 'node:fs/promises';
7
- import { dirname, join, relative, sep } from 'node:path';
8
-
9
- const OLD_DIR = 'orionplace';
10
- const SKIP_DIRS = new Set(['node_modules', '.git', '.nuxt', '.output', '.next', '.svelte-kit', '.vercel', '.netlify',
11
- 'dist', 'build', '.gradle', '.cache', '.turbo']);
12
- const MAX_BYTES = 5 * 1024 * 1024;
13
- const RULES = [
14
- [/Orion ?Marketplace(?!\.app\b)/g, 'Basklee'], // the product's old name in comments copied from the templates
15
- [/ORIONPLACE(?!\.APP\b)/g, 'BASKLEE'],
16
- [/Orionplace(?!\.app\b)/g, 'Basklee'],
17
- [/orionplace(?!\.app\b)/g, 'basklee'],
18
- ];
19
-
20
- const hash = (text) => createHash('sha256').update(text).digest('hex');
21
- const rename = (text) => RULES.reduce((out, [re, to]) => out.replace(re, to), text);
22
- const toPosix = (path) => path.split(sep).join('/');
23
-
24
- async function isLegacy(root) {
25
- if (existsSync(join(root, OLD_DIR, '.generated.json'))) return true;
26
- try {
27
- const pkg = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
28
- return Object.keys({ ...pkg.dependencies, ...pkg.devDependencies }).some((name) => /^orionplace-(nuxt|react|svelte)$/.test(name));
29
- } catch {
30
- return false;
31
- }
32
- }
33
-
34
- async function walk(root, dir = root, files = []) {
35
- for (const entry of await readdir(dir, { withFileTypes: true })) {
36
- if (entry.isDirectory()) {
37
- if (SKIP_DIRS.has(entry.name) || entry.name.startsWith('.basklee-backup-')) continue;
38
- await walk(root, join(dir, entry.name), files);
39
- } else if (entry.isFile()) {
40
- files.push(toPosix(relative(root, join(dir, entry.name))));
41
- }
42
- }
43
- return files;
44
- }
45
-
46
- /**
47
- * Renames an old project in place. Returns null for a project that needs nothing, else
48
- * { files, moved, backup, dependency } — with dryRun nothing is written.
49
- * version: the version of the new package written into package.json.
50
- */
51
- export async function migrateLegacyProject({ cwd, dryRun = false, packageName, version }) {
52
- if (!(await isLegacy(cwd))) return null;
53
- const changes = new Map(); // old relative path -> { to, content (string | Buffer), changed }
54
- for (const path of await walk(cwd)) {
55
- const to = path.split('/').map(rename).join('/');
56
- const info = await stat(join(cwd, path));
57
- let content = null;
58
- if (info.size <= MAX_BYTES) {
59
- const buf = await readFile(join(cwd, path));
60
- if (!buf.subarray(0, 8000).includes(0)) {
61
- const text = buf.toString('utf8');
62
- const next = rename(text);
63
- if (next !== text) content = next;
64
- }
65
- }
66
- if (to !== path || content !== null) changes.set(path, { to, content });
67
- }
68
-
69
- // Generated-file record: a file still equal to what the package wrote stays "unchanged" after the rename, so the
70
- // template update may replace it; a file the owner edited stays edited.
71
- const oldRecord = join(OLD_DIR, '.generated.json');
72
- if (existsSync(join(cwd, oldRecord))) {
73
- const previous = JSON.parse(await readFile(join(cwd, oldRecord), 'utf8'));
74
- const record = {};
75
- for (const [name, sum] of Object.entries(previous)) {
76
- const newName = name.split('/').map(rename).join('/');
77
- let current = null;
78
- try { current = await readFile(join(cwd, name), 'utf8'); } catch { /* removed by the owner */ }
79
- record[newName] = current !== null && hash(current) === sum ? hash(rename(current)) : sum;
80
- }
81
- changes.set(oldRecord, { to: rename(oldRecord), content: JSON.stringify(record, null, 2) + '\n' });
82
- }
83
-
84
- // package.json: the new package at the running version (the old pin names a version the new package lacks).
85
- const pkgPath = 'package.json';
86
- if (existsSync(join(cwd, pkgPath))) {
87
- const text = changes.get(pkgPath)?.content ?? await readFile(join(cwd, pkgPath), 'utf8');
88
- const pkg = JSON.parse(text);
89
- for (const field of ['dependencies', 'devDependencies']) {
90
- if (pkg[field]?.[packageName] !== undefined && version) pkg[field][packageName] = version;
91
- }
92
- changes.set(pkgPath, { to: pkgPath, content: JSON.stringify(pkg, null, 2) + '\n' });
93
- }
94
-
95
- const files = [...changes].filter(([, c]) => c.content !== null).map(([from, c]) => c.to === from ? from : `${from} -> ${c.to}`);
96
- const moved = [...changes].filter(([from, c]) => c.to !== from).length;
97
- const backup = `.basklee-backup-${new Date().toISOString().replace(/[-:]/g, '').slice(0, 15)}`;
98
- if (dryRun) return { files, moved, backup: null, dependency: `${packageName}@${version}` };
99
-
100
- // Backup of every file the migration touches, at its old path.
101
- for (const [from] of changes) {
102
- const target = join(cwd, backup, from);
103
- await mkdir(dirname(target), { recursive: true });
104
- await writeFile(target, await readFile(join(cwd, from)));
105
- }
106
- for (const [from, { to, content }] of changes) {
107
- const source = join(cwd, from);
108
- const target = join(cwd, to);
109
- const data = content ?? await readFile(source);
110
- await mkdir(dirname(target), { recursive: true });
111
- await writeFile(target, data, { mode: (await stat(source)).mode });
112
- if (to !== from) await rm(source);
113
- }
114
- // Folders left empty by the moves (deepest first).
115
- const dirs = new Set();
116
- for (const [from, { to }] of changes) {
117
- if (to === from) continue;
118
- for (let dir = dirname(from); dir !== '.'; dir = dirname(dir)) dirs.add(dir);
119
- }
120
- for (const dir of [...dirs].sort((a, b) => b.split('/').length - a.split('/').length)) {
121
- try { await rmdir(join(cwd, dir)); } catch { /* not empty: holds files the migration did not move */ }
122
- }
123
- return { files, moved, backup, dependency: `${packageName}@${version}` };
124
- }