Compare commits

..

1 Commits

Author SHA1 Message Date
4337207400 Enabling shorter import paths [automatic] 2021-03-09 04:01:39 +00:00
12 changed files with 82 additions and 172 deletions

View File

@ -1,27 +1,3 @@
### **0.2.8** (2021-03-19)
- Bugfix: keycloak_build that grow and grow in size
- Add disclaimer about maitainment strategy
- Add a note for tested version support
### **0.2.7** (2021-03-13)
- Bump version
- Update README.md
- Update README.md
### **0.2.6** (2021-03-10)
- Fix generated gitignore
### **0.2.5** (2021-03-10)
- Fix generated .gitignore
### **0.2.4** (2021-03-10)
- Update README.md
### **0.2.3** (2021-03-09)
- fix gitignore generation

View File

@ -31,13 +31,6 @@ Here is `yarn add keycloakify` for you 🍸
TODO: Insert video after.
Tested with the following Keycloak versions:
- [11.0.3](https://hub.docker.com/layers/jboss/keycloak/11.0.3/images/sha256-4438f1e51c1369371cb807dffa526e1208086b3ebb9cab009830a178de949782?context=explore)
- [12.0.4](https://hub.docker.com/layers/jboss/keycloak/12.0.4/images/sha256-67e0c88e69bd0c7aef972c40bdeb558a974013a28b3668ca790ed63a04d70584?context=explore)
**Disclaimer**: This tool will be maintained to stay compatible with Keycloak v11 and up, however, the default pages you will get
(before you customize it) will always be the ones of the Keycloak v11.
- [Motivations](#motivations)
- [How to use](#how-to-use)
- [Setting up the build tool](#setting-up-the-build-tool)
@ -68,11 +61,11 @@ Typically you will get:
"keycloakify": "^0.0.10"
},
"scripts": {
"keycloak": "yarn build && build-keycloak-theme",
"build": "react-scripts build && build-keycloak-theme"
},
```
Then run `yarn keycloak` or `npm run keycloak`, you will be provided with instructions
Then build your app with `yarn run build` or `npm run build`, you will be provided with instructions
about how to load the theme into Keycloak.
## Developing your login and register pages in your React app
@ -149,8 +142,6 @@ reactDom.render(
then `yarn start` ...
Checkout [this concrete example](https://github.com/garronej/keycloakify-demo-app/blob/main/src/index.tsx)
*NOTE: keycloak-react-theming was renamed keycloakify since this video was recorded*
[![kickstart_video](https://user-images.githubusercontent.com/6702424/108877866-f146ee80-75ff-11eb-8120-003b3c5f6dd8.png)](https://youtu.be/xTz0Rj7i2v8)
@ -176,8 +167,6 @@ TOTO: Provide a clean way, as abstracted as possible, way to do that.
# GitHub Actions
![image](https://user-images.githubusercontent.com/6702424/110708305-c44b2c00-81fa-11eb-8152-eeaaac0883d6.png)
[Here is a demo repo](https://github.com/garronej/keycloakify-demo-app) to show how to automate
the building and publishing of the theme (the .jar file).

View File

@ -41,7 +41,6 @@ var downloadAndUnzip_1 = require("../tools/downloadAndUnzip");
var child_process = __importStar(require("child_process"));
var ftlValuesGlobalName_1 = require("./ftlValuesGlobalName");
var urlResourcesPath_1 = require("../../lib/kcContextMocks/urlResourcesPath");
var isInside_1 = require("../tools/isInside");
function generateKeycloakThemeResources(params) {
var themeName = params.themeName, reactAppBuildDirPath = params.reactAppBuildDirPath, keycloakThemeBuildingDirPath = params.keycloakThemeBuildingDirPath;
var themeDirPath = path_1.join(keycloakThemeBuildingDirPath, "src", "main", "resources", "theme", themeName, "login");
@ -51,13 +50,6 @@ function generateKeycloakThemeResources(params) {
"srcDirPath": reactAppBuildDirPath,
"transformSourceCode": function (_a) {
var filePath = _a.filePath, sourceCode = _a.sourceCode;
//NOTE: Prevent cycles, excludes the folder we generated for debug in public/
if (isInside_1.isInside({
"dirPath": path_1.join(reactAppBuildDirPath, urlResourcesPath_1.subDirOfPublicDirBasename),
filePath: filePath
})) {
return undefined;
}
if (/\.css?$/i.test(filePath)) {
var _b = replaceImportFromStatic_1.replaceImportFromStaticInCssCode({ "cssCode": sourceCode.toString("utf8") }), cssGlobalsToDefine = _b.cssGlobalsToDefine, fixedCssCode = _b.fixedCssCode;
allCssGlobalsToDefine = __assign(__assign({}, allCssGlobalsToDefine), cssGlobalsToDefine);
@ -93,6 +85,7 @@ function generateKeycloakThemeResources(params) {
"srcDirPath": path_1.join(tmpDirPath, "keycloak", "login", "resources"),
"destDirPath": themeResourcesDirPath
});
//const keycloakResourcesWithinPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public", "keycloak_static");
var reactAppPublicDirPath = path_1.join(reactAppBuildDirPath, "..", "public");
transformCodebase_1.transformCodebase({
"srcDirPath": themeResourcesDirPath,
@ -103,11 +96,14 @@ function generateKeycloakThemeResources(params) {
"destDirPath": path_1.join(reactAppPublicDirPath, urlResourcesPath_1.resourcesCommonPath)
});
var keycloakResourcesWithinPublicDirPath = path_1.join(reactAppPublicDirPath, urlResourcesPath_1.subDirOfPublicDirBasename);
fs.writeFileSync(path_1.join(keycloakResourcesWithinPublicDirPath, ".gitignore"), Buffer.from([
urlResourcesPath_1.resourcesPath,
urlResourcesPath_1.resourcesCommonPath
].map(function (s) { return path_1.basename(s); }).join("\n")));
fs.writeFileSync(path_1.join(keycloakResourcesWithinPublicDirPath, "README.txt"), Buffer.from([
"This is just a test folder that helps develop",
"the login and register page without having to yarn build"
].join(" ")));
fs.writeFileSync(path_1.join(keycloakResourcesWithinPublicDirPath, ".gitignore"), Buffer.from("*", "utf8"));
child_process.execSync("rm -r " + tmpDirPath);
}
fs.writeFileSync(path_1.join(themeDirPath, "theme.properties"), Buffer.from("parent=keycloak", "utf8"));

View File

@ -1 +1 @@
{"version":3,"file":"generateKeycloakThemeResources.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAA+D;AAC/D,qCAAyB;AACzB,6BAAwC;AACxC,qEAGmC;AACnC,6CAAqE;AACrE,sFAAsE;AACtE,8DAA6D;AAC7D,2DAA+C;AAC/C,6DAA4D;AAC5D,8EAA0H;AAC1H,8CAA6C;AAE7C,SAAgB,8BAA8B,CAC1C,MAIC;IAGO,IAAA,SAAS,GAAyD,MAAM,UAA/D,EAAE,oBAAoB,GAAmC,MAAM,qBAAzC,EAAE,4BAA4B,GAAK,MAAM,6BAAX,CAAY;IAEjF,IAAM,YAAY,GAAG,WAAQ,CAAC,4BAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WA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,EACrB,sCAAmB,CACtB;SACJ,CAAC,CAAC;QAEH,IAAM,oCAAoC,GACtC,WAAQ,CAAC,qBAAqB,EAAE,4CAAyB,CAAC,CAAC;QAG/D,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,oCAAoC,EAAE,YAAY,CAAC,EAC5D,MAAM,CAAC,IAAI,CAAC;YACR,+CAA+C;YAC/C,0DAA0D;SAC7D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACf,CAAC;QAEF,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,oCAAoC,EAAE,YAAY,CAAC,EAC5D,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAC3B,CAAC;QAEF,aAAa,CAAC,QAAQ,CAAC,WAAS,UAAY,CAAC,CAAC;KAEjD;IAED,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC1C,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CACzC,CAAC;AAEN,CAAC;AA5ID,wEA4IC"}
{"version":3,"file":"generateKeycloakThemeResources.js","sourceRoot":"","sources":["../../src/bin/build-keycloak-theme/generateKeycloakThemeResources.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gEAA+D;AAC/D,qCAAyB;AACzB,6BAAkE;AAClE,qEAGmC;AACnC,6CAAqE;AACrE,sFAAsE;AACtE,8DAA6D;AAC7D,2DAA+C;AAC/C,6DAA4D;AAC5D,8EAA0H;AAE1H,SAAgB,8BAA8B,CAC1C,MAIC;IAGO,IAAA,SAAS,GAAyD,MAAM,UAA/D,EAAE,oBAAoB,GAAmC,MAAM,qBAAzC,EAAE,4BAA4B,GAAK,MAAM,6BAAX,CAAY;IAEjF,IAAM,YAAY,GAAG,WAAQ,CAAC,4BAA4B,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,C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CAAC,IAAI,CAAC;YACR,gCAAa;YACb,sCAAmB;SACtB,CAAC,GAAG,CAAC,UAAA,CAAC,IAAE,OAAA,eAAY,CAAC,CAAC,CAAC,EAAf,CAAe,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CACxC,CAAC;QAEF,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,oCAAoC,EAAE,YAAY,CAAC,EAC5D,MAAM,CAAC,IAAI,CAAC;YACR,+CAA+C;YAC/C,0DAA0D;SAC7D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CACf,CAAC;QAEF,aAAa,CAAC,QAAQ,CAAC,WAAS,UAAY,CAAC,CAAC;KAEjD;IAED,EAAE,CAAC,aAAa,CACZ,WAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC,EAC1C,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,CACzC,CAAC;AAEN,CAAC;AAvID,wEAuIC"}

View File

@ -1,4 +0,0 @@
export declare function isInside(params: {
dirPath: string;
filePath: string;
}): boolean;

View File

@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isInside = void 0;
var path_1 = require("path");
function isInside(params) {
var dirPath = params.dirPath, filePath = params.filePath;
return !path_1.relative(dirPath, filePath).startsWith("..");
}
exports.isInside = isInside;
//# sourceMappingURL=isInside.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"isInside.js","sourceRoot":"","sources":["../../src/bin/tools/isInside.ts"],"names":[],"mappings":";;;AAAA,6BAAgD;AAEhD,SAAgB,QAAQ,CACpB,MAGC;IAGO,IAAA,OAAO,GAAe,MAAM,QAArB,EAAE,QAAQ,GAAK,MAAM,SAAX,CAAY;IAErC,OAAO,CAAC,eAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAE7D,CAAC;AAXD,4BAWC"}

View File

@ -1,6 +1,6 @@
{
"name": "keycloakify",
"version": "0.2.8",
"version": "0.2.3",
"description": "Keycloak theme generator for Reacts app",
"repository": {
"type": "git",
@ -37,7 +37,6 @@
"src/bin/tools/downloadAndUnzip.ts",
"src/bin/tools/getProjectRoot.ts",
"src/bin/tools/grant-exec-perms.ts",
"src/bin/tools/isInside.ts",
"src/bin/tools/transformCodebase.ts",
"src/lib/components/Error.tsx",
"src/lib/components/Info.tsx",
@ -110,9 +109,6 @@
"bin/tools/grant-exec-perms.d.ts",
"bin/tools/grant-exec-perms.js",
"bin/tools/grant-exec-perms.js.map",
"bin/tools/isInside.d.ts",
"bin/tools/isInside.js",
"bin/tools/isInside.js.map",
"bin/tools/transformCodebase.d.ts",
"bin/tools/transformCodebase.js",
"bin/tools/transformCodebase.js.map",
@ -211,7 +207,7 @@
"evt": "2.0.0-beta.15",
"minimal-polyfills": "^2.1.6",
"path": "^0.12.7",
"powerhooks": "^0.0.21",
"powerhooks": "^0.0.20",
"scripting-tools": "^0.19.13",
"tss-react": "^0.0.11"
}

View File

@ -1,7 +1,7 @@
import { transformCodebase } from "../tools/transformCodebase";
import * as fs from "fs";
import { join as pathJoin } from "path";
import { join as pathJoin, basename as pathBasename } from "path";
import {
replaceImportFromStaticInCssCode,
replaceImportFromStaticInJsCode
@ -12,7 +12,6 @@ import { downloadAndUnzip } from "../tools/downloadAndUnzip";
import * as child_process from "child_process";
import { ftlValuesGlobalName } from "./ftlValuesGlobalName";
import { resourcesCommonPath, resourcesPath, subDirOfPublicDirBasename } from "../../lib/kcContextMocks/urlResourcesPath";
import { isInside } from "../tools/isInside";
export function generateKeycloakThemeResources(
params: {
@ -33,17 +32,6 @@ export function generateKeycloakThemeResources(
"srcDirPath": reactAppBuildDirPath,
"transformSourceCode": ({ filePath, sourceCode }) => {
//NOTE: Prevent cycles, excludes the folder we generated for debug in public/
if (
isInside({
"dirPath": pathJoin(reactAppBuildDirPath, subDirOfPublicDirBasename),
filePath
})
) {
return undefined;
}
if (/\.css?$/i.test(filePath)) {
const { cssGlobalsToDefine, fixedCssCode } = replaceImportFromStaticInCssCode(
@ -103,19 +91,23 @@ export function generateKeycloakThemeResources(
"destDirPath": tmpDirPath
});
const themeResourcesDirPath = pathJoin(themeDirPath, "resources");
const themeResourcesDirPath= pathJoin(themeDirPath, "resources");
transformCodebase({
"srcDirPath": pathJoin(tmpDirPath, "keycloak", "login", "resources"),
"destDirPath": themeResourcesDirPath
});
//const keycloakResourcesWithinPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public", "keycloak_static");
const reactAppPublicDirPath = pathJoin(reactAppBuildDirPath, "..", "public");
transformCodebase({
"srcDirPath": themeResourcesDirPath,
"destDirPath": pathJoin(
reactAppPublicDirPath,
reactAppPublicDirPath,
resourcesPath
)
});
@ -128,9 +120,16 @@ export function generateKeycloakThemeResources(
)
});
const keycloakResourcesWithinPublicDirPath =
const keycloakResourcesWithinPublicDirPath =
pathJoin(reactAppPublicDirPath, subDirOfPublicDirBasename);
fs.writeFileSync(
pathJoin(keycloakResourcesWithinPublicDirPath, ".gitignore"),
Buffer.from([
resourcesPath,
resourcesCommonPath
].map(s=>pathBasename(s)).join("\n"))
);
fs.writeFileSync(
pathJoin(keycloakResourcesWithinPublicDirPath, "README.txt"),
@ -140,11 +139,6 @@ export function generateKeycloakThemeResources(
].join(" "))
);
fs.writeFileSync(
pathJoin(keycloakResourcesWithinPublicDirPath, ".gitignore"),
Buffer.from("*", "utf8")
);
child_process.execSync(`rm -r ${tmpDirPath}`);
}

View File

@ -1,14 +0,0 @@
import { relative as pathRelative } from "path";
export function isInside(
params: {
dirPath: string;
filePath: string;
}
) {
const { dirPath, filePath } = params;
return !pathRelative(dirPath, filePath).startsWith("..");
}

View File

@ -247,8 +247,8 @@
"affectsGlobalScope": false
},
"../node_modules/domutils/lib/traversal.d.ts": {
"version": "c32e79eb2aa71936c8f49891e54708685dc3ac0980cf73c84e59be2418d45599",
"signature": "c32e79eb2aa71936c8f49891e54708685dc3ac0980cf73c84e59be2418d45599",
"version": "25e59492c50d22fae6cb56fb3fda12996b239b9305ff64fd598afe577e561057",
"signature": "25e59492c50d22fae6cb56fb3fda12996b239b9305ff64fd598afe577e561057",
"affectsGlobalScope": false
},
"../node_modules/domutils/lib/manipulation.d.ts": {
@ -272,8 +272,8 @@
"affectsGlobalScope": false
},
"../node_modules/domutils/lib/tagtypes.d.ts": {
"version": "b3efcc465b38cb346799da01c18dada0ca5f150e52f87015d43e869b4d6bd099",
"signature": "b3efcc465b38cb346799da01c18dada0ca5f150e52f87015d43e869b4d6bd099",
"version": "e963d7df9d1ae068384baff5ab46c64c9b0ad49c9849e06fdbc1db437880c135",
"signature": "e963d7df9d1ae068384baff5ab46c64c9b0ad49c9849e06fdbc1db437880c135",
"affectsGlobalScope": false
},
"../node_modules/domutils/lib/index.d.ts": {
@ -311,13 +311,8 @@
"signature": "db9b2e3b155ba39d12eff339f5a807746c3b7a4c175585eb6fffd099300aba9f",
"affectsGlobalScope": false
},
"../src/bin/tools/isinside.ts": {
"version": "5085f40816aa9039d7a1b417bf17df3f017d188996993ea69c6582fc68a567b9",
"signature": "872f9d4f1fd14faa27f4f08ec18af75e989c5006272d7a86da421c298337d1c1",
"affectsGlobalScope": false
},
"../src/bin/build-keycloak-theme/generatekeycloakthemeresources.ts": {
"version": "03beff6b2f4435fa6ae3f540b0a164b523c655874f72299e965770087d3c0888",
"version": "94772425efc8b71da85fe2bda7448cecc4a544143c75f6b4e88a4bd300961cd5",
"signature": "c53e9172d81232fc2b183d2105ce6b33db0803cdb01c188755460b66b9e7bf35",
"affectsGlobalScope": false
},
@ -1702,7 +1697,6 @@
"../src/bin/build-keycloak-theme/replaceimportfromstatic.ts",
"../src/bin/install-builtin-keycloak-themes.ts",
"../src/bin/tools/downloadandunzip.ts",
"../src/bin/tools/isinside.ts",
"../src/bin/tools/transformcodebase.ts",
"../src/lib/kccontextmocks/urlresourcespath.ts"
],
@ -1758,10 +1752,6 @@
"../node_modules/@types/react/jsx-runtime.d.ts",
"../src/bin/tools/getprojectroot.ts"
],
"../src/bin/tools/isinside.ts": [
"../node_modules/@types/node/path.d.ts",
"../node_modules/@types/react/jsx-runtime.d.ts"
],
"../src/bin/tools/transformcodebase.ts": [
"../node_modules/@types/node/fs.d.ts",
"../node_modules/@types/node/path.d.ts",
@ -2732,7 +2722,6 @@
"../src/bin/tools/downloadandunzip.ts",
"../src/bin/tools/getprojectroot.ts",
"../src/bin/tools/grant-exec-perms.ts",
"../src/bin/tools/isinside.ts",
"../src/bin/tools/transformcodebase.ts",
"../src/lib/components/error.tsx",
"../src/lib/components/info.tsx",

105
yarn.lock
View File

@ -27,9 +27,9 @@
integrity sha512-np/lG3uARFybkoHokJUmf1QfEvRVCPbmQeUQpKow5cQ3xWrV9i3rUHodKDJPQfTVX61qKi+UdYk8kik84n7XOw==
"@babel/highlight@^7.12.13":
version "7.13.10"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.13.10.tgz#a8b2a66148f5b27d666b15d81774347a731d52d1"
integrity sha512-5aPpe5XQPzflQrFwL1/QoeHkP2MsA4JCntcXHRhEsdsfPVkvPi2w7Qix4iV7t5S/oC9OodGrggd8aco1g3SZFg==
version "7.13.8"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.13.8.tgz#10b2dac78526424dfc1f47650d0e415dfd9dc481"
integrity sha512-4vrIhfJyfNf+lCtXC2ck1rKSzDwciqF7IWFhXXrSOUC2O5DrVp+w4c6ed4AllTxhTkUP5x2tYj41VaxdVMMRDw==
dependencies:
"@babel/helper-validator-identifier" "^7.12.11"
chalk "^2.0.0"
@ -43,9 +43,9 @@
"@babel/helper-plugin-utils" "^7.12.13"
"@babel/runtime@^7.7.2":
version "7.13.10"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.10.tgz#47d42a57b6095f4468da440388fdbad8bebf0d7d"
integrity sha512-4QPkjJq6Ns3V/RgpEahRk+AGfL0eO6RHHtTWoNNr5mO49G6B5+X6d6THgWEAvTrznU5xYpbAlVKRYcsCgh/Akw==
version "7.13.9"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.13.9.tgz#97dbe2116e2630c489f22e0656decd60aaa1fcee"
integrity sha512-aY2kU+xgJ3dJ1eU6FMB9EH8dIe8dmusF1xEku52joLvw6eAFN0AI+WxCLDnpev2LEejWBAy2sBvBOBAjI3zmvA==
dependencies:
regenerator-runtime "^0.13.4"
@ -147,16 +147,15 @@
"@octokit/types" "^6.0.3"
"@octokit/core@^3.2.3":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.3.0.tgz#58afc26c302e22cf97491bad9a30b2f33e2bcaed"
integrity sha512-GGMpjaodCBY7JrtOwfolMocwZw9Pj5NxuQqfaJhGau4tkyonm0JRV9D6juQYLMb1Kl261++4Q980o0FlAtg8jg==
version "3.2.5"
resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.2.5.tgz#57becbd5fd789b0592b915840855f3a5f233d554"
integrity sha512-+DCtPykGnvXKWWQI0E1XD+CCeWSBhB6kwItXqfFmNBlIlhczuDPbg+P6BtLnVBaRJDAjv+1mrUJuRsFSjktopg==
dependencies:
"@octokit/auth-token" "^2.4.4"
"@octokit/graphql" "^4.5.8"
"@octokit/request" "^5.4.12"
"@octokit/request-error" "^2.0.5"
"@octokit/types" "^6.0.3"
before-after-hook "^2.2.0"
before-after-hook "^2.1.0"
universal-user-agent "^6.0.0"
"@octokit/endpoint@^6.0.1":
@ -169,23 +168,23 @@
universal-user-agent "^6.0.0"
"@octokit/graphql@^4.5.8":
version "4.6.1"
resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.6.1.tgz#f975486a46c94b7dbe58a0ca751935edc7e32cc9"
integrity sha512-2lYlvf4YTDgZCTXTW4+OX+9WTLFtEUc6hGm4qM1nlZjzxj+arizM4aHWzBVBCxY9glh7GIs0WEuiSgbVzv8cmA==
version "4.6.0"
resolved "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-4.6.0.tgz#f9abca55f82183964a33439d5264674c701c3327"
integrity sha512-CJ6n7izLFXLvPZaWzCQDjU/RP+vHiZmWdOunaCS87v+2jxMsW9FB5ktfIxybRBxZjxuJGRnxk7xJecWTVxFUYQ==
dependencies:
"@octokit/request" "^5.3.0"
"@octokit/types" "^6.0.3"
universal-user-agent "^6.0.0"
"@octokit/openapi-types@^5.3.2":
version "5.3.2"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-5.3.2.tgz#b8ac43c5c3d00aef61a34cf744e315110c78deb4"
integrity sha512-NxF1yfYOUO92rCx3dwvA2onF30Vdlg7YUkMVXkeptqpzA3tRLplThhFleV/UKWFgh7rpKu1yYRbvNDUtzSopKA==
"@octokit/openapi-types@^5.3.1":
version "5.3.1"
resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-5.3.1.tgz#a49d119a1b9e47b7a9f5133ab14be2d8afaa183d"
integrity sha512-TvVk2QuIA0lQZcIMd6xbdGaGDVeNYIOa3l1ZVagAIk5K3t/WMYbcg4BISNDhzdVhm/TgQB26frAgd/GV81aHJA==
"@octokit/plugin-paginate-rest@^2.6.2":
version "2.13.2"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.13.2.tgz#7b8244a0dd7a31135ba2adc58a533213837bfe87"
integrity sha512-mjfBcla00UNS4EI/NN7toEbUM45ow3kk4go+LxsXAFLQodsrXcIZbftUhXTqi6ZKd+r6bcqMI+Lv4dshLtFjww==
version "2.11.0"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.11.0.tgz#3568c43896a3355f4a0bbb3a64f443b2abdc760d"
integrity sha512-7L9xQank2G3r1dGqrVPo1z62V5utbykOUzlmNHPz87Pww/JpZQ9KyG5CHtUzgmB4n5iDRKYNK/86A8D98HP0yA==
dependencies:
"@octokit/types" "^6.11.0"
@ -194,15 +193,15 @@
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.3.tgz#70a62be213e1edc04bb8897ee48c311482f9700d"
integrity sha512-4RFU4li238jMJAzLgAwkBAw+4Loile5haQMQr+uhFq27BmyJXcXSKvoQKqh0agsZEiUlW6iSv3FAgvmGkur7OQ==
"@octokit/plugin-rest-endpoint-methods@4.13.5":
version "4.13.5"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.13.5.tgz#ad76285b82fe05fbb4adf2774a9c887f3534a880"
integrity sha512-kYKcWkFm4Ldk8bZai2RVEP1z97k1C/Ay2FN9FNTBg7JIyKoiiJjks4OtT6cuKeZX39tqa+C3J9xeYc6G+6g8uQ==
"@octokit/plugin-rest-endpoint-methods@4.13.4":
version "4.13.4"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.13.4.tgz#093b130d558760f6bc912c6f622ce502522410af"
integrity sha512-MGxptzVfiP8O+aydC/riheYzS/yJ9P16M29OuvtZep/sF5sKuOCQP8Wf83YCKXRsQF+ZpYfke2snbPPSIMZKzg==
dependencies:
"@octokit/types" "^6.12.2"
"@octokit/types" "^6.12.0"
deprecation "^2.3.1"
"@octokit/request-error@^2.0.0", "@octokit/request-error@^2.0.5":
"@octokit/request-error@^2.0.0":
version "2.0.5"
resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.0.5.tgz#72cc91edc870281ad583a42619256b380c600143"
integrity sha512-T/2wcCFyM7SkXzNoyVNWjyVlUwBvW3igM3Btr/eKYiPmucXTtkxt2RBsf6gn3LTzaLSLTQtNmvg+dGsOxQrjZg==
@ -226,21 +225,21 @@
universal-user-agent "^6.0.0"
"@octokit/rest@^18.0.0":
version "18.3.5"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.3.5.tgz#a89903d46e0b4273bd3234674ec2777a651d68ab"
integrity sha512-ZPeRms3WhWxQBEvoIh0zzf8xdU2FX0Capa7+lTca8YHmRsO3QNJzf1H3PcuKKsfgp91/xVDRtX91sTe1kexlbw==
version "18.3.4"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-18.3.4.tgz#8e7ab02cd509e2fe7e71917a54254a8f8b827f20"
integrity sha512-NES0pHbwyFB1D0jrLkdnIXgEmze/gLE0JoSNgfAe4vwD77/qaQGO/lRWNuPPsoBVBjiW6mmA9CU5cYHujJTKQA==
dependencies:
"@octokit/core" "^3.2.3"
"@octokit/plugin-paginate-rest" "^2.6.2"
"@octokit/plugin-request-log" "^1.0.2"
"@octokit/plugin-rest-endpoint-methods" "4.13.5"
"@octokit/plugin-rest-endpoint-methods" "4.13.4"
"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.12.2", "@octokit/types@^6.7.1":
version "6.12.2"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.12.2.tgz#5b44add079a478b8eb27d78cf384cc47e4411362"
integrity sha512-kCkiN8scbCmSq+gwdJV0iLgHc0O/GTPY1/cffo9kECu1MvatLPh9E+qFhfRIktKfHEA6ZYvv6S1B4Wnv3bi3pA==
"@octokit/types@^6.0.3", "@octokit/types@^6.11.0", "@octokit/types@^6.12.0", "@octokit/types@^6.7.1":
version "6.12.1"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.12.1.tgz#74cc9240d84706d1f2f5970425c90af016b0a9ac"
integrity sha512-eZTTWJxGBon01Ra4EX86rvlMZGkU5SeJ8BtwQlsv2wEqZttpjtefLetJndZTVbJ25qFKoyKMWsRFnwlOx7ZaDQ==
dependencies:
"@octokit/openapi-types" "^5.3.2"
"@octokit/openapi-types" "^5.3.1"
"@types/comment-json@^1.1.1":
version "1.1.1"
@ -309,7 +308,7 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
before-after-hook@^2.2.0:
before-after-hook@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.0.tgz#09c40d92e936c64777aa385c4e9b904f8147eaf0"
integrity sha512-jH6rKQIfroBbhEXVmI7XmXe3ix5S/PgJqpzdDPnR8JGLHWNYLsYZ6tK5iWOF/Ra3oqEX0NobXGlzbiylIzVphQ==
@ -528,9 +527,9 @@ domhandler@^4.0.0:
domelementtype "^2.1.0"
domutils@^2.4.3, domutils@^2.4.4:
version "2.5.0"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.5.0.tgz#42f49cffdabb92ad243278b331fd761c1c2d3039"
integrity sha512-Ho16rzNMOFk2fPwChGh3D2D9OEHAfG19HgmRR2l+WLSsIstNsAYBzePH412bL0y5T44ejABIVfTHQ8nqi/tBCg==
version "2.4.4"
resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.4.4.tgz#282739c4b150d022d34699797369aad8d19bbbd3"
integrity sha512-jBC0vOsECI4OMdD0GC9mGn7NXPLb+Qt6KW1YDQzeQYRUFKmNG8lh7mO5HiELfr+lLQE7loDVI4QcAxV80HS+RA==
dependencies:
dom-serializer "^1.0.1"
domelementtype "^2.0.1"
@ -944,10 +943,10 @@ path@^0.12.7:
process "^0.11.1"
util "^0.10.3"
powerhooks@^0.0.21:
version "0.0.21"
resolved "https://registry.yarnpkg.com/powerhooks/-/powerhooks-0.0.21.tgz#0eebaffa3193157981f8cdadd38e76c59e98bb82"
integrity sha512-CmysMra4VNK0eU70PtvxVBzGIi5SXS+oFI2Hd1R5VPzCbQh0ud56EBvfZT5jmnrKAzoLOW6W01FGRwgFskEJfg==
powerhooks@^0.0.20:
version "0.0.20"
resolved "https://registry.yarnpkg.com/powerhooks/-/powerhooks-0.0.20.tgz#c606499d66737395f922c52995cefeb1b66e25df"
integrity sha512-eSmryhs6dpT0R9lYFgYvF5BifL2v/WYTkItwka9CZ/DPGSS8o+xhXNNIctdSmXsW449glf1525t6tr1s3KUaVQ==
dependencies:
evt "2.0.0-beta.15"
memoizee "^0.4.15"
@ -1142,9 +1141,9 @@ type@^1.0.1:
integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==
type@^2.0.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d"
integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw==
version "2.3.0"
resolved "https://registry.yarnpkg.com/type/-/type-2.3.0.tgz#ada7c045f07ead08abf9e2edd29be1a0c0661132"
integrity sha512-rgPIqOdfK/4J9FhiVrZ3cveAjRRo5rsQBAIhnylX874y1DX/kEKSVdLsnuHB6l1KTjHyU01VjiMBHgU2adejyg==
typescript@^4.1.5:
version "4.2.3"
@ -1203,14 +1202,14 @@ y18n@^5.0.5:
integrity sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==
yaml@^1.7.2:
version "1.10.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.1.tgz#bb13d805ed104fba38f533570f3441027eeeca22"
integrity sha512-z/asvd+V08l1ywhaemZVirCwjdzLo6O1/0j2JbYCsGjiezupNQqjs5IIPyNtctbHjPEckqzVGd4jvpU5Lr25vQ==
version "1.10.0"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"
integrity sha512-yr2icI4glYaNG+KWONODapy2/jDdMSDnrONSjblABjD9B4Z5LgiircSt8m8sRZFNi08kG9Sm0uSHtEmP3zaEGg==
yargs-parser@^20.2.2:
version "20.2.7"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a"
integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==
version "20.2.6"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.6.tgz#69f920addf61aafc0b8b89002f5d66e28f2d8b20"
integrity sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==
yargs@^16.1.0:
version "16.2.0"