Skip to content

Commit 9e547cc

Browse files
authored
Merge pull request #1980 from umbraco/v14/chore/bundling-webhook
Chore: Bundling of the Webhook package
2 parents 241ba50 + 87911b3 commit 9e547cc

File tree

7 files changed

+56
-16
lines changed

7 files changed

+56
-16
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"local-rules/enforce-umbraco-external-imports": [
5353
"error",
5454
{
55-
"exceptions": ["@umbraco-cms", "@open-wc/testing", "@storybook", "msw", "."]
55+
"exceptions": ["@umbraco-cms", "@open-wc/testing", "@storybook", "msw", ".", "vite"]
5656
}
5757
],
5858
"local-rules/exported-string-constant-naming": [

package-lock.json

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@
126126
"url": "https://umbraco.com"
127127
},
128128
"workspaces": [
129-
"./src/packages/dictionary"
129+
"./src/packages/dictionary",
130+
"./src/packages/webhook"
130131
],
131132
"scripts": {
132133
"backoffice:test:e2e": "npx playwright test",
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
import { defineConfig } from 'vite';
22
import { rmSync } from 'fs';
3+
import { getDefaultConfig } from '../../vite-config-base';
34

45
const dist = '../../../dist-cms/packages/dictionary';
56

67
// delete the unbundled dist folder
78
rmSync(dist, { recursive: true, force: true });
89

910
export default defineConfig({
10-
build: {
11-
target: 'es2022',
12-
lib: {
13-
entry: ['index.ts', 'manifests.ts', 'umbraco-package.ts'],
14-
formats: ['es'],
15-
},
16-
outDir: dist,
17-
sourcemap: true,
18-
rollupOptions: {
19-
external: [/^@umbraco/],
20-
},
21-
},
11+
...getDefaultConfig({ dist }),
2212
});

src/packages/webhook/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "@umbraco-backoffice/webhook",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "vite build"
7+
}
8+
}

src/packages/webhook/vite.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { defineConfig } from 'vite';
2+
import { rmSync } from 'fs';
3+
import { getDefaultConfig } from '../../vite-config-base';
4+
5+
const dist = '../../../dist-cms/packages/webhook';
6+
7+
// delete the unbundled dist folder
8+
rmSync(dist, { recursive: true, force: true });
9+
10+
export default defineConfig({
11+
...getDefaultConfig({ dist }),
12+
});

src/vite-config-base.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import type { UserConfig } from 'vite';
2+
3+
interface UmbViteDefaultConfigArgs {
4+
dist: string;
5+
entry?: string[];
6+
}
7+
8+
export const getDefaultConfig = (args: UmbViteDefaultConfigArgs): UserConfig => {
9+
return {
10+
build: {
11+
target: 'es2022',
12+
lib: {
13+
entry: args.entry || ['index.ts', 'manifests.ts', 'umbraco-package.ts'],
14+
formats: ['es'],
15+
},
16+
outDir: args.dist,
17+
sourcemap: true,
18+
rollupOptions: {
19+
external: [/^@umbraco/],
20+
},
21+
},
22+
};
23+
};

0 commit comments

Comments
 (0)