Skip to content

Commit 6b04f49

Browse files
committed
Simplify rebrander and plop scripts
1 parent 8d77ad7 commit 6b04f49

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

scripts/rc.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,6 @@ interface InquirerDataType {
2626
description: string;
2727
}
2828

29-
/**
30-
* Adds export entries to package.json for a given target directory.
31-
* @param pkgJSON - The parsed contents of package.json.
32-
* @param target - Relative path inside the `src` directory (e.g., "client/button").
33-
* @param data - Collected CLI prompt data.
34-
*/
35-
function createExportsEntry(pkgJSON: any, target: string, data: InquirerDataType) {
36-
const entry = {
37-
types: `./dist/${target}/index.d.ts`,
38-
import: `./dist/${target}/index.mjs`,
39-
require: `./dist/${target}/index.js`,
40-
};
41-
pkgJSON.exports = pkgJSON.exports ?? {};
42-
pkgJSON.exports[`./${target}`] = entry;
43-
pkgJSON.exports[`./dist/${target}`] = entry;
44-
45-
if (data.createScss) {
46-
pkgJSON.exports[`./${target}/index.css`] = `./dist/${target}/index.css`;
47-
pkgJSON.exports[`./dist/${target}/index.css`] = `./dist/${target}/index.css`;
48-
}
49-
}
50-
5129
/**
5230
* Ensures nested directories have `index.ts` files and proper exports.
5331
* @param nestedRouteActions - Action array to be populated.
@@ -83,8 +61,6 @@ function updateIndexFilesIfNeeded(
8361
path: `${root + (length === 1 ? "" : `${currentDirSegments.slice(0, length - 1).join("/")}/`)}index.ts`,
8462
template: `export * from "./${currentDirSegments[length - 1]}"`,
8563
});
86-
87-
createExportsEntry(pkgJSON, dirPath.split("src/")[1], data);
8864
}
8965
}
9066

@@ -124,22 +100,6 @@ function createRootIndexAndDeclarations(
124100
path: `${data.pkgPath}/src/index.ts`,
125101
template: `${banner}export * from "./${target}";\n`,
126102
});
127-
128-
pkgJSON.exports = {
129-
".": {
130-
types: "./dist/index.d.ts",
131-
import: "./dist/index.mjs",
132-
require: "./dist/index.js",
133-
},
134-
...(data.createScss
135-
? {
136-
"./index.css": "./dist/index.css",
137-
"./dist/index.css": "./dist/index.css",
138-
"./styles": "./dist/index.css",
139-
"./css": "./dist/index.css",
140-
}
141-
: {}),
142-
};
143103
}
144104

145105
// Create src/declaration.d.ts
@@ -158,7 +118,6 @@ function createRootIndexAndDeclarations(
158118
path: `${root}index.ts`,
159119
template: `${banner}/**\n * Server and client components must be exported from separate files.\n * This ensures correct behavior of the "use client" directive.\n */\n\n// ${target} component exports\n`,
160120
});
161-
createExportsEntry(pkgJSON, target, data);
162121
}
163122

164123
return { nestedRouteActions, root };
@@ -218,8 +177,6 @@ function getIndexAction(data: InquirerDataType, parentDir: string, pkgJSON: any)
218177
};
219178
}
220179

221-
createExportsEntry(pkgJSON, dirPath.split("src")[1].slice(1).replace(/\\/g, "/"), data);
222-
223180
return {
224181
type: "add",
225182
path: `${parentDir}{{kebabCase name}}/index.ts`,

scripts/rebrander.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ packageJSON.funding.unshift({
2424
});
2525
packageJSON.keywords = packageJSON.keywords.slice(2);
2626

27-
// @ts-expect-error - ok
28-
packageJSON.exports = {
29-
".": {
30-
types: "./dist/index.d.ts",
31-
import: "./dist/index.mjs",
32-
require: "./dist/index.js",
33-
},
34-
};
35-
3627
fs.writeFileSync(
3728
path.resolve(rootDir, "lib", "package.json"),
3829
JSON.stringify(packageJSON, null, 2),

0 commit comments

Comments
 (0)