Skip to content

Commit 45ccc13

Browse files
committed
Updated style-system package
1 parent f05447b commit 45ccc13

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"scripts": {
99
"dev": "NODE_NO_WARNINGS=1 storybook dev -p 6006 --no-open",
1010
"build:storybook": "storybook build --debug",
11+
"build:bundler": "yarn workspace @macrostrat/web-components-bundler run build",
1112
"build": "NODE_NO_WARNINGS=1 tsx scripts/publish-helpers build",
1213
"status": "NODE_NO_WARNINGS=1 tsx scripts/publish-helpers status",
1314
"prepare": "NODE_NO_WARNINGS=1 tsx scripts/publish-helpers prepare",

packages/style-system/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
"version": "0.3.0",
44
"description": "Style system for Macrostrat",
55
"main": "dist/style-system.css",
6+
"type": "module",
67
"source": "src/index.ts",
78
"scripts": {
8-
"build": " vite build"
9+
"build": "vite build"
910
},
1011
"dependencies": {
1112
"@blueprintjs/core": "^6.6.1"

packages/style-system/vite.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
import { resolve } from "path";
1+
import { resolve, dirname } from "node:path";
22
import { defineConfig } from "vite";
3+
import {fileURLToPath} from "node:url";
4+
5+
const __dirname = dirname(fileURLToPath(import.meta.url));
36

47
export default defineConfig({
8+
root: __dirname,
59
build: {
610
minify: false,
711
emptyOutDir: true,

toolchain/bundler/src/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function buildStandardViteConfig(
6363
/** Build a standardized vite configuration for packages */
6464

6565
const verbose = opts.verbose ?? false;
66+
6667
const packageNameWithoutScope = pkg.name.replace(/^@[^/]+\//, "");
6768

6869
const pkgData = { ...pkg, directory: root };
@@ -108,11 +109,14 @@ function buildStandardViteConfig(
108109
cssFileName: packageNameWithoutScope,
109110
fileName: (format, entryName) => {
110111
// Place ES modules at root and CJS in /cjs subdirectory
111-
entryName = entryName.replace(prefix, format);
112112

113-
const prefixToRemove = format + "/";
114-
if (entryName.startsWith(prefixToRemove)) {
115-
entryName = entryName.slice(prefixToRemove.length);
113+
// Remove prefixes
114+
for (const splitPart of ["node_modules", prefix]) {
115+
const partWithSlashes = splitPart + "/";
116+
if (entryName.includes(partWithSlashes)) {
117+
const parts = entryName.split(partWithSlashes);
118+
entryName = parts[parts.length - 1];
119+
}
116120
}
117121

118122
return `${entryName}.${format === "es" ? "js" : "cjs"}`;

0 commit comments

Comments
 (0)