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 2564ede commit 9fc52f1
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 53 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
24 changes: 11 additions & 13 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 @@ -31,20 +32,17 @@
"url": "https://github.com/nextcloud/nextcloud-auth"
},
"dependencies": {
"@nextcloud/event-bus": "^3.1.0"
"@nextcloud/event-bus": "^3.2.0"
},
"devDependencies": {
"@nextcloud/typings": "^1.8.0",
"@rollup/plugin-typescript": "^11.1.6",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"rollup": "^4.14.3",
"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 9fc52f1

Please sign in to comment.