mirror of
https://github.com/nocobase/nocobase.git
synced 2026-12-06 22:23:41 +08:00
* feat(app-cli): retain unregistered plugins and their Skills for development * fix(create-app): initialize edition templates with an explicit dialect * docs(create-app): align enterprise guidance with the preinstalled templates * fix(create-app): drop nested edition template settings * feat(app-template-default): preinstall Web Push for opt-in use * feat(app-template-default): preinstall optional database drivers * feat(app-cli): validate production drivers for effective database connections * fix(app-cli): preserve the selected driver version in the manifest and lockfile * fix(app-template-default): keep the workspace reference sources visible to Vite * test(app-cli): declare the driver from the provisioned test dialect * docs(app-template-default): explain how to update a preinstalled plugin * docs(app-skills): guide edition upgrades with preinstalled plugins and drivers * feat(app-skills): guide existing applications through edition upgrades
64 lines
2.0 KiB
JavaScript
64 lines
2.0 KiB
JavaScript
// Build the workspace's runnable reference without changing the manifest that releases pack as a template.
|
|
import { spawnSync } from 'node:child_process';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
const root = process.cwd();
|
|
// pnpm's workspace bin shims address sibling packages relative to their directory.
|
|
const parent = path.resolve(
|
|
import.meta.dirname,
|
|
'../packages/.reference-builds',
|
|
);
|
|
fs.mkdirSync(parent, { recursive: true });
|
|
const stage = fs.mkdtempSync(path.join(parent, 'default-'));
|
|
try {
|
|
const transient = new Set([
|
|
'node_modules',
|
|
'dist',
|
|
'storage',
|
|
'coverage',
|
|
'test-results',
|
|
'playwright-report',
|
|
'.agents',
|
|
'.claude',
|
|
'.cursor',
|
|
]);
|
|
fs.cpSync(root, stage, {
|
|
recursive: true,
|
|
filter: (file) =>
|
|
!transient.has(path.relative(root, file).split(path.sep)[0]),
|
|
});
|
|
fs.symlinkSync(
|
|
path.join(root, 'node_modules'),
|
|
path.join(stage, 'node_modules'),
|
|
'junction',
|
|
);
|
|
const file = path.join(stage, 'package.json');
|
|
const manifest = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
const sqlite = '@nocobase/db-sqlite';
|
|
manifest.dependencies[sqlite] = manifest.devDependencies[sqlite];
|
|
delete manifest.devDependencies[sqlite];
|
|
fs.writeFileSync(file, JSON.stringify(manifest, null, 2) + '\n');
|
|
const run = spawnSync(
|
|
'pnpm',
|
|
['exec', 'nocobase', 'build', ...process.argv.slice(2)],
|
|
{ cwd: stage, stdio: 'inherit' },
|
|
);
|
|
if (run.error) throw run.error;
|
|
if (run.status !== 0) process.exitCode = run.status ?? 1;
|
|
else {
|
|
fs.rmSync(path.join(root, 'dist'), { recursive: true, force: true });
|
|
fs.renameSync(path.join(stage, 'dist'), path.join(root, 'dist'));
|
|
if (process.argv.includes('--tar')) {
|
|
const archives = path.join(root, 'storage', 'exports');
|
|
fs.mkdirSync(archives, { recursive: true });
|
|
fs.renameSync(
|
|
path.join(stage, 'storage/exports/dist.tar.gz'),
|
|
path.join(archives, 'dist.tar.gz'),
|
|
);
|
|
}
|
|
}
|
|
} finally {
|
|
fs.rmSync(stage, { recursive: true, force: true });
|
|
}
|