Skip to content

Commit

Permalink
fix(maz-ui): add hash to css files to avoid overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisMazel committed Dec 8, 2024
1 parent 0a50bf1 commit 3cd0a76
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cli-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: '21'
registry-url: 'https://registry.npmjs.org'
# registry-url: 'https://registry.npmjs.org'

- name: Get last repo version
run: git pull origin master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lib-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: '21'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lib-test-unit-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lib-test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
version: latest

- name: Use Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '21'
cache: 'pnpm'
Expand Down
13 changes: 7 additions & 6 deletions packages/lib/build/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function getBuildConfig({
path: string
hash?: string
isModuleBuild?: boolean
}): InlineConfig {
}) {
return {
build: {
emptyOutDir: false,
Expand All @@ -72,14 +72,15 @@ function getBuildConfig({
formats: [format],
fileName: name,
name,
cssFileName: '[name].[hash].css',
},
rollupOptions: {
treeshake: true,
external: ['vue', 'libphonenumber-js', '/^dayjs:.*/', 'chart.js', 'dropzone', 'vue-chartjs'],
output: {
exports: 'named',
chunkFileNames: `chunks/[name]-[hash].${format === 'es' ? 'mjs' : 'cjs'}`,
assetFileNames: `assets/[name].[ext]`,
chunkFileNames: `chunks/[name].[hash].${format === 'es' ? 'mjs' : 'cjs'}`,
assetFileNames: 'assets/[name].[hash].[ext]',
entryFileNames: `[name].${format === 'es' ? 'mjs' : 'cjs'}`,
preserveModules: false,
globals: {
Expand Down Expand Up @@ -108,7 +109,7 @@ function getBuildConfig({
libInjectCss(),
...(isModuleBuild ? [viteStaticCopy({ targets: staticAssetsToCopy })] : []),
],
}
} satisfies InlineConfig
}

async function run() {
Expand Down Expand Up @@ -165,10 +166,10 @@ async function run() {
argv.component ? name === argv.component : true,
)

for await (const { path: componentPath, name } of componentToBuild) {
for await (const { path, name } of componentToBuild) {
await build(
getBuildConfig({
path: componentPath,
path,
name,
outDir: resolve(_dirname, '../dist/components'),
format: 'es',
Expand Down

0 comments on commit 3cd0a76

Please sign in to comment.