Generate the postinstall script as the first entry of the package.json
This commit is contained in:
@ -15,8 +15,6 @@ export function addPostinstallScriptIfNotPresent(params: {
|
|||||||
}) {
|
}) {
|
||||||
const { parsedPackageJson, buildContext } = params;
|
const { parsedPackageJson, buildContext } = params;
|
||||||
|
|
||||||
const scripts = (parsedPackageJson.scripts ??= {});
|
|
||||||
|
|
||||||
const cmd_base = "keycloakify postinstall";
|
const cmd_base = "keycloakify postinstall";
|
||||||
|
|
||||||
const projectCliOptionValue = (() => {
|
const projectCliOptionValue = (() => {
|
||||||
@ -48,6 +46,9 @@ export function addPostinstallScriptIfNotPresent(params: {
|
|||||||
return cmd;
|
return cmd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
{
|
||||||
|
const scripts = (parsedPackageJson.scripts ??= {});
|
||||||
|
|
||||||
for (const scriptName of ["postinstall", "prepare"]) {
|
for (const scriptName of ["postinstall", "prepare"]) {
|
||||||
const cmd_preexisting = scripts[scriptName];
|
const cmd_preexisting = scripts[scriptName];
|
||||||
|
|
||||||
@ -60,6 +61,10 @@ export function addPostinstallScriptIfNotPresent(params: {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
scripts["postinstall"] = generateCmd({ cmd_preexisting: scripts["postinstall"] });
|
|
||||||
|
parsedPackageJson.scripts = {
|
||||||
|
postinstall: generateCmd({ cmd_preexisting: undefined }),
|
||||||
|
...parsedPackageJson.scripts
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user