From 61f94ca1b90be58151dcef50acaaa5cd64ef846e Mon Sep 17 00:00:00 2001 From: Kamil Kisiela Date: Tue, 15 May 2018 21:39:34 +0200 Subject: [PATCH 1/2] Mark packages as side effects free Mostly for Webpack 4, it will tree-shake it more effectively --- packages/apollo-boost/package.json | 14 ++++++------ packages/apollo-cache-inmemory/package.json | 14 ++++++------ packages/apollo-cache/package.json | 17 +++++++-------- packages/apollo-client/package.json | 24 ++++++++++----------- packages/apollo-utilities/package.json | 14 ++++++------ packages/graphql-anywhere/package.json | 18 ++++++---------- 6 files changed, 44 insertions(+), 57 deletions(-) diff --git a/packages/apollo-boost/package.json b/packages/apollo-boost/package.json index dc47a83fdd4..5f9803d6e40 100644 --- a/packages/apollo-boost/package.json +++ b/packages/apollo-boost/package.json @@ -11,6 +11,7 @@ "license": "MIT", "main": "./lib/index.js", "typings": "./lib/index.d.ts", + "sideEffects": false, "repository": { "type": "git", "url": "git+https://github.com/apollographql/apollo-client.git" @@ -28,8 +29,10 @@ "watch": "tsc -w -p .", "clean": "rimraf coverage/* && rimraf lib/*", "prepublishOnly": "npm run build", - "build:browser": "browserify ./lib/index.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": + "browserify ./lib/index.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": + "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build && npm run build:browser" }, "dependencies": { @@ -60,11 +63,6 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ] + "moduleFileExtensions": ["ts", "tsx", "js", "json"] } } diff --git a/packages/apollo-cache-inmemory/package.json b/packages/apollo-cache-inmemory/package.json index c4f43ef0788..72842405f99 100644 --- a/packages/apollo-cache-inmemory/package.json +++ b/packages/apollo-cache-inmemory/package.json @@ -15,6 +15,7 @@ "module": "./lib/index.js", "jsnext:main": "./lib/index.js", "typings": "./lib/index.d.ts", + "sideEffects": false, "repository": { "type": "git", "url": "git+https://github.com/apollographql/apollo-client.git" @@ -34,8 +35,10 @@ "watch": "tsc -w -p .", "clean": "rimraf coverage/* && rimraf lib/*", "prepublishOnly": "npm run build", - "build:browser": "browserify ./lib/bundle.umd.js --i apollo-cache --i apollo-utilities --i graphql -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": + "browserify ./lib/bundle.umd.js --i apollo-cache --i apollo-utilities --i graphql -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": + "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build:browser" }, "dependencies": { @@ -67,11 +70,6 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ] + "moduleFileExtensions": ["ts", "tsx", "js", "json"] } } diff --git a/packages/apollo-cache/package.json b/packages/apollo-cache/package.json index ce235e7bf8b..f58550fd253 100644 --- a/packages/apollo-cache/package.json +++ b/packages/apollo-cache/package.json @@ -14,6 +14,7 @@ "module": "./lib/index.js", "jsnext:main": "./lib/index.js", "typings": "./lib/index.d.ts", + "sideEffects": false, "repository": { "type": "git", "url": "git+https://github.com/apollographql/apollo-client.git" @@ -25,7 +26,8 @@ "scripts": { "coverage": "jest --coverage", "test": "jest", - "lint": "tslint --type-check -p tsconfig.json src/*.ts && tslint --type-check -p tsconfig.json tests/*.ts", + "lint": + "tslint --type-check -p tsconfig.json src/*.ts && tslint --type-check -p tsconfig.json tests/*.ts", "prebuild": "npm run clean", "build": "tsc -p .", "postbuild": "npm run bundle", @@ -33,8 +35,10 @@ "watch": "tsc -w -p .", "clean": "rimraf coverage/* && rimraf lib/*", "prepublishOnly": "npm run clean && npm run build", - "build:browser": "browserify ./lib/bundle.umd.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": + "browserify ./lib/bundle.umd.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": + "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build && npm run build:browser" }, "dependencies": { @@ -60,11 +64,6 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ] + "moduleFileExtensions": ["ts", "tsx", "js", "json"] } } diff --git a/packages/apollo-client/package.json b/packages/apollo-client/package.json index 38d85ccf215..258b3c5e948 100644 --- a/packages/apollo-client/package.json +++ b/packages/apollo-client/package.json @@ -7,19 +7,24 @@ "module": "./lib/index.js", "jsnext:main": "./lib/index.js", "typings": "./lib/index.d.ts", + "sideEffects": false, "scripts": { "coverage": "jest --coverage", "dev": "./scripts/dev.sh", "deploy": "./scripts/deploy.sh", "test": "jest", - "benchmark": "npm run build:benchmark && node benchmark_lib/benchmark/index.js", - "benchmark:inspect": "npm run build:benchmark && node --inspect --debug-brk benchmark_lib/benchmark/index.js", + "benchmark": + "npm run build:benchmark && node benchmark_lib/benchmark/index.js", + "benchmark:inspect": + "npm run build:benchmark && node --inspect --debug-brk benchmark_lib/benchmark/index.js", "filesize": "npm run build && npm run build:browser", "type-check": "flow check", "build": "tsc", "build:benchmark": "tsc -p tsconfig.benchmark.json", - "build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities --i apollo-cache --i apollo-link --i apollo-link-dedup && npm run minify:browser", - "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": + "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities --i apollo-cache --i apollo-link --i apollo-link-dedup && npm run minify:browser", + "minify:browser": + "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "watch": "tsc -w", "bundle": "rollup -c rollup.config.js", "postbuild": "npm run bundle", @@ -93,14 +98,7 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ], - "setupFiles": [ - "/scripts/tests.js" - ] + "moduleFileExtensions": ["ts", "tsx", "js", "json"], + "setupFiles": ["/scripts/tests.js"] } } diff --git a/packages/apollo-utilities/package.json b/packages/apollo-utilities/package.json index 3e93ccf4dcf..c26f3d3f1c1 100644 --- a/packages/apollo-utilities/package.json +++ b/packages/apollo-utilities/package.json @@ -14,6 +14,7 @@ "module": "./lib/index.js", "jsnext:main": "./lib/index.js", "typings": "./lib/index.d.ts", + "sideEffects": false, "repository": { "type": "git", "url": "git+https://github.com/apollographql/apollo-client.git" @@ -33,8 +34,10 @@ "watch": "tsc -w -p .", "clean": "rimraf lib/* && rimraf coverage/*", "prepublishOnly": "npm run clean && npm run build", - "build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": + "browserify ./lib/bundle.umd.js -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": + "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build && npm run build:browser" }, "devDependencies": { @@ -60,11 +63,6 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ] + "moduleFileExtensions": ["ts", "tsx", "js", "json"] } } diff --git a/packages/graphql-anywhere/package.json b/packages/graphql-anywhere/package.json index ab4566a7810..5ca348c4e2f 100644 --- a/packages/graphql-anywhere/package.json +++ b/packages/graphql-anywhere/package.json @@ -6,6 +6,7 @@ "module": "./lib/index.js", "jsnext:main": "./lib/index.js", "typings": "./lib/index.d.ts", + "sideEffects": false, "scripts": { "coverage": "jest --coverage", "test": "jest", @@ -15,8 +16,10 @@ "watch": "tsc -w", "prepublishOnly": "npm run build", "lint": "tslint --type-check -p tsconfig.json src/*.ts", - "build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities && npm run minify:browser", - "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": + "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities && npm run minify:browser", + "minify:browser": + "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build:browser" }, "repository": { @@ -33,9 +36,7 @@ "react" ], "author": "Sashko Stubailo ", - "contributors": [ - "James Burgess " - ], + "contributors": ["James Burgess "], "license": "MIT", "dependencies": { "apollo-utilities": "^1.0.12" @@ -65,11 +66,6 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": [ - "ts", - "tsx", - "js", - "json" - ] + "moduleFileExtensions": ["ts", "tsx", "js", "json"] } } From 5301f087b14eb32374069974221290fd4445a4af Mon Sep 17 00:00:00 2001 From: Hugh Willson Date: Thu, 24 May 2018 15:32:42 -0400 Subject: [PATCH 2/2] Unwind rogue `prettier` pre-commit issues --- packages/apollo-boost/package.json | 13 +++++++----- packages/apollo-cache-inmemory/package.json | 13 +++++++----- packages/apollo-cache/package.json | 16 +++++++------- packages/apollo-client/package.json | 23 ++++++++++++--------- packages/apollo-utilities/package.json | 13 +++++++----- packages/graphql-anywhere/package.json | 17 +++++++++------ 6 files changed, 57 insertions(+), 38 deletions(-) diff --git a/packages/apollo-boost/package.json b/packages/apollo-boost/package.json index 4851136bc51..1869388a0a9 100644 --- a/packages/apollo-boost/package.json +++ b/packages/apollo-boost/package.json @@ -29,10 +29,8 @@ "watch": "tsc -w -p .", "clean": "rimraf coverage/* && rimraf lib/*", "prepublishOnly": "npm run build", - "build:browser": - "browserify ./lib/index.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": - "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": "browserify ./lib/index.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build && npm run build:browser" }, "dependencies": { @@ -63,6 +61,11 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": ["ts", "tsx", "js", "json"] + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json" + ] } } diff --git a/packages/apollo-cache-inmemory/package.json b/packages/apollo-cache-inmemory/package.json index 4a99430f8fd..25c9de56a96 100644 --- a/packages/apollo-cache-inmemory/package.json +++ b/packages/apollo-cache-inmemory/package.json @@ -35,10 +35,8 @@ "watch": "tsc -w -p .", "clean": "rimraf coverage/* && rimraf lib/*", "prepublishOnly": "npm run build", - "build:browser": - "browserify ./lib/bundle.umd.js --i apollo-cache --i apollo-utilities --i graphql -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": - "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": "browserify ./lib/bundle.umd.js --i apollo-cache --i apollo-utilities --i graphql -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build:browser" }, "dependencies": { @@ -70,6 +68,11 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": ["ts", "tsx", "js", "json"] + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json" + ] } } diff --git a/packages/apollo-cache/package.json b/packages/apollo-cache/package.json index 6245314fd6b..ce351a9966f 100644 --- a/packages/apollo-cache/package.json +++ b/packages/apollo-cache/package.json @@ -26,8 +26,7 @@ "scripts": { "coverage": "jest --coverage", "test": "jest", - "lint": - "tslint --type-check -p tsconfig.json src/*.ts && tslint --type-check -p tsconfig.json tests/*.ts", + "lint": "tslint --type-check -p tsconfig.json src/*.ts && tslint --type-check -p tsconfig.json tests/*.ts", "prebuild": "npm run clean", "build": "tsc -p .", "postbuild": "npm run bundle", @@ -35,10 +34,8 @@ "watch": "tsc -w -p .", "clean": "rimraf coverage/* && rimraf lib/*", "prepublishOnly": "npm run clean && npm run build", - "build:browser": - "browserify ./lib/bundle.umd.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": - "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": "browserify ./lib/bundle.umd.js --i apollo-utilities -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build && npm run build:browser" }, "dependencies": { @@ -64,6 +61,11 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": ["ts", "tsx", "js", "json"] + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json" + ] } } diff --git a/packages/apollo-client/package.json b/packages/apollo-client/package.json index 03ee3f46676..5863931e854 100644 --- a/packages/apollo-client/package.json +++ b/packages/apollo-client/package.json @@ -13,18 +13,14 @@ "dev": "./scripts/dev.sh", "deploy": "./scripts/deploy.sh", "test": "jest", - "benchmark": - "npm run build:benchmark && node benchmark_lib/benchmark/index.js", - "benchmark:inspect": - "npm run build:benchmark && node --inspect --debug-brk benchmark_lib/benchmark/index.js", + "benchmark": "npm run build:benchmark && node benchmark_lib/benchmark/index.js", + "benchmark:inspect": "npm run build:benchmark && node --inspect --debug-brk benchmark_lib/benchmark/index.js", "filesize": "npm run build && npm run build:browser", "type-check": "flow check", "build": "tsc", "build:benchmark": "tsc -p tsconfig.benchmark.json", - "build:browser": - "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities --i apollo-cache --i apollo-link --i apollo-link-dedup && npm run minify:browser", - "minify:browser": - "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities --i apollo-cache --i apollo-link --i apollo-link-dedup && npm run minify:browser", + "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "watch": "tsc -w", "bundle": "rollup -c rollup.config.js", "postbuild": "npm run bundle", @@ -98,7 +94,14 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": ["ts", "tsx", "js", "json"], - "setupFiles": ["/scripts/tests.js"] + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json" + ], + "setupFiles": [ + "/scripts/tests.js" + ] } } diff --git a/packages/apollo-utilities/package.json b/packages/apollo-utilities/package.json index a834eeace6a..a26cc0ab586 100644 --- a/packages/apollo-utilities/package.json +++ b/packages/apollo-utilities/package.json @@ -34,10 +34,8 @@ "watch": "tsc -w -p .", "clean": "rimraf lib/* && rimraf coverage/*", "prepublishOnly": "npm run clean && npm run build", - "build:browser": - "browserify ./lib/bundle.umd.js -o=./lib/bundle.js && npm run minify:browser", - "minify:browser": - "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js && npm run minify:browser", + "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build && npm run build:browser" }, "devDependencies": { @@ -63,6 +61,11 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": ["ts", "tsx", "js", "json"] + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json" + ] } } diff --git a/packages/graphql-anywhere/package.json b/packages/graphql-anywhere/package.json index bedab3c11bd..68fd8517929 100644 --- a/packages/graphql-anywhere/package.json +++ b/packages/graphql-anywhere/package.json @@ -16,10 +16,8 @@ "watch": "tsc -w", "prepublishOnly": "npm run build", "lint": "tslint --type-check -p tsconfig.json src/*.ts", - "build:browser": - "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities && npm run minify:browser", - "minify:browser": - "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", + "build:browser": "browserify ./lib/bundle.umd.js -o=./lib/bundle.js --i apollo-utilities && npm run minify:browser", + "minify:browser": "uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js", "filesize": "npm run build:browser" }, "repository": { @@ -36,7 +34,9 @@ "react" ], "author": "Sashko Stubailo ", - "contributors": ["James Burgess "], + "contributors": [ + "James Burgess " + ], "license": "MIT", "dependencies": { "apollo-utilities": "^1.0.12" @@ -66,6 +66,11 @@ ".(ts|tsx)": "/node_modules/ts-jest/preprocessor.js" }, "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", - "moduleFileExtensions": ["ts", "tsx", "js", "json"] + "moduleFileExtensions": [ + "ts", + "tsx", + "js", + "json" + ] } }