web: first stab at monorepo.

This commit is contained in:
Ken Sternberg 2024-01-05 07:56:55 -08:00
parent cb685c42bc
commit 54aae94143
12 changed files with 20420 additions and 75 deletions

113
web/.gitignore vendored Normal file
View File

@ -0,0 +1,113 @@
# Created by https://www.gitignore.io/api/node
# Edit at https://www.gitignore.io/?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# next.js build output
.next
# nuxt.js build output
.nuxt
dist
# Uncomment the public line if your project uses Gatsby
# https://nextjs.org/blog/next-9-1#public-directory-support
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
# public
# Storybook build outputs
.out
.storybook-out
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# Temporary folders
tmp/
temp/
# End of https://www.gitignore.io/api/node
api/**
storybook-static/
scripts/*.mjs
scripts/*.js

18
web/lage.config.js Normal file
View File

@ -0,0 +1,18 @@
module.exports = {
pipeline: {
"build": [],
"lint": [],
"tsc": [],
"lit-analyse": [],
"lint:precommit": [],
"lint:spelling": [],
"precommit-all": ["tsc", "lit-analyse", "lint:precommit", "lint:spelling", "prettier"],
"build-locales": ["^build-locales"],
"extract-locales": ["^extract-locales"],
"watch": ["authentik#watch"],
"web-fix": ["^web-lint-fix", "^web-lint", "^web-check-compile", "^web-i18n-extract"],
"prettier": ["^prettier"],
},
};

20170
web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
web/package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "@goauthentik/web",
"version": "0.0.0",
"private": true,
"license": "MIT",
"scripts": {
"build": "lage build",
"lint": "lage lint",
"localize": "lage localize",
"web-fix": "lage web-fix",
"prettier": "lage prettier",
"precommit": "lage precommit-all"
},
"optionalDependencies": {
"@esbuild/darwin-arm64": "^0.19.10",
"@esbuild/linux-amd64": "^0.18.11",
"@esbuild/linux-arm64": "^0.19.10"
},
"dependencies": {
"@manypkg/cli": "^0.21.1",
"lage": "^2.7.9"
},
"workspaces": [
"packages/authentik"
],
"engines": {
"node": ">=20"
}
}

View File

@ -16,7 +16,7 @@
"watch": "run-s build-locales rollup:watch", "watch": "run-s build-locales rollup:watch",
"lint": "eslint . --max-warnings 0 --fix", "lint": "eslint . --max-warnings 0 --fix",
"lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain . | grep '^[M?][M?]' | cut -c8- | grep -E '\\.(ts|js|tsx|jsx)$') ", "lint:precommit": "eslint --max-warnings 0 --config ./.eslintrc.precommit.json $(git status --porcelain . | grep '^[M?][M?]' | cut -c8- | grep -E '\\.(ts|js|tsx|jsx)$') ",
"lint:spelling": "codespell -D - -D ../.github/codespell-dictionary.txt -I ../.github/codespell-words.txt -S './src/locales/**' ./src -s", "lint:spelling": "codespell -D - -D ../../../.github/codespell-dictionary.txt -I ../../../.github/codespell-words.txt -S './src/locales/**' ./src -s",
"lit-analyse": "lit-analyzer src", "lit-analyse": "lit-analyzer src",
"precommit": "run-s tsc lit-analyse lint:precommit lint:spelling prettier", "precommit": "run-s tsc lit-analyse lint:precommit lint:spelling prettier",
"prequick": "run-s tsc:execute lit-analyse lint:precommit lint:spelling", "prequick": "run-s tsc:execute lit-analyse lint:precommit lint:spelling",

View File

@ -4,9 +4,15 @@ import commonjs from "@rollup/plugin-commonjs";
import { nodeResolve } from "@rollup/plugin-node-resolve"; import { nodeResolve } from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace"; import replace from "@rollup/plugin-replace";
import terser from "@rollup/plugin-terser"; import terser from "@rollup/plugin-terser";
import path from "path";
import { cwd } from "process"; import { cwd } from "process";
import copy from "rollup-plugin-copy"; import copy from "rollup-plugin-copy";
import cssimport from "rollup-plugin-cssimport"; import cssimport from "rollup-plugin-cssimport";
import { fileURLToPath } from "url";
const __dirname = fileURLToPath(new URL(".", import.meta.url));
const ROOT = path.join(__dirname, "../../");
const DIST = path.join(ROOT, "dist");
// https://github.com/d3/d3-interpolate/issues/58 // https://github.com/d3/d3-interpolate/issues/58
const IGNORED_WARNINGS = /Circular dependency(.*d3-[interpolate|selection])|(.*@lit\/localize.*)/; const IGNORED_WARNINGS = /Circular dependency(.*d3-[interpolate|selection])|(.*@lit\/localize.*)/;
@ -15,18 +21,18 @@ const extensions = [".js", ".jsx", ".ts", ".tsx"];
export const resources = [ export const resources = [
{ {
src: "node_modules/@patternfly/patternfly/patternfly.min.css", src: path.join(ROOT, "node_modules/@patternfly/patternfly/patternfly.min.css"),
dest: "dist/", dest: DIST,
}, },
{ src: "src/common/styles/*", dest: "dist/" }, { src: "src/common/styles/*", dest: DIST },
{ src: "src/custom.css", dest: "dist/" }, { src: "src/custom.css", dest: DIST },
{ {
src: "node_modules/@patternfly/patternfly/assets/*", src: path.join(ROOT, "node_modules/@patternfly/patternfly/assets/*"),
dest: "dist/assets/", dest: path.join(DIST, "assets/"),
}, },
{ src: "src/assets/*", dest: "dist/assets" }, { src: "src/assets/*", dest: path.join(DIST, "assets") },
{ src: "./icons/*", dest: "dist/assets/icons" }, { src: "./icons/*", dest: path.join(DIST, "assets/icons") },
]; ];
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
@ -97,7 +103,7 @@ export const POLY = {
output: [ output: [
{ {
format: "iife", format: "iife",
file: "dist/poly.js", file: path.join(DIST, "poly.js"),
sourcemap: true, sourcemap: true,
}, },
], ],
@ -116,11 +122,11 @@ export const POLY = {
export const standalone = ["api-browser", "loading"].map((input) => { export const standalone = ["api-browser", "loading"].map((input) => {
return { return {
input: `./src/standalone/${input}`, input: path.join("./src/standalone", input),
output: [ output: [
{ {
format: "es", format: "es",
dir: `dist/standalone/${input}`, dir: path.join(DIST, "standalone", input),
sourcemap: true, sourcemap: true,
manualChunks: manualChunks, manualChunks: manualChunks,
}, },
@ -131,11 +137,11 @@ export const standalone = ["api-browser", "loading"].map((input) => {
export const enterprise = ["rac"].map((input) => { export const enterprise = ["rac"].map((input) => {
return { return {
input: `./src/enterprise/${input}`, input: path.join("./src/enterprise", input),
output: [ output: [
{ {
format: "es", format: "es",
dir: `dist/enterprise/${input}`, dir: path.join(DIST, "enterprise", input),
sourcemap: true, sourcemap: true,
manualChunks: manualChunks, manualChunks: manualChunks,
}, },
@ -154,7 +160,7 @@ export default [
output: [ output: [
{ {
format: "es", format: "es",
dir: "dist/flow", dir: path.join(DIST, "flow"),
sourcemap: true, sourcemap: true,
manualChunks: manualChunks, manualChunks: manualChunks,
}, },
@ -167,7 +173,7 @@ export default [
output: [ output: [
{ {
format: "es", format: "es",
dir: "dist/admin", dir: path.join(DIST, "admin"),
sourcemap: true, sourcemap: true,
manualChunks: manualChunks, manualChunks: manualChunks,
}, },
@ -180,7 +186,7 @@ export default [
output: [ output: [
{ {
format: "es", format: "es",
dir: "dist/user", dir: path.join(DIST, "user"),
sourcemap: true, sourcemap: true,
manualChunks: manualChunks, manualChunks: manualChunks,
}, },

View File

@ -1,64 +1,19 @@
{ {
"extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"strict": true,
"paths": { "paths": {
"@goauthentik/app/*": ["src/*"], "@goauthentik/app/*": ["./src/*"],
"@goauthentik/admin/*": ["src/admin/*"], "@goauthentik/admin/*": ["./src/admin/*"],
"@goauthentik/common/*": ["src/common/*"], "@goauthentik/common/*": ["./src/common/*"],
"@goauthentik/components/*": ["src/components/*"], "@goauthentik/components/*": ["./src/components/*"],
"@goauthentik/docs/*": ["../website/docs/*"], "@goauthentik/docs/*": ["../../../website/docs/*"],
"@goauthentik/elements/*": ["src/elements/*"], "@goauthentik/elements/*": ["./src/elements/*"],
"@goauthentik/flow/*": ["src/flow/*"], "@goauthentik/locales/*": ["./src/locales/*"],
"@goauthentik/locales/*": ["src/locales/*"], "@goauthentik/flow/*": ["./src/flow/*"],
"@goauthentik/polyfill/*": ["src/polyfill/*"], "@goauthentik/polyfill/*": ["./src/polyfill/*"],
"@goauthentik/standalone/*": ["src/standalone/*"], "@goauthentik/standalone/*": ["./src/standalone/*"],
"@goauthentik/user/*": ["src/user/*"] "@goauthentik/user/*": ["./src/user/*"]
}, },
"baseUrl": ".", "baseUrl": "."
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"sourceMap": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"lib": [
"ES5",
"ES2015",
"ES2016",
"ES2017",
"ES2018",
"ES2019",
"ES2020",
"ESNext",
"DOM",
"DOM.Iterable",
"WebWorker"
],
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"useDefineForClassFields": false,
"alwaysStrict": true,
"noImplicitAny": true,
"plugins": [
{
"name": "ts-lit-plugin",
"strict": true,
"rules": {
"no-unknown-tag-name": "off",
"no-missing-import": "off",
"no-incompatible-type-binding": "off",
"no-unknown-property": "off",
"no-unknown-attribute": "off"
}
}
]
} }
} }

54
web/tsconfig.base.json Normal file
View File

@ -0,0 +1,54 @@
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"baseUrl": ".",
"paths": {
"@goauthentik/docs/*": ["../website/docs/*"]
},
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"sourceMap": true,
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"lib": [
"ES5",
"ES2015",
"ES2016",
"ES2017",
"ES2018",
"ES2019",
"ES2020",
"ESNext",
"DOM",
"DOM.Iterable",
"WebWorker"
],
"noUnusedLocals": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"strictBindCallApply": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"useDefineForClassFields": false,
"alwaysStrict": true,
"noImplicitAny": true,
"plugins": [
{
"name": "ts-lit-plugin",
"strict": true,
"rules": {
"no-unknown-tag-name": "off",
"no-missing-import": "off",
"no-incompatible-type-binding": "off",
"no-unknown-property": "off",
"no-unknown-attribute": "off"
}
}
]
}
}