web: move to wireit as the build runner language (#10440)
* web: fix esbuild issue with style sheets Getting ESBuild, Lit, and Storybook to all agree on how to read and parse stylesheets is a serious pain. This fix better identifies the value types (instances) being passed from various sources in the repo to the three *different* kinds of style processors we're using (the native one, the polyfill one, and whatever the heck Storybook does internally). Falling back to using older CSS instantiating techniques one era at a time seems to do the trick. It's ugly, but in the face of the aggressive styling we use to avoid Flashes of Unstyled Content (FLoUC), it's the logic with which we're left. In standard mode, the following warning appears on the console when running a Flow: ``` Autofocus processing was blocked because a document already has a focused element. ``` In compatibility mode, the following **error** appears on the console when running a Flow: ``` crawler-inject.js:1106 Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'. at initDomMutationObservers (crawler-inject.js:1106:18) at crawler-inject.js:1114:24 at Array.forEach (<anonymous>) at initDomMutationObservers (crawler-inject.js:1114:10) at crawler-inject.js:1549:1 initDomMutationObservers @ crawler-inject.js:1106 (anonymous) @ crawler-inject.js:1114 initDomMutationObservers @ crawler-inject.js:1114 (anonymous) @ crawler-inject.js:1549 ``` Despite this error, nothing seems to be broken and flows work as anticipated. * root: fix migrations missing using db_alias Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * more Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> * web: add wireit as a dependency and move SFE into an independent package * web: make `sfe` a legitimite subpackage and use `wireit` to control the build - Move sfe to a `packages` subfolder: this is a more standard format for subpackages - `Move sfe/index.ts` to `sfe/src/index.ts`: this is a more standard layout for a package - Adjusted paths is `package.json` and `sfe/rollup.config.js` accordingly. - Add prettier and safety linting to `sfe`. - fix a naming issues in `build-locales`, highlighted by eslint - fix some minor linting issues is `build-locales` - add comments to `build-locales`, to make it clear what it does - updated the README and LICENSE files - start using `wireit` heavily as the task-runner definition language Primarily, to look professional and pave the way for future enhancements. Aside from the standardization and so forth, the primary goal here is to move our task runner to wireit. Wireit offers a number of intriguing abilities with respect to caching, building, and testing, such as an ability to `watch` our folders and files and automatically re-run the build when the relevant code changes, without having to rebuild the copied content or sub-packages such as `sfe`. The ability to pass in environment variables without needed `cross-env` makes code that required it much easier to read. Commands that take a long time can be prefixed with the environment variable `${NODE_RUNNER} `, which then would allow you to default to using `node`, but by setting `NODE_RUNNER` in your shell you could specify `bun` (or `deno`, maybe, but I haven't tested it with `deno`). `bun` runs the `eslint` pass in about three-quarters the time `node` takes. This commit exists primarily to ensure that the build runs as expected under CI, and the result is as expected under CI. Wireit was produced by Google and is used by Adobe Spectrum Components, Patternfly Components, Material Web, Red Hat Design, and the Lit-Element teams, so I'm confident that it's robust and reliable as a build runner. * Merge failed to account for this. * web: fix bad reference to lint command * Adding sfe to workspaces means its install is run automatically. * sfe build is now orchestrated by the web build process * web: slowly tracking down the old ways. * Trying to fix lit-analyze pass. * Still struggling with the build. * Monorepo, please. * Still trying to solve swc binding issue. * Reformat package.json so that scripts and wireit are closer to one another. * Use the right formatter for packagefiles. * Retarget dockerfile to have the right paths to sfe during build. * Comment to explain gitignore update. * Add lint correcting to package.json as well as package-lock * Restored lost package-lock.json * Updating the authentik version. * Trying to force version consistency. --------- Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space> Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
4
.github/workflows/api-ts-publish.yml
vendored
4
.github/workflows/api-ts-publish.yml
vendored
@ -35,8 +35,8 @@ jobs:
|
||||
run: |
|
||||
export VERSION=`node -e 'console.log(require("../gen-ts-api/package.json").version)'`
|
||||
npm i @goauthentik/api@$VERSION
|
||||
- name: Upgrade /web/sfe
|
||||
working-directory: web/sfe
|
||||
- name: Upgrade /web/packages/sfe
|
||||
working-directory: web/packages/sfe
|
||||
run: |
|
||||
export VERSION=`node -e 'console.log(require("../gen-ts-api/package.json").version)'`
|
||||
npm i @goauthentik/api@$VERSION
|
||||
|
7
.github/workflows/ci-web.yml
vendored
7
.github/workflows/ci-web.yml
vendored
@ -28,15 +28,8 @@ jobs:
|
||||
include:
|
||||
- command: tsc
|
||||
project: web
|
||||
extra_setup: |
|
||||
cd sfe/ && npm ci
|
||||
- command: lit-analyse
|
||||
project: web
|
||||
extra_setup: |
|
||||
# lit-analyse doesn't understand path rewrites, so make it
|
||||
# belive it's an actual module
|
||||
cd node_modules/@goauthentik
|
||||
ln -s ../../src/ web
|
||||
exclude:
|
||||
- command: lint:lockfile
|
||||
project: tests/wdio
|
||||
|
@ -30,12 +30,9 @@ WORKDIR /work/web
|
||||
|
||||
RUN --mount=type=bind,target=/work/web/package.json,src=./web/package.json \
|
||||
--mount=type=bind,target=/work/web/package-lock.json,src=./web/package-lock.json \
|
||||
--mount=type=bind,target=/work/web/sfe/package.json,src=./web/sfe/package.json \
|
||||
--mount=type=bind,target=/work/web/sfe/package-lock.json,src=./web/sfe/package-lock.json \
|
||||
--mount=type=bind,target=/work/web/packages/sfe/package.json,src=./web/packages/sfe/package.json \
|
||||
--mount=type=bind,target=/work/web/scripts,src=./web/scripts \
|
||||
--mount=type=cache,id=npm-web,sharing=shared,target=/root/.npm \
|
||||
npm ci --include=dev && \
|
||||
cd sfe && \
|
||||
npm ci --include=dev
|
||||
|
||||
COPY ./package.json /work
|
||||
@ -43,9 +40,7 @@ COPY ./web /work/web/
|
||||
COPY ./website /work/website/
|
||||
COPY ./gen-ts-api /work/web/node_modules/@goauthentik/api
|
||||
|
||||
RUN npm run build && \
|
||||
cd sfe && \
|
||||
npm run build
|
||||
RUN npm run build
|
||||
|
||||
# Stage 3: Build go proxy
|
||||
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/oss/go/microsoft/golang:1.22-fips-bookworm AS go-builder
|
||||
|
4
web/.gitignore
vendored
4
web/.gitignore
vendored
@ -109,4 +109,8 @@ temp/
|
||||
# End of https://www.gitignore.io/api/node
|
||||
api/**
|
||||
storybook-static/
|
||||
|
||||
# Wireit's cache
|
||||
.wireit
|
||||
|
||||
custom-elements.json
|
||||
|
@ -12,3 +12,5 @@ storybook-static/
|
||||
# Prettier breaks the tsconfig file
|
||||
tsconfig.json
|
||||
.storybook/css-import-maps*
|
||||
package.json
|
||||
packages/**/package.json
|
||||
|
@ -40,7 +40,6 @@ const rawCssImportMaps = [
|
||||
'import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css";',
|
||||
'import PFGlobal from "@patternfly/patternfly/patternfly-base.css";',
|
||||
'import PFGrid from "@patternfly/patternfly/layouts/Grid/grid.css";',
|
||||
'import PFHint from "@patternfly/patternfly/components/Hint/hint.css";',
|
||||
'import PFInputGroup from "@patternfly/patternfly/components/InputGroup/input-group.css";',
|
||||
'import PFLabel from "@patternfly/patternfly/components/Label/label.css";',
|
||||
'import PFList from "@patternfly/patternfly/components/List/list.css";',
|
||||
@ -58,6 +57,7 @@ const rawCssImportMaps = [
|
||||
'import PFSizing from "@patternfly/patternfly/utilities/Sizing/sizing.css";',
|
||||
'import PFSpacing from "@patternfly/patternfly/utilities/Spacing/spacing.css";',
|
||||
'import PFSpinner from "@patternfly/patternfly/components/Spinner/spinner.css";',
|
||||
'import PFSplit from "@patternfly/patternfly/layouts/Split/split.css";',
|
||||
'import PFStack from "@patternfly/patternfly/layouts/Stack/stack.css";',
|
||||
'import PFSwitch from "@patternfly/patternfly/components/Switch/switch.css";',
|
||||
'import PFTable from "@patternfly/patternfly/components/Table/table.css";',
|
||||
@ -71,8 +71,10 @@ const rawCssImportMaps = [
|
||||
'import styles from "./LibraryPageImpl.css";',
|
||||
];
|
||||
|
||||
const cssImportMaps = rawCssImportMaps.reduce((acc, line) => (
|
||||
{...acc, [line]: line.replace(/\.css/, ".css?inline")}), {});
|
||||
const cssImportMaps = rawCssImportMaps.reduce(
|
||||
(acc, line) => ({ ...acc, [line]: line.replace(/\.css/, ".css?inline") }),
|
||||
{},
|
||||
);
|
||||
|
||||
export { cssImportMaps };
|
||||
export default cssImportMaps;
|
||||
|
18
web/LICENSE.txt
Normal file
18
web/LICENSE.txt
Normal file
@ -0,0 +1,18 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2024 Authentik Security, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
||||
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@ -107,3 +107,8 @@ settings in JSON files, which do not support comments.
|
||||
- `compilerOptions.plugins.ts-lit-plugin.rules.no-incompatible-type-binding: "warn"`: lit-analyzer
|
||||
does not support generics well when parsing a subtype of `HTMLElement`. As a result, this threw
|
||||
too many errors to be supportable.
|
||||
|
||||
### License
|
||||
|
||||
This code is licensed under the [MIT License](https://www.tldrlegal.com/license/mit-license).
|
||||
[A copy of the license](./LICENSE.txt) is included with this package.
|
||||
|
@ -115,7 +115,9 @@ async function buildOneSource(source, dest) {
|
||||
});
|
||||
const end = Date.now();
|
||||
console.log(
|
||||
`[${new Date(end).toISOString()}] Finished build for target ${source} in ${Date.now() - start}ms`,
|
||||
`[${new Date(end).toISOString()}] Finished build for target ${source} in ${
|
||||
Date.now() - start
|
||||
}ms`,
|
||||
);
|
||||
} catch (exc) {
|
||||
console.error(`[${new Date(Date.now()).toISOString()}] Failed to build ${source}: ${exc}`);
|
||||
|
8105
web/package-lock.json
generated
8105
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
262
web/package.json
262
web/package.json
@ -1,42 +1,6 @@
|
||||
{
|
||||
"name": "@goauthentik/web",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"extract-locales": "lit-localize extract",
|
||||
"build-locales": "node scripts/build-locales.mjs",
|
||||
"build-locales:build": "lit-localize build",
|
||||
"build-locales:repair": "prettier --write ./src/locale-codes.ts",
|
||||
"build:manifest": "custom-elements-manifest analyze --litelement --globs 'src/**/*.ts' --exclude 'src/**/*.stories.ts' --exclude 'src/**/*.tests.ts'",
|
||||
"esbuild:build": "node build.mjs",
|
||||
"esbuild:build-proxy": "node build.mjs --proxy",
|
||||
"esbuild:watch": "node build.mjs --watch",
|
||||
"build": "run-s build-locales build:manifest esbuild:build",
|
||||
"build-proxy": "run-s build-locales esbuild:build-proxy",
|
||||
"watch": "run-s build-locales build:manifest esbuild:watch",
|
||||
"lint": "cross-env NODE_OPTIONS='--max_old_space_size=65536' eslint . --max-warnings 0 --fix",
|
||||
"lint:lockfile": "lockfile-lint --path package.json --type npm --allowed-hosts npm --validate-https",
|
||||
"lint:precommit": "bun ./scripts/eslint.mjs --precommit",
|
||||
"lint:nightmare": "bun ./scripts/eslint.mjs --nightmare",
|
||||
"lint:spelling": "node scripts/check-spelling.mjs",
|
||||
"lit-analyse": "lit-analyzer src",
|
||||
"lit-analyse:strict": "lit-analyzer src --strict",
|
||||
"postinstall": "bash scripts/patch-spotlight.sh",
|
||||
"precommit": "npm-run-all --parallel tsc lit-analyse lint:spelling lint:lockfile --sequential lint:precommit prettier",
|
||||
"prequick": "run-s tsc:execute lit-analyse lint:precommit lint:spelling",
|
||||
"prettier-check": "prettier --check .",
|
||||
"prettier": "prettier --write .",
|
||||
"pseudolocalize": "node scripts/pseudolocalize.mjs",
|
||||
"tsc:execute": "tsc --noEmit -p .",
|
||||
"tsc": "run-s build-locales tsc:execute",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"storybook:build": "cross-env NODE_OPTIONS='--max_old_space_size=8192' storybook build",
|
||||
"storybook:build-import-map": "node scripts/build-storybook-import-maps.mjs",
|
||||
"test": "npx wdio run ./wdio.conf.ts --logLevel=warn --autoCompileOpts.tsNodeOpts.project=tsconfig.test.json",
|
||||
"test-view": "npx wdio run ./wdio.conf.ts --autoCompileOpts.tsNodeOpts.project=tsconfig.test.json",
|
||||
"test-watch": "npx wdio run ./wdio.conf.ts --autoCompileOpts.tsNodeOpts.project=tsconfig.test.json --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@codemirror/lang-html": "^6.4.9",
|
||||
"@codemirror/lang-javascript": "^6.2.2",
|
||||
@ -138,6 +102,7 @@
|
||||
"rollup-plugin-postcss-lit": "^2.1.0",
|
||||
"storybook": "^8.1.11",
|
||||
"storybook-addon-mock": "^5.0.0",
|
||||
"syncpack": "^12.3.3",
|
||||
"ts-lit-plugin": "^2.0.2",
|
||||
"ts-node": "^10.9.2",
|
||||
"tslib": "^2.6.3",
|
||||
@ -145,8 +110,13 @@
|
||||
"typescript": "^5.5.4",
|
||||
"typescript-eslint": "^8.0.1",
|
||||
"vite-tsconfig-paths": "^4.3.2",
|
||||
"wdio-wait-for": "^3.0.11"
|
||||
"wdio-wait-for": "^3.0.11",
|
||||
"wireit": "^0.14.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"@esbuild/darwin-arm64": "^0.23.0",
|
||||
"@esbuild/linux-amd64": "^0.18.11",
|
||||
@ -155,7 +125,219 @@
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.20.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.20.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
}
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "wireit",
|
||||
"build-locales": "wireit",
|
||||
"build-locales:build": "wireit",
|
||||
"build-proxy": "wireit",
|
||||
"build:sfe": "wireit",
|
||||
"esbuild:watch": "node build.mjs --watch",
|
||||
"extract-locales": "wireit",
|
||||
"format": "wireit",
|
||||
"lint": "wireit",
|
||||
"lint:lockfile": "wireit",
|
||||
"lint:package": "wireit",
|
||||
"lit-analyse": "wireit",
|
||||
"postinstall": "bash scripts/patch-spotlight.sh",
|
||||
"precommit": "wireit",
|
||||
"prettier": "wireit",
|
||||
"prettier-check": "wireit",
|
||||
"pseudolocalize": "wireit",
|
||||
"storybook": "storybook dev -p 6006",
|
||||
"storybook:build": "wireit",
|
||||
"storybook:build-import-map": "wireit",
|
||||
"test": "wireit",
|
||||
"test-view": "wireit",
|
||||
"test-watch": "npx wdio run ./wdio.conf.ts --autoCompileOpts.tsNodeOpts.project=tsconfig.test.json --watch",
|
||||
"tsc": "wireit",
|
||||
"watch": "run-s build-locales esbuild:watch"
|
||||
},
|
||||
"wireit": {
|
||||
"build": {
|
||||
"#comment": [
|
||||
"`npm run build` and `npm run watch` are the most common ",
|
||||
"commands you should be using when working on the front-end ",
|
||||
"The files and output spec here expect you to use `npm run build --watch` ",
|
||||
"instead of `npm run watch`. The former is more comprehensive, but ",
|
||||
"the latter is faster."
|
||||
],
|
||||
"command": "${NODE_RUNNER} build.mjs",
|
||||
"files": [
|
||||
"src/**/*.{css,jpg,png,ts,js,json}",
|
||||
"!src/**/*.stories.ts",
|
||||
"!src/**/*.tests.ts",
|
||||
"!src/locales/*.ts",
|
||||
"!src/locale-codes.ts",
|
||||
"icons/**/*"
|
||||
],
|
||||
"output": [
|
||||
"./dist/admin/**",
|
||||
"./dist/user/**",
|
||||
"./dist/flow/**",
|
||||
"./dist/standalone/api-browser/**",
|
||||
"./dist/standalone/loading/**",
|
||||
"./dist/enterprise/**",
|
||||
"./dist/poly-*.js",
|
||||
"./dist/poly-*.js.map",
|
||||
"./dist/custom.css",
|
||||
"./dist/theme-dark.css",
|
||||
"./dist/patternfly.min.css"
|
||||
],
|
||||
"dependencies": [
|
||||
"build-locales",
|
||||
"./packages/sfe:build"
|
||||
],
|
||||
"env": {
|
||||
"NODE_RUNNER": {
|
||||
"external": true,
|
||||
"default": "node"
|
||||
}
|
||||
}
|
||||
},
|
||||
"build:sfe": {
|
||||
"dependencies": [
|
||||
"./packages/sfe:build"
|
||||
],
|
||||
"files": [
|
||||
"./packages/sfe/**/*.ts"
|
||||
]
|
||||
},
|
||||
"build-proxy": {
|
||||
"command": "node build.mjs --proxy",
|
||||
"dependencies": [
|
||||
"build-locales"
|
||||
]
|
||||
},
|
||||
"build-locales:build": {
|
||||
"command": "lit-localize build"
|
||||
},
|
||||
"build-locales:repair": {
|
||||
"command": "prettier --write ./src/locale-codes.ts"
|
||||
},
|
||||
"build-locales": {
|
||||
"command": "node scripts/build-locales.mjs",
|
||||
"files": [
|
||||
"./xliff/*.xlf"
|
||||
],
|
||||
"output": [
|
||||
"./src/locales/*.ts",
|
||||
"./src/locale-codes.ts"
|
||||
]
|
||||
},
|
||||
"extract-locales": {
|
||||
"command": "lit-localize extract"
|
||||
},
|
||||
"format": {
|
||||
"command": "prettier --write .",
|
||||
"dependencies": [
|
||||
"lint:package"
|
||||
]
|
||||
},
|
||||
"format:packages": {
|
||||
"dependencies": [
|
||||
"./packages/sfe:prettier"
|
||||
]
|
||||
},
|
||||
"lint": {
|
||||
"command": "eslint --max-warnings 0 --fix",
|
||||
"env": {
|
||||
"NODE_OPTIONS": "--max_old_space_size=65536"
|
||||
}
|
||||
},
|
||||
"lint:components": {
|
||||
"command": "lit-analyzer src"
|
||||
},
|
||||
"lint:types": {
|
||||
"command": "tsc --noEmit -p .",
|
||||
"dependencies": [
|
||||
"build-locales"
|
||||
]
|
||||
},
|
||||
"lint:lockfile": {
|
||||
"command": "lockfile-lint --path package.json --type npm --allowed-hosts npm --validate-https"
|
||||
},
|
||||
"lint:lockfiles": {
|
||||
"dependencies": [
|
||||
"./packages/sfe:lint:lockfile"
|
||||
]
|
||||
},
|
||||
"lint:package": {
|
||||
"command": "syncpack format -i ' '"
|
||||
},
|
||||
"lint:nightmare": {
|
||||
"command": "${NODE_RUNNER} ./scripts/eslint.mjs --nightmare",
|
||||
"env": {
|
||||
"NODE_RUNNER": {
|
||||
"external": true,
|
||||
"default": "node"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint:precommit": {
|
||||
"command": "${NODE_RUNNER} ./scripts/eslint.mjs --precommit",
|
||||
"env": {
|
||||
"NODE_RUNNER": {
|
||||
"external": true,
|
||||
"default": "node"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lint:spelling": {
|
||||
"command": "node scripts/check-spelling.mjs"
|
||||
},
|
||||
"lit-analyse": {
|
||||
"command": "lit-analyzer src"
|
||||
},
|
||||
"precommit": {
|
||||
"command": "prettier --write .",
|
||||
"dependencies": [
|
||||
"lint:types",
|
||||
"lint:components",
|
||||
"lint:spelling",
|
||||
"lint:lockfile",
|
||||
"lint:lockfiles",
|
||||
"lint:precommit",
|
||||
"format:packages"
|
||||
]
|
||||
},
|
||||
"prettier": {
|
||||
"dependencies": [
|
||||
"format"
|
||||
]
|
||||
},
|
||||
"prettier-check": {
|
||||
"command": "prettier --check ."
|
||||
},
|
||||
"pseudolocalize": {
|
||||
"command": "node scripts/pseudolocalize.mjs"
|
||||
},
|
||||
"storybook:build": {
|
||||
"command": "storybook build",
|
||||
"env": {
|
||||
"NODE_OPTIONS": "--max_old_space_size=8192"
|
||||
}
|
||||
},
|
||||
"storybook:build-import-map": {
|
||||
"command": "node scripts/build-storybook-import-maps.mjs"
|
||||
},
|
||||
"test": {
|
||||
"command": "wdio run ./wdio.conf.ts --logLevel=warn --autoCompileOpts.tsNodeOpts.project=tsconfig.test.json",
|
||||
"env": {
|
||||
"CI": "true"
|
||||
}
|
||||
},
|
||||
"test-view": {
|
||||
"command": "wdio run ./wdio.conf.ts --autoCompileOpts.tsNodeOpts.project=tsconfig.test.json"
|
||||
},
|
||||
"tsc": {
|
||||
"dependencies": [
|
||||
"lint:types"
|
||||
]
|
||||
}
|
||||
},
|
||||
"workspaces": [
|
||||
".",
|
||||
"./packages/*"
|
||||
]
|
||||
}
|
||||
|
23
web/packages/sfe/.prettierrc.json
Normal file
23
web/packages/sfe/.prettierrc.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"arrowParens": "always",
|
||||
"bracketSpacing": true,
|
||||
"embeddedLanguageFormatting": "auto",
|
||||
"htmlWhitespaceSensitivity": "css",
|
||||
"insertPragma": false,
|
||||
"jsxSingleQuote": false,
|
||||
"printWidth": 100,
|
||||
"proseWrap": "preserve",
|
||||
"quoteProps": "consistent",
|
||||
"requirePragma": false,
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"tabWidth": 4,
|
||||
"trailingComma": "all",
|
||||
"useTabs": false,
|
||||
"vueIndentScriptAndStyle": false,
|
||||
"plugins": ["@trivago/prettier-plugin-sort-imports"],
|
||||
"importOrder": ["^(@?)lit(.*)$", "\\.css$", "^@goauthentik/api$", "^[./]"],
|
||||
"importOrderSeparation": true,
|
||||
"importOrderSortSpecifiers": true,
|
||||
"importOrderParserPlugins": ["typescript", "classProperties", "decorators-legacy"]
|
||||
}
|
18
web/packages/sfe/LICENSE.txt
Normal file
18
web/packages/sfe/LICENSE.txt
Normal file
@ -0,0 +1,18 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2024 Authentik Security, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
||||
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
|
||||
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
web/packages/sfe/README.md
Normal file
21
web/packages/sfe/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Simplified Flow Executor
|
||||
|
||||
The Simplified Flow Executor is a limited fallback browser-side interpreter, written in TypeScript,
|
||||
for authentik's Flow language, which controls transactions between the authentik server and its
|
||||
interaction with users and the services to which those users are seeking to gain authentication and
|
||||
authorization.
|
||||
|
||||
It exists primarily to support late versions of Microsoft Office365 and Microsoft Teams, older
|
||||
software that still uses the MSEdge-18 and IE-11 _Trident_ web engine for web-based log-ins. It has
|
||||
limited support for the full language, supporting only the following stages:
|
||||
|
||||
- identification
|
||||
- password
|
||||
- redirect
|
||||
- autosubmit
|
||||
- authenticator validation (both code and WebAuthn)
|
||||
|
||||
### License
|
||||
|
||||
This code is licensed under the [MIT License](https://www.tldrlegal.com/license/mit-license).
|
||||
[A copy of the license](./LICENSE.txt) is included with this package.
|
68
web/packages/sfe/package.json
Normal file
68
web/packages/sfe/package.json
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"name": "@goauthentik/web-sfe",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"@goauthentik/api": "^2024.6.0-1719577139",
|
||||
"base64-js": "^1.5.1",
|
||||
"bootstrap": "^4.6.1",
|
||||
"formdata-polyfill": "^4.0.10",
|
||||
"jquery": "^3.7.1",
|
||||
"weakmap-polyfill": "^2.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^26.0.1",
|
||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||
"@rollup/plugin-swc": "^0.3.1",
|
||||
"@swc/cli": "^0.4.0",
|
||||
"@swc/core": "^1.6.13",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
||||
"@types/jquery": "^3.5.30",
|
||||
"lockfile-lint": "^4.14.0",
|
||||
"prettier": "^3.3.2",
|
||||
"rollup": "^4.18.1",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"wireit": "^0.14.4"
|
||||
},
|
||||
"license": "MIT",
|
||||
"optionalDependencies": {
|
||||
"@swc/core": "^1.6.13",
|
||||
"@swc/core-darwin-arm64": "^1.6.13",
|
||||
"@swc/core-darwin-x64": "^1.6.13",
|
||||
"@swc/core-linux-arm-gnueabihf": "^1.6.13",
|
||||
"@swc/core-linux-arm64-gnu": "^1.6.13",
|
||||
"@swc/core-linux-arm64-musl": "^1.6.13",
|
||||
"@swc/core-linux-x64-gnu": "^1.6.13",
|
||||
"@swc/core-linux-x64-musl": "^1.6.13",
|
||||
"@swc/core-win32-arm64-msvc": "^1.6.13",
|
||||
"@swc/core-win32-ia32-msvc": "^1.6.13",
|
||||
"@swc/core-win32-x64-msvc": "^1.6.13"
|
||||
},
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "wireit",
|
||||
"lint:lockfile": "wireit",
|
||||
"prettier": "prettier --write ./src ./tsconfig.json ./rollup.config.js ./package.json",
|
||||
"watch": "rollup -w -c rollup.config.js --bundleConfigAsCjs"
|
||||
},
|
||||
"wireit": {
|
||||
"build:sfe": {
|
||||
"command": "rollup -c rollup.config.js --bundleConfigAsCjs",
|
||||
"files": [
|
||||
"../../node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
"src/index.ts"
|
||||
],
|
||||
"output": [
|
||||
"./dist/sfe/*"
|
||||
]
|
||||
},
|
||||
"build": {
|
||||
"command": "mkdir -p ../../dist/sfe && cp -r dist/sfe/* ../../dist/sfe",
|
||||
"dependencies": [
|
||||
"build:sfe"
|
||||
]
|
||||
},
|
||||
"lint:lockfile": {
|
||||
"command": "lockfile-lint --path package.json --type npm --allowed-hosts npm --validate-https"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,16 +4,19 @@ import swc from "@rollup/plugin-swc";
|
||||
import copy from "rollup-plugin-copy";
|
||||
|
||||
export default {
|
||||
input: "index.ts",
|
||||
input: "src/index.ts",
|
||||
output: {
|
||||
dir: "../dist/sfe",
|
||||
dir: "./dist/sfe",
|
||||
format: "cjs",
|
||||
},
|
||||
context: "window",
|
||||
plugins: [
|
||||
copy({
|
||||
targets: [
|
||||
{ src: "node_modules/bootstrap/dist/css/bootstrap.min.css", dest: "../dist/sfe" },
|
||||
{
|
||||
src: "../../node_modules/bootstrap/dist/css/bootstrap.min.css",
|
||||
dest: "./dist/sfe",
|
||||
},
|
||||
],
|
||||
}),
|
||||
resolve({ browser: true }),
|
@ -3,5 +3,5 @@
|
||||
"types": ["jquery"],
|
||||
"esModuleInterop": true,
|
||||
"lib": ["DOM", "ES2015", "ES2017"]
|
||||
},
|
||||
}
|
||||
}
|
@ -3,6 +3,13 @@ import fs from "fs";
|
||||
import path from "path";
|
||||
import process from "process";
|
||||
|
||||
/**
|
||||
* Determines if all the Xliff translation source files are present and if the Typescript source
|
||||
* files generated from those sources are up-to-date. If they are not, it runs the locale building
|
||||
* script, intercepting the long spew of "this string is not translated" and replacing it with a
|
||||
* summary of how many strings are missing with respect to the source locale.
|
||||
*/
|
||||
|
||||
const localizeRules = JSON.parse(fs.readFileSync("./lit-localize.json", "utf-8"));
|
||||
|
||||
function generatedFileIsUpToDateWithXliffSource(loc) {
|
||||
@ -28,13 +35,12 @@ function generatedFileIsUpToDateWithXliffSource(loc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if the generated file is the same age or older (date is greater) than the xliff file, it's
|
||||
// if the generated file is the same age or newer (date is greater) than the xliff file, it's
|
||||
// presumed to have been generated by that file and is up-to-date.
|
||||
return genedStat.mtimeMs >= xlfStat.mtimeMs;
|
||||
}
|
||||
|
||||
// For all the expected files, find out if any aren't up-to-date.
|
||||
|
||||
const upToDate = localizeRules.targetLocales.reduce(
|
||||
(acc, loc) => acc && generatedFileIsUpToDateWithXliffSource(loc),
|
||||
true,
|
||||
|
@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@goauthentik/api": "^2024.6.1-1720888668",
|
||||
"@goauthentik/api": "^2024.6.3-1723109801",
|
||||
"base64-js": "^1.5.1",
|
||||
"bootstrap": "^4.6.1",
|
||||
"formdata-polyfill": "^4.0.10",
|
||||
|
Reference in New Issue
Block a user