Skip to content

Commit

Permalink
feat(entities-*): externalize deps (#1579)
Browse files Browse the repository at this point in the history
* feat(entities-certificates): externalize deps

* refactor: use regular expression for package match

* refactor: use regular expression for package match

* fix(deps): externalize for all packages

* fix(rollup): externalize

* fix: package.json

* fix(deps): use workspace version

* fix: lockfile

* fix: external dep pattern match

* fix: externals

* chore: exclude styles

* chore: remove duplicate entries covered by root config

* fix: do not externalize styles

* fix: more vite.config cleanups (#1589)

* fix: more vite.config cleanups

* Update packages/entities/entities-routes/vite.config.ts

Co-authored-by: Adam DeHaven <2229946+adamdehaven@users.noreply.github.com>

* Update packages/analytics/analytics-geo-map/vite.config.ts

Co-authored-by: Adam DeHaven <2229946+adamdehaven@users.noreply.github.com>

* Update vite.config.ts

* Update vite.config.ts

---------

Co-authored-by: Adam DeHaven <2229946+adamdehaven@users.noreply.github.com>

---------

Co-authored-by: ValeryG <vvalggor@gmail.com>
  • Loading branch information
adamdehaven and ValeryG authored Sep 4, 2024
1 parent 115302e commit 49a30f0
Show file tree
Hide file tree
Showing 21 changed files with 155 additions and 140 deletions.
5 changes: 4 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
shamefully-hoist=true
strict-peer-dependencies=false
auto-install-peers=false
auto-install-peers=true
side-effects-cache=false # Ensure the postinstall script of the lefthook package is executed and hooks are installed
manage-package-manager-versions=true
10 changes: 0 additions & 10 deletions packages/analytics/analytics-chart/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ const config = mergeConfig(sharedViteConfig, defineConfig({
entry: resolve(__dirname, './src/index.ts'),
fileName: (format) => `${sanitizedPackageName}.${format}.js`,
},
rollupOptions: {
// Make sure to externalize deps that shouldn't be bundled into your library
external: ['@kong-ui-public/i18n'],
output: {
// Provide global variables to use in the UMD build for externalized deps
globals: {
'@kong-ui-public/i18n': 'kong-ui-public-i18n',
},
},
},
},
server: {
open: true,
Expand Down
4 changes: 2 additions & 2 deletions packages/analytics/analytics-geo-map/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ const config = mergeConfig(sharedViteConfig, defineConfig({
},
rollupOptions: {
// Make sure to externalize deps that shouldn't be bundled into your library
external: ['maplibre-gl', '@kong-ui-public/i18n'],
external: ['maplibre-gl'],
output: {
// Provide global variables to use in the UMD build for externalized deps
globals: {
'@kong-ui-public/i18n': 'kong-ui-public-i18n',
'maplibre-gl': 'maplibregl',
},
},
},
Expand Down
3 changes: 1 addition & 2 deletions packages/analytics/analytics-metric-provider/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const config = mergeConfig(sharedViteConfig, defineConfig({
rollupOptions: {
// Make sure to externalize deps that shouldn't be bundled into your library
external: [
'@kong-ui-public/i18n',
'@kong-ui-public/analytics-config-store',
'@kong-ui-public/analytics-utilities',
'@kong-ui-public/metric-cards',
Expand All @@ -28,9 +27,9 @@ const config = mergeConfig(sharedViteConfig, defineConfig({
output: {
// Provide global variables to use in the UMD build for externalized deps
globals: {
'@kong-ui-public/i18n': 'kong-ui-public-i18n',
'@kong-ui-public/analytics-config-store': 'kong-ui-public-analytics-config-store',
'@kong-ui-public/analytics-utilities': 'kong-ui-public-analytics-utilities',
'@kong-ui-public/metric-cards': 'kong-ui-public-metric-cards',
pinia: 'pinia',
},
},
Expand Down
6 changes: 4 additions & 2 deletions packages/entities/entities-certificates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -65,8 +69,6 @@
"extends": "../../../package.json"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1",
"@peculiar/x509": "^1.9.7"
},
"distSizeChecker": {
Expand Down
8 changes: 4 additions & 4 deletions packages/entities/entities-consumer-credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -66,9 +70,5 @@
},
"distSizeChecker": {
"errorLimit": "300KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/entities/entities-consumer-groups/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -66,9 +70,5 @@
},
"distSizeChecker": {
"errorLimit": "500KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/entities/entities-consumers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -66,9 +70,5 @@
},
"distSizeChecker": {
"errorLimit": "500KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/entities/entities-data-plane-nodes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -66,9 +70,5 @@
},
"distSizeChecker": {
"errorLimit": "500KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/entities/entities-gateway-services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -66,9 +70,5 @@
},
"distSizeChecker": {
"errorLimit": "600KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/entities/entities-key-sets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -65,9 +69,5 @@
},
"distSizeChecker": {
"errorLimit": "500KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
8 changes: 4 additions & 4 deletions packages/entities/entities-keys/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -66,9 +70,5 @@
},
"distSizeChecker": {
"errorLimit": "486KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong/icons": "^1.15.1"
}
}
6 changes: 4 additions & 2 deletions packages/entities/entities-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/entities-vaults": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -78,9 +82,7 @@
"@kong-ui-public/entities-consumers": "workspace:^",
"@kong-ui-public/entities-gateway-services": "workspace:^",
"@kong-ui-public/entities-routes": "workspace:^",
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/forms": "workspace:^",
"@kong/icons": "^1.15.1",
"marked": "^12.0.2"
}
}
6 changes: 4 additions & 2 deletions packages/entities/entities-routes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
"access": "public"
},
"peerDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
"vue-router": "^4.3.3"
},
"devDependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"@types/lodash.isequal": "^4.5.8",
"axios": "^1.6.8",
Expand Down Expand Up @@ -70,9 +74,7 @@
"errorLimit": "800KB"
},
"dependencies": {
"@kong-ui-public/entities-shared": "workspace:^",
"@kong-ui-public/expressions": "workspace:^",
"@kong/icons": "^1.15.1",
"lodash.isequal": "^4.5.0"
}
}
10 changes: 6 additions & 4 deletions packages/entities/entities-routes/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ const config = mergeConfig(sharedViteConfig, defineConfig({
},
rollupOptions: {
external: [
'@kong-ui-public/entities-shared',
'@kong-ui-public/entities-shared/dist/style.css',
'@kong-ui-public/expressions',
'@kong-ui-public/expressions/dist/style.css',
'@kong/icons',
'lodash.isequal',
],
output: {
// Provide global variables to use in the UMD build for externalized deps
globals: {
'@kong-ui-public/expressions': 'kong-ui-public-expressions',
},
},
},
},
...(process.env.USE_SANDBOX
Expand Down
3 changes: 2 additions & 1 deletion packages/entities/entities-shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
},
"peerDependencies": {
"@kong-ui-public/i18n": "workspace:^",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "^9.4.1",
"axios": "^1.6.8",
"vue": ">= 3.3.13 < 4",
Expand All @@ -30,6 +31,7 @@
"devDependencies": {
"@kong-ui-public/i18n": "workspace:^",
"@kong/design-tokens": "1.17.2",
"@kong/icons": "^1.15.1",
"@kong/kongponents": "9.4.1",
"axios": "^1.6.8",
"vue": "^3.4.31",
Expand Down Expand Up @@ -69,7 +71,6 @@
},
"dependencies": {
"@kong-ui-public/core": "workspace:^",
"@kong/icons": "^1.15.1",
"compare-versions": "^6.1.0"
}
}
Loading

0 comments on commit 49a30f0

Please sign in to comment.