Skip to content

Commit

Permalink
chore(build): from rollup to vite config (#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
philibea authored Apr 30, 2024
1 parent 23abe58 commit 2f361cf
Show file tree
Hide file tree
Showing 14 changed files with 1,965 additions and 6,809 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"error",
{
"selector": "enumMember",
"format": ["PascalCase"],
"format": ["PascalCase"]
}
],
"import/prefer-default-export": "off",
Expand Down
6 changes: 0 additions & 6 deletions babel.config.json

This file was deleted.

16 changes: 4 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"type": "module",
"scripts": {
"build": "pnpm recursive exec -- rollup -c ../../rollup.config.mjs",
"build": "pnpm recursive run build",
"build:profile": "cross-env PROFILE=true pnpm run build",
"commit": "npx git-cz -a",
"doc": "typedoc",
Expand Down Expand Up @@ -44,34 +44,26 @@
]
},
"devDependencies": {
"@babel/core": "7.24.4",
"@babel/plugin-transform-runtime": "7.24.3",
"@babel/preset-env": "7.24.4",
"@babel/preset-typescript": "7.24.1",
"@commitlint/cli": "18.6.1",
"@commitlint/config-conventional": "18.6.3",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-node-resolve": "15.2.3",
"@scaleway/eslint-config-react": "3.18.1",
"@vitest/coverage-istanbul": "1.5.0",
"@vitest/coverage-v8": "1.5.0",
"@vitest/ui": "1.5.0",
"babel-plugin-annotate-pure-calls": "0.4.0",
"browserslist": "4.23.0",
"cross-env": "7.0.3",
"cross-fetch": "4.0.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.57.0",
"esbuild-plugin-browserslist": "0.11.1",
"eslint-plugin-tsdoc": "0.2.17",
"eslint": "8.57.0",
"husky": "9.0.11",
"jsdom": "24.0.0",
"lerna": "7.4.2",
"lint-staged": "15.2.2",
"prettier": "3.2.5",
"read-pkg": "9.0.1",
"rollup": "4.16.4",
"rollup-plugin-dts": "6.1.0",
"rollup-plugin-visualizer": "5.12.0",
"typedoc": "0.25.13",
"typescript": "5.4.5",
"vite": "5.2.10",
Expand Down
6 changes: 5 additions & 1 deletion packages/clients/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"module": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"version": "./scripts/update-constants-file.sh"
"version": "./scripts/update-constants-file.sh",
"typecheck": "tsc --noEmit",
"type:generate": "tsc --declaration -p tsconfig.build.json",
"build": "vite build --config ../../vite.config.ts && pnpm run type:generate",
"build:profile": "npx vite-bundle-visualizer -c ../../vite.config.ts"
},
"files": [
"dist"
Expand Down
18 changes: 18 additions & 0 deletions packages/clients/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"emitDeclarationOnly": true,
"rootDir": "src",
"outDir": "dist",
"skipLibCheck": true
},
"exclude": [
"dist/*",
"*.config.ts",
"*.setup.ts",
"**/__tests__",
"**/__mocks__",
"src/**/*.test.tsx"
]
}
4 changes: 4 additions & 0 deletions packages/clients/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"]
}
6 changes: 6 additions & 0 deletions packages/configuration-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
"node": ">=14.13"
},
"type": "module",
"scripts": {
"typecheck": "tsc --noEmit",
"type:generate": "tsc --declaration -p tsconfig.build.json",
"build": "vite build --config ../../vite.config.ts && pnpm run type:generate",
"build:profile": "npx vite-bundle-visualizer -c ../../vite.config.ts"
},
"devDependencies": {
"@types/node": "18.11.18"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'node:fs'
import * as os from 'node:os'
import { writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { env } from 'node:process'
import { afterEach, describe, expect, it } from 'vitest'
Expand All @@ -10,7 +10,7 @@ import {
import { EnvironmentKey } from '../env'
import type { Profile } from '../types'

const CONFIG_FILE_PATH = join(os.tmpdir(), 'scw-config.yaml')
const CONFIG_FILE_PATH = join(tmpdir(), 'scw-config.yaml')

const EMPTY_PROFILE: Profile = {}

Expand Down Expand Up @@ -46,7 +46,7 @@ const updateProfileInConfiFile = (
default_region: ${newProfile.defaultRegion ?? ''}\n
default_zone: ${newProfile.defaultZone ?? ''}\n
secret_key: ${newProfile.secretKey ?? ''}`
fs.writeFileSync(filePath, yml)
writeFileSync(filePath, yml)
}

afterEach(() => {
Expand Down
18 changes: 18 additions & 0 deletions packages/configuration-loader/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": false,
"emitDeclarationOnly": true,
"rootDir": "src",
"outDir": "dist",
"skipLibCheck": true
},
"exclude": [
"dist/*",
"*.config.ts",
"*.setup.ts",
"**/__tests__",
"**/__mocks__",
"src/**/*.test.tsx"
]
}
4 changes: 4 additions & 0 deletions packages/configuration-loader/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"]
}
Loading

0 comments on commit 2f361cf

Please sign in to comment.