Fix many little bugs

This commit is contained in:
Joseph Garrone 2021-02-21 21:27:42 +01:00
parent 98ff75daff
commit 4c21446390
10 changed files with 1173 additions and 64 deletions

View File

@ -2,7 +2,7 @@
<img src="https://user-images.githubusercontent.com/6702424/80216211-00ef5280-863e-11ea-81de-59f3a3d4b8e4.png">
</p>
<p align="center">
<i>Provides a way to customise Keycloak login and register pages with React</i>
<i>Provides a way to customize Keycloak login and register pages with React</i>
<br>
<br>
<img src="https://github.com/garronej/keycloak-react-theming/workflows/ci/badge.svg?branch=develop">
@ -15,52 +15,3 @@
-
<a href="https://github.com/garronej/keycloak-react-theming">Documentation</a>
</p>
# Install / Import
```bash
$ npm install --save keycloak-react-theming
```
```typescript
import { myFunction, myObject } from "keycloak-react-theming";
```
Specific imports:
```typescript
import { myFunction } from "keycloak-react-theming/myFunction";
import { myObject } from "keycloak-react-theming/myObject";
```
## Import from HTML, with CDN
Import it via a bundle that creates a global ( wider browser support ):
```html
<script src="//unpkg.com/keycloak-react-theming/bundle.min.js"></script>
<script>
const { myFunction, myObject } = keycloak_react_theming;
</script>
```
Or import it as an ES module:
```html
<script type="module">
import {
myFunction,
myObject,
} from "//unpkg.com/keycloak-react-theming/zz_esm/index.js";
</script>
```
_You can specify the version you wish to import:_ [unpkg.com](https://unpkg.com)
## Contribute
```bash
npm install
npm run build
npm test
```

1158
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
"scripts": {
"build": "npm run tsc && npm run grant-exec-perms",
"build": "tsc && npm run grant-exec-perms",
"grant-exec-perms": "chmod +x dist/bin/build-keycloak-theme/index.js",
"test": "node dist/test/build-keycloak-theme.js",
"enable_short_import_path": "npm run build && denoify_enable_short_npm_import_path"
@ -36,8 +36,8 @@
"@types/node": "^10.0.0",
"denoify": "^0.6.4",
"evt": "beta",
"typescript": "^4.1.5",
"scripting-tools": "^0.19.13"
"scripting-tools": "^0.19.13",
"typescript": "^4.1.5"
},
"dependencies": {
"cheerio": "^1.0.0-rc.5"

View File

@ -55,7 +55,7 @@ export function generateJavaStackFiles(
})();
fs.writeFileSync(
keycloakThemeBuildingDirPath,
pathJoin(keycloakThemeBuildingDirPath, "pom.xml"),
Buffer.from(pomFileCode, "utf8")
);

View File

@ -1,5 +1,5 @@
import { transformCodebase } from "tools/transformCodebase";
import { transformCodebase } from "../../tools/transformCodebase";
import * as fs from "fs";
import { join as pathJoin } from "path";
import {

View File

@ -7,5 +7,5 @@ process.chdir(sampleReactProjectDirPath);
console.log(`Running main in ${sampleReactProjectDirPath}`);
import("bin/build-keycloak-theme");
import("../bin/build-keycloak-theme");

View File

@ -1,6 +1,6 @@
import { join as pathJoin } from "path";
import { generateKeycloakThemeResources } from "bin/build-keycloak-theme/generateKeycloakThemeResources";
import { generateKeycloakThemeResources } from "../bin/build-keycloak-theme/generateKeycloakThemeResources";
import { setupSampleReactProject } from "./setupSampleReactProject";
const { sampleReactProjectDirPath } = setupSampleReactProject();

View File

@ -3,7 +3,7 @@ import { 
replaceImportFromStaticInJsCode,
replaceImportFromStaticInCssCode,
generateCssCodeToDefineGlobals
} from "bin/build-keycloak-theme/replaceImportFromStatic";
} from "../bin/build-keycloak-theme/replaceImportFromStatic";
const { fixedJsCode } = replaceImportFromStaticInJsCode({
"ftlValuesGlobalName": "keycloakFtlValues",

View File

@ -1,6 +1,6 @@
import * as st from "scripting-tools";
import { join as pathJoin } from "path";
import { join as pathJoin, basename as pathBasename } from "path";
export function setupSampleReactProject() {
@ -9,10 +9,11 @@ export function setupSampleReactProject() {
st.execSync(`rm -rf ${sampleReactProjectDirPath}`);
st.execSync(`mkdir ${sampleReactProjectDirPath}`);
const url = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/sample_build_dir_and_package_json.zip";
[
"wget https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/sample_build_dir_and_package_json.zip",
"unzip build.zip",
"rm build.zip"
`wget ${url}`,
...["unzip", "rm"].map(prg => `${prg} ${pathBasename(url)}`)
].forEach(cmd => st.execSync(cmd, { "cwd": sampleReactProjectDirPath }));
return { sampleReactProjectDirPath };

View File

@ -2,7 +2,6 @@
"compilerOptions": {
"module": "CommonJS",
"target": "es5",
"baseUrl": "src",
"lib": ["es2015", "DOM"],
"esModuleInterop": true,
"declaration": true,