Make standalone mode the default
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "keycloakify",
|
"name": "keycloakify",
|
||||||
"version": "0.3.7",
|
"version": "0.3.8",
|
||||||
"description": "Keycloak theme generator for Reacts app",
|
"description": "Keycloak theme generator for Reacts app",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -33,7 +33,7 @@ export type Mode = {
|
|||||||
type: "standalone";
|
type: "standalone";
|
||||||
urlPathname: string;
|
urlPathname: string;
|
||||||
} | {
|
} | {
|
||||||
type: "static fetched from app";
|
type: "external assets";
|
||||||
urlPathname: string;
|
urlPathname: string;
|
||||||
urlOrigin: string;
|
urlOrigin: string;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ export function generateFtlFilesCodeFactory(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (mode.type) {
|
switch (mode.type) {
|
||||||
case "static fetched from app":
|
case "external assets":
|
||||||
$(element).attr(
|
$(element).attr(
|
||||||
attrName,
|
attrName,
|
||||||
href.replace(/^\//, `${mode.urlOrigin}/`)
|
href.replace(/^\//, `${mode.urlOrigin}/`)
|
||||||
|
@ -11,7 +11,7 @@ import { URL } from "url";
|
|||||||
|
|
||||||
const reactProjectDirPath = process.cwd();
|
const reactProjectDirPath = process.cwd();
|
||||||
|
|
||||||
const isStandalone = process.argv[2]?.toLowerCase() === "--standalone";
|
const doUseExternalAssets = process.argv[2]?.toLowerCase() === "--external-assets";
|
||||||
|
|
||||||
const parsedPackageJson: ParsedPackageJson = require(pathJoin(reactProjectDirPath, "package.json"));
|
const parsedPackageJson: ParsedPackageJson = require(pathJoin(reactProjectDirPath, "package.json"));
|
||||||
|
|
||||||
@ -46,14 +46,14 @@ if (require.main === module) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return isStandalone ?
|
return !doUseExternalAssets ?
|
||||||
{
|
{
|
||||||
"type": "standalone",
|
"type": "standalone",
|
||||||
urlPathname
|
urlPathname
|
||||||
} as const
|
} as const
|
||||||
:
|
:
|
||||||
{
|
{
|
||||||
"type": "static fetched from app",
|
"type": "external assets",
|
||||||
urlPathname,
|
urlPathname,
|
||||||
"urlOrigin": (() => {
|
"urlOrigin": (() => {
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import * as crypto from "crypto";
|
|||||||
type Mode = {
|
type Mode = {
|
||||||
type: "standalone";
|
type: "standalone";
|
||||||
} | {
|
} | {
|
||||||
type: "static fetched from app";
|
type: "external assets";
|
||||||
urlOrigin: string;
|
urlOrigin: string;
|
||||||
urlPathname: string;
|
urlPathname: string;
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ export function replaceImportFromStaticInJsCode(
|
|||||||
/[a-z]+\.[a-z]+\+"static\//g,
|
/[a-z]+\.[a-z]+\+"static\//g,
|
||||||
`window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/`
|
`window.${ftlValuesGlobalName}.url.resourcesPath + "/build/static/`
|
||||||
);
|
);
|
||||||
case "static fetched from app":
|
case "external assets":
|
||||||
return jsCode!.replace(
|
return jsCode!.replace(
|
||||||
/[a-z]+\.[a-z]+\+"static\//g,
|
/[a-z]+\.[a-z]+\+"static\//g,
|
||||||
`"${mode.urlOrigin}${mode.urlPathname}static/`
|
`"${mode.urlOrigin}${mode.urlPathname}static/`
|
||||||
|
Reference in New Issue
Block a user