Merge branch 'main' into passkey-conditional-authenticate
This commit is contained in:
commit
8340608045
@ -6,6 +6,7 @@ import {
|
|||||||
getLatestsSemVersionedTag,
|
getLatestsSemVersionedTag,
|
||||||
type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag
|
type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag
|
||||||
} from "../shared/getLatestsSemVersionedTag";
|
} from "../shared/getLatestsSemVersionedTag";
|
||||||
|
import { SemVer } from "../tools/SemVer";
|
||||||
import fetch from "make-fetch-happen";
|
import fetch from "make-fetch-happen";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { assert, type Equals } from "tsafe/assert";
|
import { assert, type Equals } from "tsafe/assert";
|
||||||
@ -68,7 +69,9 @@ export async function initializeAccountTheme_singlePage(params: {
|
|||||||
})()
|
})()
|
||||||
);
|
);
|
||||||
|
|
||||||
dependencies.dependencies["@keycloakify/keycloak-account-ui"] = semVersionedTag.tag;
|
dependencies.dependencies["@keycloakify/keycloak-account-ui"] = SemVer.stringify(
|
||||||
|
semVersionedTag.version
|
||||||
|
);
|
||||||
|
|
||||||
const parsedPackageJson = (() => {
|
const parsedPackageJson = (() => {
|
||||||
type ParsedPackageJson = {
|
type ParsedPackageJson = {
|
||||||
|
@ -4,8 +4,7 @@ import {
|
|||||||
join as pathJoin,
|
join as pathJoin,
|
||||||
resolve as pathResolve,
|
resolve as pathResolve,
|
||||||
relative as pathRelative,
|
relative as pathRelative,
|
||||||
dirname as pathDirname,
|
dirname as pathDirname
|
||||||
basename as pathBasename
|
|
||||||
} from "path";
|
} from "path";
|
||||||
import { replaceImportsInJsCode } from "../replacers/replaceImportsInJsCode";
|
import { replaceImportsInJsCode } from "../replacers/replaceImportsInJsCode";
|
||||||
import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
|
import { replaceImportsInCssCode } from "../replacers/replaceImportsInCssCode";
|
||||||
@ -43,7 +42,7 @@ import {
|
|||||||
} from "../../shared/metaInfKeycloakThemes";
|
} from "../../shared/metaInfKeycloakThemes";
|
||||||
import { objectEntries } from "tsafe/objectEntries";
|
import { objectEntries } from "tsafe/objectEntries";
|
||||||
import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
|
import { escapeStringForPropertiesFile } from "../../tools/escapeStringForPropertiesFile";
|
||||||
import { downloadAndExtractArchive } from "../../tools/downloadAndExtractArchive";
|
import * as child_process from "child_process";
|
||||||
|
|
||||||
export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
||||||
BuildContextLike_downloadKeycloakStaticResources &
|
BuildContextLike_downloadKeycloakStaticResources &
|
||||||
@ -56,6 +55,7 @@ export type BuildContextLike = BuildContextLike_kcContextExclusionsFtlCode &
|
|||||||
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
implementedThemeTypes: BuildContext["implementedThemeTypes"];
|
||||||
themeSrcDirPath: string;
|
themeSrcDirPath: string;
|
||||||
bundler: "vite" | "webpack";
|
bundler: "vite" | "webpack";
|
||||||
|
packageJsonFilePath: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
assert<BuildContext extends BuildContextLike ? true : false>();
|
assert<BuildContext extends BuildContextLike ? true : false>();
|
||||||
@ -313,27 +313,23 @@ export async function generateResourcesForMainTheme(params: {
|
|||||||
break bring_in_account_v3_i18n_messages;
|
break bring_in_account_v3_i18n_messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { extractedDirPath } = await downloadAndExtractArchive({
|
const accountUiDirPath = child_process
|
||||||
url: "https://repo1.maven.org/maven2/org/keycloak/keycloak-account-ui/25.0.1/keycloak-account-ui-25.0.1.jar",
|
.execSync("npm list @keycloakify/keycloak-account-ui --parseable", {
|
||||||
cacheDirPath: buildContext.cacheDirPath,
|
cwd: pathDirname(buildContext.packageJsonFilePath)
|
||||||
fetchOptions: buildContext.fetchOptions,
|
})
|
||||||
uniqueIdOfOnArchiveFile: "bring_in_account_v3_i18n_messages",
|
.toString("utf8")
|
||||||
onArchiveFile: async ({ fileRelativePath, writeFile }) => {
|
.trim();
|
||||||
if (
|
|
||||||
!fileRelativePath.startsWith(
|
const messagesDirPath = pathJoin(accountUiDirPath, "messages");
|
||||||
pathJoin("theme", "keycloak.v3", "account", "messages")
|
|
||||||
)
|
if (!fs.existsSync(messagesDirPath)) {
|
||||||
) {
|
throw new Error(
|
||||||
return;
|
`Please update @keycloakify/keycloak-account-ui to 25.0.4-rc.5 or later.`
|
||||||
}
|
);
|
||||||
await writeFile({
|
}
|
||||||
fileRelativePath: pathBasename(fileRelativePath)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
transformCodebase({
|
transformCodebase({
|
||||||
srcDirPath: extractedDirPath,
|
srcDirPath: messagesDirPath,
|
||||||
destDirPath: pathJoin(
|
destDirPath: pathJoin(
|
||||||
getThemeTypeDirPath({ themeType: "account" }),
|
getThemeTypeDirPath({ themeType: "account" }),
|
||||||
"messages"
|
"messages"
|
||||||
|
@ -12,6 +12,10 @@ import * as os from "os";
|
|||||||
import { rmSync } from "../tools/fs.rmSync";
|
import { rmSync } from "../tools/fs.rmSync";
|
||||||
|
|
||||||
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
|
export async function command(params: { cliCommandOptions: CliCommandOptions }) {
|
||||||
|
const { cliCommandOptions } = params;
|
||||||
|
|
||||||
|
const buildContext = getBuildContext({ cliCommandOptions });
|
||||||
|
|
||||||
exit_if_maven_not_installed: {
|
exit_if_maven_not_installed: {
|
||||||
let commandOutput: Buffer | undefined = undefined;
|
let commandOutput: Buffer | undefined = undefined;
|
||||||
|
|
||||||
@ -25,31 +29,44 @@ export async function command(params: { cliCommandOptions: CliCommandOptions })
|
|||||||
break exit_if_maven_not_installed;
|
break exit_if_maven_not_installed;
|
||||||
}
|
}
|
||||||
|
|
||||||
const installationCommand = (() => {
|
if (
|
||||||
switch (os.platform()) {
|
fs
|
||||||
case "darwin":
|
.readFileSync(buildContext.packageJsonFilePath)
|
||||||
return "brew install mvn";
|
.toString("utf8")
|
||||||
case "win32":
|
.includes(`"mvn"`)
|
||||||
return "choco install mvn";
|
) {
|
||||||
case "linux":
|
console.log(
|
||||||
default:
|
chalk.red(
|
||||||
return "sudo apt-get install mvn";
|
[
|
||||||
}
|
"Please remove the 'mvn' package from your package.json'dependencies list,",
|
||||||
})();
|
"reinstall your dependencies and try again.",
|
||||||
|
"We need the Apache Maven CLI, not this: https://www.npmjs.com/package/mvn"
|
||||||
|
].join(" ")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
const installationCommand = (() => {
|
||||||
|
switch (os.platform()) {
|
||||||
|
case "darwin":
|
||||||
|
return "brew install mvn";
|
||||||
|
case "win32":
|
||||||
|
return "choco install mvn";
|
||||||
|
case "linux":
|
||||||
|
default:
|
||||||
|
return "sudo apt-get install mvn";
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`${chalk.red("Apache Maven required.")} Install it with \`${chalk.bold(
|
`${chalk.red("Apache Maven required.")} Install it with \`${chalk.bold(
|
||||||
installationCommand
|
installationCommand
|
||||||
)}\` (for example)`
|
)}\` (for example)`
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { cliCommandOptions } = params;
|
|
||||||
|
|
||||||
const buildContext = getBuildContext({ cliCommandOptions });
|
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
[
|
[
|
||||||
chalk.cyan(`keycloakify v${readThisNpmPackageVersion()}`),
|
chalk.cyan(`keycloakify v${readThisNpmPackageVersion()}`),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user