Skip to content

Commit

Permalink
Fix #983: Add sideEffects to package.json to enable tree-shaking
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed May 31, 2024
1 parent a2d9254 commit 8b47d18
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 15 deletions.
3 changes: 2 additions & 1 deletion packages/checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/confirm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,6 @@
},
"publishConfig": {
"access": "public"
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/expand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/figures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/input/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/inquirer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 2 additions & 1 deletion packages/password/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/prompts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
3 changes: 2 additions & 1 deletion packages/rawlist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
3 changes: 2 additions & 1 deletion packages/type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
"default": "./dist/cjs/index.js"
}
}
}
},
"sideEffects": false
}
4 changes: 4 additions & 0 deletions tools/setup-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? {};
Expand Down

0 comments on commit 8b47d18

Please sign in to comment.