Skip to content

Commit

Permalink
set side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Aug 31, 2024
1 parent dadd50b commit e00b018
Show file tree
Hide file tree
Showing 37 changed files with 117 additions and 82 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
"publishConfig": {
"registry": "https://registry.npmjs.org/",
"access": "public"
}
}
},
"sideEffects": false
}
6 changes: 4 additions & 2 deletions packages/config-eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
"eslint-config-turbo": "^1.12.5",
"eslint-plugin-only-warn": "^1.1.0",
"typescript": "^5.4.2"
}
}
},
"publishConfig": {},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/config-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"license": "MIT",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/config-vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
},
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/file-ops/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
2 changes: 1 addition & 1 deletion packages/jimp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@
"publishConfig": {
"access": "public"
}
}
}
5 changes: 3 additions & 2 deletions packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
},
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/js-bmp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
},
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/js-gif/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
},
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/js-jpeg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
},
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/js-png/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/js-tiff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
},
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-blit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-blur/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-circle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-color/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-contain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-cover/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-crop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-displace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-dither/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-fisheye/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-flip/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-hash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-mask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
2 changes: 1 addition & 1 deletion plugins/plugin-print/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@
"publishConfig": {
"access": "public"
}
}
}
5 changes: 3 additions & 2 deletions plugins/plugin-resize/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-rotate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-shadow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
5 changes: 3 additions & 2 deletions plugins/plugin-threshold/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}
24 changes: 12 additions & 12 deletions refactor.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
const fs = require("fs");
const path = require("path");

function renameVitestConfigs(directory) {
function addPublishConfigToPackageJson(directory) {
fs.readdirSync(directory, { withFileTypes: true }).forEach((entry) => {
const fullPath = path.join(directory, entry.name);
if (entry.isDirectory()) {
renameVitestConfigs(fullPath);
} else if (
entry.isFile() &&
entry.name.startsWith("vitest.config") &&
entry.name.endsWith(".cjs")
) {
const newPath = fullPath.slice(0, -4) + ".mjs";
fs.renameSync(fullPath, newPath);
console.log(`Renamed: ${fullPath} -> ${newPath}`);
addPublishConfigToPackageJson(fullPath);
} else if (entry.isFile() && entry.name === "package.json") {
const packageJson = JSON.parse(fs.readFileSync(fullPath, "utf8"));
if (!packageJson.publishConfig) {
packageJson.publishConfig = {};
}
packageJson.sideEffects = false;
fs.writeFileSync(fullPath, JSON.stringify(packageJson, null, 2));
console.log(`Updated publishConfig in: ${fullPath}`);
}
});
}

// Run the script in the current directory
renameVitestConfigs(".");
addPublishConfigToPackageJson(".");

console.log("Renaming complete.");
console.log("Package.json updates complete.");
5 changes: 3 additions & 2 deletions turbo/generators/templates/package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
"type": "module",
"publishConfig": {
"access": "public"
}
}
},
"sideEffects": false
}

0 comments on commit e00b018

Please sign in to comment.