From b37aa893507db5066e65fcd4106f8ffafd7fc9e8 Mon Sep 17 00:00:00 2001 From: slikts Date: Thu, 8 Aug 2019 17:21:13 +0300 Subject: [PATCH 1/2] Make /lib in deep import paths optional --- .gitignore | 1 - package-lock.json | 94 ++++++++++++++++++++++++++++++++++++++++------ package.json | 12 ++++-- scripts/prepare.js | 11 ++++++ tsconfig.es6.json | 2 +- 5 files changed, 102 insertions(+), 18 deletions(-) create mode 100755 scripts/prepare.js diff --git a/.gitignore b/.gitignore index 9600292f0..afb9b5aeb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ *.log node_modules lib -es6 dev .idea coverage diff --git a/package-lock.json b/package-lock.json index 02750635a..948ade95a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "fp-ts", - "version": "2.0.3", + "version": "2.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -2083,6 +2083,12 @@ "is-symbol": "^1.0.2" } }, + "es6-object-assign": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es6-object-assign/-/es6-object-assign-1.1.0.tgz", + "integrity": "sha1-wsNYJlYkfDnqEHyx5mUrb58kUjw=", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -2823,7 +2829,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -2844,12 +2851,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -2864,17 +2873,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -2991,7 +3003,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -3003,6 +3016,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -3017,6 +3031,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -3024,12 +3039,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3048,6 +3065,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -3128,7 +3146,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -3140,6 +3159,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -3225,7 +3245,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -3261,6 +3282,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -3280,6 +3302,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -3323,12 +3346,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -3712,6 +3737,12 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", + "dev": true + }, "invariant": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", @@ -5901,6 +5932,15 @@ "util.promisify": "^1.0.0" } }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -6230,12 +6270,42 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, + "shelljs": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", + "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, "shellwords": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==", "dev": true }, + "shx": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/shx/-/shx-0.3.2.tgz", + "integrity": "sha512-aS0mWtW3T2sHAenrSrip2XGv39O9dXIFUqxAEWHEOS1ePtGIBavdPJY1kE2IHl14V/4iCbUiNDPGdyYTtmhSoA==", + "dev": true, + "requires": { + "es6-object-assign": "^1.0.3", + "minimist": "^1.2.0", + "shelljs": "^0.8.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + } + } + }, "signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", diff --git a/package.json b/package.json index 46cbe8e58..2e56ec7c0 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,12 @@ "prettier": "prettier --list-different \"./{src,test,tutorials}/**/*.ts\"", "fix-prettier": "prettier --write \"./{src,test,tutorials}/**/*.ts\"", "test": "npm run lint && npm run prettier && npm run dtslint && npm run jest-clear-cache && npm run jest && npm run docs", - "clean": "rimraf lib/* es6/*", + "clean": "shx rm -rf lib/*", "build": "npm run clean && tsc && tsc -p tsconfig.es6.json", - "prepublish": "npm run build", + "postbuild": "mkdir lib/lib && shx cp -R lib/*.{ts,js} lib/lib && shx cp {LICENSE,*.md} lib && ./scripts/prepare.js", + "prepublishOnly": "echo Use 'npm run publish' instead && exit 1", + "publish": "npm publish lib", + "prepare": "npm run build", "doctoc": "doctoc README.md docs/introduction/code-conventions.md --title \"**Table of contents**\"", "mocha": "mocha -r ts-node/register test/*.ts", "dtslint": "dtslint dtslint", @@ -53,7 +56,7 @@ "jest": "^24.8.0", "mocha": "^5.2.0", "prettier": "^1.18.2", - "rimraf": "2.6.2", + "shx": "^0.3.2", "ts-jest": "^24.0.2", "ts-node": "^8.0.2", "ts-simple-ast": "17.1.1", @@ -71,5 +74,6 @@ "algebraic-data-types", "functional-programming" ], - "dependencies": {} + "dependencies": {}, + "private": true } diff --git a/scripts/prepare.js b/scripts/prepare.js new file mode 100755 index 000000000..e82809f77 --- /dev/null +++ b/scripts/prepare.js @@ -0,0 +1,11 @@ +#!/usr/bin/env node + +const fs = require('fs'); + +const package = Object.assign({}, require('../package.json'), { + private: false, + scripts: {}, + files: ['*'], +}); + +fs.writeFileSync('lib/package.json', JSON.stringify(package, null, 2)); diff --git a/tsconfig.es6.json b/tsconfig.es6.json index fa53d00ed..d9610bd9f 100644 --- a/tsconfig.es6.json +++ b/tsconfig.es6.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "./es6", + "outDir": "./lib/es6", "module": "es6" } } From 79e7a61b7a835726ee66aac81f93bd759c2b8702 Mon Sep 17 00:00:00 2001 From: slikts Date: Thu, 8 Aug 2019 19:39:00 +0300 Subject: [PATCH 2/2] Prepare before publishing --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2e56ec7c0..30c70a30d 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "build": "npm run clean && tsc && tsc -p tsconfig.es6.json", "postbuild": "mkdir lib/lib && shx cp -R lib/*.{ts,js} lib/lib && shx cp {LICENSE,*.md} lib && ./scripts/prepare.js", "prepublishOnly": "echo Use 'npm run publish' instead && exit 1", - "publish": "npm publish lib", + "publish": "npm run prepare && npm publish lib", "prepare": "npm run build", "doctoc": "doctoc README.md docs/introduction/code-conventions.md --title \"**Table of contents**\"", "mocha": "mocha -r ts-node/register test/*.ts",