From 1ed0e2f92f8951c57e52d31e9d7d6ca4f087f3a8 Mon Sep 17 00:00:00 2001 From: adamhamlin Date: Sat, 17 Dec 2022 12:37:16 -0500 Subject: [PATCH] fix: Properly package for publishing (#8) --- .gitignore | 3 ++- .prettierignore | 2 +- dist/.npmignore | 2 ++ index.ts | 7 ++----- package-lock.json | 14 +++++++------- package.json | 10 +++++++--- tsconfig.json | 5 +++-- 7 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 dist/.npmignore diff --git a/.gitignore b/.gitignore index 5e93f1a..d86e515 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # TS build dir -out/ +dist/* +!dist/.npmignore # Coverage coverage/ diff --git a/.prettierignore b/.prettierignore index 7301f74..f8c2d96 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,5 +1,5 @@ # Ignore artifacts: -out +dist coverage # Ignore changelog since auto-updated by standard-version diff --git a/dist/.npmignore b/dist/.npmignore new file mode 100644 index 0000000..f63252e --- /dev/null +++ b/dist/.npmignore @@ -0,0 +1,2 @@ +# Using "files" whitelist in package.json, but root-level .npmignore will not work :( +__tests__ \ No newline at end of file diff --git a/index.ts b/index.ts index df6d416..65efc3f 100644 --- a/index.ts +++ b/index.ts @@ -1,5 +1,2 @@ -import { DeepMap } from './src/map'; -import { DeepSet } from './src/set'; - -export { DeepMap }; -export { DeepSet }; +export { DeepMap } from './src/map'; +export { DeepSet } from './src/set'; diff --git a/package-lock.json b/package-lock.json index 9289671..c1f73de 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "typescript": "^4.9.3" }, "devDependencies": { - "@adamhamlin/eslint-config": "^1.2.0", + "@adamhamlin/eslint-config": "^1.3.0", "@tsconfig/recommended": "^1.0.1", "@types/jest": "^29.2.3", "@types/object-hash": "^2.2.1", @@ -25,9 +25,9 @@ } }, "node_modules/@adamhamlin/eslint-config": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@adamhamlin/eslint-config/-/eslint-config-1.2.0.tgz", - "integrity": "sha512-DZPFBaEMRdKSGRby/Smg6jNvWS524hB3EXxoP/JxiX4JWjnUbr+c69MMJaqvq7bwpmxTvQMGtGv64lQ/H5B0cg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@adamhamlin/eslint-config/-/eslint-config-1.3.0.tgz", + "integrity": "sha512-tKgH38u6KetHYqVWHj1RthuSSz2q6eOE4u+KMrovBGEwe4UuErOtmSvdCZhnHJidfOyzFHxPNpTRGCCyMVpL2Q==", "dev": true, "peerDependencies": { "@typescript-eslint/eslint-plugin": "^5.30.6", @@ -6557,9 +6557,9 @@ }, "dependencies": { "@adamhamlin/eslint-config": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@adamhamlin/eslint-config/-/eslint-config-1.2.0.tgz", - "integrity": "sha512-DZPFBaEMRdKSGRby/Smg6jNvWS524hB3EXxoP/JxiX4JWjnUbr+c69MMJaqvq7bwpmxTvQMGtGv64lQ/H5B0cg==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@adamhamlin/eslint-config/-/eslint-config-1.3.0.tgz", + "integrity": "sha512-tKgH38u6KetHYqVWHj1RthuSSz2q6eOE4u+KMrovBGEwe4UuErOtmSvdCZhnHJidfOyzFHxPNpTRGCCyMVpL2Q==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index 00673fa..99ea14a 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,13 @@ "name": "deep-equality-data-structures", "version": "1.0.1", "description": "Javascript data structures (e.g., Map, Set) that support deep object equality", - "main": "index.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "/dist" + ], "scripts": { - "prepare": "husky install", + "prepare": "husky install && npm run compile", "_lint": "eslint --fix", "_lint:check": "eslint", "_format": " prettier --write --ignore-unknown", @@ -40,7 +44,7 @@ }, "homepage": "https://github.com/adamhamlin/deep-equality-data-structures#readme", "devDependencies": { - "@adamhamlin/eslint-config": "^1.2.0", + "@adamhamlin/eslint-config": "^1.3.0", "@tsconfig/recommended": "^1.0.1", "@types/jest": "^29.2.3", "@types/object-hash": "^2.2.1", diff --git a/tsconfig.json b/tsconfig.json index d02ead3..d2f5e68 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "@tsconfig/recommended/tsconfig.json", "compilerOptions": { - "outDir": "./out" + "outDir": "./dist", + "declaration": true }, - "exclude": ["node_modules"] + "exclude": ["node_modules", "dist/**/*"] }