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
Signed-off-by: Frédéric Vilcot <[email protected]>
  • Loading branch information
fredericvilcot committed Nov 26, 2024
1 parent e0746c9 commit 78b0172
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 28 deletions.
3 changes: 3 additions & 0 deletions packages/manager/modules/manager-pci-common/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ storybook-static
coverage
playwright-report
tests-results

# Bundle stats
stats
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 Components Library

## Features

Hosts the components used in manager for the Public Cloud universe
Keep it as simple as possible
72 changes: 46 additions & 26 deletions packages/manager/modules/manager-pci-common/package.json
Original file line number Diff line number Diff line change
@@ -1,70 +1,90 @@
{
"name": "@ovh-ux/manager-pci-common",
"version": "0.9.1",
"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.42.0",
"@ovh-ux/manager-react-shell-client": "^0.8.1",
"@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",
"rollup-plugin-visualizer": "^5.12.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-react-shell-client": "^0.8.0-alpha.0",
"@ovh-ux/manager-tailwind-config": "^0.2.0",
"@ovh-ux/shell": "^3.7.0",
"@ovh-ux/manager-core-api": "^0.9.0",
"@ovh-ux/manager-react-components": "^1.41.2",
"@ovh-ux/manager-react-shell-client": "^0.8.1",
"@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",
"@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"]
}
76 changes: 76 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,76 @@
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 { visualizer } from 'rollup-plugin-visualizer';
import * as packageJson from './package.json';

const baseConfig = getBaseConfig({});
const pathSrc = path.resolve(__dirname, 'src');

export default defineConfig({
...baseConfig,
resolve: {
alias: {
'@/': pathSrc,
},
},
plugins: [
react(),
dts({
root: __dirname,
insertTypesEntry: true,
outDir: 'dist/types',
}),
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) => {
const deps = [...Object.keys(packageJson.peerDependencies || {})];
return deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
},
output: {
globals: {
'@ovh-ux/manager-core-api': 'ManagerCoreApi',
'@ovh-ux/manager-react-components': 'ManagerReactComponents',
'@ovh-ux/manager-react-shell-client': 'ManagerReactShellClient',
'@ovhcloud/ods-common-core': 'OdsCommonCore',
'@ovhcloud/ods-common-stencil': 'OdsCommonStencil',
'@ovhcloud/ods-common-theming': 'OdsCommonTheming',
'@ovhcloud/ods-components': 'OdsComponents',
'@ovhcloud/ods-components/react': 'OdsComponentsReact',
'@ovhcloud/ods-theme-blue-jeans': 'OdsThemeBlueJeans',
'@tanstack/react-query': 'ReactQuery',
i18next: 'i18next',
react: 'React',
'react-dom': 'ReactDOM',
'react-i18next': 'ReactI18next',
'react/jsx-runtime': 'ReactJsxRuntime',
'react-router-dom': 'ReactRouterDOM',
},
},
},
},
});

0 comments on commit 78b0172

Please sign in to comment.