@sap-ux/project-access 1.22.3 → 1.23.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/dist/file/file-access.js +42 -65
- package/dist/file/file-search.js +19 -34
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/library/helpers.js +51 -72
- package/dist/project/access.js +30 -43
- package/dist/project/cap.js +273 -322
- package/dist/project/dependencies.js +9 -21
- package/dist/project/i18n/i18n.js +16 -29
- package/dist/project/i18n/read.js +30 -43
- package/dist/project/i18n/write.js +46 -58
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +3 -1
- package/dist/project/info.js +109 -134
- package/dist/project/module-loader.js +12 -23
- package/dist/project/mta.js +12 -23
- package/dist/project/script.js +8 -19
- package/dist/project/search.js +223 -261
- package/dist/project/service.d.ts +9 -1
- package/dist/project/service.js +29 -32
- package/dist/project/ui5-config.js +18 -32
- package/package.json +4 -4
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.addPackageDevDependency = exports.getNodeModulesPath = exports.hasDependency = void 0;
|
|
13
4
|
const fs_1 = require("fs");
|
|
@@ -21,7 +12,7 @@ const file_1 = require("../file");
|
|
|
21
12
|
* @param dependency - name of the dependency
|
|
22
13
|
* @returns - true: has dependency; false: no dependency
|
|
23
14
|
*/
|
|
24
|
-
const hasDependency = (packageJson, dependency) =>
|
|
15
|
+
const hasDependency = (packageJson, dependency) => !!(packageJson.dependencies?.[dependency] ?? packageJson.devDependencies?.[dependency]);
|
|
25
16
|
exports.hasDependency = hasDependency;
|
|
26
17
|
/**
|
|
27
18
|
* Returns path to folder that hosts 'node_modules' used by project.
|
|
@@ -61,17 +52,14 @@ exports.getNodeModulesPath = getNodeModulesPath;
|
|
|
61
52
|
* @param depVersion - the dependency version
|
|
62
53
|
* @param fs - optional memfs editor instance
|
|
63
54
|
*/
|
|
64
|
-
function addPackageDevDependency(basePath, depName, depVersion, fs) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
packageJson.devDependencies =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
yield (0, file_1.updatePackageJSON)(filePath, packageJson, fs);
|
|
74
|
-
});
|
|
55
|
+
async function addPackageDevDependency(basePath, depName, depVersion, fs) {
|
|
56
|
+
const filePath = (0, path_1.join)(basePath, constants_1.FileName.Package);
|
|
57
|
+
const packageJson = await (0, file_1.readJSON)(filePath, fs);
|
|
58
|
+
packageJson.devDependencies = packageJson.devDependencies ?? {};
|
|
59
|
+
if (!packageJson.devDependencies[depName]) {
|
|
60
|
+
packageJson.devDependencies[depName] = depVersion;
|
|
61
|
+
}
|
|
62
|
+
await (0, file_1.updatePackageJSON)(filePath, packageJson, fs);
|
|
75
63
|
}
|
|
76
64
|
exports.addPackageDevDependency = addPackageDevDependency;
|
|
77
65
|
//# sourceMappingURL=dependencies.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getRelativeI18nPropertiesPaths = exports.getI18nPropertiesPaths = void 0;
|
|
13
4
|
const path_1 = require("path");
|
|
@@ -19,22 +10,20 @@ const file_1 = require("../../file");
|
|
|
19
10
|
* @param manifest - optionally, parsed content of manifest.json, pass to avoid reading it again.
|
|
20
11
|
* @returns - absolute paths to i18n.properties
|
|
21
12
|
*/
|
|
22
|
-
function getI18nPropertiesPaths(manifestPath, manifest) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
13
|
+
async function getI18nPropertiesPaths(manifestPath, manifest) {
|
|
14
|
+
const parsedManifest = manifest ?? (await (0, file_1.readJSON)(manifestPath));
|
|
15
|
+
const manifestFolder = (0, path_1.dirname)(manifestPath);
|
|
16
|
+
const relativeI18nPropertiesPaths = getRelativeI18nPropertiesPaths(parsedManifest);
|
|
17
|
+
const i18nPropertiesPaths = {
|
|
18
|
+
'sap.app': (0, path_1.join)(manifestFolder, relativeI18nPropertiesPaths['sap.app']),
|
|
19
|
+
models: {}
|
|
20
|
+
};
|
|
21
|
+
for (const modelKey in relativeI18nPropertiesPaths.models) {
|
|
22
|
+
i18nPropertiesPaths.models[modelKey] = {
|
|
23
|
+
path: (0, path_1.join)(manifestFolder, relativeI18nPropertiesPaths.models[modelKey].path)
|
|
30
24
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
path: (0, path_1.join)(manifestFolder, relativeI18nPropertiesPaths.models[modelKey].path)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return i18nPropertiesPaths;
|
|
37
|
-
});
|
|
25
|
+
}
|
|
26
|
+
return i18nPropertiesPaths;
|
|
38
27
|
}
|
|
39
28
|
exports.getI18nPropertiesPaths = getI18nPropertiesPaths;
|
|
40
29
|
/**
|
|
@@ -63,12 +52,11 @@ exports.getRelativeI18nPropertiesPaths = getRelativeI18nPropertiesPaths;
|
|
|
63
52
|
* @returns - path to i18n.properties file
|
|
64
53
|
*/
|
|
65
54
|
function getI18nAppPath(manifest) {
|
|
66
|
-
var _a, _b;
|
|
67
55
|
const defaultPath = (0, path_1.join)('i18n/i18n.properties');
|
|
68
|
-
if (typeof
|
|
56
|
+
if (typeof manifest?.['sap.app']?.i18n === 'string') {
|
|
69
57
|
return (0, path_1.join)(manifest['sap.app'].i18n);
|
|
70
58
|
}
|
|
71
|
-
if (typeof
|
|
59
|
+
if (typeof manifest?.['sap.app']?.i18n === 'object') {
|
|
72
60
|
// bundleName wins over `bundleUrl`
|
|
73
61
|
if ('bundleName' in manifest['sap.app'].i18n) {
|
|
74
62
|
// module name is in dot notation
|
|
@@ -97,9 +85,8 @@ function getI18nAppPath(manifest) {
|
|
|
97
85
|
* @returns - paths to i18n.properties file from models
|
|
98
86
|
*/
|
|
99
87
|
function getI18nModelPaths(manifest) {
|
|
100
|
-
var _a, _b;
|
|
101
88
|
const result = {};
|
|
102
|
-
const models =
|
|
89
|
+
const models = manifest?.['sap.ui5']?.models ?? {};
|
|
103
90
|
const resourceModelKeys = Object.keys(models).filter((key) => models[key].type === 'sap.ui.model.resource.ResourceModel');
|
|
104
91
|
for (const modelKey of resourceModelKeys) {
|
|
105
92
|
const i18nModel = models[modelKey];
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getCapI18nFolderNames = exports.getI18nBundles = void 0;
|
|
13
4
|
const i18n_1 = require("@sap-ux/i18n");
|
|
@@ -36,41 +27,39 @@ function addToErrors(result, key, error) {
|
|
|
36
27
|
* When calling this function, adding or removing a CDS file in memory or changing CDS configuration will not be considered until present on real file system.
|
|
37
28
|
* @returns i18n bundles or exception captured in optional errors object
|
|
38
29
|
*/
|
|
39
|
-
function getI18nBundles(root, i18nPropertiesPaths, projectType, fs) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
async function getI18nBundles(root, i18nPropertiesPaths, projectType, fs) {
|
|
31
|
+
const result = {
|
|
32
|
+
'sap.app': {},
|
|
33
|
+
models: {},
|
|
34
|
+
service: {}
|
|
35
|
+
};
|
|
36
|
+
try {
|
|
37
|
+
result['sap.app'] = await (0, i18n_1.getPropertiesI18nBundle)(i18nPropertiesPaths['sap.app'], fs);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
addToErrors(result, 'sap.app', error);
|
|
41
|
+
}
|
|
42
|
+
for (const key of Object.keys(i18nPropertiesPaths.models)) {
|
|
46
43
|
try {
|
|
47
|
-
result[
|
|
44
|
+
result.models[key] = await (0, i18n_1.getPropertiesI18nBundle)(i18nPropertiesPaths.models[key].path, fs);
|
|
48
45
|
}
|
|
49
46
|
catch (error) {
|
|
50
|
-
|
|
47
|
+
// add models key with empty model
|
|
48
|
+
result.models[key] = {};
|
|
49
|
+
addToErrors(result, `models.${key}`, error);
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
result.models[key] = {};
|
|
59
|
-
addToErrors(result, `models.${key}`, error);
|
|
60
|
-
}
|
|
51
|
+
}
|
|
52
|
+
if (projectType === 'CAPJava' || projectType === 'CAPNodejs') {
|
|
53
|
+
try {
|
|
54
|
+
const env = await (0, __1.getCapEnvironment)(root);
|
|
55
|
+
const cdsFiles = await (0, __1.getCdsFiles)(root, true);
|
|
56
|
+
result.service = await (0, i18n_1.getCapI18nBundle)(root, env, cdsFiles, fs);
|
|
61
57
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const env = yield (0, __1.getCapEnvironment)(root);
|
|
65
|
-
const cdsFiles = yield (0, __1.getCdsFiles)(root, true);
|
|
66
|
-
result.service = yield (0, i18n_1.getCapI18nBundle)(root, env, cdsFiles, fs);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
addToErrors(result, 'service', error);
|
|
70
|
-
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
addToErrors(result, 'service', error);
|
|
71
60
|
}
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
74
63
|
}
|
|
75
64
|
exports.getI18nBundles = getI18nBundles;
|
|
76
65
|
/**
|
|
@@ -79,11 +68,9 @@ exports.getI18nBundles = getI18nBundles;
|
|
|
79
68
|
* @param root Project root.
|
|
80
69
|
* @returns ii18n folder names
|
|
81
70
|
*/
|
|
82
|
-
function getCapI18nFolderNames(root) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return (0, i18n_1.getI18nFolderNames)(environment);
|
|
86
|
-
});
|
|
71
|
+
async function getCapI18nFolderNames(root) {
|
|
72
|
+
const environment = await (0, __1.getCapEnvironment)(root);
|
|
73
|
+
return (0, i18n_1.getI18nFolderNames)(environment);
|
|
87
74
|
}
|
|
88
75
|
exports.getCapI18nFolderNames = getCapI18nFolderNames;
|
|
89
76
|
//# sourceMappingURL=read.js.map
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.createManifestI18nEntries = exports.createAnnotationI18nEntries = exports.createUI5I18nEntries = exports.createCapI18nEntries = void 0;
|
|
13
4
|
const i18n_1 = require("@sap-ux/i18n");
|
|
@@ -26,11 +17,9 @@ const promises_1 = require("fs/promises");
|
|
|
26
17
|
* When calling this function, adding or removing a CDS file in memory or changing CDS configuration will not be considered until present on real file system.
|
|
27
18
|
* @returns boolean or exception
|
|
28
19
|
*/
|
|
29
|
-
function createCapI18nEntries(root, filePath, newI18nEntries, fs) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return (0, i18n_1.createCapI18nEntries)(root, filePath, newI18nEntries, env, fs);
|
|
33
|
-
});
|
|
20
|
+
async function createCapI18nEntries(root, filePath, newI18nEntries, fs) {
|
|
21
|
+
const env = await (0, __1.getCapEnvironment)(root);
|
|
22
|
+
return (0, i18n_1.createCapI18nEntries)(root, filePath, newI18nEntries, env, fs);
|
|
34
23
|
}
|
|
35
24
|
exports.createCapI18nEntries = createCapI18nEntries;
|
|
36
25
|
/**
|
|
@@ -44,34 +33,39 @@ exports.createCapI18nEntries = createCapI18nEntries;
|
|
|
44
33
|
* @param fs optional `mem-fs-editor` instance. If provided, `mem-fs-editor` api is used instead of `fs` of node
|
|
45
34
|
* @returns boolean or exception
|
|
46
35
|
*/
|
|
47
|
-
function createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEntries, modelKey, fs) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// ensure folder for i18n exists
|
|
54
|
-
const dirPath = (0, path_1.dirname)(i18nFilePath);
|
|
55
|
-
if (!fs) {
|
|
56
|
-
// create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
|
|
57
|
-
yield (0, promises_1.mkdir)(dirPath, { recursive: true });
|
|
58
|
-
}
|
|
59
|
-
return (0, i18n_1.createPropertiesI18nEntries)(i18nFilePath, newEntries, root, fs);
|
|
60
|
-
}
|
|
61
|
-
// update manifest.json entry
|
|
62
|
-
const manifest = yield (0, file_1.readJSON)(manifestPath);
|
|
63
|
-
const models = Object.assign({}, (_b = manifest['sap.ui5']) === null || _b === void 0 ? void 0 : _b.models);
|
|
64
|
-
models[modelKey] = { type: 'sap.ui.model.resource.ResourceModel', uri: defaultPath };
|
|
65
|
-
const newContent = Object.assign(Object.assign({}, manifest), { 'sap.ui5': Object.assign(Object.assign({}, manifest['sap.ui5']), { models }) });
|
|
66
|
-
yield (0, file_1.writeFile)(manifestPath, JSON.stringify(newContent, undefined, 4), fs);
|
|
67
|
-
// make sure i18n folder exists
|
|
68
|
-
const dirPath = (0, path_1.dirname)(defaultPath);
|
|
36
|
+
async function createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEntries, modelKey, fs) {
|
|
37
|
+
const defaultPath = 'i18n/i18n.properties';
|
|
38
|
+
const i18nFilePath = i18nPropertiesPaths.models[modelKey]?.path;
|
|
39
|
+
if (i18nFilePath) {
|
|
40
|
+
// ensure folder for i18n exists
|
|
41
|
+
const dirPath = (0, path_1.dirname)(i18nFilePath);
|
|
69
42
|
if (!fs) {
|
|
70
43
|
// create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
|
|
71
|
-
|
|
44
|
+
await (0, promises_1.mkdir)(dirPath, { recursive: true });
|
|
72
45
|
}
|
|
73
|
-
return (0, i18n_1.createPropertiesI18nEntries)(
|
|
74
|
-
}
|
|
46
|
+
return (0, i18n_1.createPropertiesI18nEntries)(i18nFilePath, newEntries, root, fs);
|
|
47
|
+
}
|
|
48
|
+
// update manifest.json entry
|
|
49
|
+
const manifest = await (0, file_1.readJSON)(manifestPath);
|
|
50
|
+
const models = {
|
|
51
|
+
...manifest['sap.ui5']?.models
|
|
52
|
+
};
|
|
53
|
+
models[modelKey] = { type: 'sap.ui.model.resource.ResourceModel', uri: defaultPath };
|
|
54
|
+
const newContent = {
|
|
55
|
+
...manifest,
|
|
56
|
+
'sap.ui5': {
|
|
57
|
+
...manifest['sap.ui5'],
|
|
58
|
+
models
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
await (0, file_1.writeFile)(manifestPath, JSON.stringify(newContent, undefined, 4), fs);
|
|
62
|
+
// make sure i18n folder exists
|
|
63
|
+
const dirPath = (0, path_1.dirname)(defaultPath);
|
|
64
|
+
if (!fs) {
|
|
65
|
+
// create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
|
|
66
|
+
await (0, promises_1.mkdir)((0, path_1.join)(root, dirPath), { recursive: true });
|
|
67
|
+
}
|
|
68
|
+
return (0, i18n_1.createPropertiesI18nEntries)((0, path_1.join)(root, defaultPath), newEntries, root, fs);
|
|
75
69
|
}
|
|
76
70
|
/**
|
|
77
71
|
* Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist.
|
|
@@ -98,10 +92,8 @@ function createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEn
|
|
|
98
92
|
* }
|
|
99
93
|
* ```
|
|
100
94
|
*/
|
|
101
|
-
function createUI5I18nEntries(root, manifestPath, i18nPropertiesPaths, newEntries, modelKey, fs) {
|
|
102
|
-
return
|
|
103
|
-
return createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEntries, modelKey, fs);
|
|
104
|
-
});
|
|
95
|
+
async function createUI5I18nEntries(root, manifestPath, i18nPropertiesPaths, newEntries, modelKey, fs) {
|
|
96
|
+
return createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEntries, modelKey, fs);
|
|
105
97
|
}
|
|
106
98
|
exports.createUI5I18nEntries = createUI5I18nEntries;
|
|
107
99
|
/**
|
|
@@ -128,10 +120,8 @@ exports.createUI5I18nEntries = createUI5I18nEntries;
|
|
|
128
120
|
* }
|
|
129
121
|
* ```
|
|
130
122
|
*/
|
|
131
|
-
function createAnnotationI18nEntries(root, manifestPath, i18nPropertiesPaths, newEntries, fs) {
|
|
132
|
-
return
|
|
133
|
-
return createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEntries, '@i18n', fs);
|
|
134
|
-
});
|
|
123
|
+
async function createAnnotationI18nEntries(root, manifestPath, i18nPropertiesPaths, newEntries, fs) {
|
|
124
|
+
return createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths, newEntries, '@i18n', fs);
|
|
135
125
|
}
|
|
136
126
|
exports.createAnnotationI18nEntries = createAnnotationI18nEntries;
|
|
137
127
|
/**
|
|
@@ -144,17 +134,15 @@ exports.createAnnotationI18nEntries = createAnnotationI18nEntries;
|
|
|
144
134
|
* @returns boolean or exception
|
|
145
135
|
* @description If `i18n` entry is missing from `"sap.app":{}`, default `i18n/i18n.properties` is used. Update of `manifest.json` file is not needed.
|
|
146
136
|
*/
|
|
147
|
-
function createManifestI18nEntries(root, i18nPropertiesPaths, newEntries, fs) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return (0, i18n_1.createPropertiesI18nEntries)(i18nFilePath, newEntries, root, fs);
|
|
157
|
-
});
|
|
137
|
+
async function createManifestI18nEntries(root, i18nPropertiesPaths, newEntries, fs) {
|
|
138
|
+
const i18nFilePath = i18nPropertiesPaths['sap.app'];
|
|
139
|
+
// make sure i18n folder exists
|
|
140
|
+
const dirPath = (0, path_1.dirname)(i18nFilePath);
|
|
141
|
+
if (!fs) {
|
|
142
|
+
// create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
|
|
143
|
+
await (0, promises_1.mkdir)(dirPath, { recursive: true });
|
|
144
|
+
}
|
|
145
|
+
return (0, i18n_1.createPropertiesI18nEntries)(i18nFilePath, newEntries, root, fs);
|
|
158
146
|
}
|
|
159
147
|
exports.createManifestI18nEntries = createManifestI18nEntries;
|
|
160
148
|
//# sourceMappingURL=write.js.map
|
package/dist/project/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getCapCustomPaths, getCapModelAndServices, getCapProjectType, getCdsFiles, getCdsRoots, getCdsServices, isCapProject, isCapJavaProject, isCapNodeJsProject, getCapEnvironment, readCapServiceMetadataEdmx, toReferenceUri, clearCdsModuleCache } from './cap';
|
|
2
|
+
export { filterDataSourcesByType } from './service';
|
|
2
3
|
export { addPackageDevDependency, getNodeModulesPath } from './dependencies';
|
|
3
4
|
export { getCapI18nFolderNames, getI18nPropertiesPaths } from './i18n';
|
|
4
5
|
export { getAppProgrammingLanguage, getAppType, getMinUI5VersionFromManifest, getMinUI5VersionAsArray, getMinimumUI5Version, getProject, getProjectType } from './info';
|
package/dist/project/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.addPackageDevDependency = exports.clearCdsModuleCache = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
|
|
3
|
+
exports.updatePackageScript = exports.createProjectAccess = exports.createApplicationAccess = exports.getMtaPath = exports.readUi5Yaml = exports.getWebappPath = exports.getAppRootFromWebappPath = exports.findProjectRoot = exports.findFioriArtifacts = exports.findCapProjects = exports.findAllApps = exports.loadModuleFromProject = exports.getProjectType = exports.getProject = exports.getMinimumUI5Version = exports.getMinUI5VersionAsArray = exports.getMinUI5VersionFromManifest = exports.getAppType = exports.getAppProgrammingLanguage = exports.getI18nPropertiesPaths = exports.getCapI18nFolderNames = exports.getNodeModulesPath = exports.addPackageDevDependency = exports.filterDataSourcesByType = exports.clearCdsModuleCache = exports.toReferenceUri = exports.readCapServiceMetadataEdmx = exports.getCapEnvironment = exports.isCapNodeJsProject = exports.isCapJavaProject = exports.isCapProject = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapProjectType = exports.getCapModelAndServices = exports.getCapCustomPaths = void 0;
|
|
4
4
|
var cap_1 = require("./cap");
|
|
5
5
|
Object.defineProperty(exports, "getCapCustomPaths", { enumerable: true, get: function () { return cap_1.getCapCustomPaths; } });
|
|
6
6
|
Object.defineProperty(exports, "getCapModelAndServices", { enumerable: true, get: function () { return cap_1.getCapModelAndServices; } });
|
|
@@ -15,6 +15,8 @@ Object.defineProperty(exports, "getCapEnvironment", { enumerable: true, get: fun
|
|
|
15
15
|
Object.defineProperty(exports, "readCapServiceMetadataEdmx", { enumerable: true, get: function () { return cap_1.readCapServiceMetadataEdmx; } });
|
|
16
16
|
Object.defineProperty(exports, "toReferenceUri", { enumerable: true, get: function () { return cap_1.toReferenceUri; } });
|
|
17
17
|
Object.defineProperty(exports, "clearCdsModuleCache", { enumerable: true, get: function () { return cap_1.clearCdsModuleCache; } });
|
|
18
|
+
var service_1 = require("./service");
|
|
19
|
+
Object.defineProperty(exports, "filterDataSourcesByType", { enumerable: true, get: function () { return service_1.filterDataSourcesByType; } });
|
|
18
20
|
var dependencies_1 = require("./dependencies");
|
|
19
21
|
Object.defineProperty(exports, "addPackageDevDependency", { enumerable: true, get: function () { return dependencies_1.addPackageDevDependency; } });
|
|
20
22
|
Object.defineProperty(exports, "getNodeModulesPath", { enumerable: true, get: function () { return dependencies_1.getNodeModulesPath; } });
|