Skip to content

Commit 2f361cf

Browse files
authored
chore(build): from rollup to vite config (#1255)
1 parent 23abe58 commit 2f361cf

14 files changed

+1965
-6809
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"error",
1212
{
1313
"selector": "enumMember",
14-
"format": ["PascalCase"],
14+
"format": ["PascalCase"]
1515
}
1616
],
1717
"import/prefer-default-export": "off",

babel.config.json

-6
This file was deleted.

package.json

+4-12
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"type": "module",
1212
"scripts": {
13-
"build": "pnpm recursive exec -- rollup -c ../../rollup.config.mjs",
13+
"build": "pnpm recursive run build",
1414
"build:profile": "cross-env PROFILE=true pnpm run build",
1515
"commit": "npx git-cz -a",
1616
"doc": "typedoc",
@@ -44,34 +44,26 @@
4444
]
4545
},
4646
"devDependencies": {
47-
"@babel/core": "7.24.4",
48-
"@babel/plugin-transform-runtime": "7.24.3",
49-
"@babel/preset-env": "7.24.4",
50-
"@babel/preset-typescript": "7.24.1",
5147
"@commitlint/cli": "18.6.1",
5248
"@commitlint/config-conventional": "18.6.3",
53-
"@rollup/plugin-babel": "6.0.4",
54-
"@rollup/plugin-commonjs": "25.0.7",
55-
"@rollup/plugin-node-resolve": "15.2.3",
5649
"@scaleway/eslint-config-react": "3.18.1",
5750
"@vitest/coverage-istanbul": "1.5.0",
5851
"@vitest/coverage-v8": "1.5.0",
5952
"@vitest/ui": "1.5.0",
6053
"babel-plugin-annotate-pure-calls": "0.4.0",
54+
"browserslist": "4.23.0",
6155
"cross-env": "7.0.3",
6256
"cross-fetch": "4.0.0",
6357
"cz-conventional-changelog": "3.3.0",
64-
"eslint": "8.57.0",
58+
"esbuild-plugin-browserslist": "0.11.1",
6559
"eslint-plugin-tsdoc": "0.2.17",
60+
"eslint": "8.57.0",
6661
"husky": "9.0.11",
6762
"jsdom": "24.0.0",
6863
"lerna": "7.4.2",
6964
"lint-staged": "15.2.2",
7065
"prettier": "3.2.5",
7166
"read-pkg": "9.0.1",
72-
"rollup": "4.16.4",
73-
"rollup-plugin-dts": "6.1.0",
74-
"rollup-plugin-visualizer": "5.12.0",
7567
"typedoc": "0.25.13",
7668
"typescript": "5.4.5",
7769
"vite": "5.2.10",

packages/clients/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
"module": "dist/index.js",
1313
"types": "dist/index.d.ts",
1414
"scripts": {
15-
"version": "./scripts/update-constants-file.sh"
15+
"version": "./scripts/update-constants-file.sh",
16+
"typecheck": "tsc --noEmit",
17+
"type:generate": "tsc --declaration -p tsconfig.build.json",
18+
"build": "vite build --config ../../vite.config.ts && pnpm run type:generate",
19+
"build:profile": "npx vite-bundle-visualizer -c ../../vite.config.ts"
1620
},
1721
"files": [
1822
"dist"

packages/clients/tsconfig.build.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"emitDeclarationOnly": true,
6+
"rootDir": "src",
7+
"outDir": "dist",
8+
"skipLibCheck": true
9+
},
10+
"exclude": [
11+
"dist/*",
12+
"*.config.ts",
13+
"*.setup.ts",
14+
"**/__tests__",
15+
"**/__mocks__",
16+
"src/**/*.test.tsx"
17+
]
18+
}

packages/clients/tsconfig.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"]
4+
}

packages/configuration-loader/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
"node": ">=14.13"
1919
},
2020
"type": "module",
21+
"scripts": {
22+
"typecheck": "tsc --noEmit",
23+
"type:generate": "tsc --declaration -p tsconfig.build.json",
24+
"build": "vite build --config ../../vite.config.ts && pnpm run type:generate",
25+
"build:profile": "npx vite-bundle-visualizer -c ../../vite.config.ts"
26+
},
2127
"devDependencies": {
2228
"@types/node": "18.11.18"
2329
}

packages/configuration-loader/src/__tests__/config-loader.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import * as fs from 'node:fs'
2-
import * as os from 'node:os'
1+
import { writeFileSync } from 'node:fs'
2+
import { tmpdir } from 'node:os'
33
import { join } from 'node:path'
44
import { env } from 'node:process'
55
import { afterEach, describe, expect, it } from 'vitest'
@@ -10,7 +10,7 @@ import {
1010
import { EnvironmentKey } from '../env'
1111
import type { Profile } from '../types'
1212

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

1515
const EMPTY_PROFILE: Profile = {}
1616

@@ -46,7 +46,7 @@ const updateProfileInConfiFile = (
4646
default_region: ${newProfile.defaultRegion ?? ''}\n
4747
default_zone: ${newProfile.defaultZone ?? ''}\n
4848
secret_key: ${newProfile.secretKey ?? ''}`
49-
fs.writeFileSync(filePath, yml)
49+
writeFileSync(filePath, yml)
5050
}
5151

5252
afterEach(() => {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": false,
5+
"emitDeclarationOnly": true,
6+
"rootDir": "src",
7+
"outDir": "dist",
8+
"skipLibCheck": true
9+
},
10+
"exclude": [
11+
"dist/*",
12+
"*.config.ts",
13+
"*.setup.ts",
14+
"**/__tests__",
15+
"**/__mocks__",
16+
"src/**/*.test.tsx"
17+
]
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"include": ["src/**/*.ts", "src/**/*.tsx", "*.config.ts"]
4+
}

0 commit comments

Comments
 (0)