fix build and clean scripts

This commit is contained in:
Namekuji 2023-06-21 21:25:25 -04:00
parent 48f58feae6
commit e232332a46
No known key found for this signature in database
GPG Key ID: B541BD6E646CABC7
4 changed files with 25 additions and 21 deletions

View File

@ -10,9 +10,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"rebuild": "pnpm run clean && pnpm -r run build && pnpm run gulp", "rebuild": "pnpm run clean && pnpm -r run build && pnpm run gulp",
"build": "pnpm -r run build:cargo && pnpm -r run build:recursive && pnpm run gulp", "build": "pnpm -r run build && pnpm run gulp",
"build:recursive": "pnpm -r run build",
"build:cargo": "pnpm --filter backend run build:cargo",
"start": "pnpm --filter backend run start", "start": "pnpm --filter backend run start",
"start:test": "pnpm --filter backend run start:test", "start:test": "pnpm --filter backend run start:test",
"init": "pnpm run migrate", "init": "pnpm run migrate",

View File

@ -34,8 +34,8 @@
}, },
"scripts": { "scripts": {
"artifacts": "napi artifacts", "artifacts": "napi artifacts",
"build": "napi build --features napi --platform --release ./built/", "build": "napi build --features napi --platform --release ./built/ && cargo build --locked --release --manifest-path ./migration/Cargo.toml",
"build:debug": "napi build --platform", "build:debug": "napi build --platform ./built/ && cargo build --manifest-path ./migration/Cargo.toml",
"prepublishOnly": "napi prepublish -t npm", "prepublishOnly": "napi prepublish -t npm",
"test": "pnpm run cargo:test && pnpm run build && ava", "test": "pnpm run cargo:test && pnpm run build && ava",
"universal": "napi universal", "universal": "napi universal",

View File

@ -1,26 +1,30 @@
const fs = require('fs'); const fs = require('node:fs');
const execa = require('execa'); const execa = require('execa');
const { join } = require('node:path');
(async () => { (async () => {
fs.rmSync(__dirname + '/../packages/backend/built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/backend/node_modules', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/backend/node_modules'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/client/built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/client/node_modules', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/backend/native-utils/node_modules'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/sw/built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/sw/node_modules', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/client/node_modules'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../node_modules', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/sw/node_modules'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../node_modules'), { recursive: true, force: true });
execa('pnpm', ['store', 'prune'], { execa('pnpm', ['store', 'prune'], {
cwd: __dirname + '/../', cwd: join(__dirname, '/../'),
stdio: 'inherit' stdio: 'inherit'
}); });
execa('cargo', ['clean'], { execa('cargo', ['clean'], {
cwd: __dirname + '/../packages/backend/native-utils', cwd: join(__dirname, '/../packages/backend/native-utils'),
stdio: 'inherit' stdio: 'inherit'
}); });
})(); })();

View File

@ -1,8 +1,10 @@
const fs = require('fs'); const fs = require('node:fs');
const { join } = require('node:path');
(async () => { (async () => {
fs.rmSync(__dirname + '/../packages/backend/built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/backend/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/client/built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/backend/native-utils/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../packages/sw/built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/client/built'), { recursive: true, force: true });
fs.rmSync(__dirname + '/../built', { recursive: true, force: true }); fs.rmSync(join(__dirname, '/../packages/sw/built'), { recursive: true, force: true });
fs.rmSync(join(__dirname, '/../built'), { recursive: true, force: true });
})(); })();