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

Fix/esm #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ yarn-error.log
.vscode
.DS_Store
src/version.ts
dist
6 changes: 0 additions & 6 deletions api/index.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion bin/cucumber-js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require('../lib/cli/run.js').default();
require('../dist/cjs/cli/run.js').default();
5 changes: 5 additions & 0 deletions bin/cucumber-js-es
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env node

import run from '../dist/esm/cli/run.js'

run()
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,26 +179,27 @@
"url": "https://github.com/cucumber/cucumber-js/issues"
},
"directories": {
"lib": "./lib"
"lib": "./dist"
},
"main": "./lib/index.js",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"exports": {
".": {
"import": "./lib/wrapper.mjs",
"require": "./lib/index.js",
"types": "./lib/index.d.ts"
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js",
"types": "./dist/esm/index.d.ts"
},
"./api": {
"import": "./lib/api/wrapper.mjs",
"require": "./lib/api/index.js",
"types": "./lib/api/index.d.ts"
"import": "./dist/esm/api/index.js",
"require": "./dist/cjs/api/index.js",
"types": "./dist/esm/api/index.d.ts"
},
"./lib/*": {
"require": "./lib/*.js"
"require": "./dist/cjs/*.js"
},
"./package.json": "./package.json"
},
"types": "./lib/index.d.ts",
"types": "./dist/esm/index.d.ts",
"engines": {
"node": "14 || 16 || >=18"
},
Expand Down Expand Up @@ -308,7 +309,7 @@
"ansi-regex": "^5.0.1"
},
"scripts": {
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/ && shx cp src/api/wrapper.mjs lib/api/",
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.cjs.json && tsc --build tsconfig.mjs.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/ && shx cp src/api/wrapper.mjs lib/api/",
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
"docs:ci": "api-extractor run --verbose",
"docs:local": "api-extractor run --verbose --local && api-documenter markdown --input-folder ./tmp/api-extractor --output-folder ./docs/api",
Expand All @@ -333,12 +334,13 @@
"update-dependencies": "npx npm-check-updates --upgrade"
},
"bin": {
"cucumber-js": "bin/cucumber.js"
"cucumber-js": "bin/cucumber.js",
"cucumber-js-es": "bin/cucumber.js"
},
"license": "MIT",
"files": [
"api/",
"bin/",
"lib/"
"dist/"
]
}
3 changes: 1 addition & 2 deletions tsconfig.node.json → tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"outDir": "lib"
"outDir": "dist/cjs",
},
"include": ["src/**/*.ts"],
"exclude": ["**/*_spec.ts"]
Expand Down
11 changes: 11 additions & 0 deletions tsconfig.mjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"declaration": true,
"outDir": "dist/esm",
"module": "ESNext",
"moduleResolution": "node"
},
"include": ["src/**/*.ts"],
"exclude": ["**/*_spec.ts"]
}