fix(build): autogen生成時にbackendを2度buildしているのを修正 (#14309)
* fix(build): autogen生成時にbackendを2度buildしているのを修正 * fix * fix
This commit is contained in:
parent
0d76842abe
commit
46d96c7412
@ -21,7 +21,7 @@
|
|||||||
"build-assets": "node ./scripts/build-assets.mjs",
|
"build-assets": "node ./scripts/build-assets.mjs",
|
||||||
"build": "pnpm build-pre && pnpm -r build && pnpm build-assets",
|
"build": "pnpm build-pre && pnpm -r build && pnpm build-assets",
|
||||||
"build-storybook": "pnpm --filter frontend build-storybook",
|
"build-storybook": "pnpm --filter frontend build-storybook",
|
||||||
"build-misskey-js-with-types": "pnpm build-pre && pnpm --filter backend... --filter=!misskey-js build && pnpm --filter backend generate-api-json && ncp packages/backend/built/api.json packages/misskey-js/generator/api.json && pnpm --filter misskey-js update-autogen-code && pnpm --filter misskey-js build && pnpm --filter misskey-js api",
|
"build-misskey-js-with-types": "pnpm build-pre && pnpm --filter backend... --filter=!misskey-js build && pnpm --filter backend generate-api-json --no-build && ncp packages/backend/built/api.json packages/misskey-js/generator/api.json && pnpm --filter misskey-js update-autogen-code && pnpm --filter misskey-js build && pnpm --filter misskey-js api",
|
||||||
"start": "pnpm check:connect && cd packages/backend && node ./built/boot/entry.js",
|
"start": "pnpm check:connect && cd packages/backend && node ./built/boot/entry.js",
|
||||||
"start:test": "cd packages/backend && cross-env NODE_ENV=test node ./built/boot/entry.js",
|
"start:test": "cd packages/backend && cross-env NODE_ENV=test node ./built/boot/entry.js",
|
||||||
"init": "pnpm migrate",
|
"init": "pnpm migrate",
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
"test:e2e": "pnpm build && pnpm build:test && pnpm jest:e2e",
|
"test:e2e": "pnpm build && pnpm build:test && pnpm jest:e2e",
|
||||||
"test-and-coverage": "pnpm jest-and-coverage",
|
"test-and-coverage": "pnpm jest-and-coverage",
|
||||||
"test-and-coverage:e2e": "pnpm build && pnpm build:test && pnpm jest-and-coverage:e2e",
|
"test-and-coverage:e2e": "pnpm build && pnpm build:test && pnpm jest-and-coverage:e2e",
|
||||||
"generate-api-json": "pnpm build && node ./scripts/generate_api_json.js"
|
"generate-api-json": "node ./scripts/generate_api_json.js"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@swc/core-android-arm64": "1.3.11",
|
"@swc/core-android-arm64": "1.3.11",
|
||||||
|
@ -3,11 +3,34 @@
|
|||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { loadConfig } from '../built/config.js'
|
import { execa } from 'execa';
|
||||||
import { genOpenapiSpec } from '../built/server/api/openapi/gen-spec.js'
|
import { writeFileSync, existsSync } from "node:fs";
|
||||||
import { writeFileSync } from "node:fs";
|
|
||||||
|
async function main() {
|
||||||
|
if (!process.argv.includes('--no-build')) {
|
||||||
|
await execa('pnpm', ['run', 'build'], {
|
||||||
|
stdout: process.stdout,
|
||||||
|
stderr: process.stderr,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existsSync('./built')) {
|
||||||
|
throw new Error('`built` directory does not exist.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @type {import('../src/config.js')} */
|
||||||
|
const { loadConfig } = await import('../built/config.js');
|
||||||
|
|
||||||
|
/** @type {import('../src/server/api/openapi/gen-spec.js')} */
|
||||||
|
const { genOpenapiSpec } = await import('../built/server/api/openapi/gen-spec.js');
|
||||||
|
|
||||||
const config = loadConfig();
|
const config = loadConfig();
|
||||||
const spec = genOpenapiSpec(config, true);
|
const spec = genOpenapiSpec(config, true);
|
||||||
|
|
||||||
writeFileSync('./built/api.json', JSON.stringify(spec), 'utf-8');
|
writeFileSync('./built/api.json', JSON.stringify(spec), 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
main().catch(e => {
|
||||||
|
console.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user