mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-29 01:18:25 +01:00
fix(misskey-js): build-misskey-js-with-types
時はapi.json
のGETをスキップするように
This commit is contained in:
parent
c6c668d873
commit
865458989f
8 changed files with 16 additions and 1733 deletions
|
@ -18,7 +18,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 --filter backend 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 --filter backend build && pnpm --filter backend generate-api-json --skip-get && ncp packages/backend/built/api-get-skipped.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",
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
import { loadConfig } from './built/config.js'
|
import { loadConfig } from './built/config.js'
|
||||||
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
|
import { genOpenapiSpec } from './built/server/api/openapi/gen-spec.js'
|
||||||
import { writeFileSync } from "node:fs";
|
import { writeFileSync } from 'node:fs';
|
||||||
|
import { argv } from 'node:process';
|
||||||
|
|
||||||
|
const skipGet = argv.includes('--skip-get');
|
||||||
|
|
||||||
const config = loadConfig();
|
const config = loadConfig();
|
||||||
const spec = genOpenapiSpec(config);
|
const spec = genOpenapiSpec(config, skipGet);
|
||||||
|
|
||||||
writeFileSync('./built/api.json', JSON.stringify(spec), 'utf-8');
|
const path = `./built/api${skipGet ? '-get-skipped' : ''}.json`;
|
||||||
|
|
||||||
|
writeFileSync(path, JSON.stringify(spec), 'utf-8');
|
||||||
|
|
|
@ -8,7 +8,7 @@ import endpoints, { IEndpoint } from '../endpoints.js';
|
||||||
import { errors as basicErrors } from './errors.js';
|
import { errors as basicErrors } from './errors.js';
|
||||||
import { schemas, convertSchemaToOpenApiSchema } from './schemas.js';
|
import { schemas, convertSchemaToOpenApiSchema } from './schemas.js';
|
||||||
|
|
||||||
export function genOpenapiSpec(config: Config) {
|
export function genOpenapiSpec(config: Config, skipGet = false) {
|
||||||
const spec = {
|
const spec = {
|
||||||
openapi: '3.1.0',
|
openapi: '3.1.0',
|
||||||
|
|
||||||
|
@ -210,12 +210,7 @@ export function genOpenapiSpec(config: Config) {
|
||||||
};
|
};
|
||||||
|
|
||||||
spec.paths['/' + endpoint.name] = {
|
spec.paths['/' + endpoint.name] = {
|
||||||
...(endpoint.meta.allowGet ? {
|
...(!skipGet && endpoint.meta.allowGet ? { get: info } : {}),
|
||||||
get: {
|
|
||||||
...info,
|
|
||||||
operationId: 'get/' + endpoint.name,
|
|
||||||
},
|
|
||||||
} : {}),
|
|
||||||
post: info,
|
post: info,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.2
|
* version: 2023.12.2
|
||||||
* generatedAt: 2024-01-13T02:47:41.647Z
|
* generatedAt: 2024-01-13T04:19:51.712Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SwitchCaseResponseType } from '../api.js';
|
import type { SwitchCaseResponseType } from '../api.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.2
|
* version: 2023.12.2
|
||||||
* generatedAt: 2024-01-13T02:47:41.642Z
|
* generatedAt: 2024-01-13T04:19:51.705Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.2
|
* version: 2023.12.2
|
||||||
* generatedAt: 2024-01-13T02:47:41.639Z
|
* generatedAt: 2024-01-13T04:19:51.701Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { operations } from './types.js';
|
import { operations } from './types.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* version: 2023.12.2
|
* version: 2023.12.2
|
||||||
* generatedAt: 2024-01-13T02:47:41.637Z
|
* generatedAt: 2024-01-13T04:19:51.699Z
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { components } from './types.js';
|
import { components } from './types.js';
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue