Skip to content

Commit

Permalink
feat: Migrate to Vite for building / transpiling
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Apr 21, 2024
1 parent 191536d commit 1218129
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 52 deletions.
1 change: 0 additions & 1 deletion .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion lib/requesttoken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function onRequestTokenUpdate(observer: CsrfTokenObserver): void {
}

// Listen to server event and keep token in sync
subscribe('csrf-token-update', e => {
subscribe('csrf-token-update', (e: any) => {
token = e.token

observers.forEach(observer => {
Expand Down
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
"name": "@nextcloud/auth",
"version": "2.2.1",
"description": "Nextcloud helpers related to authentication and the current user",
"main": "dist/index.js",
"type": "module",
"main": "dist/index.cjs",
"types": "dist/index.d.ts",
"exports": {
"types": "./dist/index.d.ts",
"import": "./dist/index.es.mjs",
"require": "./dist/index.js"
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
},
"files": [
"dist/"
],
"scripts": {
"build": "rollup --config rollup.config.mjs",
"build": "vite --mode production build",
"build:doc": "typedoc --out dist/doc lib/index.ts && touch dist/doc/.nojekyll",
"check-types": "tsc --noEmit",
"dev": "vite --mode development run --watch",
"dev": "rollup --config rollup.config.mjs --watch",
"test": "jest",
"test:watch": "jest --watchAll"
Expand All @@ -35,16 +36,13 @@
},
"devDependencies": {
"@nextcloud/typings": "^1.8.0",
"@rollup/plugin-typescript": "^11.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"rollup": "^4.16.0",
"tslib": "^2.6.2",
"@nextcloud/vite-config": "^1.2.2",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
"typescript": "^5.4.5",
"vite": "^5.2.10"
},
"engines": {
"node": "^20.0.0",
"npm": "^9.0.0"
}
}
}
35 changes: 0 additions & 35 deletions rollup.config.mjs

This file was deleted.

6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"include": ["./lib/**/*.ts"],
"include": ["./lib/**.ts"],
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"moduleResolution": "node",
"moduleResolution": "Bundler",
"target": "ESNext",
"module": "esnext",
"module": "ESNext",
"declaration": true,
"strict": true,
"noImplicitAny": false,
Expand Down
10 changes: 10 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createLibConfig } from '@nextcloud/vite-config'

export default createLibConfig(
{
index: `${__dirname}/lib/index.ts`,
},
{
libraryFormats: ['cjs', 'es'],
},
)

0 comments on commit 1218129

Please sign in to comment.