-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add apidom-converter package scaffolding (#3699)
Refs #3698
- Loading branch information
Showing
19 changed files
with
294 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/dist | ||
/es | ||
/cjs | ||
/types | ||
/config | ||
/.eslintrc.js | ||
/.nyc_output | ||
/node_modules | ||
/**/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/dist | ||
/es | ||
/cjs | ||
/types | ||
/NOTICE | ||
/swagger-api-apidom-converter-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recursive": true, | ||
"spec": "test/**/*.ts", | ||
"file": ["test/mocha-bootstrap.cjs"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
save-prefix="=" | ||
save=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# @swagger-api/apidom-converter | ||
|
||
`apidom-converter` is a package that facilitates conversion of API specifications. | ||
|
||
## Installation | ||
|
||
You can install this package via [npm CLI](https://docs.npmjs.com/cli) by running the following command: | ||
|
||
```sh | ||
$ npm install @swagger-api/apidom-converter | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import dts from 'rollup-plugin-dts'; | ||
|
||
const config = [ | ||
{ | ||
input: './types/index.d.ts', | ||
output: [{ file: 'types/dist.d.ts', format: 'es' }], | ||
plugins: [dts()], | ||
external: ['Function/Curry'], | ||
}, | ||
]; | ||
|
||
export default config; |
70 changes: 70 additions & 0 deletions
70
packages/apidom-converter/config/webpack/browser.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import path from 'node:path'; | ||
import { nonMinimizeTrait, minimizeTrait } from './traits.config.js'; | ||
|
||
const browser = { | ||
mode: 'production', | ||
entry: ['./src/index.ts'], | ||
target: 'web', | ||
performance: { | ||
maxEntrypointSize: 1100000, | ||
maxAssetSize: 1100000, | ||
}, | ||
output: { | ||
path: path.resolve('./dist'), | ||
filename: 'apidom-converter.browser.js', | ||
libraryTarget: 'umd', | ||
library: 'apidomConverter', | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.mjs', '.js', '.json'], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(ts|js)?$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
babelrc: true, | ||
rootMode: 'upward', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
...nonMinimizeTrait, | ||
}; | ||
|
||
const browserMin = { | ||
mode: 'production', | ||
entry: ['./src/index.ts'], | ||
target: 'web', | ||
output: { | ||
path: path.resolve('./dist'), | ||
filename: 'apidom-converter.browser.min.js', | ||
libraryTarget: 'umd', | ||
library: 'apidomConverter', | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.mjs', '.js', '.json'], | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(ts|js)?$/, | ||
exclude: /node_modules/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
babelrc: true, | ||
rootMode: 'upward', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
...minimizeTrait, | ||
}; | ||
|
||
export default [browser, browserMin]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import webpack from 'webpack'; | ||
import TerserPlugin from 'terser-webpack-plugin'; | ||
|
||
export const nonMinimizeTrait = { | ||
optimization: { | ||
minimize: false, | ||
usedExports: false, | ||
concatenateModules: false, | ||
}, | ||
}; | ||
|
||
export const minimizeTrait = { | ||
plugins: [ | ||
new webpack.LoaderOptionsPlugin({ | ||
minimize: true, | ||
}), | ||
], | ||
optimization: { | ||
minimizer: [ | ||
new TerserPlugin({ | ||
terserOptions: { | ||
compress: { | ||
warnings: false, | ||
}, | ||
output: { | ||
comments: false, | ||
}, | ||
}, | ||
}), | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": [ | ||
"test/**/*" | ||
], | ||
"compilerOptions": { | ||
"declaration": true, | ||
"declarationDir": "types", | ||
"noEmit": false, | ||
"emitDeclarationOnly": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "@swagger-api/apidom-converter", | ||
"version": "0.92.0", | ||
"description": "Tool for converting API specifications.", | ||
"private": true, | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
}, | ||
"type": "module", | ||
"unpkg": "./dist/apidom-converter.browser.min.js", | ||
"main": "./cjs/index.cjs", | ||
"exports": { | ||
"types": "./types/dist.d.ts", | ||
"import": "./es/index.mjs", | ||
"require": "./cjs/index.cjs" | ||
}, | ||
"types": "./types/dist.d.ts", | ||
"scripts": { | ||
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser", | ||
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'", | ||
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir cjs --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'", | ||
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress", | ||
"lint": "eslint ./", | ||
"lint:fix": "eslint ./ --fix", | ||
"clean": "rimraf ./es ./cjs ./dist ./types", | ||
"typescript:check-types": "tsc --noEmit", | ||
"typescript:declaration": "copyfiles -u 1 'src/**/*.d.ts' ./types && tsc -p declaration.tsconfig.json && rollup -c config/rollup/types.dist.js", | ||
"test": "cross-env NODE_ENV=test BABEL_ENV=cjs mocha", | ||
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 BABEL_ENV=cjs mocha", | ||
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .", | ||
"postpack": "rimraf NOTICE LICENSES" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/swagger-api/apidom.git" | ||
}, | ||
"author": "Vladimír Gorej", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@babel/runtime-corejs3": "^7.20.7" | ||
}, | ||
"files": [ | ||
"cjs/", | ||
"dist/", | ||
"es/", | ||
"types/dist.d.ts", | ||
"types/minim.d.ts", | ||
"LICENSES", | ||
"NOTICE", | ||
"README.md", | ||
"CHANGELOG.md" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const foo = Symbol('foo'); | ||
|
||
export default foo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"env": { | ||
"mocha": true | ||
}, | ||
"globals": { | ||
"document": true | ||
}, | ||
"plugins": [ | ||
"mocha" | ||
], | ||
"rules": { | ||
"no-void": 0, | ||
"no-underscore-dangle": 0, | ||
"func-names": 0, | ||
"prefer-arrow-callback": 0, | ||
"no-array-constructor": 0, | ||
"prefer-rest-params": 0, | ||
"no-new-wrappers": 0, | ||
"mocha/no-skipped-tests": 2, | ||
"mocha/handle-done-callback": 2, | ||
"mocha/valid-suite-description": 2, | ||
"mocha/no-mocha-arrows": 2, | ||
"mocha/no-hooks-for-single-case": 2, | ||
"mocha/no-sibling-hooks": 2, | ||
"mocha/no-top-level-hooks": 2, | ||
"mocha/no-identical-title": 2, | ||
"mocha/no-nested-tests": 2, | ||
"mocha/no-exclusive-tests": 2, | ||
"max-classes-per-file": 0 | ||
}, | ||
"overrides": [{ | ||
"files": ["mocha-bootstrap.cjs"], | ||
"parserOptions": { | ||
"sourceType": "script" | ||
}, | ||
"rules": { | ||
"@typescript-eslint/no-var-requires": 0 | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { assert } from 'chai'; | ||
|
||
describe('apidom-converter', function () { | ||
it('initial test', async function () { | ||
assert.strictEqual(true, true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require('@babel/register')({ extensions: ['.js', '.ts'], rootMode: 'upward' }); | ||
|
||
const chai = require('chai'); | ||
const { jestSnapshotPlugin, addSerializer } = require('mocha-chai-jest-snapshot'); | ||
|
||
const jestApiDOMSerializer = require('../../../scripts/jest-serializer-apidom.cjs'); | ||
const jestStringSerializer = require('../../../scripts/jest-serializer-string.cjs'); | ||
|
||
chai.use(jestSnapshotPlugin()); | ||
addSerializer(jestApiDOMSerializer); | ||
addSerializer(jestStringSerializer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"include": [ | ||
"src/**/*", | ||
"test/**/*" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.