keycloakify 11.6.1 → 11.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/{653.index.js → 288.index.js} +221 -201
- package/bin/313.index.js +377 -0
- package/bin/{174.index.js → 33.index.js} +37 -2
- package/bin/{615.index.js → 355.index.js} +353 -102
- package/bin/363.index.js +1537 -0
- package/bin/453.index.js +6 -42
- package/bin/{503.index.js → 678.index.js} +577 -53
- package/bin/{921.index.js → 780.index.js} +54 -45
- package/bin/880.index.js +206 -21
- package/bin/9.index.js +850 -0
- package/bin/{525.index.js → 911.index.js} +1302 -2
- package/bin/930.index.js +164 -0
- package/bin/946.index.js +20 -0
- package/bin/{153.index.js → 947.index.js} +22 -797
- package/bin/main.js +61 -19
- package/bin/{eject-file.d.ts → own.d.ts} +2 -1
- package/bin/shared/{addPostinstallScriptIfNotPresent.d.ts → initializeSpa/addSyncExtensionsToPostinstallScript.d.ts} +1 -1
- package/bin/shared/initializeSpa/index.d.ts +1 -0
- package/bin/shared/initializeSpa/initializeSpa.d.ts +9 -0
- package/bin/{postinstall/uiModuleMeta.d.ts → sync-extensions/extensionModuleMeta.d.ts} +5 -5
- package/bin/sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
- package/bin/sync-extensions/index.d.ts +1 -0
- package/bin/{postinstall/installUiModulesPeerDependencies.d.ts → sync-extensions/installExtensionModulesPeerDependencies.d.ts} +3 -3
- package/bin/{postinstall → sync-extensions}/managedGitignoreFile.d.ts +4 -4
- package/bin/tools/getInstalledModuleDirPath.d.ts +0 -1
- package/bin/tools/isKnownByGit.d.ts +3 -0
- package/bin/tools/isRootPath.d.ts +1 -0
- package/bin/tools/listInstalledModules.d.ts +0 -1
- package/package.json +41 -63
- package/src/bin/eject-page.ts +8 -84
- package/src/bin/initialize-account-theme/initialize-account-theme.ts +15 -14
- package/src/bin/initialize-admin-theme.ts +17 -124
- package/src/bin/initialize-email-theme.ts +10 -34
- package/src/bin/keycloakify/generateResources/generateResources.ts +49 -21
- package/src/bin/main.ts +61 -16
- package/src/bin/own.ts +208 -0
- package/src/bin/shared/{addPostinstallScriptIfNotPresent.ts → initializeSpa/addSyncExtensionsToPostinstallScript.ts} +4 -4
- package/src/bin/shared/initializeSpa/index.ts +1 -0
- package/src/bin/shared/initializeSpa/initializeSpa.ts +149 -0
- package/src/bin/{postinstall/uiModuleMeta.ts → sync-extensions/extensionModuleMeta.ts} +48 -43
- package/src/bin/{postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts → sync-extensions/getExtensionModuleFileSourceCodeReadyToBeCopied.ts} +32 -21
- package/src/bin/sync-extensions/index.ts +1 -0
- package/src/bin/{postinstall/installUiModulesPeerDependencies.ts → sync-extensions/installExtensionModulesPeerDependencies.ts} +15 -13
- package/src/bin/{postinstall → sync-extensions}/managedGitignoreFile.ts +18 -18
- package/src/bin/{postinstall/postinstall.ts → sync-extensions/sync-extension.ts} +14 -26
- package/src/bin/tools/getInstalledModuleDirPath.ts +24 -22
- package/src/bin/tools/isKnownByGit.ts +45 -0
- package/src/bin/tools/isRootPath.ts +22 -0
- package/src/bin/tools/listInstalledModules.ts +4 -6
- package/src/bin/tools/npmInstall.ts +1 -1
- package/src/bin/tools/untrackFromGit.ts +19 -3
- package/src/bin/tsconfig.json +1 -1
- package/bin/300.index.js +0 -770
- package/bin/375.index.js +0 -4089
- package/bin/490.index.js +0 -1108
- package/bin/568.index.js +0 -1867
- package/bin/735.index.js +0 -907
- package/bin/743.index.js +0 -69
- package/bin/854.index.js +0 -68
- package/bin/initialize-account-theme/copyBoilerplate.d.ts +0 -4
- package/bin/initialize-account-theme/initializeAccountTheme_multiPage.d.ts +0 -3
- package/bin/initialize-account-theme/initializeAccountTheme_singlePage.d.ts +0 -11
- package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +0 -12
- package/bin/postinstall/index.d.ts +0 -1
- package/bin/shared/getLatestsSemVersionedTag.d.ts +0 -15
- package/bin/shared/promptKeycloakVersion.d.ts +0 -10
- package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
- package/bin/tools/crc32.d.ts +0 -9
- package/bin/tools/deflate.d.ts +0 -24
- package/bin/tools/isTrackedByGit.d.ts +0 -3
- package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -15
- package/bin/tools/octokit-addons/listTags.d.ts +0 -13
- package/bin/tools/tee.d.ts +0 -3
- package/bin/tools/trimIndent.d.ts +0 -5
- package/src/bin/eject-file.ts +0 -68
- package/src/bin/initialize-account-theme/copyBoilerplate.ts +0 -32
- package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +0 -21
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +0 -142
- package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +0 -7
- package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +0 -11
- package/src/bin/postinstall/index.ts +0 -1
- package/src/bin/shared/getLatestsSemVersionedTag.ts +0 -201
- package/src/bin/shared/promptKeycloakVersion.ts +0 -72
- package/src/bin/tools/OptionalIfCanBeUndefined.ts +0 -12
- package/src/bin/tools/crc32.ts +0 -73
- package/src/bin/tools/deflate.ts +0 -61
- package/src/bin/tools/isTrackedByGit.ts +0 -29
- package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +0 -47
- package/src/bin/tools/octokit-addons/listTags.ts +0 -60
- package/src/bin/tools/tee.ts +0 -39
- package/src/bin/tools/trimIndent.ts +0 -49
- /package/bin/{postinstall/postinstall.d.ts → sync-extensions/sync-extension.d.ts} +0 -0
- /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcContext.ts +0 -0
- /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPage.tsx +0 -0
- /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPageStory.tsx +0 -0
- /package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/i18n.ts +0 -0
@@ -1,201 +0,0 @@
|
|
1
|
-
import { getLatestsSemVersionedTagFactory } from "../tools/octokit-addons/getLatestsSemVersionedTag";
|
2
|
-
import { Octokit } from "@octokit/rest";
|
3
|
-
import type { ReturnType } from "tsafe";
|
4
|
-
import type { Param0 } from "tsafe";
|
5
|
-
import { join as pathJoin, dirname as pathDirname } from "path";
|
6
|
-
import * as fs from "fs";
|
7
|
-
import { z } from "zod";
|
8
|
-
import { assert, type Equals } from "tsafe/assert";
|
9
|
-
import { id } from "tsafe/id";
|
10
|
-
import type { SemVer } from "../tools/SemVer";
|
11
|
-
import { same } from "evt/tools/inDepth/same";
|
12
|
-
import type { BuildContext } from "./buildContext";
|
13
|
-
import fetch from "make-fetch-happen";
|
14
|
-
|
15
|
-
type GetLatestsSemVersionedTag = ReturnType<
|
16
|
-
typeof getLatestsSemVersionedTagFactory
|
17
|
-
>["getLatestsSemVersionedTag"];
|
18
|
-
|
19
|
-
type Params = Param0<GetLatestsSemVersionedTag>;
|
20
|
-
type R = ReturnType<GetLatestsSemVersionedTag>;
|
21
|
-
|
22
|
-
let getLatestsSemVersionedTag_stateless: GetLatestsSemVersionedTag | undefined =
|
23
|
-
undefined;
|
24
|
-
|
25
|
-
const CACHE_VERSION = 1;
|
26
|
-
|
27
|
-
type Cache = {
|
28
|
-
version: typeof CACHE_VERSION;
|
29
|
-
entries: {
|
30
|
-
time: number;
|
31
|
-
params: Params;
|
32
|
-
result: R;
|
33
|
-
}[];
|
34
|
-
};
|
35
|
-
|
36
|
-
export type BuildContextLike = {
|
37
|
-
cacheDirPath: string;
|
38
|
-
fetchOptions: BuildContext["fetchOptions"];
|
39
|
-
};
|
40
|
-
|
41
|
-
assert<BuildContext extends BuildContextLike ? true : false>();
|
42
|
-
|
43
|
-
export async function getLatestsSemVersionedTag({
|
44
|
-
buildContext,
|
45
|
-
...params
|
46
|
-
}: Params & {
|
47
|
-
buildContext: BuildContextLike;
|
48
|
-
}): Promise<R> {
|
49
|
-
const cacheFilePath = pathJoin(
|
50
|
-
buildContext.cacheDirPath,
|
51
|
-
"latest-sem-versioned-tags.json"
|
52
|
-
);
|
53
|
-
|
54
|
-
const cacheLookupResult = (() => {
|
55
|
-
const getResult_currentCache = (currentCacheEntries: Cache["entries"]) => ({
|
56
|
-
hasCachedResult: false as const,
|
57
|
-
currentCache: {
|
58
|
-
version: CACHE_VERSION,
|
59
|
-
entries: currentCacheEntries
|
60
|
-
}
|
61
|
-
});
|
62
|
-
|
63
|
-
if (!fs.existsSync(cacheFilePath)) {
|
64
|
-
return getResult_currentCache([]);
|
65
|
-
}
|
66
|
-
|
67
|
-
let cache_json;
|
68
|
-
|
69
|
-
try {
|
70
|
-
cache_json = fs.readFileSync(cacheFilePath).toString("utf8");
|
71
|
-
} catch {
|
72
|
-
return getResult_currentCache([]);
|
73
|
-
}
|
74
|
-
|
75
|
-
let cache_json_parsed: unknown;
|
76
|
-
|
77
|
-
try {
|
78
|
-
cache_json_parsed = JSON.parse(cache_json);
|
79
|
-
} catch {
|
80
|
-
return getResult_currentCache([]);
|
81
|
-
}
|
82
|
-
|
83
|
-
const zSemVer = (() => {
|
84
|
-
type TargetType = SemVer;
|
85
|
-
|
86
|
-
const zTargetType = z.object({
|
87
|
-
major: z.number(),
|
88
|
-
minor: z.number(),
|
89
|
-
patch: z.number(),
|
90
|
-
rc: z.number().optional(),
|
91
|
-
parsedFrom: z.string()
|
92
|
-
});
|
93
|
-
|
94
|
-
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
95
|
-
|
96
|
-
return id<z.ZodType<TargetType>>(zTargetType);
|
97
|
-
})();
|
98
|
-
|
99
|
-
const zCache = (() => {
|
100
|
-
type TargetType = Cache;
|
101
|
-
|
102
|
-
const zTargetType = z.object({
|
103
|
-
version: z.literal(CACHE_VERSION),
|
104
|
-
entries: z.array(
|
105
|
-
z.object({
|
106
|
-
time: z.number(),
|
107
|
-
params: z.object({
|
108
|
-
owner: z.string(),
|
109
|
-
repo: z.string(),
|
110
|
-
count: z.number(),
|
111
|
-
doIgnoreReleaseCandidates: z.boolean()
|
112
|
-
}),
|
113
|
-
result: z.array(
|
114
|
-
z.object({
|
115
|
-
tag: z.string(),
|
116
|
-
version: zSemVer
|
117
|
-
})
|
118
|
-
)
|
119
|
-
})
|
120
|
-
)
|
121
|
-
});
|
122
|
-
|
123
|
-
assert<Equals<z.infer<typeof zTargetType>, TargetType>>();
|
124
|
-
|
125
|
-
return id<z.ZodType<TargetType>>(zTargetType);
|
126
|
-
})();
|
127
|
-
|
128
|
-
let cache: Cache;
|
129
|
-
|
130
|
-
try {
|
131
|
-
cache = zCache.parse(cache_json_parsed);
|
132
|
-
} catch {
|
133
|
-
return getResult_currentCache([]);
|
134
|
-
}
|
135
|
-
|
136
|
-
const cacheEntry = cache.entries.find(e => same(e.params, params));
|
137
|
-
|
138
|
-
if (cacheEntry === undefined) {
|
139
|
-
return getResult_currentCache(cache.entries);
|
140
|
-
}
|
141
|
-
|
142
|
-
if (Date.now() - cacheEntry.time > 3_600_000) {
|
143
|
-
return getResult_currentCache(cache.entries.filter(e => e !== cacheEntry));
|
144
|
-
}
|
145
|
-
return {
|
146
|
-
hasCachedResult: true as const,
|
147
|
-
cachedResult: cacheEntry.result
|
148
|
-
};
|
149
|
-
})();
|
150
|
-
|
151
|
-
if (cacheLookupResult.hasCachedResult) {
|
152
|
-
return cacheLookupResult.cachedResult;
|
153
|
-
}
|
154
|
-
|
155
|
-
const { currentCache } = cacheLookupResult;
|
156
|
-
|
157
|
-
getLatestsSemVersionedTag_stateless ??= (() => {
|
158
|
-
const octokit = (() => {
|
159
|
-
const githubToken = process.env.GITHUB_TOKEN;
|
160
|
-
|
161
|
-
const octokit = new Octokit({
|
162
|
-
...(githubToken === undefined ? {} : { auth: githubToken }),
|
163
|
-
request: {
|
164
|
-
fetch: (url: string, options?: any) =>
|
165
|
-
fetch(url, {
|
166
|
-
...options,
|
167
|
-
...buildContext.fetchOptions
|
168
|
-
})
|
169
|
-
}
|
170
|
-
});
|
171
|
-
|
172
|
-
return octokit;
|
173
|
-
})();
|
174
|
-
|
175
|
-
const { getLatestsSemVersionedTag } = getLatestsSemVersionedTagFactory({
|
176
|
-
octokit
|
177
|
-
});
|
178
|
-
|
179
|
-
return getLatestsSemVersionedTag;
|
180
|
-
})();
|
181
|
-
|
182
|
-
const result = await getLatestsSemVersionedTag_stateless(params);
|
183
|
-
|
184
|
-
currentCache.entries.push({
|
185
|
-
time: Date.now(),
|
186
|
-
params,
|
187
|
-
result
|
188
|
-
});
|
189
|
-
|
190
|
-
{
|
191
|
-
const dirPath = pathDirname(cacheFilePath);
|
192
|
-
|
193
|
-
if (!fs.existsSync(dirPath)) {
|
194
|
-
fs.mkdirSync(dirPath, { recursive: true });
|
195
|
-
}
|
196
|
-
}
|
197
|
-
|
198
|
-
fs.writeFileSync(cacheFilePath, JSON.stringify(currentCache, null, 2));
|
199
|
-
|
200
|
-
return result;
|
201
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
getLatestsSemVersionedTag,
|
3
|
-
type BuildContextLike as BuildContextLike_getLatestsSemVersionedTag
|
4
|
-
} from "./getLatestsSemVersionedTag";
|
5
|
-
import cliSelect from "cli-select";
|
6
|
-
import { assert } from "tsafe/assert";
|
7
|
-
import { SemVer } from "../tools/SemVer";
|
8
|
-
import type { BuildContext } from "./buildContext";
|
9
|
-
|
10
|
-
export type BuildContextLike = BuildContextLike_getLatestsSemVersionedTag & {};
|
11
|
-
|
12
|
-
assert<BuildContext extends BuildContextLike ? true : false>();
|
13
|
-
|
14
|
-
export async function promptKeycloakVersion(params: {
|
15
|
-
startingFromMajor: number | undefined;
|
16
|
-
excludeMajorVersions: number[];
|
17
|
-
doOmitPatch: boolean;
|
18
|
-
buildContext: BuildContextLike;
|
19
|
-
}) {
|
20
|
-
const { startingFromMajor, excludeMajorVersions, doOmitPatch, buildContext } = params;
|
21
|
-
|
22
|
-
const semVersionedTagByMajor = new Map<number, { tag: string; version: SemVer }>();
|
23
|
-
|
24
|
-
const semVersionedTags = await getLatestsSemVersionedTag({
|
25
|
-
count: 50,
|
26
|
-
owner: "keycloak",
|
27
|
-
repo: "keycloak",
|
28
|
-
doIgnoreReleaseCandidates: true,
|
29
|
-
buildContext
|
30
|
-
});
|
31
|
-
|
32
|
-
semVersionedTags.forEach(semVersionedTag => {
|
33
|
-
if (
|
34
|
-
startingFromMajor !== undefined &&
|
35
|
-
semVersionedTag.version.major < startingFromMajor
|
36
|
-
) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
|
40
|
-
if (excludeMajorVersions.includes(semVersionedTag.version.major)) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
|
44
|
-
const currentSemVersionedTag = semVersionedTagByMajor.get(
|
45
|
-
semVersionedTag.version.major
|
46
|
-
);
|
47
|
-
|
48
|
-
if (
|
49
|
-
currentSemVersionedTag !== undefined &&
|
50
|
-
SemVer.compare(semVersionedTag.version, currentSemVersionedTag.version) === -1
|
51
|
-
) {
|
52
|
-
return;
|
53
|
-
}
|
54
|
-
|
55
|
-
semVersionedTagByMajor.set(semVersionedTag.version.major, semVersionedTag);
|
56
|
-
});
|
57
|
-
|
58
|
-
const lastMajorVersions = Array.from(semVersionedTagByMajor.values()).map(
|
59
|
-
({ version }) =>
|
60
|
-
`${version.major}.${version.minor}${doOmitPatch ? "" : `.${version.patch}`}`
|
61
|
-
);
|
62
|
-
|
63
|
-
const { value } = await cliSelect<string>({
|
64
|
-
values: lastMajorVersions
|
65
|
-
}).catch(() => {
|
66
|
-
process.exit(-1);
|
67
|
-
});
|
68
|
-
|
69
|
-
const keycloakVersion = value.split(" ")[0];
|
70
|
-
|
71
|
-
return { keycloakVersion };
|
72
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
type PropertiesThatCanBeUndefined<T extends Record<string, unknown>> = {
|
2
|
-
[Key in keyof T]: undefined extends T[Key] ? Key : never;
|
3
|
-
}[keyof T];
|
4
|
-
|
5
|
-
/**
|
6
|
-
* OptionalIfCanBeUndefined<{ p1: string | undefined; p2: string; }>
|
7
|
-
* is
|
8
|
-
* { p1?: string | undefined; p2: string }
|
9
|
-
*/
|
10
|
-
export type OptionalIfCanBeUndefined<T extends Record<string, unknown>> = {
|
11
|
-
[K in PropertiesThatCanBeUndefined<T>]?: T[K];
|
12
|
-
} & { [K in Exclude<keyof T, PropertiesThatCanBeUndefined<T>>]: T[K] };
|
package/src/bin/tools/crc32.ts
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
import { Readable } from "stream";
|
2
|
-
|
3
|
-
const crc32tab = [
|
4
|
-
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535,
|
5
|
-
0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd,
|
6
|
-
0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d,
|
7
|
-
0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec,
|
8
|
-
0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
9
|
-
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
10
|
-
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac,
|
11
|
-
0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
|
12
|
-
0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab,
|
13
|
-
0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
14
|
-
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb,
|
15
|
-
0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
16
|
-
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea,
|
17
|
-
0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce,
|
18
|
-
0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
19
|
-
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
|
20
|
-
0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409,
|
21
|
-
0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
22
|
-
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739,
|
23
|
-
0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
24
|
-
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268,
|
25
|
-
0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0,
|
26
|
-
0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8,
|
27
|
-
0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
28
|
-
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
29
|
-
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703,
|
30
|
-
0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7,
|
31
|
-
0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a,
|
32
|
-
0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae,
|
33
|
-
0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
34
|
-
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6,
|
35
|
-
0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
|
36
|
-
0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d,
|
37
|
-
0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5,
|
38
|
-
0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
39
|
-
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
40
|
-
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
41
|
-
];
|
42
|
-
|
43
|
-
/**
|
44
|
-
*
|
45
|
-
* @param input either a byte stream, a string or a buffer, you want to have the checksum for
|
46
|
-
* @returns a promise for a checksum (uint32)
|
47
|
-
*/
|
48
|
-
export function crc32(input: Readable | String | Buffer): Promise<number> {
|
49
|
-
if (typeof input === "string") {
|
50
|
-
let crc = ~0;
|
51
|
-
for (let i = 0; i < input.length; i++)
|
52
|
-
crc = (crc >>> 8) ^ crc32tab[(crc ^ input.charCodeAt(i)) & 0xff];
|
53
|
-
return Promise.resolve((crc ^ -1) >>> 0);
|
54
|
-
} else if (input instanceof Buffer) {
|
55
|
-
let crc = ~0;
|
56
|
-
for (let i = 0; i < input.length; i++)
|
57
|
-
crc = (crc >>> 8) ^ crc32tab[(crc ^ input[i]) & 0xff];
|
58
|
-
return Promise.resolve((crc ^ -1) >>> 0);
|
59
|
-
} else if (input instanceof Readable) {
|
60
|
-
return new Promise<number>((resolve, reject) => {
|
61
|
-
let crc = ~0;
|
62
|
-
input.setMaxListeners(Infinity);
|
63
|
-
input.on("end", () => resolve((crc ^ -1) >>> 0));
|
64
|
-
input.on("error", e => reject(e));
|
65
|
-
input.on("data", (chunk: Buffer) => {
|
66
|
-
for (let i = 0; i < chunk.length; i++)
|
67
|
-
crc = (crc >>> 8) ^ crc32tab[(crc ^ chunk[i]) & 0xff];
|
68
|
-
});
|
69
|
-
});
|
70
|
-
} else {
|
71
|
-
throw new Error("Unsupported input " + typeof input);
|
72
|
-
}
|
73
|
-
}
|
package/src/bin/tools/deflate.ts
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
import { PassThrough, Readable, TransformCallback, Writable } from "stream";
|
2
|
-
import { pipeline } from "stream/promises";
|
3
|
-
import { deflateRaw as deflateRawCb, createDeflateRaw } from "zlib";
|
4
|
-
import { promisify } from "util";
|
5
|
-
|
6
|
-
import { crc32 } from "./crc32";
|
7
|
-
import tee from "./tee";
|
8
|
-
|
9
|
-
const deflateRaw = promisify(deflateRawCb);
|
10
|
-
|
11
|
-
/**
|
12
|
-
* A stream transformer that records the number of bytes
|
13
|
-
* passed in its `size` property.
|
14
|
-
*/
|
15
|
-
class ByteCounter extends PassThrough {
|
16
|
-
size: number = 0;
|
17
|
-
_transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback) {
|
18
|
-
if ("length" in chunk) this.size += chunk.length;
|
19
|
-
super._transform(chunk, encoding, callback);
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
/**
|
24
|
-
* @param data buffer containing the data to be compressed
|
25
|
-
* @returns a buffer containing the compressed/deflated data and the crc32 checksum
|
26
|
-
* of the source data
|
27
|
-
*/
|
28
|
-
export async function deflateBuffer(data: Buffer) {
|
29
|
-
const [deflated, checksum] = await Promise.all([deflateRaw(data), crc32(data)]);
|
30
|
-
return { deflated, crc32: checksum };
|
31
|
-
}
|
32
|
-
|
33
|
-
/**
|
34
|
-
* @param input a byte stream, containing data to be compressed
|
35
|
-
* @param sink a method that will accept chunks of compressed data; We don't pass
|
36
|
-
* a writable here, since we don't want the writablestream to be closed after
|
37
|
-
* a single file
|
38
|
-
* @returns a promise, which will resolve with the crc32 checksum and the
|
39
|
-
* compressed size
|
40
|
-
*/
|
41
|
-
export async function deflateStream(input: Readable, sink: (chunk: Buffer) => void) {
|
42
|
-
const deflateWriter = new Writable({
|
43
|
-
write(chunk, _, callback) {
|
44
|
-
sink(chunk);
|
45
|
-
callback();
|
46
|
-
}
|
47
|
-
});
|
48
|
-
|
49
|
-
// tee the input stream, so we can compress and calc crc32 in parallel
|
50
|
-
const [rs1, rs2] = tee(input);
|
51
|
-
const byteCounter = new ByteCounter();
|
52
|
-
const [_, crc] = await Promise.all([
|
53
|
-
// pipe input into zip compressor, count the bytes
|
54
|
-
// returned and pass compressed data to the sink
|
55
|
-
pipeline(rs1, createDeflateRaw(), byteCounter, deflateWriter),
|
56
|
-
// calc checksum
|
57
|
-
crc32(rs2)
|
58
|
-
]);
|
59
|
-
|
60
|
-
return { crc32: crc, compressedSize: byteCounter.size };
|
61
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import * as child_process from "child_process";
|
2
|
-
import { dirname as pathDirname, basename as pathBasename } from "path";
|
3
|
-
import { Deferred } from "evt/tools/Deferred";
|
4
|
-
|
5
|
-
export function getIsTrackedByGit(params: { filePath: string }): Promise<boolean> {
|
6
|
-
const { filePath } = params;
|
7
|
-
|
8
|
-
const dIsTracked = new Deferred<boolean>();
|
9
|
-
|
10
|
-
child_process.exec(
|
11
|
-
`git ls-files --error-unmatch ${pathBasename(filePath)}`,
|
12
|
-
{ cwd: pathDirname(filePath) },
|
13
|
-
error => {
|
14
|
-
if (error === null) {
|
15
|
-
dIsTracked.resolve(true);
|
16
|
-
return;
|
17
|
-
}
|
18
|
-
|
19
|
-
if (error.code === 1) {
|
20
|
-
dIsTracked.resolve(false);
|
21
|
-
return;
|
22
|
-
}
|
23
|
-
|
24
|
-
dIsTracked.reject(error);
|
25
|
-
}
|
26
|
-
);
|
27
|
-
|
28
|
-
return dIsTracked.pr;
|
29
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import { listTagsFactory } from "./listTags";
|
2
|
-
import type { Octokit } from "@octokit/rest";
|
3
|
-
import { SemVer } from "../SemVer";
|
4
|
-
|
5
|
-
export function getLatestsSemVersionedTagFactory(params: { octokit: Octokit }) {
|
6
|
-
const { octokit } = params;
|
7
|
-
|
8
|
-
async function getLatestsSemVersionedTag(params: {
|
9
|
-
owner: string;
|
10
|
-
repo: string;
|
11
|
-
count: number;
|
12
|
-
doIgnoreReleaseCandidates: boolean;
|
13
|
-
}): Promise<
|
14
|
-
{
|
15
|
-
tag: string;
|
16
|
-
version: SemVer;
|
17
|
-
}[]
|
18
|
-
> {
|
19
|
-
const { owner, repo, count, doIgnoreReleaseCandidates } = params;
|
20
|
-
|
21
|
-
const semVersionedTags: { tag: string; version: SemVer }[] = [];
|
22
|
-
|
23
|
-
const { listTags } = listTagsFactory({ octokit });
|
24
|
-
|
25
|
-
for await (const tag of listTags({ owner, repo })) {
|
26
|
-
let version: SemVer;
|
27
|
-
|
28
|
-
try {
|
29
|
-
version = SemVer.parse(tag.replace(/^[vV]?/, ""));
|
30
|
-
} catch {
|
31
|
-
continue;
|
32
|
-
}
|
33
|
-
|
34
|
-
if (doIgnoreReleaseCandidates && version.rc !== undefined) {
|
35
|
-
continue;
|
36
|
-
}
|
37
|
-
|
38
|
-
semVersionedTags.push({ tag, version });
|
39
|
-
}
|
40
|
-
|
41
|
-
return semVersionedTags
|
42
|
-
.sort(({ version: vX }, { version: vY }) => SemVer.compare(vY, vX))
|
43
|
-
.slice(0, count);
|
44
|
-
}
|
45
|
-
|
46
|
-
return { getLatestsSemVersionedTag };
|
47
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
import type { Octokit } from "@octokit/rest";
|
2
|
-
|
3
|
-
const per_page = 99;
|
4
|
-
|
5
|
-
export function listTagsFactory(params: { octokit: Octokit }) {
|
6
|
-
const { octokit } = params;
|
7
|
-
|
8
|
-
const octokit_repo_listTags = async (params: {
|
9
|
-
owner: string;
|
10
|
-
repo: string;
|
11
|
-
per_page: number;
|
12
|
-
page: number;
|
13
|
-
}) => {
|
14
|
-
return octokit.repos.listTags(params);
|
15
|
-
};
|
16
|
-
|
17
|
-
async function* listTags(params: {
|
18
|
-
owner: string;
|
19
|
-
repo: string;
|
20
|
-
}): AsyncGenerator<string> {
|
21
|
-
const { owner, repo } = params;
|
22
|
-
|
23
|
-
let page = 1;
|
24
|
-
|
25
|
-
while (true) {
|
26
|
-
const resp = await octokit_repo_listTags({
|
27
|
-
owner,
|
28
|
-
repo,
|
29
|
-
per_page,
|
30
|
-
page: page++
|
31
|
-
});
|
32
|
-
|
33
|
-
for (const branch of resp.data.map(({ name }) => name)) {
|
34
|
-
yield branch;
|
35
|
-
}
|
36
|
-
|
37
|
-
if (resp.data.length < 99) {
|
38
|
-
break;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
/** Returns the same "latest" tag as deno.land/x, not actually the latest though */
|
44
|
-
async function getLatestTag(params: {
|
45
|
-
owner: string;
|
46
|
-
repo: string;
|
47
|
-
}): Promise<string | undefined> {
|
48
|
-
const { owner, repo } = params;
|
49
|
-
|
50
|
-
const itRes = await listTags({ owner, repo }).next();
|
51
|
-
|
52
|
-
if (itRes.done) {
|
53
|
-
return undefined;
|
54
|
-
}
|
55
|
-
|
56
|
-
return itRes.value;
|
57
|
-
}
|
58
|
-
|
59
|
-
return { listTags, getLatestTag };
|
60
|
-
}
|
package/src/bin/tools/tee.ts
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
import { PassThrough, Readable } from "stream";
|
2
|
-
|
3
|
-
export default function tee(input: Readable) {
|
4
|
-
const a = new PassThrough();
|
5
|
-
const b = new PassThrough();
|
6
|
-
|
7
|
-
let aFull = false;
|
8
|
-
let bFull = false;
|
9
|
-
|
10
|
-
a.setMaxListeners(Infinity);
|
11
|
-
|
12
|
-
a.on("drain", () => {
|
13
|
-
aFull = false;
|
14
|
-
if (!aFull && !bFull) input.resume();
|
15
|
-
});
|
16
|
-
b.on("drain", () => {
|
17
|
-
bFull = false;
|
18
|
-
if (!aFull && !bFull) input.resume();
|
19
|
-
});
|
20
|
-
|
21
|
-
input.on("error", e => {
|
22
|
-
a.emit("error", e);
|
23
|
-
b.emit("error", e);
|
24
|
-
});
|
25
|
-
|
26
|
-
input.on("data", chunk => {
|
27
|
-
aFull = !a.write(chunk);
|
28
|
-
bFull = !b.write(chunk);
|
29
|
-
|
30
|
-
if (aFull || bFull) input.pause();
|
31
|
-
});
|
32
|
-
|
33
|
-
input.on("end", () => {
|
34
|
-
a.end();
|
35
|
-
b.end();
|
36
|
-
});
|
37
|
-
|
38
|
-
return [a, b] as const;
|
39
|
-
}
|
@@ -1,49 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Concatenate the string fragments and interpolated values
|
3
|
-
* to get a single string.
|
4
|
-
*/
|
5
|
-
function populateTemplate(strings: TemplateStringsArray, ...args: unknown[]) {
|
6
|
-
const chunks: string[] = [];
|
7
|
-
for (let i = 0; i < strings.length; i++) {
|
8
|
-
let lastStringLineLength = 0;
|
9
|
-
if (strings[i]) {
|
10
|
-
chunks.push(strings[i]);
|
11
|
-
// remember last indent of the string portion
|
12
|
-
lastStringLineLength = strings[i].split("\n").slice(-1)[0]?.length ?? 0;
|
13
|
-
}
|
14
|
-
if (args[i]) {
|
15
|
-
// if the interpolation value has newlines, indent the interpolation values
|
16
|
-
// using the last known string indent
|
17
|
-
const chunk = String(args[i]).replace(
|
18
|
-
/([\r?\n])/g,
|
19
|
-
"$1" + " ".repeat(lastStringLineLength)
|
20
|
-
);
|
21
|
-
chunks.push(chunk);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
return chunks.join("");
|
25
|
-
}
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Shift all lines left by the *smallest* indentation level,
|
29
|
-
* and remove initial newline and all trailing spaces.
|
30
|
-
*/
|
31
|
-
export default function trimIndent(strings: TemplateStringsArray, ...args: any[]) {
|
32
|
-
// Remove initial and final newlines
|
33
|
-
let string = populateTemplate(strings, ...args)
|
34
|
-
.replace(/^[\r\n]/, "")
|
35
|
-
.replace(/\r?\n *$/, "");
|
36
|
-
const dents =
|
37
|
-
string
|
38
|
-
.match(/^([ \t])+/gm)
|
39
|
-
?.filter(s => /^\s+$/.test(s))
|
40
|
-
?.map(s => s.length) ?? [];
|
41
|
-
// No dents? no change required
|
42
|
-
if (!dents || dents.length == 0) return string;
|
43
|
-
const minDent = Math.min(...dents);
|
44
|
-
// The min indentation is 0, no change needed
|
45
|
-
if (!minDent) return string;
|
46
|
-
const re = new RegExp(`^${" ".repeat(minDent)}`, "gm");
|
47
|
-
const dedented = string.replace(re, "");
|
48
|
-
return dedented;
|
49
|
-
}
|
File without changes
|
/package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcContext.ts
RENAMED
File without changes
|
/package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPage.tsx
RENAMED
File without changes
|
/package/src/bin/initialize-account-theme/{src/multi-page → multi-page-boilerplate}/KcPageStory.tsx
RENAMED
File without changes
|
File without changes
|