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,6 +1,6 @@
|
|
1
1
|
import { assert, type Equals, is } from "tsafe/assert";
|
2
2
|
import type { BuildContext } from "../shared/buildContext";
|
3
|
-
import type {
|
3
|
+
import type { ExtensionModuleMeta } from "./extensionModuleMeta";
|
4
4
|
import { z } from "zod";
|
5
5
|
import { id } from "tsafe/id";
|
6
6
|
import * as fsPr from "fs/promises";
|
@@ -16,29 +16,29 @@ export type BuildContextLike = {
|
|
16
16
|
|
17
17
|
assert<BuildContext extends BuildContextLike ? true : false>();
|
18
18
|
|
19
|
-
export type
|
19
|
+
export type ExtensionModuleMetaLike = {
|
20
20
|
moduleName: string;
|
21
21
|
peerDependencies: Record<string, string>;
|
22
22
|
};
|
23
23
|
|
24
|
-
assert<
|
24
|
+
assert<ExtensionModuleMeta extends ExtensionModuleMetaLike ? true : false>();
|
25
25
|
|
26
|
-
export async function
|
26
|
+
export async function installExtensionModulesPeerDependencies(params: {
|
27
27
|
buildContext: BuildContextLike;
|
28
|
-
|
28
|
+
extensionModuleMetas: ExtensionModuleMetaLike[];
|
29
29
|
}): Promise<void | never> {
|
30
|
-
const { buildContext,
|
30
|
+
const { buildContext, extensionModuleMetas } = params;
|
31
31
|
|
32
|
-
const {
|
33
|
-
const
|
32
|
+
const { extensionModulesPerDependencies } = (() => {
|
33
|
+
const extensionModulesPerDependencies: Record<string, string> = {};
|
34
34
|
|
35
|
-
for (const { peerDependencies } of
|
35
|
+
for (const { peerDependencies } of extensionModuleMetas) {
|
36
36
|
for (const [peerDependencyName, versionRange_candidate] of Object.entries(
|
37
37
|
peerDependencies
|
38
38
|
)) {
|
39
39
|
const versionRange = (() => {
|
40
40
|
const versionRange_current =
|
41
|
-
|
41
|
+
extensionModulesPerDependencies[peerDependencyName];
|
42
42
|
|
43
43
|
if (versionRange_current === undefined) {
|
44
44
|
return versionRange_candidate;
|
@@ -76,11 +76,11 @@ export async function installUiModulesPeerDependencies(params: {
|
|
76
76
|
return versionRange;
|
77
77
|
})();
|
78
78
|
|
79
|
-
|
79
|
+
extensionModulesPerDependencies[peerDependencyName] = versionRange;
|
80
80
|
}
|
81
81
|
}
|
82
82
|
|
83
|
-
return {
|
83
|
+
return { extensionModulesPerDependencies };
|
84
84
|
})();
|
85
85
|
|
86
86
|
const parsedPackageJson = await (async () => {
|
@@ -117,7 +117,9 @@ export async function installUiModulesPeerDependencies(params: {
|
|
117
117
|
|
118
118
|
const parsedPackageJson_before = JSON.parse(JSON.stringify(parsedPackageJson));
|
119
119
|
|
120
|
-
for (const [moduleName, versionRange] of Object.entries(
|
120
|
+
for (const [moduleName, versionRange] of Object.entries(
|
121
|
+
extensionModulesPerDependencies
|
122
|
+
)) {
|
121
123
|
if (moduleName.startsWith("@types/")) {
|
122
124
|
(parsedPackageJson.devDependencies ??= {})[moduleName] = versionRange;
|
123
125
|
continue;
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
} from "path";
|
8
8
|
import { assert } from "tsafe/assert";
|
9
9
|
import type { BuildContext } from "../shared/buildContext";
|
10
|
-
import type {
|
10
|
+
import type { ExtensionModuleMeta } from "./extensionModuleMeta";
|
11
11
|
import { existsAsync } from "../tools/fs.existsAsync";
|
12
12
|
import { getAbsoluteAndInOsFormatPath } from "../tools/getAbsoluteAndInOsFormatPath";
|
13
13
|
|
@@ -17,17 +17,17 @@ export type BuildContextLike = {
|
|
17
17
|
|
18
18
|
assert<BuildContext extends BuildContextLike ? true : false>();
|
19
19
|
|
20
|
-
const DELIMITER_START = `# ===
|
21
|
-
const DELIMITER_END = `# ===
|
20
|
+
const DELIMITER_START = `# === Owned files start ===`;
|
21
|
+
const DELIMITER_END = `# === Owned files end =====`;
|
22
22
|
|
23
23
|
export async function writeManagedGitignoreFile(params: {
|
24
24
|
buildContext: BuildContextLike;
|
25
|
-
|
26
|
-
|
25
|
+
extensionModuleMetas: ExtensionModuleMeta[];
|
26
|
+
ownedFilesRelativePaths: string[];
|
27
27
|
}): Promise<void> {
|
28
|
-
const { buildContext,
|
28
|
+
const { buildContext, extensionModuleMetas, ownedFilesRelativePaths } = params;
|
29
29
|
|
30
|
-
if (
|
30
|
+
if (extensionModuleMetas.length === 0) {
|
31
31
|
return;
|
32
32
|
}
|
33
33
|
|
@@ -38,19 +38,19 @@ export async function writeManagedGitignoreFile(params: {
|
|
38
38
|
`# This file is managed by Keycloakify, do not edit it manually.`,
|
39
39
|
``,
|
40
40
|
DELIMITER_START,
|
41
|
-
...
|
41
|
+
...ownedFilesRelativePaths
|
42
42
|
.map(fileRelativePath => fileRelativePath.split(pathSep).join("/"))
|
43
43
|
.map(line => `# ${line}`),
|
44
44
|
DELIMITER_END,
|
45
45
|
``,
|
46
|
-
...
|
47
|
-
.map(
|
48
|
-
`# === ${
|
49
|
-
...
|
46
|
+
...extensionModuleMetas
|
47
|
+
.map(extensionModuleMeta => [
|
48
|
+
`# === ${extensionModuleMeta.moduleName} v${extensionModuleMeta.version} ===`,
|
49
|
+
...extensionModuleMeta.files
|
50
50
|
.map(({ fileRelativePath }) => fileRelativePath)
|
51
51
|
.filter(
|
52
52
|
fileRelativePath =>
|
53
|
-
!
|
53
|
+
!ownedFilesRelativePaths.includes(fileRelativePath)
|
54
54
|
)
|
55
55
|
.map(
|
56
56
|
fileRelativePath =>
|
@@ -92,14 +92,14 @@ export async function writeManagedGitignoreFile(params: {
|
|
92
92
|
export async function readManagedGitignoreFile(params: {
|
93
93
|
buildContext: BuildContextLike;
|
94
94
|
}): Promise<{
|
95
|
-
|
95
|
+
ownedFilesRelativePaths: string[];
|
96
96
|
}> {
|
97
97
|
const { buildContext } = params;
|
98
98
|
|
99
99
|
const filePath = pathJoin(buildContext.themeSrcDirPath, ".gitignore");
|
100
100
|
|
101
101
|
if (!(await existsAsync(filePath))) {
|
102
|
-
return {
|
102
|
+
return { ownedFilesRelativePaths: [] };
|
103
103
|
}
|
104
104
|
|
105
105
|
const contentStr = (await fsPr.readFile(filePath)).toString("utf8");
|
@@ -116,10 +116,10 @@ export async function readManagedGitignoreFile(params: {
|
|
116
116
|
})();
|
117
117
|
|
118
118
|
if (payload === undefined) {
|
119
|
-
return {
|
119
|
+
return { ownedFilesRelativePaths: [] };
|
120
120
|
}
|
121
121
|
|
122
|
-
const
|
122
|
+
const ownedFilesRelativePaths = payload
|
123
123
|
.split("\n")
|
124
124
|
.map(line => line.trim())
|
125
125
|
.map(line => line.replace(/^# /, ""))
|
@@ -132,5 +132,5 @@ export async function readManagedGitignoreFile(params: {
|
|
132
132
|
)
|
133
133
|
.map(filePath => pathRelative(buildContext.themeSrcDirPath, filePath));
|
134
134
|
|
135
|
-
return {
|
135
|
+
return { ownedFilesRelativePaths };
|
136
136
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { BuildContext } from "../shared/buildContext";
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { getExtensionModuleMetas, computeHash } from "./extensionModuleMeta";
|
3
|
+
import { installExtensionModulesPeerDependencies } from "./installExtensionModulesPeerDependencies";
|
4
4
|
import {
|
5
5
|
readManagedGitignoreFile,
|
6
6
|
writeManagedGitignoreFile
|
@@ -9,36 +9,36 @@ import { dirname as pathDirname } from "path";
|
|
9
9
|
import { join as pathJoin } from "path";
|
10
10
|
import { existsAsync } from "../tools/fs.existsAsync";
|
11
11
|
import * as fsPr from "fs/promises";
|
12
|
-
import {
|
12
|
+
import { getIsKnownByGit } from "../tools/isKnownByGit";
|
13
13
|
import { untrackFromGit } from "../tools/untrackFromGit";
|
14
14
|
|
15
15
|
export async function command(params: { buildContext: BuildContext }) {
|
16
16
|
const { buildContext } = params;
|
17
17
|
|
18
|
-
const
|
18
|
+
const extensionModuleMetas = await getExtensionModuleMetas({ buildContext });
|
19
19
|
|
20
|
-
await
|
20
|
+
await installExtensionModulesPeerDependencies({
|
21
21
|
buildContext,
|
22
|
-
|
22
|
+
extensionModuleMetas
|
23
23
|
});
|
24
24
|
|
25
|
-
const {
|
25
|
+
const { ownedFilesRelativePaths } = await readManagedGitignoreFile({
|
26
26
|
buildContext
|
27
27
|
});
|
28
28
|
|
29
29
|
await writeManagedGitignoreFile({
|
30
30
|
buildContext,
|
31
|
-
|
32
|
-
|
31
|
+
ownedFilesRelativePaths,
|
32
|
+
extensionModuleMetas
|
33
33
|
});
|
34
34
|
|
35
35
|
await Promise.all(
|
36
|
-
|
37
|
-
.map(
|
36
|
+
extensionModuleMetas
|
37
|
+
.map(extensionModuleMeta =>
|
38
38
|
Promise.all(
|
39
|
-
|
39
|
+
extensionModuleMeta.files.map(
|
40
40
|
async ({ fileRelativePath, copyableFilePath, hash }) => {
|
41
|
-
if (
|
41
|
+
if (ownedFilesRelativePaths.includes(fileRelativePath)) {
|
42
42
|
return;
|
43
43
|
}
|
44
44
|
|
@@ -65,19 +65,7 @@ export async function command(params: { buildContext: BuildContext }) {
|
|
65
65
|
return;
|
66
66
|
}
|
67
67
|
|
68
|
-
|
69
|
-
if (!doesFileExist) {
|
70
|
-
break git_untrack;
|
71
|
-
}
|
72
|
-
|
73
|
-
const isTracked = await getIsTrackedByGit({
|
74
|
-
filePath: destFilePath
|
75
|
-
});
|
76
|
-
|
77
|
-
if (!isTracked) {
|
78
|
-
break git_untrack;
|
79
|
-
}
|
80
|
-
|
68
|
+
if (await getIsKnownByGit({ filePath: destFilePath })) {
|
81
69
|
await untrackFromGit({
|
82
70
|
filePath: destFilePath
|
83
71
|
});
|
@@ -2,40 +2,42 @@ import { join as pathJoin } from "path";
|
|
2
2
|
import { existsAsync } from "./fs.existsAsync";
|
3
3
|
import * as child_process from "child_process";
|
4
4
|
import { assert } from "tsafe/assert";
|
5
|
+
import { getIsRootPath } from "../tools/isRootPath";
|
5
6
|
|
6
7
|
export async function getInstalledModuleDirPath(params: {
|
7
8
|
moduleName: string;
|
8
9
|
packageJsonDirPath: string;
|
9
|
-
projectDirPath: string;
|
10
10
|
}) {
|
11
|
-
const { moduleName, packageJsonDirPath
|
11
|
+
const { moduleName, packageJsonDirPath } = params;
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
...[packageJsonDirPath, "node_modules", ...moduleName.split("/")]
|
16
|
-
);
|
13
|
+
{
|
14
|
+
let dirPath = packageJsonDirPath;
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
while (true) {
|
17
|
+
const dirPath_candidate = pathJoin(
|
18
|
+
dirPath,
|
19
|
+
"node_modules",
|
20
|
+
...moduleName.split("/")
|
21
|
+
);
|
21
22
|
|
22
|
-
|
23
|
-
}
|
23
|
+
let doesExist: boolean;
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
try {
|
26
|
+
doesExist = await existsAsync(dirPath_candidate);
|
27
|
+
} catch {
|
28
|
+
doesExist = false;
|
29
|
+
}
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
if (doesExist) {
|
32
|
+
return dirPath_candidate;
|
33
|
+
}
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
if (getIsRootPath(dirPath)) {
|
36
|
+
break;
|
37
|
+
}
|
37
38
|
|
38
|
-
|
39
|
+
dirPath = pathJoin(dirPath, "..");
|
40
|
+
}
|
39
41
|
}
|
40
42
|
|
41
43
|
const dirPath = child_process
|
@@ -0,0 +1,45 @@
|
|
1
|
+
import * as child_process from "child_process";
|
2
|
+
import {
|
3
|
+
dirname as pathDirname,
|
4
|
+
basename as pathBasename,
|
5
|
+
join as pathJoin,
|
6
|
+
sep as pathSep
|
7
|
+
} from "path";
|
8
|
+
import { Deferred } from "evt/tools/Deferred";
|
9
|
+
import * as fs from "fs";
|
10
|
+
|
11
|
+
export function getIsKnownByGit(params: { filePath: string }): Promise<boolean> {
|
12
|
+
const { filePath } = params;
|
13
|
+
|
14
|
+
const dIsKnownByGit = new Deferred<boolean>();
|
15
|
+
|
16
|
+
let relativePath = pathBasename(filePath);
|
17
|
+
|
18
|
+
let dirPath = pathDirname(filePath);
|
19
|
+
|
20
|
+
while (!fs.existsSync(dirPath)) {
|
21
|
+
relativePath = pathJoin(pathBasename(dirPath), relativePath);
|
22
|
+
|
23
|
+
dirPath = pathDirname(dirPath);
|
24
|
+
}
|
25
|
+
|
26
|
+
child_process.exec(
|
27
|
+
`git ls-files --error-unmatch '${relativePath.split(pathSep).join("/")}'`,
|
28
|
+
{ cwd: dirPath },
|
29
|
+
error => {
|
30
|
+
if (error === null) {
|
31
|
+
dIsKnownByGit.resolve(true);
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
|
35
|
+
if (error.code === 1) {
|
36
|
+
dIsKnownByGit.resolve(false);
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
dIsKnownByGit.reject(error);
|
41
|
+
}
|
42
|
+
);
|
43
|
+
|
44
|
+
return dIsKnownByGit.pr;
|
45
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { normalize as pathNormalize } from "path";
|
2
|
+
|
3
|
+
export function getIsRootPath(filePath: string): boolean {
|
4
|
+
const path_normalized = pathNormalize(filePath);
|
5
|
+
|
6
|
+
// Unix-like root ("/")
|
7
|
+
if (path_normalized === "/") {
|
8
|
+
return true;
|
9
|
+
}
|
10
|
+
|
11
|
+
// Check for Windows drive root (e.g., "C:\\")
|
12
|
+
if (/^[a-zA-Z]:\\$/.test(path_normalized)) {
|
13
|
+
return true;
|
14
|
+
}
|
15
|
+
|
16
|
+
// Check for UNC root (e.g., "\\server\share")
|
17
|
+
if (/^\\\\[^\\]+\\[^\\]+\\?$/.test(path_normalized)) {
|
18
|
+
return true;
|
19
|
+
}
|
20
|
+
|
21
|
+
return false;
|
22
|
+
}
|
@@ -8,7 +8,6 @@ import { exclude } from "tsafe/exclude";
|
|
8
8
|
|
9
9
|
export async function listInstalledModules(params: {
|
10
10
|
packageJsonFilePath: string;
|
11
|
-
projectDirPath: string;
|
12
11
|
filter: (params: { moduleName: string }) => boolean;
|
13
12
|
}): Promise<
|
14
13
|
{
|
@@ -18,13 +17,13 @@ export async function listInstalledModules(params: {
|
|
18
17
|
peerDependencies: Record<string, string>;
|
19
18
|
}[]
|
20
19
|
> {
|
21
|
-
const { packageJsonFilePath,
|
20
|
+
const { packageJsonFilePath, filter } = params;
|
22
21
|
|
23
22
|
const parsedPackageJson = await readPackageJsonDependencies({
|
24
23
|
packageJsonFilePath
|
25
24
|
});
|
26
25
|
|
27
|
-
const
|
26
|
+
const extensionModuleNames = (
|
28
27
|
[parsedPackageJson.dependencies, parsedPackageJson.devDependencies] as const
|
29
28
|
)
|
30
29
|
.filter(exclude(undefined))
|
@@ -33,11 +32,10 @@ export async function listInstalledModules(params: {
|
|
33
32
|
.filter(moduleName => filter({ moduleName }));
|
34
33
|
|
35
34
|
const result = await Promise.all(
|
36
|
-
|
35
|
+
extensionModuleNames.map(async moduleName => {
|
37
36
|
const dirPath = await getInstalledModuleDirPath({
|
38
37
|
moduleName,
|
39
|
-
packageJsonDirPath: pathDirname(packageJsonFilePath)
|
40
|
-
projectDirPath
|
38
|
+
packageJsonDirPath: pathDirname(packageJsonFilePath)
|
41
39
|
});
|
42
40
|
|
43
41
|
const { version, peerDependencies } =
|
@@ -108,7 +108,7 @@ async function runPackageManagerInstall(params: {
|
|
108
108
|
child.stdout.on("data", data => process.stdout.write(data));
|
109
109
|
|
110
110
|
child.stderr.on("data", data => {
|
111
|
-
if (data.toString("utf8").includes("
|
111
|
+
if (data.toString("utf8").includes("peer dependency")) {
|
112
112
|
return;
|
113
113
|
}
|
114
114
|
|
@@ -1,15 +1,31 @@
|
|
1
1
|
import * as child_process from "child_process";
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
dirname as pathDirname,
|
4
|
+
basename as pathBasename,
|
5
|
+
join as pathJoin,
|
6
|
+
sep as pathSep
|
7
|
+
} from "path";
|
3
8
|
import { Deferred } from "evt/tools/Deferred";
|
9
|
+
import { existsAsync } from "./fs.existsAsync";
|
4
10
|
|
5
11
|
export async function untrackFromGit(params: { filePath: string }): Promise<void> {
|
6
12
|
const { filePath } = params;
|
7
13
|
|
8
14
|
const dDone = new Deferred<void>();
|
9
15
|
|
16
|
+
let relativePath = pathBasename(filePath);
|
17
|
+
|
18
|
+
let dirPath = pathDirname(filePath);
|
19
|
+
|
20
|
+
while (!(await existsAsync(dirPath))) {
|
21
|
+
relativePath = pathJoin(pathBasename(dirPath), relativePath);
|
22
|
+
|
23
|
+
dirPath = pathDirname(dirPath);
|
24
|
+
}
|
25
|
+
|
10
26
|
child_process.exec(
|
11
|
-
`git rm --cached ${
|
12
|
-
{ cwd:
|
27
|
+
`git rm --cached '${relativePath.split(pathSep).join("/")}'`,
|
28
|
+
{ cwd: dirPath },
|
13
29
|
error => {
|
14
30
|
if (error !== null) {
|
15
31
|
dDone.reject(error);
|
package/src/bin/tsconfig.json
CHANGED