Skip to content

Commit

Permalink
chore: refactor unbuild settings (#97)
Browse files Browse the repository at this point in the history
* refactor: unbuild settings

* fix lint
  • Loading branch information
productdevbook authored May 9, 2023
1 parent 81e6a92 commit bb7f469
Show file tree
Hide file tree
Showing 39 changed files with 111 additions and 263 deletions.
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ pnpm test testfilename # Run a specific test file name
pnpm play # Run the playground
pnpm play:vue # Run the playground with Vue
pnpm play:nuxt # Run the playground with Nuxt

pnpm clean: all # Clean all node_modules
pnpm clean:dist # Clean dist folder in all packages
pnpm clean:dts # Clean dts folder in all packages
```

## Testing
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
"test:watch": "vitest --watch",
"coverage": "vitest run --coverage",
"build:storybook": "pnpm storybook build",
"cleanup": "rimraf 'packages/**/node_modules' 'playground/**/node_modules' 'node_modules'",
"cleanup:dts": "rimraf 'playground/vue3/src/components.d.ts' 'playground/vue3/src/auto-imports.d.ts' 'playground/nuxt3/.nuxt'"
"clean": "rimraf 'packages/**/node_modules' 'playground/**/node_modules' 'node_modules'",
"clean:dist": "rimraf 'packages/**/dist' 'playground/**/dist'",
"clean:dts": "rimraf 'playground/vue3/src/components.d.ts' 'playground/vue3/src/auto-imports.d.ts' 'playground/nuxt3/.nuxt'"
},
"devDependencies": {
"@iconify-json/ph": "^1.1.5",
Expand Down
15 changes: 2 additions & 13 deletions packages/components/aspect-ratio/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { defineBuildConfig } from 'unbuild'

import pkg from './package.json'

const external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
pattern: ['*.ts', '!*.test.ts', '!*/stories/*'],
input: './src/',
pattern: ['*.ts', '!*.test.ts'],
},
],
declaration: true,
clean: true,
externals: external,
})
4 changes: 2 additions & 2 deletions packages/components/aspect-ratio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
13 changes: 1 addition & 12 deletions packages/components/avatar/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { defineBuildConfig } from 'unbuild'

import pkg from './package.json'

const external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
input: './src/',
pattern: ['*.ts', '!*.test.ts'],
},
],
declaration: true,
clean: true,
externals: external,
})
4 changes: 2 additions & 2 deletions packages/components/avatar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
13 changes: 1 addition & 12 deletions packages/components/checkbox/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { defineBuildConfig } from 'unbuild'

import pkg from './package.json'

const external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
input: './src/',
pattern: ['*.ts', '!*.test.ts'],
},
],
declaration: true,
clean: true,
externals: external,
})
4 changes: 2 additions & 2 deletions packages/components/checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
13 changes: 1 addition & 12 deletions packages/components/label/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { defineBuildConfig } from 'unbuild'

import pkg from './package.json'

const external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
input: './src/',
pattern: ['*.ts', '!*.test.ts'],
},
],
declaration: true,
clean: true,
externals: external,
})
4 changes: 2 additions & 2 deletions packages/components/label/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
5 changes: 1 addition & 4 deletions packages/components/label/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"extends": "./../../../tsconfig.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@oku-ui/label": ["./src/index.ts"]
}
"baseUrl": "."
},
"include": [
"./"
Expand Down
13 changes: 13 additions & 0 deletions packages/components/progress/build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
entries: [
{
builder: 'mkdist',
input: './src/',
pattern: ['*.ts', '!*.test.ts'],
},
],
declaration: true,
clean: true,
})
14 changes: 6 additions & 8 deletions packages/components/progress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@
},
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"require": "./dist/progress.cjs",
"import": "./dist/progress.js"
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs"
}
},
"main": "dist/progress.cjs",
"module": "dist/progress.js",
"types": "dist/types/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"scripts": {
"clean": "rm -rf dist",
"build": "vite build --mode production",
"dev": "vite build --mode production --watch",
"build": "unbuild",
"dev": "unbuild --stub",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
Expand Down
48 changes: 0 additions & 48 deletions packages/components/progress/vite.config.ts

This file was deleted.

13 changes: 1 addition & 12 deletions packages/components/separator/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { defineBuildConfig } from 'unbuild'

import pkg from './package.json'

const external = [
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
input: './src/',
pattern: ['*.ts', '!*.test.ts'],
},
],
declaration: true,
clean: true,
externals: external,
})
4 changes: 2 additions & 2 deletions packages/components/separator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
2 changes: 1 addition & 1 deletion packages/components/separator/src/separator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Separator = defineComponent({
* are updated so that that the rendered element is removed from the accessibility tree.
*/
orientation: {
type: String as unknown as PropType<Orientation>,
type: String as PropType<Orientation>,
default: DEFAULT_ORIENTATION,
},
},
Expand Down
17 changes: 4 additions & 13 deletions packages/core/compose-refs/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,10 @@ const external = [
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
pattern: ['*.ts', '!*.test.ts'],
},
],
// rollup: {
// emitCJS: true,
// },
entries: ['./src/index'],
rollup: {
emitCJS: true,
},
declaration: true,
clean: true,
externals: external,
Expand Down
6 changes: 4 additions & 2 deletions packages/core/compose-refs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
"exports": {
".": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
18 changes: 4 additions & 14 deletions packages/core/primitive/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@ const external = [
]

export default defineBuildConfig({
entries: [
{
input: './src',
builder: 'mkdist',
outDir: 'dist',
format: 'esm',
declaration: true,
pattern: ['*.ts', '!*.test.ts'],
},
],
entries: ['./src/index'],
declaration: true,
clean: true,
// rollup: {
// emitCJS: true,
// inlineDependencies: true,
// },
rollup: {
emitCJS: true,
},
externals: external,
})
4 changes: 2 additions & 2 deletions packages/core/primitive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"import": "./dist/index.mjs"
}
},
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
Expand Down
Loading

0 comments on commit bb7f469

Please sign in to comment.