From 8b47d18e2e19d2a7376a28e0c78c10e7029489ff Mon Sep 17 00:00:00 2001 From: Simon Boudrias Date: Fri, 31 May 2024 14:37:11 -0400 Subject: [PATCH] Fix #983: Add sideEffects to package.json to enable tree-shaking --- packages/checkbox/package.json | 3 ++- packages/confirm/package.json | 3 ++- packages/core/package.json | 3 ++- packages/demo/package.json | 3 ++- packages/editor/package.json | 3 ++- packages/expand/package.json | 3 ++- packages/figures/package.json | 3 ++- packages/input/package.json | 3 ++- packages/inquirer/package.json | 3 ++- packages/password/package.json | 3 ++- packages/prompts/package.json | 3 ++- packages/rawlist/package.json | 3 ++- packages/select/package.json | 3 ++- packages/testing/package.json | 3 ++- packages/type/package.json | 3 ++- tools/setup-packages.mjs | 4 ++++ 16 files changed, 34 insertions(+), 15 deletions(-) diff --git a/packages/checkbox/package.json b/packages/checkbox/package.json index ea3413e1e..3b210769e 100644 --- a/packages/checkbox/package.json +++ b/packages/checkbox/package.json @@ -87,5 +87,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/confirm/package.json b/packages/confirm/package.json index 004829110..9e20328f7 100644 --- a/packages/confirm/package.json +++ b/packages/confirm/package.json @@ -84,5 +84,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/core/package.json b/packages/core/package.json index 184af0e43..0120e0734 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -95,5 +95,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/demo/package.json b/packages/demo/package.json index 9d433f453..ddc4c3cf6 100644 --- a/packages/demo/package.json +++ b/packages/demo/package.json @@ -66,5 +66,6 @@ }, "publishConfig": { "access": "public" - } + }, + "sideEffects": false } diff --git a/packages/editor/package.json b/packages/editor/package.json index f2de367d3..914aa7492 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -85,5 +85,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/expand/package.json b/packages/expand/package.json index 88c9e644c..00b9b65dd 100644 --- a/packages/expand/package.json +++ b/packages/expand/package.json @@ -85,5 +85,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/figures/package.json b/packages/figures/package.json index 7feee6ed6..f6ee08ce8 100644 --- a/packages/figures/package.json +++ b/packages/figures/package.json @@ -75,5 +75,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/input/package.json b/packages/input/package.json index 11df54217..c5a64061a 100644 --- a/packages/input/package.json +++ b/packages/input/package.json @@ -84,5 +84,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/inquirer/package.json b/packages/inquirer/package.json index c74e6ad3d..9a76f509a 100644 --- a/packages/inquirer/package.json +++ b/packages/inquirer/package.json @@ -75,5 +75,6 @@ "strip-ansi": "^6.0.1", "wrap-ansi": "^6.2.0" }, - "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/inquirer/README.md" + "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/inquirer/README.md", + "sideEffects": false } diff --git a/packages/password/package.json b/packages/password/package.json index f8cc8c1d2..4b6fe9cf5 100644 --- a/packages/password/package.json +++ b/packages/password/package.json @@ -85,5 +85,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/prompts/package.json b/packages/prompts/package.json index abcefbc24..4d3213b00 100644 --- a/packages/prompts/package.json +++ b/packages/prompts/package.json @@ -89,5 +89,6 @@ "devDependencies": { "@inquirer/type": "^1.3.2" }, - "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/prompts/README.md" + "homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/prompts/README.md", + "sideEffects": false } diff --git a/packages/rawlist/package.json b/packages/rawlist/package.json index ec10dd1cc..193f5d7c8 100644 --- a/packages/rawlist/package.json +++ b/packages/rawlist/package.json @@ -85,5 +85,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/select/package.json b/packages/select/package.json index b37033847..82fa41c3b 100644 --- a/packages/select/package.json +++ b/packages/select/package.json @@ -87,5 +87,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/testing/package.json b/packages/testing/package.json index 24d2a7646..c40a99eb7 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -85,5 +85,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/packages/type/package.json b/packages/type/package.json index 04cf5af61..ae2e44db3 100644 --- a/packages/type/package.json +++ b/packages/type/package.json @@ -75,5 +75,6 @@ "default": "./dist/cjs/index.js" } } - } + }, + "sideEffects": false } diff --git a/tools/setup-packages.mjs b/tools/setup-packages.mjs index f7e6561fd..c9ddb06a7 100644 --- a/tools/setup-packages.mjs +++ b/tools/setup-packages.mjs @@ -51,6 +51,10 @@ paths.forEach(async (pkgPath) => { pkg.homepage = `https://github.com/SBoudrias/Inquirer.js/blob/master/${repoPath}/README.md`; } + if (!('sideEffects' in pkg)) { + pkg.sideEffects = false; + } + if (isTS) { delete pkg.type; pkg.scripts = pkg.scripts ?? {};