keycloakify 11.3.19 → 11.3.21
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/124.index.js +676 -0
- package/bin/356.index.js +700 -0
- package/bin/40.index.js +41 -21
- package/bin/{903.index.js → 450.index.js} +2 -680
- package/bin/453.index.js +143 -85
- package/bin/573.index.js +51 -24
- package/bin/{599.index.js → 735.index.js} +438 -121
- package/bin/786.index.js +129 -78
- package/bin/805.index.js +674 -0
- package/bin/854.index.js +68 -0
- package/bin/{780.index.js → 921.index.js} +168 -109
- package/bin/932.index.js +41 -21
- package/bin/97.index.js +125 -75
- package/bin/eject-file.d.ts +7 -0
- package/bin/keycloakify/generateResources/generateMessageProperties.d.ts +1 -1
- package/bin/keycloakify/generateResources/readFieldNameUsage.d.ts +1 -1
- package/bin/main.js +70 -7
- package/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.d.ts +12 -0
- package/bin/postinstall/index.d.ts +1 -0
- package/bin/postinstall/installUiModulesPeerDependencies.d.ts +11 -0
- package/bin/postinstall/managedGitignoreFile.d.ts +14 -0
- package/bin/postinstall/postinstall.d.ts +4 -0
- package/bin/postinstall/uiModuleMeta.d.ts +21 -0
- package/bin/shared/buildContext.d.ts +3 -0
- package/bin/shared/constants.d.ts +2 -1
- package/bin/shared/constants.js +2 -1
- package/bin/shared/constants.js.map +1 -1
- package/bin/shared/customHandler.d.ts +1 -1
- package/bin/shared/customHandler.js.map +1 -1
- package/bin/shared/exitIfUncommittedChanges.d.ts +3 -0
- package/bin/tools/crawlAsync.d.ts +6 -0
- package/bin/tools/getInstalledModuleDirPath.d.ts +5 -0
- package/bin/tools/listInstalledModules.d.ts +12 -0
- package/bin/tools/nodeModulesBinDirPath.d.ts +1 -0
- package/bin/tools/runPrettier.d.ts +17 -0
- package/package.json +34 -6
- package/src/bin/add-story.ts +28 -10
- package/src/bin/eject-file.ts +68 -0
- package/src/bin/eject-page.ts +51 -31
- package/src/bin/initialize-account-theme/initialize-account-theme.ts +4 -32
- package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +2 -16
- package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +1 -1
- package/src/bin/keycloakify/generateResources/generateResources.ts +58 -26
- package/src/bin/keycloakify/generateResources/readFieldNameUsage.ts +1 -1
- package/src/bin/main.ts +50 -0
- package/src/bin/postinstall/getUiModuleFileSourceCodeReadyToBeCopied.ts +73 -0
- package/src/bin/postinstall/index.ts +1 -0
- package/src/bin/postinstall/installUiModulesPeerDependencies.ts +158 -0
- package/src/bin/postinstall/managedGitignoreFile.ts +136 -0
- package/src/bin/postinstall/postinstall.ts +79 -0
- package/src/bin/postinstall/uiModuleMeta.ts +309 -0
- package/src/bin/shared/buildContext.ts +11 -5
- package/src/bin/shared/constants.ts +3 -1
- package/src/bin/shared/customHandler.ts +1 -0
- package/src/bin/shared/customHandler_delegate.ts +2 -27
- package/src/bin/shared/exitIfUncommittedChanges.ts +36 -0
- package/src/bin/tools/crawlAsync.ts +51 -0
- package/src/bin/tools/getInstalledModuleDirPath.ts +51 -0
- package/src/bin/tools/listInstalledModules.ts +131 -0
- package/src/bin/tools/nodeModulesBinDirPath.ts +38 -0
- package/src/bin/tools/npmInstall.ts +411 -15
- package/src/bin/tools/readThisNpmPackageVersion.ts +8 -0
- package/src/bin/tools/runPrettier.ts +106 -0
- package/src/bin/update-kc-gen.ts +28 -17
- package/vite-plugin/index.js +9237 -9163
- package/bin/tools/runFormat.d.ts +0 -3
- package/src/bin/tools/runFormat.ts +0 -76
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
-
exports.id =
|
3
|
-
exports.ids = [
|
2
|
+
exports.id = 735;
|
3
|
+
exports.ids = [735];
|
4
4
|
exports.modules = {
|
5
5
|
|
6
6
|
/***/ 81434:
|
@@ -35,98 +35,29 @@ function copyBoilerplate(params) {
|
|
35
35
|
|
36
36
|
/***/ }),
|
37
37
|
|
38
|
-
/***/
|
38
|
+
/***/ 84735:
|
39
39
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
40
40
|
|
41
|
-
// ESM COMPAT FLAG
|
42
41
|
__webpack_require__.r(__webpack_exports__);
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
var
|
51
|
-
|
52
|
-
var
|
53
|
-
|
54
|
-
var
|
55
|
-
var
|
56
|
-
|
57
|
-
var
|
58
|
-
|
59
|
-
var
|
60
|
-
|
61
|
-
var
|
62
|
-
var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
|
63
|
-
// EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
|
64
|
-
var zod_lib = __webpack_require__(52300);
|
65
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
|
66
|
-
var assert = __webpack_require__(29041);
|
67
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
|
68
|
-
var is = __webpack_require__(16453);
|
69
|
-
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
70
|
-
var id = __webpack_require__(38469);
|
71
|
-
// EXTERNAL MODULE: external "child_process"
|
72
|
-
var external_child_process_ = __webpack_require__(32081);
|
73
|
-
;// CONCATENATED MODULE: ./dist/bin/tools/npmInstall.js
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
function npmInstall(params) {
|
79
|
-
const { packageJsonDirPath } = params;
|
80
|
-
const packageManagerBinName = (() => {
|
81
|
-
const packageMangers = [
|
82
|
-
{
|
83
|
-
binName: "yarn",
|
84
|
-
lockFileBasename: "yarn.lock"
|
85
|
-
},
|
86
|
-
{
|
87
|
-
binName: "npm",
|
88
|
-
lockFileBasename: "package-lock.json"
|
89
|
-
},
|
90
|
-
{
|
91
|
-
binName: "pnpm",
|
92
|
-
lockFileBasename: "pnpm-lock.yaml"
|
93
|
-
},
|
94
|
-
{
|
95
|
-
binName: "bun",
|
96
|
-
lockFileBasename: "bun.lockdb"
|
97
|
-
}
|
98
|
-
];
|
99
|
-
for (const packageManager of packageMangers) {
|
100
|
-
if (external_fs_.existsSync((0,external_path_.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
|
101
|
-
external_fs_.existsSync((0,external_path_.join)(process.cwd(), packageManager.lockFileBasename))) {
|
102
|
-
return packageManager.binName;
|
103
|
-
}
|
104
|
-
}
|
105
|
-
return undefined;
|
106
|
-
})();
|
107
|
-
install_dependencies: {
|
108
|
-
if (packageManagerBinName === undefined) {
|
109
|
-
break install_dependencies;
|
110
|
-
}
|
111
|
-
console.log(`Installing the new dependencies...`);
|
112
|
-
try {
|
113
|
-
external_child_process_.execSync(`${packageManagerBinName} install`, {
|
114
|
-
cwd: packageJsonDirPath,
|
115
|
-
stdio: "inherit"
|
116
|
-
});
|
117
|
-
}
|
118
|
-
catch (_a) {
|
119
|
-
console.log(source_default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
|
120
|
-
}
|
121
|
-
}
|
122
|
-
}
|
123
|
-
//# sourceMappingURL=npmInstall.js.map
|
124
|
-
// EXTERNAL MODULE: ./dist/bin/initialize-account-theme/copyBoilerplate.js
|
125
|
-
var copyBoilerplate = __webpack_require__(81434);
|
126
|
-
// EXTERNAL MODULE: ./dist/bin/tools/getThisCodebaseRootDirPath.js
|
127
|
-
var getThisCodebaseRootDirPath = __webpack_require__(58822);
|
128
|
-
;// CONCATENATED MODULE: ./dist/bin/initialize-account-theme/initializeAccountTheme_singlePage.js
|
129
|
-
|
42
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
43
|
+
/* harmony export */ "initializeAccountTheme_singlePage": () => (/* binding */ initializeAccountTheme_singlePage)
|
44
|
+
/* harmony export */ });
|
45
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(71017);
|
46
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
47
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(57147);
|
48
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_1__);
|
49
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(78818);
|
50
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_2__);
|
51
|
+
/* harmony import */ var _shared_getLatestsSemVersionedTag__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(97189);
|
52
|
+
/* harmony import */ var _tools_SemVer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(12171);
|
53
|
+
/* harmony import */ var make_fetch_happen__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9525);
|
54
|
+
/* harmony import */ var make_fetch_happen__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(make_fetch_happen__WEBPACK_IMPORTED_MODULE_5__);
|
55
|
+
/* harmony import */ var zod__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(52300);
|
56
|
+
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(29041);
|
57
|
+
/* harmony import */ var tsafe_is__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(16453);
|
58
|
+
/* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(38469);
|
59
|
+
/* harmony import */ var _tools_npmInstall__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(63046);
|
60
|
+
/* harmony import */ var _copyBoilerplate__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(81434);
|
130
61
|
|
131
62
|
|
132
63
|
|
@@ -139,44 +70,44 @@ var getThisCodebaseRootDirPath = __webpack_require__(58822);
|
|
139
70
|
|
140
71
|
|
141
72
|
|
142
|
-
(0,
|
73
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .h)();
|
143
74
|
async function initializeAccountTheme_singlePage(params) {
|
144
75
|
const { accountThemeSrcDirPath, buildContext } = params;
|
145
76
|
const OWNER = "keycloakify";
|
146
77
|
const REPO = "keycloak-account-ui";
|
147
|
-
const [semVersionedTag] = await (0,
|
78
|
+
const [semVersionedTag] = await (0,_shared_getLatestsSemVersionedTag__WEBPACK_IMPORTED_MODULE_3__/* .getLatestsSemVersionedTag */ ._)({
|
148
79
|
owner: OWNER,
|
149
80
|
repo: REPO,
|
150
81
|
count: 1,
|
151
82
|
doIgnoreReleaseCandidates: false,
|
152
83
|
buildContext
|
153
84
|
});
|
154
|
-
const dependencies = await
|
85
|
+
const dependencies = await make_fetch_happen__WEBPACK_IMPORTED_MODULE_5___default()(`https://raw.githubusercontent.com/${OWNER}/${REPO}/${semVersionedTag.tag}/dependencies.gen.json`, buildContext.fetchOptions)
|
155
86
|
.then(r => r.json())
|
156
87
|
.then((() => {
|
157
88
|
const zDependencies = (() => {
|
158
|
-
const zTargetType =
|
159
|
-
dependencies:
|
160
|
-
devDependencies:
|
89
|
+
const zTargetType = zod__WEBPACK_IMPORTED_MODULE_10__.z.object({
|
90
|
+
dependencies: zod__WEBPACK_IMPORTED_MODULE_10__.z.record(zod__WEBPACK_IMPORTED_MODULE_10__.z.string()),
|
91
|
+
devDependencies: zod__WEBPACK_IMPORTED_MODULE_10__.z.record(zod__WEBPACK_IMPORTED_MODULE_10__.z.string()).optional()
|
161
92
|
});
|
162
|
-
(0,
|
163
|
-
return (0,
|
93
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .h)();
|
94
|
+
return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_11__.id)(zTargetType);
|
164
95
|
})();
|
165
96
|
return o => zDependencies.parse(o);
|
166
97
|
})());
|
167
|
-
dependencies.dependencies["@keycloakify/keycloak-account-ui"] =
|
98
|
+
dependencies.dependencies["@keycloakify/keycloak-account-ui"] = _tools_SemVer__WEBPACK_IMPORTED_MODULE_4__/* .SemVer.stringify */ .h.stringify(semVersionedTag.version);
|
168
99
|
const parsedPackageJson = (() => {
|
169
100
|
const zParsedPackageJson = (() => {
|
170
|
-
const zTargetType =
|
171
|
-
dependencies:
|
172
|
-
devDependencies:
|
101
|
+
const zTargetType = zod__WEBPACK_IMPORTED_MODULE_10__.z.object({
|
102
|
+
dependencies: zod__WEBPACK_IMPORTED_MODULE_10__.z.record(zod__WEBPACK_IMPORTED_MODULE_10__.z.string()).optional(),
|
103
|
+
devDependencies: zod__WEBPACK_IMPORTED_MODULE_10__.z.record(zod__WEBPACK_IMPORTED_MODULE_10__.z.string()).optional()
|
173
104
|
});
|
174
|
-
(0,
|
175
|
-
return (0,
|
105
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .h)();
|
106
|
+
return (0,tsafe_id__WEBPACK_IMPORTED_MODULE_11__.id)(zTargetType);
|
176
107
|
})();
|
177
|
-
const parsedPackageJson = JSON.parse(
|
108
|
+
const parsedPackageJson = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(buildContext.packageJsonFilePath).toString("utf8"));
|
178
109
|
zParsedPackageJson.parse(parsedPackageJson);
|
179
|
-
(0,
|
110
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .h)((0,tsafe_is__WEBPACK_IMPORTED_MODULE_7__.is)(parsedPackageJson));
|
180
111
|
return parsedPackageJson;
|
181
112
|
})();
|
182
113
|
parsedPackageJson.dependencies = Object.assign(Object.assign({}, parsedPackageJson.dependencies), dependencies.dependencies);
|
@@ -184,25 +115,18 @@ async function initializeAccountTheme_singlePage(params) {
|
|
184
115
|
if (Object.keys(parsedPackageJson.devDependencies).length === 0) {
|
185
116
|
delete parsedPackageJson.devDependencies;
|
186
117
|
}
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
.toString("utf8"))["version"] === "0.0.0") {
|
191
|
-
//NOTE: Linked version
|
192
|
-
break run_npm_install;
|
193
|
-
}
|
194
|
-
npmInstall({ packageJsonDirPath: (0,external_path_.dirname)(buildContext.packageJsonFilePath) });
|
195
|
-
}
|
196
|
-
(0,copyBoilerplate/* copyBoilerplate */.T)({
|
118
|
+
fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(buildContext.packageJsonFilePath, JSON.stringify(parsedPackageJson, undefined, 4));
|
119
|
+
(0,_tools_npmInstall__WEBPACK_IMPORTED_MODULE_8__/* .npmInstall */ .c)({ packageJsonDirPath: (0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(buildContext.packageJsonFilePath) });
|
120
|
+
(0,_copyBoilerplate__WEBPACK_IMPORTED_MODULE_9__/* .copyBoilerplate */ .T)({
|
197
121
|
accountThemeType: "Single-Page",
|
198
122
|
accountThemeSrcDirPath
|
199
123
|
});
|
200
124
|
console.log([
|
201
|
-
|
202
|
-
`Using Account UI of Keycloak version: ${
|
203
|
-
`Directory created: ${
|
125
|
+
chalk__WEBPACK_IMPORTED_MODULE_2___default().green("The Single-Page account theme has been successfully initialized."),
|
126
|
+
`Using Account UI of Keycloak version: ${chalk__WEBPACK_IMPORTED_MODULE_2___default().bold(semVersionedTag.tag.split("-")[0])}`,
|
127
|
+
`Directory created: ${chalk__WEBPACK_IMPORTED_MODULE_2___default().bold((0,path__WEBPACK_IMPORTED_MODULE_0__.relative)(process.cwd(), accountThemeSrcDirPath))}`,
|
204
128
|
`Dependencies added to your project's package.json: `,
|
205
|
-
|
129
|
+
chalk__WEBPACK_IMPORTED_MODULE_2___default().bold(JSON.stringify(dependencies, null, 2))
|
206
130
|
].join("\n"));
|
207
131
|
}
|
208
132
|
//# sourceMappingURL=initializeAccountTheme_singlePage.js.map
|
@@ -563,6 +487,399 @@ var SemVer;
|
|
563
487
|
})(SemVer || (SemVer = {}));
|
564
488
|
//# sourceMappingURL=SemVer.js.map
|
565
489
|
|
490
|
+
/***/ }),
|
491
|
+
|
492
|
+
/***/ 89693:
|
493
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
494
|
+
|
495
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
496
|
+
/* harmony export */ "a": () => (/* binding */ rmSync)
|
497
|
+
/* harmony export */ });
|
498
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57147);
|
499
|
+
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
500
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(71017);
|
501
|
+
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
502
|
+
/* harmony import */ var _SemVer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(12171);
|
503
|
+
|
504
|
+
|
505
|
+
|
506
|
+
/**
|
507
|
+
* Polyfill of fs.rmSync(dirPath, { "recursive": true })
|
508
|
+
* For older version of Node
|
509
|
+
*/
|
510
|
+
function rmSync(dirPath, options) {
|
511
|
+
if (_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.compare */ .h.compare(_SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse(process.version), _SemVer__WEBPACK_IMPORTED_MODULE_2__/* .SemVer.parse */ .h.parse("14.14.0")) > 0) {
|
512
|
+
fs__WEBPACK_IMPORTED_MODULE_0__.rmSync(dirPath, options);
|
513
|
+
return;
|
514
|
+
}
|
515
|
+
const { force = true } = options;
|
516
|
+
if (force && !fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(dirPath)) {
|
517
|
+
return;
|
518
|
+
}
|
519
|
+
const removeDir_rec = (dirPath) => fs__WEBPACK_IMPORTED_MODULE_0__.readdirSync(dirPath).forEach(basename => {
|
520
|
+
const fileOrDirPath = (0,path__WEBPACK_IMPORTED_MODULE_1__.join)(dirPath, basename);
|
521
|
+
if (fs__WEBPACK_IMPORTED_MODULE_0__.lstatSync(fileOrDirPath).isDirectory()) {
|
522
|
+
removeDir_rec(fileOrDirPath);
|
523
|
+
return;
|
524
|
+
}
|
525
|
+
else {
|
526
|
+
fs__WEBPACK_IMPORTED_MODULE_0__.unlinkSync(fileOrDirPath);
|
527
|
+
}
|
528
|
+
});
|
529
|
+
removeDir_rec(dirPath);
|
530
|
+
}
|
531
|
+
//# sourceMappingURL=fs.rmSync.js.map
|
532
|
+
|
533
|
+
/***/ }),
|
534
|
+
|
535
|
+
/***/ 63046:
|
536
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
537
|
+
|
538
|
+
|
539
|
+
// EXPORTS
|
540
|
+
__webpack_require__.d(__webpack_exports__, {
|
541
|
+
"c": () => (/* binding */ npmInstall)
|
542
|
+
});
|
543
|
+
|
544
|
+
// EXTERNAL MODULE: external "fs"
|
545
|
+
var external_fs_ = __webpack_require__(57147);
|
546
|
+
// EXTERNAL MODULE: external "path"
|
547
|
+
var external_path_ = __webpack_require__(71017);
|
548
|
+
// EXTERNAL MODULE: external "child_process"
|
549
|
+
var external_child_process_ = __webpack_require__(32081);
|
550
|
+
// EXTERNAL MODULE: ./node_modules/chalk/source/index.js
|
551
|
+
var source = __webpack_require__(78818);
|
552
|
+
var source_default = /*#__PURE__*/__webpack_require__.n(source);
|
553
|
+
// EXTERNAL MODULE: ./node_modules/zod/lib/index.mjs
|
554
|
+
var lib = __webpack_require__(52300);
|
555
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/assert.mjs + 1 modules
|
556
|
+
var assert = __webpack_require__(29041);
|
557
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
|
558
|
+
var id = __webpack_require__(38469);
|
559
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/is.mjs
|
560
|
+
var is = __webpack_require__(16453);
|
561
|
+
;// CONCATENATED MODULE: ./node_modules/tsafe/esm/objectKeys.mjs
|
562
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
563
|
+
/** https://docs.tsafe.dev/objectKeys */
|
564
|
+
function objectKeys(o) {
|
565
|
+
return Object.keys(o);
|
566
|
+
}
|
567
|
+
|
568
|
+
|
569
|
+
//# sourceMappingURL=objectKeys.mjs.map
|
570
|
+
|
571
|
+
// EXTERNAL MODULE: ./dist/bin/tools/getAbsoluteAndInOsFormatPath.js
|
572
|
+
var getAbsoluteAndInOsFormatPath = __webpack_require__(84794);
|
573
|
+
// EXTERNAL MODULE: ./node_modules/tsafe/esm/exclude.mjs
|
574
|
+
var exclude = __webpack_require__(83101);
|
575
|
+
// EXTERNAL MODULE: ./dist/bin/tools/fs.rmSync.js
|
576
|
+
var fs_rmSync = __webpack_require__(89693);
|
577
|
+
;// CONCATENATED MODULE: ./dist/bin/tools/npmInstall.js
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
|
590
|
+
function npmInstall(params) {
|
591
|
+
const { packageJsonDirPath } = params;
|
592
|
+
const packageManagerBinName = (() => {
|
593
|
+
const packageMangers = [
|
594
|
+
{
|
595
|
+
binName: "yarn",
|
596
|
+
lockFileBasename: "yarn.lock"
|
597
|
+
},
|
598
|
+
{
|
599
|
+
binName: "npm",
|
600
|
+
lockFileBasename: "package-lock.json"
|
601
|
+
},
|
602
|
+
{
|
603
|
+
binName: "pnpm",
|
604
|
+
lockFileBasename: "pnpm-lock.yaml"
|
605
|
+
},
|
606
|
+
{
|
607
|
+
binName: "bun",
|
608
|
+
lockFileBasename: "bun.lockdb"
|
609
|
+
},
|
610
|
+
{
|
611
|
+
binName: "deno",
|
612
|
+
lockFileBasename: "deno.lock"
|
613
|
+
}
|
614
|
+
];
|
615
|
+
for (const packageManager of packageMangers) {
|
616
|
+
if (external_fs_.existsSync((0,external_path_.join)(packageJsonDirPath, packageManager.lockFileBasename)) ||
|
617
|
+
external_fs_.existsSync((0,external_path_.join)(process.cwd(), packageManager.lockFileBasename))) {
|
618
|
+
return packageManager.binName;
|
619
|
+
}
|
620
|
+
}
|
621
|
+
throw new Error("No lock file found, cannot tell which package manager to use for installing dependencies.");
|
622
|
+
})();
|
623
|
+
console.log(`Installing the new dependencies...`);
|
624
|
+
install_without_breaking_links: {
|
625
|
+
if (packageManagerBinName !== "yarn") {
|
626
|
+
break install_without_breaking_links;
|
627
|
+
}
|
628
|
+
const garronejLinkInfos = getGarronejLinkInfos({ packageJsonDirPath });
|
629
|
+
if (garronejLinkInfos === undefined) {
|
630
|
+
break install_without_breaking_links;
|
631
|
+
}
|
632
|
+
console.log(source_default().green("Installing in a way that won't break the links..."));
|
633
|
+
installWithoutBreakingLinks({
|
634
|
+
packageJsonDirPath,
|
635
|
+
garronejLinkInfos
|
636
|
+
});
|
637
|
+
return;
|
638
|
+
}
|
639
|
+
try {
|
640
|
+
external_child_process_.execSync(`${packageManagerBinName} install`, {
|
641
|
+
cwd: packageJsonDirPath,
|
642
|
+
stdio: "inherit"
|
643
|
+
});
|
644
|
+
}
|
645
|
+
catch (_a) {
|
646
|
+
console.log(source_default().yellow(`\`${packageManagerBinName} install\` failed, continuing anyway...`));
|
647
|
+
}
|
648
|
+
}
|
649
|
+
function getGarronejLinkInfos(params) {
|
650
|
+
const { packageJsonDirPath } = params;
|
651
|
+
const nodeModuleDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
|
652
|
+
if (!external_fs_.existsSync(nodeModuleDirPath)) {
|
653
|
+
return undefined;
|
654
|
+
}
|
655
|
+
const linkedModuleNames = [];
|
656
|
+
let yarnHomeDirPath = undefined;
|
657
|
+
const getIsLinkedByGarronejScript = (path) => {
|
658
|
+
let realPath;
|
659
|
+
try {
|
660
|
+
realPath = external_fs_.readlinkSync(path);
|
661
|
+
}
|
662
|
+
catch (_a) {
|
663
|
+
return false;
|
664
|
+
}
|
665
|
+
const doesIncludeYarnHome = realPath.includes(".yarn_home");
|
666
|
+
if (!doesIncludeYarnHome) {
|
667
|
+
return false;
|
668
|
+
}
|
669
|
+
set_yarnHomeDirPath: {
|
670
|
+
if (yarnHomeDirPath !== undefined) {
|
671
|
+
break set_yarnHomeDirPath;
|
672
|
+
}
|
673
|
+
const [firstElement] = (0,getAbsoluteAndInOsFormatPath/* getAbsoluteAndInOsFormatPath */.c)({
|
674
|
+
pathIsh: realPath,
|
675
|
+
cwd: (0,external_path_.dirname)(path)
|
676
|
+
}).split(".yarn_home");
|
677
|
+
yarnHomeDirPath = (0,external_path_.join)(firstElement, ".yarn_home");
|
678
|
+
}
|
679
|
+
return true;
|
680
|
+
};
|
681
|
+
for (const basename of external_fs_.readdirSync(nodeModuleDirPath)) {
|
682
|
+
const path = (0,external_path_.join)(nodeModuleDirPath, basename);
|
683
|
+
if (external_fs_.lstatSync(path).isSymbolicLink()) {
|
684
|
+
if (basename.startsWith("@")) {
|
685
|
+
return undefined;
|
686
|
+
}
|
687
|
+
if (!getIsLinkedByGarronejScript(path)) {
|
688
|
+
return undefined;
|
689
|
+
}
|
690
|
+
linkedModuleNames.push(basename);
|
691
|
+
continue;
|
692
|
+
}
|
693
|
+
if (!external_fs_.lstatSync(path).isDirectory()) {
|
694
|
+
continue;
|
695
|
+
}
|
696
|
+
if (basename.startsWith("@")) {
|
697
|
+
for (const subBasename of external_fs_.readdirSync(path)) {
|
698
|
+
const subPath = (0,external_path_.join)(path, subBasename);
|
699
|
+
if (!external_fs_.lstatSync(subPath).isSymbolicLink()) {
|
700
|
+
continue;
|
701
|
+
}
|
702
|
+
if (!getIsLinkedByGarronejScript(subPath)) {
|
703
|
+
return undefined;
|
704
|
+
}
|
705
|
+
linkedModuleNames.push(`${basename}/${subBasename}`);
|
706
|
+
}
|
707
|
+
}
|
708
|
+
}
|
709
|
+
if (yarnHomeDirPath === undefined) {
|
710
|
+
return undefined;
|
711
|
+
}
|
712
|
+
return { linkedModuleNames, yarnHomeDirPath };
|
713
|
+
}
|
714
|
+
function installWithoutBreakingLinks(params) {
|
715
|
+
const { packageJsonDirPath, garronejLinkInfos: { linkedModuleNames, yarnHomeDirPath } } = params;
|
716
|
+
const parsedPackageJson = (() => {
|
717
|
+
const packageJsonFilePath = (0,external_path_.join)(packageJsonDirPath, "package.json");
|
718
|
+
const zParsedPackageJson = (() => {
|
719
|
+
const zTargetType = lib.z.object({
|
720
|
+
scripts: lib.z.record(lib.z.string()).optional()
|
721
|
+
});
|
722
|
+
assert/* assert */.h;
|
723
|
+
return (0,id.id)(zTargetType);
|
724
|
+
})();
|
725
|
+
const parsedPackageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
|
726
|
+
zParsedPackageJson.parse(parsedPackageJson);
|
727
|
+
(0,assert/* assert */.h)((0,is.is)(parsedPackageJson));
|
728
|
+
return parsedPackageJson;
|
729
|
+
})();
|
730
|
+
const isImplementedScriptByName = {
|
731
|
+
postinstall: false,
|
732
|
+
prepare: false
|
733
|
+
};
|
734
|
+
delete_postinstall_script: {
|
735
|
+
if (parsedPackageJson.scripts === undefined) {
|
736
|
+
break delete_postinstall_script;
|
737
|
+
}
|
738
|
+
for (const scriptName of objectKeys(isImplementedScriptByName)) {
|
739
|
+
if (parsedPackageJson.scripts[scriptName] === undefined) {
|
740
|
+
continue;
|
741
|
+
}
|
742
|
+
isImplementedScriptByName[scriptName] = true;
|
743
|
+
delete parsedPackageJson.scripts[scriptName];
|
744
|
+
}
|
745
|
+
}
|
746
|
+
const tmpProjectDirPath = (0,external_path_.join)(yarnHomeDirPath, "tmpProject");
|
747
|
+
if (external_fs_.existsSync(tmpProjectDirPath)) {
|
748
|
+
(0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
|
749
|
+
}
|
750
|
+
external_fs_.mkdirSync(tmpProjectDirPath, { recursive: true });
|
751
|
+
external_fs_.writeFileSync((0,external_path_.join)(tmpProjectDirPath, "package.json"), JSON.stringify(parsedPackageJson, undefined, 4));
|
752
|
+
const YARN_LOCK = "yarn.lock";
|
753
|
+
external_fs_.copyFileSync((0,external_path_.join)(packageJsonDirPath, YARN_LOCK), (0,external_path_.join)(tmpProjectDirPath, YARN_LOCK));
|
754
|
+
external_child_process_.execSync(`yarn install`, {
|
755
|
+
cwd: tmpProjectDirPath,
|
756
|
+
stdio: "inherit"
|
757
|
+
});
|
758
|
+
// NOTE: Moving the modules from the tmp project to the actual project
|
759
|
+
// without messing up the links.
|
760
|
+
{
|
761
|
+
const { getAreSameVersions } = (() => {
|
762
|
+
const zParsedPackageJson = (() => {
|
763
|
+
const zTargetType = lib.z.object({
|
764
|
+
version: lib.z.string()
|
765
|
+
});
|
766
|
+
assert/* assert */.h;
|
767
|
+
return (0,id.id)(zTargetType);
|
768
|
+
})();
|
769
|
+
function readVersion(params) {
|
770
|
+
const { moduleDirPath } = params;
|
771
|
+
const packageJsonFilePath = (0,external_path_.join)(moduleDirPath, "package.json");
|
772
|
+
const packageJson = JSON.parse(external_fs_.readFileSync(packageJsonFilePath).toString("utf8"));
|
773
|
+
zParsedPackageJson.parse(packageJson);
|
774
|
+
(0,assert/* assert */.h)((0,is.is)(packageJson));
|
775
|
+
return packageJson.version;
|
776
|
+
}
|
777
|
+
function getAreSameVersions(params) {
|
778
|
+
const { moduleDirPath_a, moduleDirPath_b } = params;
|
779
|
+
return (readVersion({ moduleDirPath: moduleDirPath_a }) ===
|
780
|
+
readVersion({ moduleDirPath: moduleDirPath_b }));
|
781
|
+
}
|
782
|
+
return { getAreSameVersions };
|
783
|
+
})();
|
784
|
+
const nodeModulesDirPath_tmpProject = (0,external_path_.join)(tmpProjectDirPath, "node_modules");
|
785
|
+
const nodeModulesDirPath = (0,external_path_.join)(packageJsonDirPath, "node_modules");
|
786
|
+
const modulePaths = external_fs_.readdirSync(nodeModulesDirPath_tmpProject)
|
787
|
+
.map(basename => {
|
788
|
+
if (basename.startsWith(".")) {
|
789
|
+
return undefined;
|
790
|
+
}
|
791
|
+
const path = (0,external_path_.join)(nodeModulesDirPath_tmpProject, basename);
|
792
|
+
if (basename.startsWith("@")) {
|
793
|
+
return external_fs_.readdirSync(path)
|
794
|
+
.map(subBasename => {
|
795
|
+
if (subBasename.startsWith(".")) {
|
796
|
+
return undefined;
|
797
|
+
}
|
798
|
+
const subPath = (0,external_path_.join)(path, subBasename);
|
799
|
+
if (!external_fs_.lstatSync(subPath).isDirectory()) {
|
800
|
+
return undefined;
|
801
|
+
}
|
802
|
+
return {
|
803
|
+
moduleName: `${basename}/${subBasename}`,
|
804
|
+
moduleDirPath_tmpProject: subPath,
|
805
|
+
moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename, subBasename)
|
806
|
+
};
|
807
|
+
})
|
808
|
+
.filter((0,exclude/* exclude */.D)(undefined));
|
809
|
+
}
|
810
|
+
if (!external_fs_.lstatSync(path).isDirectory()) {
|
811
|
+
return undefined;
|
812
|
+
}
|
813
|
+
return [
|
814
|
+
{
|
815
|
+
moduleName: basename,
|
816
|
+
moduleDirPath_tmpProject: path,
|
817
|
+
moduleDirPath: (0,external_path_.join)(nodeModulesDirPath, basename)
|
818
|
+
}
|
819
|
+
];
|
820
|
+
})
|
821
|
+
.filter((0,exclude/* exclude */.D)(undefined))
|
822
|
+
.flat();
|
823
|
+
for (const { moduleName, moduleDirPath, moduleDirPath_tmpProject } of modulePaths) {
|
824
|
+
if (linkedModuleNames.includes(moduleName)) {
|
825
|
+
continue;
|
826
|
+
}
|
827
|
+
let doesTargetModuleExist = false;
|
828
|
+
skip_condition: {
|
829
|
+
if (!external_fs_.existsSync(moduleDirPath)) {
|
830
|
+
break skip_condition;
|
831
|
+
}
|
832
|
+
doesTargetModuleExist = true;
|
833
|
+
const areSameVersions = getAreSameVersions({
|
834
|
+
moduleDirPath_a: moduleDirPath,
|
835
|
+
moduleDirPath_b: moduleDirPath_tmpProject
|
836
|
+
});
|
837
|
+
if (!areSameVersions) {
|
838
|
+
break skip_condition;
|
839
|
+
}
|
840
|
+
continue;
|
841
|
+
}
|
842
|
+
if (doesTargetModuleExist) {
|
843
|
+
(0,fs_rmSync/* rmSync */.a)(moduleDirPath, { recursive: true });
|
844
|
+
}
|
845
|
+
{
|
846
|
+
const dirPath = (0,external_path_.dirname)(moduleDirPath);
|
847
|
+
if (!external_fs_.existsSync(dirPath)) {
|
848
|
+
external_fs_.mkdirSync(dirPath, { recursive: true });
|
849
|
+
}
|
850
|
+
}
|
851
|
+
external_fs_.renameSync(moduleDirPath_tmpProject, moduleDirPath);
|
852
|
+
}
|
853
|
+
move_bin: {
|
854
|
+
const binDirPath_tmpProject = (0,external_path_.join)(nodeModulesDirPath_tmpProject, ".bin");
|
855
|
+
const binDirPath = (0,external_path_.join)(nodeModulesDirPath, ".bin");
|
856
|
+
if (!external_fs_.existsSync(binDirPath_tmpProject)) {
|
857
|
+
break move_bin;
|
858
|
+
}
|
859
|
+
for (const basename of external_fs_.readdirSync(binDirPath_tmpProject)) {
|
860
|
+
const path_tmpProject = (0,external_path_.join)(binDirPath_tmpProject, basename);
|
861
|
+
const path = (0,external_path_.join)(binDirPath, basename);
|
862
|
+
if (external_fs_.existsSync(path)) {
|
863
|
+
continue;
|
864
|
+
}
|
865
|
+
external_fs_.renameSync(path_tmpProject, path);
|
866
|
+
}
|
867
|
+
}
|
868
|
+
}
|
869
|
+
external_fs_.cpSync((0,external_path_.join)(tmpProjectDirPath, YARN_LOCK), (0,external_path_.join)(packageJsonDirPath, YARN_LOCK));
|
870
|
+
(0,fs_rmSync/* rmSync */.a)(tmpProjectDirPath, { recursive: true });
|
871
|
+
for (const scriptName of objectKeys(isImplementedScriptByName)) {
|
872
|
+
if (!isImplementedScriptByName[scriptName]) {
|
873
|
+
continue;
|
874
|
+
}
|
875
|
+
external_child_process_.execSync(`yarn run ${scriptName}`, {
|
876
|
+
cwd: packageJsonDirPath,
|
877
|
+
stdio: "inherit"
|
878
|
+
});
|
879
|
+
}
|
880
|
+
}
|
881
|
+
//# sourceMappingURL=npmInstall.js.map
|
882
|
+
|
566
883
|
/***/ })
|
567
884
|
|
568
885
|
};
|