@qodly/cli
Version:
Qodly CLI
33 lines (32 loc) • 1.62 kB
JavaScript
import { readFileSync, writeFileSync } from "node:fs";
import { execSync } from "node:child_process";
import path, { resolve } from "node:path";
import { libDir } from "../../tools/pkg.js";
const PROJECT_TEMPLATES = resolve(libDir, 'templates/v2/project');
function toPOSIX(value) {
return value.split(path.sep).join(path.posix.sep);
}
export async function execute() {
try {
console.log('Migrating the project, please wait...');
const newProxyFile = readFileSync(toPOSIX(`${PROJECT_TEMPLATES}/proxy.config.ts`), 'utf-8');
writeFileSync(resolve(process.cwd(), 'proxy.config.ts'), newProxyFile);
const newViteConfigFile = readFileSync(toPOSIX(`${PROJECT_TEMPLATES}/vite.config.ts`), 'utf-8');
writeFileSync(resolve(process.cwd(), 'vite.config.ts'), newViteConfigFile);
[
'npm i --save-dev @module-federation/vite@^1.2.6 vite@^6.3.5 typescript@^5.8.3 @vitejs/plugin-react-swc@latest @ws-ui/vite-plugins@latest @qodly/cli@latest',
'npm i @ws-ui/webform-editor@latest @ws-ui/craftjs-utils@latest @ws-ui/craftjs-core@latest @ws-ui/craftjs-layers@latest',
'npm i --save-peer @ws-ui/code-editor@latest @ws-ui/icons@latest @ws-ui/shared@latest @ws-ui/store@latest',
'git add .',
'git commit -nm "Migrate the cli to the latest version"'
].forEach((cmd)=>{
execSync(cmd, {
cwd: resolve(process.cwd())
});
});
console.log('✅ Project successfully migrated.');
} catch (e) {
console.error(e);
}
}
//# sourceMappingURL=execute.js.map