* web: Format live reload package. * web: Format package.json. * web: Revise globals. * web: Build entrypoints with a single ESBuild context. Clean up entrypoints. * web: WIP Prepare monorepo package for use. * web: Update build paths. Fix types. * web: WIP Add monorepo dependency. * web: Use monorepo utilities when building. * web: Fix issue where linters collide. Update ignore file. - Remove unused sort override for polyfills. * core: Prepare repo for NPM workspaces.
		
			
				
	
	
		
			79 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			79 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
import { dirname, resolve } from "node:path";
 | 
						|
import { fileURLToPath } from "node:url";
 | 
						|
 | 
						|
const relativeDirname = dirname(fileURLToPath(import.meta.url));
 | 
						|
 | 
						|
//#region Base paths
 | 
						|
 | 
						|
/**
 | 
						|
 * @typedef {'@goauthentik/web'} WebPackageIdentifier
 | 
						|
 */
 | 
						|
 | 
						|
/**
 | 
						|
 * The root of the web package.
 | 
						|
 */
 | 
						|
export const PackageRoot = /** @type {WebPackageIdentifier} */ (resolve(relativeDirname));
 | 
						|
 | 
						|
/**
 | 
						|
 * The name of the distribution directory.
 | 
						|
 */
 | 
						|
export const DistDirectoryName = "dist";
 | 
						|
 | 
						|
/**
 | 
						|
 * Path to the web package's distribution directory.
 | 
						|
 *
 | 
						|
 * This is where the built files are located after running the build process.
 | 
						|
 */
 | 
						|
export const DistDirectory = /** @type {`${WebPackageIdentifier}/${DistDirectoryName}`} */ (
 | 
						|
    resolve(relativeDirname, DistDirectoryName)
 | 
						|
);
 | 
						|
 | 
						|
//#endregion
 | 
						|
 | 
						|
//#region Entry points
 | 
						|
 | 
						|
/**
 | 
						|
 * @typedef {{ in: string, out: string }} EntryPointTarget
 | 
						|
 *
 | 
						|
 * ESBuild entrypoint target.
 | 
						|
 * Matches the type defined in the ESBuild context.
 | 
						|
 */
 | 
						|
 | 
						|
/**
 | 
						|
 * Entry points available for building.
 | 
						|
 *
 | 
						|
 * @satisfies {Record<string, EntryPointTarget>}
 | 
						|
 */
 | 
						|
export const EntryPoint = /** @type {const} */ ({
 | 
						|
    Admin: {
 | 
						|
        in: resolve(PackageRoot, "src", "admin", "AdminInterface", "index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "admin", "AdminInterface"),
 | 
						|
    },
 | 
						|
    User: {
 | 
						|
        in: resolve(PackageRoot, "src", "user", "index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "user", "UserInterface"),
 | 
						|
    },
 | 
						|
    Flow: {
 | 
						|
        in: resolve(PackageRoot, "src", "flow", "index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "flow", "FlowInterface"),
 | 
						|
    },
 | 
						|
    Standalone: {
 | 
						|
        in: resolve(PackageRoot, "src", "standalone", "api-browser/index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "standalone", "api-browser", "index"),
 | 
						|
    },
 | 
						|
    StandaloneLoading: {
 | 
						|
        in: resolve(PackageRoot, "src", "standalone", "loading/index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "standalone", "loading", "index"),
 | 
						|
    },
 | 
						|
    RAC: {
 | 
						|
        in: resolve(PackageRoot, "src", "rac", "index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "rac", "index"),
 | 
						|
    },
 | 
						|
    Polyfill: {
 | 
						|
        in: resolve(PackageRoot, "src", "polyfill", "index.entrypoint.ts"),
 | 
						|
        out: resolve(DistDirectory, "poly"),
 | 
						|
    },
 | 
						|
});
 | 
						|
 | 
						|
//#endregion
 |