Skip to content

Commit

Permalink
feat: remove openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
v8tenko committed Jun 6, 2023
1 parent 31e05b5 commit cac389f
Show file tree
Hide file tree
Showing 42 changed files with 51 additions and 6,705 deletions.
6 changes: 1 addition & 5 deletions .babelrc → babel.config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"presets": [
"@babel/env",
"@babel/react",
"@babel/typescript"
],
"presets": [["@babel/env", { "modules": "cjs", "targets": { "node": true }}], "@babel/react", "@babel/typescript"],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-runtime",
Expand Down
29 changes: 21 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@apidevtools/swagger-parser": "^10.1.0",
"@diplodoc/markdown-translation": "^0.1.0",
"@diplodoc/mermaid-extension": "0.0.2",
"@diplodoc/openapi-extension": "1.2.3",
"@doc-tools/components": "^2.7.2",
"@doc-tools/transform": "^3.0.2",
"@doc-tools/yfm2xliff": "0.0.5",
Expand Down
13 changes: 9 additions & 4 deletions scripts/build.cli.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
const esbuild = require('esbuild');
const {version} = require('../package.json');
const {version, dependencies} = require('../package.json');
const {target} = require('../tsconfig.json').compilerOptions;
const diplodocExtensions = Object.keys(dependencies).filter((name) => name.startsWith('@diplodoc'));

const commonConfig = {
tsconfig: './tsconfig.json',
packages: 'external',
platform: 'node',
target: target,
format: 'cjs',
bundle: true,
sourcemap: true,
define: {
Expand All @@ -17,17 +21,18 @@ const builds = [
[['src/workers/linter/index.ts'], 'build/linter.js'],
];

builds.forEach(([entries, target]) => {
builds.forEach(([entries, outfile]) => {
const currentConfig = {
...commonConfig,
entryPoints: entries,
outfile: target,
outfile,
};

if (target.endsWith('index.js')) {
if (outfile.endsWith('index.js')) {
currentConfig.banner = {
js: '#!/usr/bin/env node',
};
currentConfig.external = diplodocExtensions;
}

esbuild.build(currentConfig);
Expand Down
5 changes: 3 additions & 2 deletions src/app/components/App/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import {getDocSettings, updateRootClassName, withSavingSetting} from '../../util
import '../../interceptors/leading-page-links';

import {useMermaid} from '@diplodoc/mermaid-extension/hooks';
import {Runtime as OpenapiSandbox} from '../../../services/includers/batteries/openapi/plugin/public';
import '../../../services/includers/batteries/openapi/generators/style.scss';
import {Runtime as OpenapiSandbox} from '@diplodoc/openapi-extension/runtime';

// webpack@4.0 cannot parse node "exports" field. @todo fix, after migrate to webpack@5.0
import '@diplodoc/openapi-extension/runtime/index.min.css';
import '@doc-tools/components/styles/themes.scss';
import '@doc-tools/components/styles/default.scss';
import '@doc-tools/components/styles/typography.scss';
Expand Down
5 changes: 2 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ const monospace = require('@doc-tools/transform/lib/plugins/monospace');
const table = require('@doc-tools/transform/lib/plugins/table');
const term = require('@doc-tools/transform/lib/plugins/term');
const mermaid = require('@diplodoc/mermaid-extension');
const openapi = require('@diplodoc/openapi-extension');

includes.collect = require('@doc-tools/transform/lib/plugins/includes/collect');
images.collect = require('@doc-tools/transform/lib/plugins/images/collect');

import openapiSandbox from './services/includers/batteries/openapi/plugin';

export const BUILD_FOLDER = 'build';
export const BUNDLE_FOLDER = '_bundle';
export const BUNDLE_FILENAME = 'app.js';
Expand Down Expand Up @@ -84,7 +83,7 @@ export const YFM_PLUGINS = [
monospace,
table,
term,
openapiSandbox,
openapi.transform(),
mermaid.transform(),
];

Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {argvValidator} from './validator';
import {prepareMapFile} from './steps/processMapFile';
import {copyFiles} from './utils';
import {Resources} from './models';
import OpenapiIncluder from '@diplodoc/openapi-extension/includer';

console.time(MAIN_TIMER_ID);

Expand Down Expand Up @@ -172,7 +173,7 @@ async function main(args: Arguments<any>) {
input: tmpInputFolder,
output: tmpOutputFolder,
});
Includers.init();
Includers.init([OpenapiIncluder as any]);

const {
output: outputFolderPath,
Expand Down
1 change: 0 additions & 1 deletion src/services/includers/batteries/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * as generic from './generic';
export * as sourcedocs from './sourcedocs';
export * as openapi from './openapi';
export * as unarchive from './unarchive';
89 changes: 0 additions & 89 deletions src/services/includers/batteries/openapi/constants.ts

This file was deleted.

93 changes: 0 additions & 93 deletions src/services/includers/batteries/openapi/generators/common.ts

This file was deleted.

This file was deleted.

Loading

0 comments on commit cac389f

Please sign in to comment.