browsertrix/frontend/web-test-runner.config.mjs
Tessa Walsh 8a904c9031
feat: Rename org when accepting org invite for first admin (#1870)
Resolves https://github.com/webrecorder/browsertrix/issues/1874

Support for new two-part sign up flow if first admin user is added to org
- If new user, user registers first, then is able to change the org name / slug on following screen
- If existing user, user accepts invite, then is able to change the org name / slug on following screen
- After confirming org slug name, user is taken to dashboard, or error is shown if org name or slug already taken.
- If org name == org id, org name and slug is automatically set to `{Your Name}'s Archive` when first user is registered / accepts invite
- Email templates updated to better reflect new / existing users and not show org name if it is 'unset' (org name == org id internally)
- tests: frontend unit testing for accept + invite screens.

---------
Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
Co-authored-by: sua yoo <sua@suayoo.com>
Co-authored-by: sua yoo <sua@webrecorder.org>
Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
Co-authored-by: Ilya Kreymer <ikreymer@users.noreply.github.com>
Co-authored-by: Emma Segal-Grossman <hi@emma.cafe>
2024-06-27 16:08:31 -07:00

80 lines
2.4 KiB
JavaScript

/* eslint-env node */
import { fileURLToPath } from "url";
import commonjsPlugin from "@rollup/plugin-commonjs";
import { esbuildPlugin } from "@web/dev-server-esbuild";
import { importMapsPlugin } from "@web/dev-server-import-maps";
import { fromRollup } from "@web/dev-server-rollup";
import glob from "glob";
import { typescriptPaths as typescriptPathsPlugin } from "rollup-plugin-typescript-paths";
const commonjs = fromRollup(commonjsPlugin);
const typescriptPaths = fromRollup(typescriptPathsPlugin);
// Map css and assert imports to mock file
const emptyImports = {};
glob.sync("./src/**/*.css").forEach((filepath) => {
emptyImports[filepath] = fileURLToPath(
new URL("./src/__mocks__/_empty.js", import.meta.url),
);
});
glob.sync("./src/assets/**/*").forEach((filepath) => {
// Enable "~assets" imports, which doesn't work with `rollup-plugin-typescript-paths`
const aliasedImportPath = filepath.replace("./src/", "~");
emptyImports[aliasedImportPath] = fileURLToPath(
new URL("./src/__mocks__/_empty.js", import.meta.url),
);
});
export default {
nodeResolve: true,
rootDir: process.cwd(),
plugins: [
typescriptPaths({
preserveExtensions: true,
absolute: false,
nonRelative: true, // needed for non-ts files
transform(path) {
return `/${path}`;
},
}),
esbuildPlugin({
ts: true,
tsconfig: fileURLToPath(new URL("./tsconfig.json", import.meta.url)),
target: "esnext",
}),
commonjs({
include: [
// web-test-runner expects es modules,
// include umd/commonjs modules here:
"node_modules/url-pattern/**/*",
],
}),
importMapsPlugin({
inject: {
importMap: {
imports: {
...emptyImports,
"./src/shoelace": fileURLToPath(
new URL("./src/__mocks__/shoelace.js", import.meta.url),
),
"tailwindcss/tailwind.css": fileURLToPath(
new URL("./src/__mocks__/_empty.js", import.meta.url),
),
"@shoelace-style/shoelace/dist/themes/light.css": fileURLToPath(
new URL("./src/__mocks__/_empty.js", import.meta.url),
),
color: fileURLToPath(
new URL("./src/__mocks__/color.js", import.meta.url),
),
slugify: fileURLToPath(
new URL("./src/__mocks__/slugify.js", import.meta.url),
),
},
},
},
}),
],
};