Skip to content

Commit adc383d

Browse files
committed
feat(angular): produce build th Vite
1 parent 357d582 commit adc383d

5 files changed

Lines changed: 77 additions & 26 deletions

File tree

packages/angular-table/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
"datagrid"
2222
],
2323
"type": "module",
24-
"module": "dist/fesm2022/tanstack-angular-table.mjs",
25-
"types": "dist/types/tanstack-angular-table.d.ts",
24+
"module": "dist/fesm2022/tanstack-angular-table.js",
25+
"types": "dist/types/index.d.ts",
2626
"exports": {
2727
".": {
28-
"types": "./dist/types/tanstack-angular-table.d.ts",
29-
"default": "./dist/fesm2022/tanstack-angular-table.mjs"
28+
"types": "./dist/types/index.d.ts",
29+
"default": "./dist/fesm2022/tanstack-angular-table.js"
3030
},
3131
"./package.json": {
3232
"default": "./package.json"
@@ -40,7 +40,7 @@
4040
"src"
4141
],
4242
"scripts": {
43-
"build": "ng-packagr -p ng-package.json -c tsconfig.build.json && rimraf ./dist/package.json",
43+
"build": "vite build",
4444
"build:types": "tsc --emitDeclarationOnly",
4545
"clean": "rimraf ./build && rimraf ./dist",
4646
"test:build": "publint --strict",

packages/angular-table/tsconfig.build.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@
66
"module": "ESNext",
77
"moduleDetection": "force",
88
"moduleResolution": "Bundler",
9-
"stripInternal": true
9+
"stripInternal": true,
10+
"baseUrl": ".",
11+
"target": "es2022",
12+
"outDir": "dist",
13+
"declaration": true,
14+
"declarationDir": "types",
15+
"sourceMap": true,
16+
"inlineSourceMap": false,
17+
"inlineSources": true,
18+
"skipLibCheck": true,
19+
"emitDecoratorMetadata": false,
20+
"experimentalDecorators": true,
21+
"importHelpers": true,
22+
"lib": ["dom", "es2020"]
1023
},
1124
"angularCompilerOptions": {
1225
"enableI18nLegacyMessageIdFormat": false,
@@ -15,5 +28,6 @@
1528
"strictTemplates": true,
1629
"compilationMode": "partial"
1730
},
18-
"include": ["src"]
31+
"include": ["src"],
32+
"exclude": ["node_modules", "dist", "**/*.shim.ts", "**/*.spec.ts"]
1933
}

packages/angular-table/tsconfig.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@
1212
"experimentalDecorators": true,
1313
"importHelpers": true
1414
},
15-
"include": ["src", "tests", "eslint.config.js", "vite.config.ts"]
15+
"include": [
16+
"src",
17+
"tests",
18+
"eslint.config.js",
19+
"vite.config.ts",
20+
"vitest.config.ts"
21+
]
1622
}
Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
1-
import * as path from 'node:path'
2-
import { defineConfig } from 'vitest/config'
1+
import path from 'node:path'
2+
import { defineConfig } from 'vite'
33
import angular from '@analogjs/vite-plugin-angular'
4-
import packageJson from './package.json'
5-
6-
const tsconfigPath = path.join(import.meta.dirname, 'tsconfig.test.json')
7-
const testDirPath = path.join(import.meta.dirname, 'tests')
8-
const angularPlugin = angular({ tsconfig: tsconfigPath, jit: true })
94

105
export default defineConfig({
11-
plugins: [angularPlugin],
12-
test: {
13-
name: packageJson.name,
14-
watch: false,
15-
dir: testDirPath,
16-
pool: 'threads',
17-
environment: 'jsdom',
18-
setupFiles: [path.join(testDirPath, 'test-setup.ts')],
19-
globals: true,
20-
reporters: 'default',
21-
disableConsoleIntercept: true,
6+
root: import.meta.dirname,
7+
plugins: [
8+
angular({
9+
tsconfig: path.join(import.meta.dirname, 'tsconfig.build.json'),
10+
}),
11+
],
12+
resolve: {
13+
mainFields: ['module'],
14+
},
15+
build: {
16+
target: ['esnext'],
17+
sourcemap: true,
18+
lib: {
19+
entry: 'src/index.ts',
20+
fileName: `fesm2022/tanstack-angular-table`,
21+
formats: ['es'],
22+
},
23+
rolldownOptions: {
24+
external: [/^@angular\/.*/, /^@tanstack\/.*/, 'rxjs', 'rxjs/operators'],
25+
output: {
26+
preserveModules: false,
27+
},
28+
},
29+
minify: false,
2230
},
2331
})
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as path from 'node:path'
2+
import { defineConfig } from 'vitest/config'
3+
import angular from '@analogjs/vite-plugin-angular'
4+
import packageJson from './package.json'
5+
6+
const tsconfigPath = path.join(import.meta.dirname, 'tsconfig.test.json')
7+
const testDirPath = path.join(import.meta.dirname, 'tests')
8+
const angularPlugin = angular({ tsconfig: tsconfigPath, jit: true })
9+
10+
export default defineConfig({
11+
plugins: [angularPlugin],
12+
test: {
13+
name: packageJson.name,
14+
watch: false,
15+
dir: testDirPath,
16+
pool: 'threads',
17+
environment: 'jsdom',
18+
setupFiles: [path.join(testDirPath, 'test-setup.ts')],
19+
globals: true,
20+
reporters: 'default',
21+
disableConsoleIntercept: true,
22+
},
23+
})

0 commit comments

Comments
 (0)