Workaround bug with the versions subcomand of older npm versions
This commit is contained in:
parent
a085c8093e
commit
158275f5c2
@ -103,14 +103,21 @@ export async function command(params: { buildContext: BuildContext }) {
|
|||||||
|
|
||||||
const moduleName = `@keycloakify/email-native`;
|
const moduleName = `@keycloakify/email-native`;
|
||||||
|
|
||||||
const [version] = (
|
const [version] = ((): string[] => {
|
||||||
JSON.parse(
|
const cmdOutput = child_process
|
||||||
child_process
|
.execSync(`npm show ${moduleName} versions --json`)
|
||||||
.execSync(`npm show ${moduleName} versions --json`)
|
.toString("utf8")
|
||||||
.toString("utf8")
|
.trim();
|
||||||
.trim()
|
|
||||||
) as string[]
|
const versions = JSON.parse(cmdOutput) as string | string[];
|
||||||
)
|
|
||||||
|
// NOTE: Bug in some older npm versions
|
||||||
|
if (typeof versions === "string") {
|
||||||
|
return [versions];
|
||||||
|
}
|
||||||
|
|
||||||
|
return versions;
|
||||||
|
})()
|
||||||
.reverse()
|
.reverse()
|
||||||
.filter(version => !version.includes("-"));
|
.filter(version => !version.includes("-"));
|
||||||
|
|
||||||
|
@ -105,14 +105,21 @@ export async function initializeSpa(params: {
|
|||||||
|
|
||||||
const moduleName = `@keycloakify/keycloak-${themeType}-ui`;
|
const moduleName = `@keycloakify/keycloak-${themeType}-ui`;
|
||||||
|
|
||||||
const version = (
|
const version = ((): string[] => {
|
||||||
JSON.parse(
|
const cmdOutput = child_process
|
||||||
child_process
|
.execSync(`npm show ${moduleName} versions --json`)
|
||||||
.execSync(`npm show ${moduleName} versions --json`)
|
.toString("utf8")
|
||||||
.toString("utf8")
|
.trim();
|
||||||
.trim()
|
|
||||||
) as string[]
|
const versions = JSON.parse(cmdOutput) as string | string[];
|
||||||
)
|
|
||||||
|
// NOTE: Bug in some older npm versions
|
||||||
|
if (typeof versions === "string") {
|
||||||
|
return [versions];
|
||||||
|
}
|
||||||
|
|
||||||
|
return versions;
|
||||||
|
})()
|
||||||
.reverse()
|
.reverse()
|
||||||
.filter(version => !version.includes("-"))
|
.filter(version => !version.includes("-"))
|
||||||
.find(version =>
|
.find(version =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user