Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests in ESM mode #4392

Merged
merged 42 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6e2e1cc
test(apidom-ast): run tests in ESM mode
char0n Oct 19, 2024
29c1364
test(apidom-converter): run tests in ESM mode
char0n Oct 19, 2024
57c4a12
test(apidom-core): run tests in ESM mode
char0n Oct 22, 2024
933c44e
test(apidom-error): run tests in ESM mode
char0n Oct 22, 2024
c152f2f
ci(build): build for EMS, not CJS
char0n Oct 22, 2024
a407271
test(apidom-json-path): run tests in ESM mode
char0n Oct 22, 2024
946377a
Merge branch 'main' into char0n/esm-tests
char0n Oct 22, 2024
60db02c
test(apidom-json-pointer): run tests in ESM mode
char0n Oct 22, 2024
3efbe15
test(apidom-json-pointer-relative): run tests in ESM mode
char0n Oct 22, 2024
68622f8
test(apidom-logging): run tests in ESM mode
char0n Oct 22, 2024
6b67b13
test(apidom-parser-adapter-json): run tests in ESM mode
char0n Oct 22, 2024
8a27501
fix: achieve backward compatibility
char0n Oct 23, 2024
825ffbf
test(apidom-parser-adapter-yamo-1-2): run tests in ESM mode
char0n Oct 23, 2024
2bef2dd
test(apidom-ns-json-schema-draft-4): run tests in ESM mode
char0n Oct 23, 2024
88e79ed
test(apidom-parser-adapter): run tests in ESM mode
char0n Oct 23, 2024
11faaf6
test(apidom-ns-openapi-3-1): run tetst in ESM mode
char0n Oct 23, 2024
c50e8b3
test(apidom-ns-openapi-3-0): run tests in ESM mode
char0n Oct 23, 2024
7e0e63d
test(apidon-ns-openapi-2): run tests in ESM mode
char0n Oct 23, 2024
4268e89
test(apidom-ns-json-schema-draft-6): run tests in ESM mode
char0n Oct 23, 2024
6dd33b3
test(apidom-ns-json-schema-draft-7): run tests in ESM mode
char0n Oct 23, 2024
0475217
test(apidom-parser-adapter-openapi-yaml-2): run tests in ESM mode
char0n Oct 23, 2024
41f2982
test(apidom-parser-adapter-openapi-json-2): run tests in ESM mode
char0n Oct 23, 2024
58f79a2
test(apidom-parser-adapter-openapi-json-3-0): run tests in ESM mode
char0n Oct 23, 2024
26268d5
test(apidom-parser-adapter-openapi-3-1): run tests in ESM mode
char0n Oct 23, 2024
9ebbed9
test(apidom-parser-adapter-openapi-yaml-3-0): run tets in ESM mode
char0n Oct 23, 2024
1d81d72
test(apidom-parser-adapter-openapi-yaml3-1): run tests in ESM mode
char0n Oct 23, 2024
d109478
test(apidom-parser-adapter-workflows-json-1): run tests in ESM mode
char0n Oct 23, 2024
87429fa
test(apidom-parser-adapter-workflows-yaml-1-2): run tests in ESM mode
char0n Oct 23, 2024
9418139
test(apidom-parser-adapter-api-design-systems-json): run tests in ESM
char0n Oct 23, 2024
e546196
test(apidom-parser-adapter-api-design-systems-json): run tests in ESM
char0n Oct 23, 2024
0818b0b
test(apidom-parser-adapter-asyncapi-json-2): run tests in ESM
char0n Oct 23, 2024
c2a0455
test(apidom-parser-adapter-asyncapi-yaml-2): run tests in ESM
char0n Oct 23, 2024
da0ed3a
test(apidom-ns-asyncapi-2): run tests in ESM mode
char0n Oct 24, 2024
32b9636
test(apidom-ns-workflows-1): run tests in ESM
char0n Oct 24, 2024
c0e8c8a
test(apidom-ns-ads): run tests in ESM mode
char0n Oct 24, 2024
cb0cfb4
test(apidom-reference): run tests in ESM
char0n Oct 24, 2024
dcadc4d
test(piadom-ls): run tests in ESM
char0n Oct 24, 2024
c84c404
fix: remove ignored file
char0n Oct 24, 2024
79ba91f
fix(types): fix type checking
char0n Oct 24, 2024
c523889
Merge branch 'main' into char0n/esm-tests
char0n Oct 24, 2024
15e9eb0
refactor: return back json files
char0n Oct 24, 2024
24f7d89
Merge branch 'char0n/esm-tests' of github.com:swagger-api/apidom into…
char0n Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Build monorepo for testing
run: |
npm run prebuild
npm run build:cjs
npm run build:es
- name: Execute tests in monorepo
run: npm run test

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,17 +235,18 @@ All the packages have identical build system and expose build artifacts in ident
After building artifacts, every package will contain five (5) additional directories.
All the build artifacts are polymorphic - they can run in different environments like [Web Browser](https://en.wikipedia.org/wiki/Web_browser), [Node.js](https://nodejs.org/) or [Web Worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).

**cjs/**
***.cjs**

This directory mirrors the structure of the codebase in `src/`.
Contains ES5 compatible code with [CommonJS](https://en.wikipedia.org/wiki/CommonJS) style imports.
Build fragments in this directory are ideal for [Node.js](https://nodejs.org/) and similar environments.
These files are generated inside `src/` directory.
Contain ES5 compatible code with [CommonJS](https://en.wikipedia.org/wiki/CommonJS) style imports.
These build fragments are ideal for legacy [Node.js](https://nodejs.org/) and similar environments.

**es/**
***.mjs**

This directory mirrors the structure of the codebase in `src/`.
Contains ES5 compatible code with [ES6 imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
Build fragments in this directory are ideal for bundling with [Webpack](https://webpack.js.org/) or similar bundlers.
These files are generated inside `src/` directory.
Contain ES5 compatible code with [ES6 imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import).
These build fragments are ideal for modern [Node.js](https://nodejs.org/),
bundling with [Webpack](https://webpack.js.org/) or similar bundlers.

**dist/**

Expand Down
32 changes: 18 additions & 14 deletions babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ const path = require('node:path');

module.exports = {
babelrcRoots: ['packages/*'],
ignore: [
'**/*.d.ts',
],
ignore: ['**/*.d.ts'],
env: {
cjs: {
browserslistEnv: "isomorphic-production",
browserslistEnv: 'isomorphic-production',
presets: [
[
'@babel/preset-env',
{
debug: false,
modules: "commonjs",
modules: 'commonjs',
loose: true,
useBuiltIns: false,
forceAllTransforms: false,
Expand All @@ -25,7 +23,7 @@ module.exports = {
'@babel/preset-typescript',
{
allowDeclareFields: true,
}
},
],
],
plugins: [
Expand All @@ -40,12 +38,15 @@ module.exports = {
},
],
process.env.NODE_ENV !== 'test'
? [path.join(__dirname, './scripts/babel-plugin-add-import-extension.cjs'), { extension: 'cjs' }]
: false
? [
path.join(__dirname, './scripts/babel-plugin-add-import-extension.cjs'),
{ extension: 'cjs' },
]
: false,
].filter(Boolean),
},
es: {
browserslistEnv: "isomorphic-production",
browserslistEnv: 'isomorphic-production',
presets: [
[
'@babel/preset-env',
Expand All @@ -62,7 +63,7 @@ module.exports = {
'@babel/preset-typescript',
{
allowDeclareFields: true,
}
},
],
],
plugins: [
Expand All @@ -77,11 +78,14 @@ module.exports = {
version: '^7.22.15',
},
],
[path.join(__dirname, './scripts/babel-plugin-add-import-extension.cjs'), { extension: 'mjs' }],
[
path.join(__dirname, './scripts/babel-plugin-add-import-extension.cjs'),
{ extension: 'mjs' },
],
],
},
browser: {
browserslistEnv: "browser-production",
browserslistEnv: 'browser-production',
presets: [
[
'@babel/preset-env',
Expand All @@ -98,7 +102,7 @@ module.exports = {
'@babel/preset-typescript',
{
allowDeclareFields: true,
}
},
],
],
plugins: [
Expand All @@ -112,7 +116,7 @@ module.exports = {
version: '^7.22.15',
},
],
]
],
},
},
};
Loading