@sap-ux/project-access 1.29.14 → 1.29.16
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/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -1
- package/dist/project/module-loader.js +20 -2
- package/package.json +2 -2
package/dist/constants.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const FileName: {
|
|
|
16
16
|
readonly Ui5LocalYaml: "ui5-local.yaml";
|
|
17
17
|
readonly Ui5MockYaml: "ui5-mock.yaml";
|
|
18
18
|
readonly UI5DeployYaml: "ui5-deploy.yaml";
|
|
19
|
+
readonly PackageLock: "package-lock.json";
|
|
19
20
|
};
|
|
20
21
|
export declare const DirName: {
|
|
21
22
|
readonly Changes: "changes";
|
package/dist/constants.js
CHANGED
|
@@ -20,7 +20,8 @@ exports.FileName = {
|
|
|
20
20
|
Ui5Yaml: 'ui5.yaml',
|
|
21
21
|
Ui5LocalYaml: 'ui5-local.yaml',
|
|
22
22
|
Ui5MockYaml: 'ui5-mock.yaml',
|
|
23
|
-
UI5DeployYaml: 'ui5-deploy.yaml'
|
|
23
|
+
UI5DeployYaml: 'ui5-deploy.yaml',
|
|
24
|
+
PackageLock: 'package-lock.json'
|
|
24
25
|
};
|
|
25
26
|
exports.DirName = {
|
|
26
27
|
Changes: 'changes',
|
|
@@ -83,17 +83,35 @@ async function getModule(module, version, options) {
|
|
|
83
83
|
const logger = options?.logger;
|
|
84
84
|
const moduleDirectory = (0, path_1.join)(constants_1.moduleCacheRoot, module, version);
|
|
85
85
|
const modulePackagePath = (0, path_1.join)(moduleDirectory, constants_1.FileName.Package);
|
|
86
|
+
const installCommand = ['install', '--prefix', moduleDirectory, `${module}@${version}`];
|
|
86
87
|
if (!(0, fs_1.existsSync)(modulePackagePath)) {
|
|
87
88
|
if ((0, fs_1.existsSync)(moduleDirectory)) {
|
|
88
89
|
await (0, promises_1.rm)(moduleDirectory, { recursive: true });
|
|
89
90
|
}
|
|
90
91
|
await (0, promises_1.mkdir)(moduleDirectory, { recursive: true });
|
|
91
|
-
await (0, command_1.execNpmCommand)(
|
|
92
|
+
await (0, command_1.execNpmCommand)(installCommand, {
|
|
92
93
|
cwd: moduleDirectory,
|
|
93
94
|
logger
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
+
let resolvedModule;
|
|
98
|
+
try {
|
|
99
|
+
resolvedModule = await loadModuleFromProject(moduleDirectory, module);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
logger?.error(`Failed to load module: ${module}. Attempting to fix installation.`);
|
|
103
|
+
const modulePackageLockPath = (0, path_1.join)(moduleDirectory, constants_1.FileName.PackageLock);
|
|
104
|
+
// If 'package-lock.json' file exists then use 'npm ci', otherwise try reinstall
|
|
105
|
+
const command = (0, fs_1.existsSync)(modulePackageLockPath) ? ['ci'] : installCommand;
|
|
106
|
+
// Run reinstall only if the first attempt fails
|
|
107
|
+
await (0, command_1.execNpmCommand)(command, {
|
|
108
|
+
cwd: moduleDirectory,
|
|
109
|
+
logger
|
|
110
|
+
});
|
|
111
|
+
// Retry loading the module
|
|
112
|
+
resolvedModule = await loadModuleFromProject(moduleDirectory, module);
|
|
113
|
+
}
|
|
114
|
+
return resolvedModule;
|
|
97
115
|
}
|
|
98
116
|
/**
|
|
99
117
|
* Delete a module from cache.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.16",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"mem-fs-editor": "9.4.0",
|
|
31
31
|
"semver": "7.5.4",
|
|
32
32
|
"@sap-ux/i18n": "0.2.3",
|
|
33
|
-
"@sap-ux/ui5-config": "0.26.
|
|
33
|
+
"@sap-ux/ui5-config": "0.26.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/mem-fs": "1.1.2",
|