Skip to content

Commit

Permalink
build: Native ESM support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Only Support for node.js ^12.20.0 || >=14.13.1
  • Loading branch information
sebbo2002 committed Jun 28, 2022
1 parent e0649cc commit 7b86a4f
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require:
- ts-node/register
- source-map-support/register
loader:
- ts-node/esm
full-trace: true
recursive: true
extension:
- ts
experimental-modules: true
134 changes: 96 additions & 38 deletions package-lock.json

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

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,26 @@
"@typescript-eslint/parser": "^5.4.0",
"eslint": "^8.3.0",
"eslint-plugin-jsonc": "^2.0.0",
"esm": "^3.2.25",
"license-checker": "^25.0.1",
"mocha": "^9.1.3",
"mochawesome": "^7.0.1",
"nyc": "^15.1.0",
"semantic-release-license": "^1.0.3",
"source-map-support": "^0.5.21",
"ts-node": "^10.4.0",
"ts-node": "^10.8.1",
"typedoc": "^0.22.10",
"typescript": "^4.5.2"
},
"engines": {
"node": ">=12.0.0"
"node": "^12.20.0 || >=14.13.1"
},
"exports": "./dist/index.js",
"files": [
"/dist"
],
"homepage": "https://github.com/sebbo2002/js-template#readme",
"license": "MIT",
"main": "dist/index.js",
"name": "@sebbo2002/js-template-test",
"repository": {
"type": "git",
Expand All @@ -57,5 +58,6 @@
"start": "node ./dist/bin/start.js",
"test": "mocha"
},
"type": "module",
"version": "1.0.0"
}
2 changes: 1 addition & 1 deletion src/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

/* istanbul ignore file */

import Magic from '../lib';
import Magic from '../lib/index.js';

const number = parseInt(process.argv[process.argv.length - 1], 10);
console.log(Magic.double(number));
4 changes: 2 additions & 2 deletions test/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import Magic from '../../src/lib';
import assert = require('assert');
import Magic from '../../src/lib/index.js';
import assert from 'assert';

describe('Example', function () {
it('should work with integers', function () {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"module": "none",
"module": "es2020",
"moduleResolution": "node",
"outDir": "./dist",
"sourceMap": true,
Expand Down

0 comments on commit 7b86a4f

Please sign in to comment.