-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.js
25 lines (25 loc) · 992 Bytes
/
publish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import fs from 'fs';
import fes from 'fs-extra';
import pkg from './package.json' assert { type: 'json' };
pkg.name = 'emm-blog';
pkg.keywords = ['svelte', 'blog', 'svelteKit-blog'];
pkg.homepage = 'https://github.com/aolose/emm';
pkg.description = 'A personal blog system built with SvelteKit';
delete pkg.devDependencies;
delete pkg.prepare;
delete pkg.private;
const env = '.env.production';
const lock = 'pnpm-lock.yaml';
const npm = '.npmrc';
pkg.scripts = {
start: 'node --trace-uncaught -r dotenv/config app dotenv_config_path=' + env
};
if (fs.existsSync('./dist')) fs.rmSync('./dist', { recursive: true });
fs.mkdirSync('./dist');
fes.moveSync('./app', './dist/app');
fs.copyFileSync(env, './dist/' + env);
fs.copyFileSync(npm + '.build', './dist/' + npm);
fs.copyFileSync(lock, './dist/' + lock);
fs.writeFileSync('./dist/package.json', JSON.stringify(pkg, null, ' '), { flag: 'w' });
if (fs.existsSync('.cssCache.json')) fs.rmSync('.cssCache.json');
console.log('publish done!');