build: pack on build-assets
This commit is contained in:
parent
c27eba4d39
commit
30224a8474
|
@ -12,6 +12,7 @@ import * as terser from 'terser';
|
||||||
import { build as buildLocales } from '../locales/index.js';
|
import { build as buildLocales } from '../locales/index.js';
|
||||||
import generateDTS from '../locales/generateDTS.js';
|
import generateDTS from '../locales/generateDTS.js';
|
||||||
import meta from '../package.json' assert { type: "json" };
|
import meta from '../package.json' assert { type: "json" };
|
||||||
|
import buildTarball from './tarball.mjs';
|
||||||
|
|
||||||
let locales = buildLocales();
|
let locales = buildLocales();
|
||||||
|
|
||||||
|
@ -77,12 +78,13 @@ async function build() {
|
||||||
copyBackendViews(),
|
copyBackendViews(),
|
||||||
buildBackendScript(),
|
buildBackendScript(),
|
||||||
buildBackendStyle(),
|
buildBackendStyle(),
|
||||||
|
buildTarball(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
await build();
|
await build();
|
||||||
|
|
||||||
if (process.argv.includes("--watch")) {
|
if (process.argv.includes('--watch')) {
|
||||||
const watcher = fs.watch('./locales');
|
const watcher = fs.watch('./locales');
|
||||||
for await (const event of watcher) {
|
for await (const event of watcher) {
|
||||||
const filename = event.filename?.replaceAll('\\', '/');
|
const filename = event.filename?.replaceAll('\\', '/');
|
||||||
|
|
|
@ -6,8 +6,6 @@ import glob from 'fast-glob';
|
||||||
import Pack from 'tar/lib/pack.js';
|
import Pack from 'tar/lib/pack.js';
|
||||||
import meta from '../package.json' assert { type: "json" };
|
import meta from '../package.json' assert { type: "json" };
|
||||||
|
|
||||||
const cwd = fileURLToPath(new URL('..', import.meta.url));
|
|
||||||
const mkdirPromise = mkdir(resolve(cwd, 'built', 'tarball'), { recursive: true });
|
|
||||||
const patterns = [
|
const patterns = [
|
||||||
'{assets,fluent-emojis,locales,misskey-assets}/**/*',
|
'{assets,fluent-emojis,locales,misskey-assets}/**/*',
|
||||||
'packages/.config/example.yml',
|
'packages/.config/example.yml',
|
||||||
|
@ -29,14 +27,19 @@ const patterns = [
|
||||||
'pnpm-lock.yaml',
|
'pnpm-lock.yaml',
|
||||||
'pnpm-workspace.yaml',
|
'pnpm-workspace.yaml',
|
||||||
];
|
];
|
||||||
const pack = new Pack({ cwd, gzip: true });
|
|
||||||
|
|
||||||
for await (const entry of glob.stream(patterns)) {
|
export default async function build() {
|
||||||
pack.add(entry);
|
const cwd = fileURLToPath(new URL('..', import.meta.url));
|
||||||
|
const mkdirPromise = mkdir(resolve(cwd, 'built', 'tarball'), { recursive: true });
|
||||||
|
const pack = new Pack({ cwd, gzip: true });
|
||||||
|
|
||||||
|
for await (const entry of glob.stream(patterns)) {
|
||||||
|
pack.add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
pack.end();
|
||||||
|
|
||||||
|
await mkdirPromise;
|
||||||
|
|
||||||
|
pack.pipe(createWriteStream(resolve(cwd, 'built', 'tarball', `misskey-${meta.version}.tar.gz`)));
|
||||||
}
|
}
|
||||||
|
|
||||||
pack.end();
|
|
||||||
|
|
||||||
await mkdirPromise;
|
|
||||||
|
|
||||||
pack.pipe(createWriteStream(resolve(cwd, 'built', 'tarball', `misskey-${meta.version}.tar.gz`)));
|
|
||||||
|
|
Loading…
Reference in New Issue