Skip to content

Commit 89cf041

Browse files
authored
Main roadmap cards (#53)
* explicit publicDir * remove public declaration * copy public per package built. * update types * remove public declaration * use PackageName for copying
1 parent 8abac38 commit 89cf041

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

scripts/build.mts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from "node:path";
33
import {
44
exec,
55
exitWithError,
6+
getPackageName,
67
isValidCommand,
78
unknownError,
89
Workspace,
@@ -20,7 +21,7 @@ const main = async () => {
2021
console.log(`Building package: ${pkg}`);
2122
exec(`pnpm -F ${pkg} build`, { args: args.slice(2) });
2223
console.log("Copying public files...");
23-
copyPublicToDist(pkg);
24+
copyPublicToDist(pkg as FullPackageName);
2425
};
2526

2627
const buildPackages = (packages: PackageName[], args: CommandExtraArgs) => {
@@ -29,18 +30,20 @@ const main = async () => {
2930
});
3031
};
3132

32-
const copyPublicToDist = (pkg?: PackageName) => {
33+
const copyPublicToDist = (pkg?: FullPackageName) => {
34+
const pack = pkg ? getPackageName(pkg) : null;
35+
3336
const src = path.resolve(
3437
__dirname,
35-
`${pkg ? `../packages/${pkg}/public` : "../public"}`,
38+
`${pkg ? `../packages/${pack}/public` : "../public"}`,
3639
);
3740
const dest = path.resolve(
3841
__dirname,
39-
`${pkg ? `../dist/${pkg}` : "../dist"}`,
42+
`${pkg ? `../dist/${pack}` : "../dist"}`,
4043
);
4144

4245
if (!fs.existsSync(src)) {
43-
console.warn(`Source directory ${src} does not exist.`);
46+
console.warn("Source directory does not exist", src);
4447
return;
4548
}
4649

scripts/workspace.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,5 @@ export {
302302
isAvailablePackage,
303303
exitWithError,
304304
unknownError,
305+
getPackageName,
305306
};

vite.config.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const PACKAGE_VERSION = String(process.env.npm_package_version);
99

1010
export default defineConfig({
1111
base: `/${PACKAGE_NAME === "site" ? "" : PACKAGE_NAME}`,
12-
publicDir: "public",
1312
build: {
1413
cssMinify: "lightningcss",
1514
minify: "terser",

0 commit comments

Comments
 (0)