@sap-ux/cap-config-writer 0.2.16 → 0.2.18
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/cap-config/index.d.ts +11 -0
- package/dist/cap-config/index.js +12 -3
- package/dist/cap-config/types.d.ts +19 -0
- package/dist/cap-config/types.js +3 -0
- package/dist/index.d.ts +1 -0
- package/package.json +2 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Editor } from 'mem-fs-editor';
|
|
2
2
|
export { satisfiesMinCdsVersion } from './package-json';
|
|
3
|
+
import type { CdsUi5PluginInfo } from './types';
|
|
3
4
|
/**
|
|
4
5
|
* Enable workspace and cds-plugin-ui5 for given CAP project.
|
|
5
6
|
*
|
|
@@ -10,10 +11,20 @@ export { satisfiesMinCdsVersion } from './package-json';
|
|
|
10
11
|
export declare function enableCdsUi5Plugin(basePath: string, fs?: Editor): Promise<Editor>;
|
|
11
12
|
/**
|
|
12
13
|
* Check if cds-plugin-ui5 is enabled on a CAP project. Checks also all prerequisites, like minimum @sap/cds version.
|
|
14
|
+
* Overloaded function that returns detailed CAP plugin info.
|
|
13
15
|
*
|
|
14
16
|
* @param basePath - root path of the CAP project, where package.json is located
|
|
15
17
|
* @param [fs] - optional: the memfs editor instance
|
|
16
18
|
* @returns true: cds-plugin-ui5 and all prerequisites are fulfilled; false: cds-plugin-ui5 is not enabled or not all prerequisites are fulfilled
|
|
17
19
|
*/
|
|
18
20
|
export declare function checkCdsUi5PluginEnabled(basePath: string, fs?: Editor): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Check if cds-plugin-ui5 is enabled on a CAP project. Checks also all prerequisites, like minimum @sap/cds version.
|
|
23
|
+
*
|
|
24
|
+
* @param basePath - root path of the CAP project, where package.json is located
|
|
25
|
+
* @param [fs] - optional: the memfs editor instance
|
|
26
|
+
* @param [moreInfo] if true return an object specifying detailed info about the cds and workspace state
|
|
27
|
+
* @returns false if package.json is not found at specified path or {@link CdsUi5PluginInfo} with additional info
|
|
28
|
+
*/
|
|
29
|
+
export declare function checkCdsUi5PluginEnabled(basePath: string, fs?: Editor, moreInfo?: boolean): Promise<boolean | CdsUi5PluginInfo>;
|
|
19
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cap-config/index.js
CHANGED
|
@@ -44,9 +44,11 @@ exports.enableCdsUi5Plugin = enableCdsUi5Plugin;
|
|
|
44
44
|
*
|
|
45
45
|
* @param basePath - root path of the CAP project, where package.json is located
|
|
46
46
|
* @param [fs] - optional: the memfs editor instance
|
|
47
|
-
* @
|
|
47
|
+
* @param [moreInfo] if true return an object specifying detailed info about the cds and workspace state
|
|
48
|
+
* @returns false if package.json is not found at specified path or {@link CdsUi5PluginInfo} with additional info or true if
|
|
49
|
+
* cds-plugin-ui5 and all prerequisites are fulfilled
|
|
48
50
|
*/
|
|
49
|
-
function checkCdsUi5PluginEnabled(basePath, fs) {
|
|
51
|
+
function checkCdsUi5PluginEnabled(basePath, fs, moreInfo = false) {
|
|
50
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
53
|
if (!fs) {
|
|
52
54
|
fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
|
|
@@ -57,7 +59,14 @@ function checkCdsUi5PluginEnabled(basePath, fs) {
|
|
|
57
59
|
}
|
|
58
60
|
const packageJson = fs.readJSON(packageJsonPath);
|
|
59
61
|
const { workspaceEnabled } = yield (0, package_json_1.getWorkspaceInfo)(basePath, packageJson);
|
|
60
|
-
|
|
62
|
+
const cdsInfo = {
|
|
63
|
+
hasMinCdsVersion: (0, package_json_1.satisfiesMinCdsVersion)(packageJson),
|
|
64
|
+
isWorkspaceEnabled: workspaceEnabled,
|
|
65
|
+
hasCdsUi5Plugin: (0, package_json_1.hasCdsPluginUi5)(packageJson),
|
|
66
|
+
isCdsUi5PluginEnabled: false
|
|
67
|
+
};
|
|
68
|
+
cdsInfo.isCdsUi5PluginEnabled = cdsInfo.hasMinCdsVersion && cdsInfo.isWorkspaceEnabled && cdsInfo.hasCdsUi5Plugin;
|
|
69
|
+
return moreInfo ? cdsInfo : cdsInfo.isCdsUi5PluginEnabled;
|
|
61
70
|
});
|
|
62
71
|
}
|
|
63
72
|
exports.checkCdsUi5PluginEnabled = checkCdsUi5PluginEnabled;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CdsUi5PluginInfo = {
|
|
2
|
+
/**
|
|
3
|
+
* Convienience property. The CDS UI5 plugin is considered enabled if `hasCdsUi5Plugin`, `hasMinCdsVersion`, `isWorkspaceEnabled` are all true.
|
|
4
|
+
*/
|
|
5
|
+
isCdsUi5PluginEnabled: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* True if the CDS version satisfies the minimum supported CDS version
|
|
8
|
+
*/
|
|
9
|
+
hasMinCdsVersion: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* True if NPM workspaces are enabled at the root of a CAP project
|
|
12
|
+
*/
|
|
13
|
+
isWorkspaceEnabled: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* True if the CDS ui5 plugin is specified as a dependency
|
|
16
|
+
*/
|
|
17
|
+
hasCdsUi5Plugin: boolean;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/cap-config-writer",
|
|
3
3
|
"description": "Add or update configuration for SAP CAP projects",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.18",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -19,11 +19,10 @@
|
|
|
19
19
|
"!dist/**/*.map"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"i18next": "20.6.1",
|
|
23
22
|
"mem-fs": "2.1.0",
|
|
24
23
|
"mem-fs-editor": "9.4.0",
|
|
25
24
|
"semver": "7.5.4",
|
|
26
|
-
"@sap-ux/project-access": "1.17.
|
|
25
|
+
"@sap-ux/project-access": "1.17.6"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
28
|
"@types/mem-fs": "1.1.2",
|