Skip to content

Commit

Permalink
build(pci-common): add vite config to publish library
Browse files Browse the repository at this point in the history
 ref: TAPC-2321

Signed-off-by: Anoop N <[email protected]>
  • Loading branch information
anooparveti authored and fredericvilcot committed Nov 29, 2024
1 parent 308cc8f commit fd22bd6
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 31 deletions.
6 changes: 6 additions & 0 deletions packages/manager/modules/manager-pci-common/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ⚛️⚡ Public Could Manager Common Components Library

## Features

Hosts the shared components used in manager for the Public Cloud universe
Keep it as simple as possible
66 changes: 44 additions & 22 deletions packages/manager/modules/manager-pci-common/package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,79 @@
{
"name": "@ovh-ux/manager-pci-common",
"version": "0.10.2",
"private": true,
"sideEffects": true,
"private": false,
"description": "Public Cloud Common components",
"homepage": "https://github.com/ovh/manager/blob/master/packages/manager/modules/manager-pci-common/README.md",
"bugs": {
"url": "https://github.com/ovh/manager/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ovh/manager.git",
"directory": "packages/manager/modules/manager-pci-common"
},
"license": "BSD-3-Clause",
"author": "OVH SAS",
"type": "module",
"main": "./src/index.ts",
"main": "dist/index.js",
"types": "dist/types/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "tsc --project tsconfig.build.json",
"dev": "tsc",
"build": "vite build",
"clean": "rimraf node_modules && rimraf dist && yarn cache clean",
"dev": "vite build",
"lint": "eslint ./src",
"lint:fix": "eslint ./src --fix",
"prepare": "vite build",
"prettier": "prettier --write \"src/**/*.{ts,tsx,js,mdx}\"",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:coverage:watch": "vitest --coverage",
"test:watch": "vitest"
"test:watch": "vitest --watch",
"type:check": "tsc --noEmit"
},
"dependencies": {
"@ovh-ux/manager-tailwind-config": "^0.2.1",
"clsx": "2.1.1",
"date-fns": "^3.6.0",
"element-internals-polyfill": "^1.3.11",
"file-saver": "^2.0.5",
"i18next": "^23.8.2",
"i18next-http-backend": "^2.6.1",
"lodash.isequal": "^4.5.0"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@ovh-ux/manager-core-api": "^0.9.0",
"@ovh-ux/manager-react-components": "^1.41.1",
"@ovh-ux/manager-react-components": "^1.43.0",
"@ovh-ux/manager-react-shell-client": "^0.8.2",
"@ovh-ux/manager-vite-config": "^0.8.3",
"@ovhcloud/ods-common-core": "^17.2.2",
"@ovhcloud/ods-common-stencil": "^17.2.2",
"@ovhcloud/ods-common-theming": "^17.2.2",
"@ovhcloud/ods-components": "^17.2.2",
"@ovhcloud/ods-theme-blue-jeans": "^17.2.2",
"@tanstack/react-query": "^5.51.21",
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/file-saver": "^2.0.7",
"@types/jest": "^29.5.12",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.2.2",
"element-internals-polyfill": "^1.3.11",
"i18next": "^23.8.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^14.0.5",
"react-router-dom": "^6.3.0",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"vite": "^5.4.2",
"vite-plugin-dts": "3.5.1",
"vitest": "^2.0.5"
},
"peerDependencies": {
"@ovh-ux/manager-config": "^7.3.2",
"@ovh-ux/manager-core-api": "^0.9.0-alpha.0",
"@ovh-ux/manager-react-components": "^1.41.0-alpha.6",
"@ovh-ux/manager-core-api": "^0.9.0",
"@ovh-ux/manager-react-components": "^1.43.0",
"@ovh-ux/manager-react-shell-client": "^0.8.2",
"@ovh-ux/manager-tailwind-config": "^0.2.0",
"@ovh-ux/shell": "^3.7.0",
Expand All @@ -58,13 +83,10 @@
"@ovhcloud/ods-components": "^17.2.2",
"@ovhcloud/ods-theme-blue-jeans": "^17.2.2",
"@tanstack/react-query": "^5.51.21",
"@tanstack/react-query-devtools": "^5.51.21",
"@tanstack/react-table": "^8.20.1",
"i18next": "^23.8.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.50.1",
"react-i18next": "^14.0.5",
"react-router-dom": "^6.3.0",
"react-use": "^17.5.0"
"react-router-dom": "^6.3.0"
}
}
8 changes: 6 additions & 2 deletions packages/manager/modules/manager-pci-common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"useDefineForClassFields": true,
"lib": ["ES2020", "dom"],
"types": ["vite/client", "node"],
"outDir": "dist",
"module": "ESNext",
"allowJs": true,
"skipLibCheck": true,
"moduleResolution": "node",
"allowImportingTsExtensions": false,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"declaration": true,
"declarationDir": "./dist/types",
"emitDeclarationOnly": true,
"jsx": "react-jsx",
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
Expand All @@ -22,5 +26,5 @@
"esModuleInterop": true
},
"include": ["src/**/*", "*.spec.tsx"],
"exclude": ["node_modules", "dist", "types"]
"exclude": ["node_modules", "dist"]
}
63 changes: 63 additions & 0 deletions packages/manager/modules/manager-pci-common/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
import dts from 'vite-plugin-dts';
import path from 'path';
import tailwindcss from 'tailwindcss';
import { getBaseConfig } from '@ovh-ux/manager-vite-config';
import * as packageJson from './package.json';

const baseConfig = getBaseConfig({});
const pathSrc = path.resolve(__dirname, 'src');
const externalDeps = [
...Object.keys(packageJson.peerDependencies || {}),
'@ovhcloud/ods-components/react',
];

export default defineConfig({
...baseConfig,
resolve: {
alias: {
'@/': pathSrc,
},
},
plugins: [
react(),
dts({
root: __dirname,
insertTypesEntry: true,
outDir: 'dist/types',
}),
/*
* Visualizer emits an HTML file that allows to check what's really included in the bundle.
* Uncomment if you want to run the plugin and check the output dist.
* Be sure that plugin is installed before and well imported.
*/
// visualizer({
// filename: 'stats/bundle-analysis.html',
// }),
],
css: {
postcss: {
plugins: [tailwindcss],
},
},
test: {
globals: true,
environment: 'jsdom',
},
build: {
outDir: path.resolve(__dirname, 'dist'),
emptyOutDir: true,
lib: {
entry: path.resolve(pathSrc, 'index.ts'),
name: 'ManagerPciCommonLib',
fileName: 'index',
formats: ['es'],
},
rollupOptions: {
external: (id) =>
externalDeps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
},
sourcemap: 'hidden',
},
});
27 changes: 20 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5165,6 +5165,26 @@
tailwindcss "^3.4.4"
uuid "^9.0.1"

"@ovh-ux/manager-react-components@^1.42.0":
version "1.43.0"
resolved "https://registry.yarnpkg.com/@ovh-ux/manager-react-components/-/manager-react-components-1.43.0.tgz#dc6ec7f3636510792c425e617d25c7b6d39a3041"
integrity sha512-ipxEFvXrTv15IQqyLuwlkLHeqIE7U0B1yugcGSmYsgQ6yokP74+7TNEyt7JqpVwt+spszRIBv+MnVPqvq24LPg==
dependencies:
"@ovhcloud/ods-common-core" "17.2.2"
"@ovhcloud/ods-common-theming" "17.2.2"
"@ovhcloud/ods-components" "17.2.2"
"@ovhcloud/ods-theme-blue-jeans" "17.2.2"
"@tanstack/react-query" "^5.51.21"
"@tanstack/react-table" "^8.20.1"
clsx "^2.1.1"
lodash.isdate "^4.0.1"
lodash.isequal "^4.5.0"
react-i18next "^14.0.5"
react-use "^17.5.0"
sass "1.71.0"
tailwindcss "^3.4.4"
uuid "^9.0.1"

"@ovh-ux/manager-react-shell-client@^0.8.2":
version "0.8.2"
resolved "https://registry.yarnpkg.com/@ovh-ux/manager-react-shell-client/-/manager-react-shell-client-0.8.2.tgz#b2e1209777126327af37193ec7d9e15593362605"
Expand Down Expand Up @@ -17292,13 +17312,6 @@ i18next-http-backend@^2.5.2:
dependencies:
cross-fetch "4.0.0"

i18next-http-backend@^2.6.1:
version "2.6.2"
resolved "https://registry.yarnpkg.com/i18next-http-backend/-/i18next-http-backend-2.6.2.tgz#b25516446ae6f251ce8231e70e6ffbca833d46a5"
integrity sha512-Hp/kd8/VuoxIHmxsknJXjkTYYHzivAyAF15pzliKzk2TiXC25rZCEerb1pUFoxz4IVrG3fCvQSY51/Lu4ECV4A==
dependencies:
cross-fetch "4.0.0"

i18next@^23.11.5:
version "23.16.5"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-23.16.5.tgz#53d48ae9f985fd73fc1fcb96e6c7d90ababf0831"
Expand Down

0 comments on commit fd22bd6

Please sign in to comment.