-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding auth-common to monorepo (#6)
- Loading branch information
Showing
13 changed files
with
213 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"packages/auth-provider": "1.0.0" | ||
"packages/auth-provider": "1.0.0", | ||
"packages/auth-common": "0.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @versini/auth-common | ||
|
||
This package provides common utilities and constants for both the client and server side of the authentication system. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "@versini/auth-common", | ||
"version": "0.0.0", | ||
"license": "MIT", | ||
"author": "Arno Versini", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"homepage": "https://github.com/aversini/auth-client", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:aversini/auth-client.git" | ||
}, | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": ["dist"], | ||
"scripts": { | ||
"build:check": "tsc", | ||
"build:js": "vite build", | ||
"build:types": "tsup", | ||
"build": "npm-run-all --serial clean build:check build:js build:types", | ||
"clean": "rimraf dist tmp", | ||
"dev:js": "vite build --watch --mode development", | ||
"dev:types": "tsup --watch src", | ||
"dev": "npm-run-all clean --parallel dev:js dev:types", | ||
"lint": "biome lint src", | ||
"start": "static-server dist --port 5173", | ||
"test:watch": "vitest", | ||
"test": "vitest run" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const AUTH_TYPES = { | ||
ID_TOKEN: "id_token", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"useDefineForClassFields": true, | ||
"lib": ["ES2020", "DOM", "DOM.Iterable"], | ||
"module": "ESNext", | ||
"skipLibCheck": true, | ||
"types": ["vitest/globals", "@testing-library/jest-dom"], | ||
|
||
/* Bundler mode */ | ||
"moduleResolution": "bundler", | ||
"allowImportingTsExtensions": true, | ||
"resolveJsonModule": true, | ||
"isolatedModules": true, | ||
"noEmit": true, | ||
"jsx": "react-jsx", | ||
|
||
/* Linting */ | ||
"strict": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"include": ["src"], | ||
"references": [{ "path": "./tsconfig.node.json" }] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"composite": true, | ||
"skipLibCheck": true, | ||
"module": "ESNext", | ||
"moduleResolution": "bundler", | ||
"allowSyntheticDefaultImports": true | ||
}, | ||
"include": ["./vite.config.ts", "./vitest.setup.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from "tsup"; | ||
|
||
export default defineConfig({ | ||
format: "esm", | ||
entry: { | ||
index: "src/components/index.ts", | ||
}, | ||
outDir: "dist", | ||
dts: { | ||
only: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { resolve } from "node:path"; | ||
|
||
import fs from "fs-extra"; | ||
import { defineConfig } from "vite"; | ||
|
||
import { externalDependencies } from "../../configuration/vite.common"; | ||
|
||
const packageJson = fs.readJSONSync("package.json"); | ||
const copyrightYear = new Date(Date.now()).getFullYear(); | ||
const buildTime = new Date() | ||
.toLocaleString("en-US", { | ||
timeZone: "America/New_York", | ||
timeZoneName: "short", | ||
year: "numeric", | ||
month: "2-digit", | ||
day: "2-digit", | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
}) | ||
.replace(/,/g, ""); | ||
const banner = `/*! | ||
${packageJson.name} v${packageJson.version} | ||
© ${copyrightYear} gizmette.com | ||
*/ | ||
try { | ||
if (!window.__VERSINI_AUTH_COMMON__) { | ||
window.__VERSINI_AUTH_COMMON__ = { | ||
version: "${packageJson.version}", | ||
buildTime: "${buildTime}", | ||
homepage: "${packageJson.homepage}", | ||
license: "${packageJson.license}", | ||
}; | ||
} | ||
} catch (error) { | ||
// nothing to declare officer | ||
} | ||
`; | ||
|
||
export default defineConfig(() => { | ||
return { | ||
build: { | ||
copyPublicDir: false, | ||
lib: { | ||
entry: resolve(__dirname, "src/components/index.ts"), | ||
formats: ["es"], | ||
name: "AuthCommon", | ||
}, | ||
rollupOptions: { | ||
input: { | ||
index: resolve(__dirname, "src/components/index.ts"), | ||
}, | ||
treeshake: "smallest", | ||
external: externalDependencies, | ||
output: { | ||
compact: true, | ||
minifyInternalExports: false, | ||
assetFileNames: "style[extname]", | ||
entryFileNames: "[name].js", | ||
chunkFileNames: "chunks/[name].[hash].js", | ||
banner: (module) => { | ||
if (module?.facadeModuleId?.endsWith("src/components/index.ts")) { | ||
return banner; | ||
} | ||
}, | ||
}, | ||
}, | ||
}, | ||
esbuild: { | ||
supported: { | ||
"top-level-await": true, | ||
}, | ||
}, | ||
plugins: [], | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/// <reference types="vitest" /> | ||
|
||
import { defineConfig, mergeConfig } from "vitest/config"; | ||
|
||
import viteConfig from "./vite.config"; | ||
|
||
export default defineConfig((configEnv) => | ||
mergeConfig( | ||
viteConfig(configEnv), | ||
defineConfig({ | ||
test: { | ||
globals: true, | ||
setupFiles: ["./vitest.setup.ts"], | ||
environment: "happy-dom", | ||
coverage: { | ||
include: ["src/**/*.ts", "src/**/*.tsx", "!src/style.ts"], | ||
provider: "v8", | ||
thresholds: { | ||
statements: 100, | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
}, | ||
}, | ||
}, | ||
}), | ||
), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import "@testing-library/jest-dom/vitest"; | ||
|
||
import util from "node:util"; | ||
|
||
const originalConsoleError = console.error; | ||
console.error = (...args: any) => { | ||
const message = util.format(...args); | ||
if ( | ||
/(Warning: validateDOMNesting|Invalid prop|Failed prop type|React does not recognize|Unknown event handler property)/gi.test( | ||
message, | ||
) | ||
) { | ||
throw new Error(message); | ||
} else { | ||
originalConsoleError.apply(console, [...args]); | ||
} | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"packages": { | ||
"packages/auth-provider": {} | ||
"packages/auth-provider": {}, | ||
"packages/auth-common": {} | ||
} | ||
} |