diff --git a/.gitignore b/.gitignore
index f5d19e3d..ca2ef914 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,10 @@
/.idea/workspace.xml
/.idea/tasks.xml
/node_modules
+/dist
package-lock.json
yarn-error.log
npm-debug.log*
-*.js
-*.d.ts
-*.js.map
-!/types/*.d.ts
# macOS
.DS_Store
diff --git a/.idea/runConfigurations/test.xml b/.idea/runConfigurations/test.xml
index e9a422df..05f807d5 100644
--- a/.idea/runConfigurations/test.xml
+++ b/.idea/runConfigurations/test.xml
@@ -4,13 +4,6 @@
-
-
-
+
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
index 6fa325c2..2eac4bde 100644
--- a/.npmignore
+++ b/.npmignore
@@ -1,19 +1,3 @@
-/.idea
-/tsconfig.json
-/tsconfig.test.json
-/.eslintignore
-/.github
-/renovate.json
-/.snyk
-*.ts
-!*.d.ts
-
-# yarn and npm
-package-lock.json
-yarn.lock
-yarn-error.log
-npm-debug.log*
-
# macOS
.DS_Store
.AppleDouble
diff --git a/index.test.ts b/index.test.ts
index 7e4ab7d8..6986aab6 100644
--- a/index.test.ts
+++ b/index.test.ts
@@ -15,7 +15,7 @@ import {
partitionWhile,
remove,
removeFirst
-} from "./index";
+} from "./index.js";
test("isArray", t => {
t.true(isArray([1, 2, 3]));
diff --git a/package.json b/package.json
index e98294a5..8ef059f2 100644
--- a/package.json
+++ b/package.json
@@ -16,16 +16,22 @@
"scripts": {
"fix": "eslint . --fix && prettier --write .",
"lint": "eslint . && prettier --check .",
- "prepare": "tsc",
+ "prepare": "tsc && tsc --project tsconfig.esm.json",
"semantic-release": "semantic-release",
"test": "ava"
},
+ "type": "module",
"sideEffects": false,
+ "files": [
+ "dist"
+ ],
+ "main": "./dist/cjs/index.cjs",
+ "module": "./dist/esm/index.js",
"devDependencies": {
"@softwareventures/eslint-config": "3.4.2",
"@softwareventures/prettier-config": "1.0.2",
"@softwareventures/semantic-release-config": "1.1.1",
- "@softwareventures/tsconfig": "2.3.3",
+ "@softwareventures/tsconfig": "5.1.0-alpha.1",
"ava": "3.15.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "7.20.0",
@@ -51,11 +57,14 @@
}
},
"ava": {
- "extensions": [
- "ts"
- ],
- "require": [
- "ts-node/register"
+ "extensions": {
+ "ts": "module"
+ },
+ "nonSemVerExperiments": {
+ "configurableModuleFormat": true
+ },
+ "nodeArguments": [
+ "--loader=ts-node/esm"
]
},
"release": {
diff --git a/tsconfig.esm.json b/tsconfig.esm.json
new file mode 100644
index 00000000..4b102be6
--- /dev/null
+++ b/tsconfig.esm.json
@@ -0,0 +1,7 @@
+{
+ "extends": "@softwareventures/tsconfig/esm.json",
+ "exclude": ["**/test.ts", "**/*.test.ts", "dist"],
+ "compilerOptions": {
+ "outDir": "dist/esm"
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
index 0d63500b..3e6438cf 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,7 +1,7 @@
{
"extends": "@softwareventures/tsconfig",
+ "exclude": ["**/test.ts", "**/*.test.ts", "dist"],
"compilerOptions": {
- "lib": ["es5", "es2015.core", "es2015.collection"]
- },
- "exclude": ["**/test.ts", "**/*.test.ts"]
+ "outDir": "dist/cjs"
+ }
}
diff --git a/tsconfig.test.json b/tsconfig.test.json
index 19df0346..0e880b79 100644
--- a/tsconfig.test.json
+++ b/tsconfig.test.json
@@ -1,7 +1,7 @@
{
- "extends": ".",
+ "extends": "./tsconfig.esm.json",
"compilerOptions": {
"noEmit": true
},
- "exclude": []
+ "exclude": ["dist"]
}
diff --git a/yarn.lock b/yarn.lock
index 6d0cbee1..15c6cb14 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -342,10 +342,10 @@
dependencies:
tslib "2.0.0"
-"@softwareventures/tsconfig@2.3.3":
- version "2.3.3"
- resolved "https://registry.yarnpkg.com/@softwareventures/tsconfig/-/tsconfig-2.3.3.tgz#29c619998a6b211180a78f34f0d417eb2eb75b0e"
- integrity sha512-ymbE2zGMozyPLCDXAIrPU6AIMkQuTrAcdy1BRTkYU0rAE7FfNhyPAP3KHbIy/RzJ49HtIMt/RbPBwCWacSiPdw==
+"@softwareventures/tsconfig@5.1.0-alpha.1":
+ version "5.1.0-alpha.1"
+ resolved "https://registry.yarnpkg.com/@softwareventures/tsconfig/-/tsconfig-5.1.0-alpha.1.tgz#adfce94f0e1c3b6da148ae11123ec1c3e526bc3f"
+ integrity sha512-XLDsvYPUyINmFhykIDiZ6TCz9/Z+Paoto1LplYiZ3mu3UKzHGTo8Md24xkZzfbkW3pBmGWngY45uK5fVHTpDZQ==
"@szmarczak/http-timer@^1.1.2":
version "1.1.2"
@@ -4753,7 +4753,6 @@ npm@^6.14.9:
cmd-shim "^3.0.3"
columnify "~1.5.4"
config-chain "^1.1.12"
- debuglog "*"
detect-indent "~5.0.0"
detect-newline "^2.1.0"
dezalgo "~1.0.3"
@@ -4768,7 +4767,6 @@ npm@^6.14.9:
has-unicode "~2.0.1"
hosted-git-info "^2.8.8"
iferr "^1.0.2"
- imurmurhash "*"
infer-owner "^1.0.4"
inflight "~1.0.6"
inherits "^2.0.4"
@@ -4787,14 +4785,8 @@ npm@^6.14.9:
libnpx "^10.2.4"
lock-verify "^2.1.0"
lockfile "^1.0.4"
- lodash._baseindexof "*"
lodash._baseuniq "~4.6.0"
- lodash._bindcallback "*"
- lodash._cacheindexof "*"
- lodash._createcache "*"
- lodash._getnative "*"
lodash.clonedeep "~4.5.0"
- lodash.restparam "*"
lodash.union "~4.6.0"
lodash.uniq "~4.5.0"
lodash.without "~4.4.0"