Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
7793c2c6ba | |||
9e826d16dd | |||
80618bbd9c | |||
38ad47ea75 | |||
45ed359bef | |||
fcc26c3e7a | |||
d4ff6b1f40 | |||
557de34eea | |||
e034dc4d90 | |||
cfbd1e5e4b | |||
0df661819f | |||
1a9f6d10d4 | |||
a787215c95 | |||
64ab400af5 |
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
## 6.11.0
|
## 6.11.0
|
||||||
|
|
||||||
- You no longer need to have Maven installed to build the theme. Thanks to @lordvlad, [see PR](https://github.com/InseeFrLab/keycloakify/pull/239).
|
- <del>You no longer need to have Maven installed to build the theme. Thanks to @lordvlad, [see PR](https://github.com/InseeFrLab/keycloakify/pull/239)</del>.
|
||||||
- Feature new build options: [`bundler`](https://docs.keycloakify.dev/build-options#keycloakify.bundler), [`groupId`](https://docs.keycloakify.dev/build-options#keycloakify.groupid), [`artifactId`](https://docs.keycloakify.dev/build-options#keycloakify.artifactid), [`version`](https://docs.keycloakify.dev/build-options#version).
|
- Feature new build options: [`bundler`](https://docs.keycloakify.dev/build-options#keycloakify.bundler), [`groupId`](https://docs.keycloakify.dev/build-options#keycloakify.groupid), [`artifactId`](https://docs.keycloakify.dev/build-options#keycloakify.artifactid), [`version`](https://docs.keycloakify.dev/build-options#version).
|
||||||
Theses options can be user to customize the output name of the .jar. You can use environnement variables to overrides the values read in the package.json. Thanks to @lordvlad.
|
Theses options can be user to customize the output name of the .jar. You can use environnement variables to overrides the values read in the package.json. Thanks to @lordvlad.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "keycloakify",
|
"name": "keycloakify",
|
||||||
"version": "6.11.0",
|
"version": "6.11.3",
|
||||||
"description": "Keycloak theme generator for Reacts app",
|
"description": "Keycloak theme generator for Reacts app",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -139,7 +139,7 @@ export function readBuildOptions(params: {
|
|||||||
`${symToStr({ KEYCLOAKIFY_BUNDLER })} should be one of ${bundlers.join(", ")}`
|
`${symToStr({ KEYCLOAKIFY_BUNDLER })} should be one of ${bundlers.join(", ")}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return KEYCLOAKIFY_BUNDLER ?? bundler ?? "keycloakify";
|
return KEYCLOAKIFY_BUNDLER ?? bundler ?? "mvn";
|
||||||
})(),
|
})(),
|
||||||
"artifactId": process.env.KEYCLOAKIFY_ARTIFACT_ID ?? artifactId ?? `${themeName}-keycloak-theme`,
|
"artifactId": process.env.KEYCLOAKIFY_ARTIFACT_ID ?? artifactId ?? `${themeName}-keycloak-theme`,
|
||||||
"groupId": (() => {
|
"groupId": (() => {
|
||||||
|
@ -4,5 +4,5 @@ export * from "./keycloakify";
|
|||||||
import { main } from "./keycloakify";
|
import { main } from "./keycloakify";
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
main();
|
main().catch(e => console.error(e));
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,10 @@ export async function main() {
|
|||||||
case "keycloakify":
|
case "keycloakify":
|
||||||
logger.log("🫶 Let keycloakify do its thang");
|
logger.log("🫶 Let keycloakify do its thang");
|
||||||
await jar({
|
await jar({
|
||||||
"rootPath": keycloakThemeBuildingDirPath,
|
"rootPath": pathJoin(keycloakThemeBuildingDirPath, "src", "main", "resources"),
|
||||||
"version": buildOptions.version,
|
"version": buildOptions.version,
|
||||||
"groupId": buildOptions.groupId,
|
"groupId": buildOptions.groupId,
|
||||||
"artifactId": buildOptions.artifactId || `${buildOptions.themeName}-keycloak-theme`,
|
"artifactId": buildOptions.artifactId,
|
||||||
"targetPath": jarFilePath
|
"targetPath": jarFilePath
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -3,10 +3,10 @@ import { join as pathJoin } from "path";
|
|||||||
import { constants } from "fs";
|
import { constants } from "fs";
|
||||||
import { chmod, stat } from "fs/promises";
|
import { chmod, stat } from "fs/promises";
|
||||||
|
|
||||||
async () => {
|
(async () => {
|
||||||
var { bin } = await import(pathJoin(getProjectRoot(), "package.json"));
|
const { bin } = await import(pathJoin(getProjectRoot(), "package.json"));
|
||||||
|
|
||||||
var promises = Object.values<string>(bin).map(async scriptPath => {
|
const promises = Object.values<string>(bin).map(async scriptPath => {
|
||||||
const fullPath = pathJoin(getProjectRoot(), scriptPath);
|
const fullPath = pathJoin(getProjectRoot(), scriptPath);
|
||||||
const oldMode = (await stat(fullPath)).mode;
|
const oldMode = (await stat(fullPath)).mode;
|
||||||
const newMode = oldMode | constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
|
const newMode = oldMode | constants.S_IXUSR | constants.S_IXGRP | constants.S_IXOTH;
|
||||||
@ -14,4 +14,4 @@ async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
};
|
})();
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { Readable, Transform } from "stream";
|
import { Readable, Transform } from "stream";
|
||||||
import { pipeline } from "stream/promises";
|
import { dirname, relative, sep } from "path";
|
||||||
import { relative, sep } from "path";
|
|
||||||
import { createWriteStream } from "fs";
|
import { createWriteStream } from "fs";
|
||||||
|
|
||||||
import walk from "./walk";
|
import walk from "./walk";
|
||||||
import type { ZipSource } from "./zip";
|
import type { ZipSource } from "./zip";
|
||||||
import zip from "./zip";
|
import zip from "./zip";
|
||||||
|
import { mkdir } from "fs/promises";
|
||||||
|
|
||||||
/** Trim leading whitespace from every line */
|
/** Trim leading whitespace from every line */
|
||||||
const trimIndent = (s: string) => s.replace(/(\n)\s+/g, "$1");
|
const trimIndent = (s: string) => s.replace(/(\n)\s+/g, "$1");
|
||||||
@ -57,9 +57,9 @@ export default async function jar({ groupId, artifactId, version, rootPath, targ
|
|||||||
const pathToRecord = () =>
|
const pathToRecord = () =>
|
||||||
new Transform({
|
new Transform({
|
||||||
objectMode: true,
|
objectMode: true,
|
||||||
transform: function (path, _, cb) {
|
transform: function (fsPath, _, cb) {
|
||||||
const filename = relative(rootPath, path).split(sep).join("/");
|
const path = relative(rootPath, fsPath).split(sep).join("/");
|
||||||
this.push({ filename, path });
|
this.push({ path, fsPath });
|
||||||
cb();
|
cb();
|
||||||
},
|
},
|
||||||
final: function () {
|
final: function () {
|
||||||
@ -69,19 +69,21 @@ export default async function jar({ groupId, artifactId, version, rootPath, targ
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
await mkdir(dirname(targetPath), { recursive: true });
|
||||||
* Create an async pipeline, wait until everything is fully processed
|
|
||||||
*/
|
// Create an async pipeline, wait until everything is fully processed
|
||||||
await pipeline(
|
await new Promise<void>((resolve, reject) => {
|
||||||
// walk all files in `rootPath` recursively
|
// walk all files in `rootPath` recursively
|
||||||
Readable.from(walk(rootPath)),
|
Readable.from(walk(rootPath))
|
||||||
// transform every path into a ZipSource object
|
// transform every path into a ZipSource object
|
||||||
pathToRecord(),
|
.pipe(pathToRecord())
|
||||||
// let the zip lib convert all ZipSource objects into a byte stream
|
// let the zip lib convert all ZipSource objects into a byte stream
|
||||||
zip(),
|
.pipe(zip())
|
||||||
// write that byte stream to targetPath
|
// write that byte stream to targetPath
|
||||||
createWriteStream(targetPath, { encoding: "binary" })
|
.pipe(createWriteStream(targetPath, { encoding: "binary" }))
|
||||||
);
|
.on("finish", () => resolve())
|
||||||
|
.on("error", e => reject(e));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -216,7 +216,7 @@ export default function zip() {
|
|||||||
const writeRecord = async (source: ZipSource) => {
|
const writeRecord = async (source: ZipSource) => {
|
||||||
if ("fsPath" in source) await writeFromPath(source.path, source.fsPath);
|
if ("fsPath" in source) await writeFromPath(source.path, source.fsPath);
|
||||||
else if ("data" in source) await writeFromBuffer(source.path, source.data);
|
else if ("data" in source) await writeFromBuffer(source.path, source.data);
|
||||||
else throw new Error("Illegal argument " + typeof source + " " + source);
|
else throw new Error("Illegal argument " + typeof source + " " + JSON.stringify(source));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user