Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ version: 2
jobs:
test:
docker:
- image: circleci/node:10
- image: circleci/node:lts
steps:
- checkout
- run: yarn
- run: yarn lint
- run: yarn test --maxWorkers=2
build:
docker:
- image: circleci/node:10
- image: circleci/node:lts
steps:
- checkout
- run: yarn
- run: yarn build

release:
docker:
- image: circleci/node:10
- image: circleci/node:lts
steps:
- checkout
- run: yarn
Expand All @@ -37,7 +37,9 @@ workflows:
- release:
filters:
branches:
only: master
only:
- beta
- master
requires:
- test
- build
11 changes: 10 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
module.exports = {
preset: 'ts-jest',
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
testMatch: ['<rootDir>/src/**/__tests__/*.(spec|test).(ts|js)'],
globals: {
'ts-jest': {
useESM: true,
},
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
};
104 changes: 76 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,106 @@
"url": "https://github.com/stoplightio/http-spec"
},
"license": "Apache-2.0",
"main": "src/index.ts",
"files": [
"**/*"
],
"engines": {
"node": ">=10"
"node": ">=14.13"
},
"type": "commonjs",
"main": "./index.js",
"module": "./index.esm.js",
"types": "./index.d.ts",
"exports": {
".": {
"types": "./index.d.ts",
"import": "./index.mjs",
"require": "./index.js"
},
"./oas": {
"types": "./oas/index.d.ts",
"import": "./oas/index.mjs",
"require": "./oas/index.js"
},
"./oas2": {
"types": "./oas2/index.d.ts",
"import": "./oas2/index.mjs",
"require": "./oas2/index.js"
},
"./oas2/operation": {
"types": "./oas2/operation.d.ts",
"import": "./oas2/operation.mjs",
"require": "./oas2/operation.js"
},
"./oas3": {
"types": "./oas3/index.d.ts",
"import": "./oas3/index.mjs",
"require": "./oas3/index.js"
},
"./oas3/operation": {
"types": "./oas3/operation.d.ts",
"import": "./oas3/operation.mjs",
"require": "./oas3/operation.js"
},
"./postman": {
"types": "./postman/index.d.ts",
"import": "./postman/index.mjs",
"require": "./postman/index.js"
},
"./postman/operation": {
"types": "./postman/operation.d.ts",
"import": "./postman/operation.mjs",
"require": "./postman/operation.js"
}
},
"scripts": {
"build": "sl-scripts build",
"build": "sl-scripts bundle && cp ./dist/index.mjs ./dist/index.esm.js && tsc -p tsconfig.build.json --declaration --emitDeclarationOnly --declarationDir dist",
"postbuild": "yarn test.packaging",
"lint": "eslint 'src/**/*.ts'",
"lint.fix": "yarn lint --fix",
"release": "sl-scripts release",
"release.dryRun": "sl-scripts release --dry-run --debug",
"test": "jest"
},
"dependencies": {
"@stoplight/json": "^3.10.2",
"@stoplight/types": "^12.4.0",
"@stoplight/json": "^3.18.0",
"@stoplight/types": "^13.0.0",
"@types/json-schema": "7.0.5",
"@types/swagger-schema-official": "~2.0.21",
"@types/to-json-schema": "^0.2.0",
"@types/type-is": "^1.6.3",
"@types/urijs": "~1.19.9",
"json-schema": "^0.4.0",
"fnv-plus": "^1.3.1",
"json-schema-generator": "^2.0.6",
"lodash": "^4.17.15",
"lodash.isequalwith": "^4.4.0",
"lodash.pick": "^4.4.0",
"lodash.pickby": "^4.6.0",
"openapi3-ts": "^2.0.1",
"postman-collection": "^4.1.0",
"type-is": "^1.6.18",
"urijs": "~1.19.2"
"tslib": "^2.3.1",
"type-is": "^1.6.18"
},
"devDependencies": {
"@stoplight/eslint-config": "^1.1.0",
"@stoplight/scripts": "^8.2.1",
"@stoplight/eslint-config": "^3.0.0",
"@stoplight/scripts": "^9.2.0",
"@stoplight/test-utils": "^0.0.1",
"@types/jest": "26.0.3",
"@types/json-schema": "7.0.5",
"@types/lodash": "4.14.157",
"@types/lodash.isequalwith": "^4.4.6",
"@types/lodash.pick": "^4.4.6",
"@types/lodash.pickby": "^4.6.6",
"@types/postman-collection": "^3.5.3",
"@typescript-eslint/eslint-plugin": "^3.5.0",
"@typescript-eslint/parser": "^3.5.0",
"eslint": "^7.3.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.17.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.5",
"eslint-plugin-simple-import-sort": "^5.0.3",
"jest": "26.1.0",
"prettier": "^2.0.5",
"ts-jest": "26.1.1",
"@typescript-eslint/eslint-plugin": "^5.15.0",
"@typescript-eslint/parser": "^5.15.0",
"eslint": "^8.11.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.1.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"jest": "^27.5.1",
"prettier": "^2.6.0",
"ts-jest": "^27.1.4",
"ts-node": "^8.10.2",
"typescript": "3.9.6",
"typescript": "4.6.2",
"utility-types": "^3.10.0"
},
"lint-staged": {
Expand Down
36 changes: 36 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as path from 'path';
import typescript from 'rollup-plugin-typescript2';

import pkg from './package.json';

module.exports = {
input: Object.values(pkg.exports).map(({ require: entry }) =>
path.join('src', path.dirname(entry), path.basename(entry, path.extname(entry)) + '.ts'),
),
output: [
{
dir: './dist',
entryFileNames: '[name].js',
exports: 'named',
format: 'cjs',
name: pkg.name,
preserveModules: true,
sourcemap: true,
},
{
dir: './dist',
entryFileNames: '[name].mjs',
format: 'es',
name: pkg.name,
preserveModules: true,
sourcemap: true,
},
],
external: Object.keys(pkg.dependencies),
plugins: [
typescript({
tsconfig: './tsconfig.build.json',
useTsconfigDeclarationDir: true,
}),
],
};
Loading