merge: upstream
This commit is contained in:
commit
10bfc61670
1855 changed files with 5717 additions and 4115 deletions
|
@ -1,20 +1,34 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as fs from 'node:fs/promises';
|
||||
import * as path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import cssnano from 'cssnano';
|
||||
import * as yaml from 'js-yaml';
|
||||
import postcss from 'postcss';
|
||||
import * as terser from 'terser';
|
||||
|
||||
import { build as buildLocales } from '../locales/index.js';
|
||||
import generateDTS from '../locales/generateDTS.js';
|
||||
import meta from '../package.json' assert { type: "json" };
|
||||
import buildTarball from './tarball.mjs';
|
||||
|
||||
const configDir = fileURLToPath(new URL('../.config', import.meta.url));
|
||||
const configPath = process.env.MISSKEY_CONFIG_YML
|
||||
? path.resolve(configDir, process.env.MISSKEY_CONFIG_YML)
|
||||
: process.env.NODE_ENV === 'test'
|
||||
? path.resolve(configDir, 'test.yml')
|
||||
: path.resolve(configDir, 'default.yml');
|
||||
|
||||
let locales = buildLocales();
|
||||
|
||||
async function loadConfig() {
|
||||
return fs.readFile(configPath, 'utf-8').then(data => yaml.load(data)).catch(() => null);
|
||||
}
|
||||
|
||||
async function copyFrontendFonts() {
|
||||
await fs.cp('./packages/frontend/node_modules/three/examples/fonts', './built/_frontend_dist_/fonts', { dereference: true, recursive: true });
|
||||
}
|
||||
|
@ -77,12 +91,13 @@ async function build() {
|
|||
copyBackendViews(),
|
||||
buildBackendScript(),
|
||||
buildBackendStyle(),
|
||||
loadConfig().then(config => config?.publishTarballInsteadOfProvideRepositoryUrl && buildTarball()),
|
||||
]);
|
||||
}
|
||||
|
||||
await build();
|
||||
|
||||
if (process.argv.includes("--watch")) {
|
||||
if (process.argv.includes('--watch')) {
|
||||
const watcher = fs.watch('./locales');
|
||||
for await (const event of watcher) {
|
||||
const filename = event.filename?.replaceAll('\\', '/');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
|
@ -70,7 +70,7 @@ execa('pnpm', ['--filter', 'backend', 'dev'], {
|
|||
stderr: process.stderr,
|
||||
});
|
||||
|
||||
execa('pnpm', ['--filter', 'frontend', 'dev'], {
|
||||
execa('pnpm', ['--filter', 'frontend', process.env.MK_DEV_PREFER === 'backend' ? 'watch' : 'dev'], {
|
||||
cwd: _dirname + '/../',
|
||||
stdout: process.stdout,
|
||||
stderr: process.stderr,
|
||||
|
|
32
scripts/tarball.mjs
Normal file
32
scripts/tarball.mjs
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { createWriteStream } from 'node:fs';
|
||||
import { mkdir } from 'node:fs/promises';
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import glob from 'fast-glob';
|
||||
import walk from 'ignore-walk';
|
||||
import Pack from 'tar/lib/pack.js';
|
||||
import meta from '../package.json' assert { type: "json" };
|
||||
|
||||
const cwd = fileURLToPath(new URL('..', import.meta.url));
|
||||
const ignore = [
|
||||
'**/.git/**/*',
|
||||
'**/*ignore',
|
||||
'**/.gitmodules',
|
||||
// Exclude files you don't want to include in the tarball here
|
||||
];
|
||||
|
||||
export default async function build() {
|
||||
const mkdirPromise = mkdir(resolve(cwd, 'built', 'tarball'), { recursive: true });
|
||||
const pack = new Pack({ cwd, gzip: true });
|
||||
const patterns = await walk({ path: cwd, ignoreFiles: ['.gitignore'] });
|
||||
|
||||
for await (const entry of glob.stream(patterns, { cwd, ignore, dot: true })) {
|
||||
pack.add(entry);
|
||||
}
|
||||
|
||||
pack.end();
|
||||
|
||||
await mkdirPromise;
|
||||
|
||||
pack.pipe(createWriteStream(resolve(cwd, 'built', 'tarball', `sharkey-${meta.version}.tar.gz`)));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue