@sap-ux/cap-config-writer 0.13.4 → 1.0.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/cap-config/index.js +10 -13
- package/dist/cap-config/package-json.js +9 -14
- package/dist/cap-config/types.js +1 -2
- package/dist/cap-writer/index.d.ts +2 -2
- package/dist/cap-writer/index.js +2 -7
- package/dist/cap-writer/package-json.d.ts +1 -1
- package/dist/cap-writer/package-json.js +17 -22
- package/dist/cap-writer/tsconfig-and-yaml.js +10 -14
- package/dist/cap-writer/updates.d.ts +1 -1
- package/dist/cap-writer/updates.js +8 -11
- package/dist/cap-writer/utils.js +4 -7
- package/dist/i18n.js +8 -16
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -22
- package/package.json +8 -6
package/dist/cap-config/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const mem_fs_1 = require("mem-fs");
|
|
6
|
-
const mem_fs_editor_1 = require("mem-fs-editor");
|
|
7
|
-
const package_json_1 = require("./package-json");
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { create as createStorage } from 'mem-fs';
|
|
3
|
+
import { create } from 'mem-fs-editor';
|
|
4
|
+
import { addCdsPluginUi5, enableWorkspaces, ensureMinCdsVersion } from './package-json.js';
|
|
8
5
|
/**
|
|
9
6
|
* Enable workspace and cds-plugin-ui5 for given CAP project.
|
|
10
7
|
* If the minimum required version for @sap/cds is not met, it will update to the minimum required for cds-plugin-ui5.
|
|
@@ -13,16 +10,16 @@ const package_json_1 = require("./package-json");
|
|
|
13
10
|
* @param [fs] - optional: the memfs editor instance
|
|
14
11
|
* @returns Promise<Editor> - memfs editor instance with updated files
|
|
15
12
|
*/
|
|
16
|
-
async function enableCdsUi5Plugin(basePath, fs) {
|
|
13
|
+
export async function enableCdsUi5Plugin(basePath, fs) {
|
|
17
14
|
if (!fs) {
|
|
18
|
-
fs =
|
|
15
|
+
fs = create(createStorage());
|
|
19
16
|
}
|
|
20
|
-
const packageJsonPath =
|
|
17
|
+
const packageJsonPath = join(basePath, 'package.json');
|
|
21
18
|
const packageJson = (fs.readJSON(packageJsonPath) ?? {});
|
|
22
19
|
const originalPackageJson = structuredClone(packageJson); // keep a copy of the package.json
|
|
23
|
-
|
|
24
|
-
await
|
|
25
|
-
|
|
20
|
+
ensureMinCdsVersion(packageJson);
|
|
21
|
+
await enableWorkspaces(basePath, packageJson);
|
|
22
|
+
addCdsPluginUi5(packageJson);
|
|
26
23
|
// only write if there are changes
|
|
27
24
|
if (JSON.stringify(originalPackageJson) !== JSON.stringify(packageJson)) {
|
|
28
25
|
fs.writeJSON(packageJsonPath, packageJson);
|
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureMinCdsVersion = ensureMinCdsVersion;
|
|
4
|
-
exports.enableWorkspaces = enableWorkspaces;
|
|
5
|
-
exports.addCdsPluginUi5 = addCdsPluginUi5;
|
|
6
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
1
|
+
import { getWorkspaceInfo, MinCdsPluginUi5Version, MinCdsVersion, hasMinCdsVersion, hasDependency } from '@sap-ux/project-access';
|
|
7
2
|
/**
|
|
8
3
|
* Ensure a minimum version of @sap/cds in dependencies.
|
|
9
4
|
*
|
|
10
5
|
* @param packageJson - the parsed package.json
|
|
11
6
|
*/
|
|
12
|
-
function ensureMinCdsVersion(packageJson) {
|
|
13
|
-
if (!
|
|
7
|
+
export function ensureMinCdsVersion(packageJson) {
|
|
8
|
+
if (!hasMinCdsVersion(packageJson)) {
|
|
14
9
|
packageJson.dependencies ??= {};
|
|
15
|
-
packageJson.dependencies['@sap/cds'] = `^${
|
|
10
|
+
packageJson.dependencies['@sap/cds'] = `^${MinCdsVersion}`;
|
|
16
11
|
}
|
|
17
12
|
}
|
|
18
13
|
/**
|
|
@@ -21,8 +16,8 @@ function ensureMinCdsVersion(packageJson) {
|
|
|
21
16
|
* @param basePath - root path of the CAP project, where package.json is located
|
|
22
17
|
* @param packageJson - the parsed package.json
|
|
23
18
|
*/
|
|
24
|
-
async function enableWorkspaces(basePath, packageJson) {
|
|
25
|
-
let { appWorkspace, workspaceEnabled, workspacePackages } = await
|
|
19
|
+
export async function enableWorkspaces(basePath, packageJson) {
|
|
20
|
+
let { appWorkspace, workspaceEnabled, workspacePackages } = await getWorkspaceInfo(basePath, packageJson);
|
|
26
21
|
if (workspaceEnabled) {
|
|
27
22
|
return;
|
|
28
23
|
}
|
|
@@ -43,10 +38,10 @@ async function enableWorkspaces(basePath, packageJson) {
|
|
|
43
38
|
*
|
|
44
39
|
* @param packageJson - the parsed package.json
|
|
45
40
|
*/
|
|
46
|
-
function addCdsPluginUi5(packageJson) {
|
|
47
|
-
if (!
|
|
41
|
+
export function addCdsPluginUi5(packageJson) {
|
|
42
|
+
if (!hasDependency(packageJson, 'cds-plugin-ui5')) {
|
|
48
43
|
packageJson.devDependencies ??= {};
|
|
49
|
-
packageJson.devDependencies['cds-plugin-ui5'] = `^${
|
|
44
|
+
packageJson.devDependencies['cds-plugin-ui5'] = `^${MinCdsPluginUi5Version}`;
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
47
|
//# sourceMappingURL=package-json.js.map
|
package/dist/cap-config/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { applyCAPUpdates } from './updates';
|
|
2
|
-
export { getAppLaunchText } from './utils';
|
|
1
|
+
export { applyCAPUpdates } from './updates.js';
|
|
2
|
+
export { getAppLaunchText } from './utils.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cap-writer/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getAppLaunchText = exports.applyCAPUpdates = void 0;
|
|
4
|
-
var updates_1 = require("./updates");
|
|
5
|
-
Object.defineProperty(exports, "applyCAPUpdates", { enumerable: true, get: function () { return updates_1.applyCAPUpdates; } });
|
|
6
|
-
var utils_1 = require("./utils");
|
|
7
|
-
Object.defineProperty(exports, "getAppLaunchText", { enumerable: true, get: function () { return utils_1.getAppLaunchText; } });
|
|
1
|
+
export { applyCAPUpdates } from './updates.js';
|
|
2
|
+
export { getAppLaunchText } from './utils.js';
|
|
8
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.updateAppPackageJson = updateAppPackageJson;
|
|
6
|
-
const node_fs_1 = require("node:fs");
|
|
7
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
8
|
-
const node_path_1 = require("node:path");
|
|
9
|
-
const cap_config_1 = require("../cap-config");
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { FileName, getCapCustomPaths, getWebappPath } from '@sap-ux/project-access';
|
|
3
|
+
import { join, normalize, posix } from 'node:path';
|
|
4
|
+
import { enableCdsUi5Plugin } from '../cap-config/index.js';
|
|
10
5
|
/**
|
|
11
6
|
* Retrieves the CDS watch script for the CAP app.
|
|
12
7
|
*
|
|
@@ -15,7 +10,7 @@ const cap_config_1 = require("../cap-config");
|
|
|
15
10
|
If appId is provided, it will be used to open the application instead of the project name. This option is available for use with npm workspaces.
|
|
16
11
|
* @returns {{ [x: string]: string }} The CDS watch script for the CAP app.
|
|
17
12
|
*/
|
|
18
|
-
function getCDSWatchScript(projectName, appId) {
|
|
13
|
+
export function getCDSWatchScript(projectName, appId) {
|
|
19
14
|
const DisableCacheParam = 'sap-ui-xx-viewCache=false';
|
|
20
15
|
// projects by default are served base on the folder name in the app/ folder
|
|
21
16
|
const project = appId ?? projectName + '/webapp';
|
|
@@ -52,9 +47,9 @@ async function updateExistingWatchScripts(fs, projectPath, appsPath, packageJson
|
|
|
52
47
|
for (const script in packageJson.scripts) {
|
|
53
48
|
if (script.startsWith('watch-') && packageJson?.scripts?.[script]?.includes('/webapp/')) {
|
|
54
49
|
const appName = script.split('-')[1];
|
|
55
|
-
const appPath =
|
|
56
|
-
if (
|
|
57
|
-
const manifestPath =
|
|
50
|
+
const appPath = join(projectPath, appsPath, appName);
|
|
51
|
+
if (existsSync(appPath)) {
|
|
52
|
+
const manifestPath = join(await getWebappPath(appPath), FileName.Manifest);
|
|
58
53
|
const manifest = fs.readJSON(manifestPath);
|
|
59
54
|
const appId = manifest['sap.app']?.id;
|
|
60
55
|
if (appId) {
|
|
@@ -90,7 +85,7 @@ async function updateScripts(fs, packageJson, { projectPath, projectName, appsPa
|
|
|
90
85
|
else {
|
|
91
86
|
cdsScripts = getCDSWatchScript(projectName);
|
|
92
87
|
}
|
|
93
|
-
updatePackageJsonWithScripts(fs,
|
|
88
|
+
updatePackageJsonWithScripts(fs, join(projectPath, 'package.json'), cdsScripts);
|
|
94
89
|
}
|
|
95
90
|
/**
|
|
96
91
|
* Updates the root package.json file of CAP projects with the following changes:
|
|
@@ -105,21 +100,21 @@ async function updateScripts(fs, packageJson, { projectPath, projectName, appsPa
|
|
|
105
100
|
* @param {boolean} addCdsUi5Plugin - whether to add the cds ui5 plugin.
|
|
106
101
|
* @returns {Promise<void>} A Promise that resolves once the root package.json is updated.
|
|
107
102
|
*/
|
|
108
|
-
async function updateRootPackageJson(fs, projectName, sapux, capService, appId, addCdsUi5Plugin) {
|
|
109
|
-
const packageJsonPath =
|
|
103
|
+
export async function updateRootPackageJson(fs, projectName, sapux, capService, appId, addCdsUi5Plugin) {
|
|
104
|
+
const packageJsonPath = join(capService.projectPath, 'package.json');
|
|
110
105
|
const packageJson = (fs.readJSON(packageJsonPath) ?? {});
|
|
111
106
|
const capNodeType = 'Node.js';
|
|
112
|
-
const appsPath = (await
|
|
107
|
+
const appsPath = (await getCapCustomPaths(capService.projectPath)).app;
|
|
113
108
|
if (capService?.capType === capNodeType) {
|
|
114
109
|
if (addCdsUi5Plugin) {
|
|
115
|
-
await
|
|
110
|
+
await enableCdsUi5Plugin(capService.projectPath, fs);
|
|
116
111
|
}
|
|
117
112
|
await updateScripts(fs, packageJson, { projectPath: capService.projectPath, projectName, appsPath, appId }, addCdsUi5Plugin);
|
|
118
113
|
}
|
|
119
114
|
if (sapux) {
|
|
120
|
-
const dirPath =
|
|
115
|
+
const dirPath = join(capService.appPath ?? appsPath, projectName);
|
|
121
116
|
// Converts a directory path to a POSIX-style path.
|
|
122
|
-
const capProjectPath =
|
|
117
|
+
const capProjectPath = normalize(dirPath).split(/[\\/]/g).join(posix.sep);
|
|
123
118
|
const sapuxExt = Array.isArray(packageJson?.sapux) ? [...packageJson.sapux, capProjectPath] : [capProjectPath];
|
|
124
119
|
fs.extendJSON(packageJsonPath, { sapux: sapuxExt });
|
|
125
120
|
}
|
|
@@ -131,8 +126,8 @@ async function updateRootPackageJson(fs, projectName, sapux, capService, appId,
|
|
|
131
126
|
* @param {Editor} fs The file system editor.
|
|
132
127
|
* @param {string} appRoot The root directory of the application.
|
|
133
128
|
*/
|
|
134
|
-
function updateAppPackageJson(fs, appRoot) {
|
|
135
|
-
const packageJsonPath =
|
|
129
|
+
export function updateAppPackageJson(fs, appRoot) {
|
|
130
|
+
const packageJsonPath = join(appRoot, 'package.json');
|
|
136
131
|
const packageJson = (fs.readJSON(packageJsonPath) ?? {});
|
|
137
132
|
delete packageJson.sapux;
|
|
138
133
|
if (packageJson?.scripts) {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
6
|
-
const yaml_1 = require("@sap-ux/yaml");
|
|
7
|
-
const node_path_1 = require("node:path");
|
|
8
|
-
const i18n_1 = require("../i18n");
|
|
1
|
+
import { FileName } from '@sap-ux/project-access';
|
|
2
|
+
import { YamlDocument, yamlDocumentToYamlString } from '@sap-ux/yaml';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { t } from '../i18n.js';
|
|
9
5
|
/**
|
|
10
6
|
* Updates the tsconfig.json file to correct the type roots when node_modules
|
|
11
7
|
* are not found in the same directory as the application.
|
|
@@ -13,8 +9,8 @@ const i18n_1 = require("../i18n");
|
|
|
13
9
|
* @param {Editor} fs The file system editor.
|
|
14
10
|
* @param {string} appRoot The root directory of the application.
|
|
15
11
|
*/
|
|
16
|
-
function updateTsConfig(fs, appRoot) {
|
|
17
|
-
const tsConfigPath =
|
|
12
|
+
export function updateTsConfig(fs, appRoot) {
|
|
13
|
+
const tsConfigPath = join(appRoot, FileName.Tsconfig);
|
|
18
14
|
if (fs.exists(tsConfigPath)) {
|
|
19
15
|
const tsConfig = fs.readJSON(tsConfigPath);
|
|
20
16
|
if (tsConfig['compilerOptions']['typeRoots']) {
|
|
@@ -40,21 +36,21 @@ function updateTsConfig(fs, appRoot) {
|
|
|
40
36
|
* @param {Logger} [logger] The logger instance for logging errors.
|
|
41
37
|
* @returns {void}
|
|
42
38
|
*/
|
|
43
|
-
async function updateStaticLocationsInApplicationYaml(fs, applicationYamlPath, capCustomPathsApp, logger) {
|
|
39
|
+
export async function updateStaticLocationsInApplicationYaml(fs, applicationYamlPath, capCustomPathsApp, logger) {
|
|
44
40
|
try {
|
|
45
41
|
const applicationYamlDocuments = fs.read(applicationYamlPath).toString();
|
|
46
|
-
const yamlDoc = await
|
|
42
|
+
const yamlDoc = await YamlDocument.newInstance(applicationYamlDocuments);
|
|
47
43
|
const stringifiedYaml = JSON.stringify(yamlDoc);
|
|
48
44
|
const parsedApplicationYamlDocuments = JSON.parse(stringifiedYaml).documents;
|
|
49
45
|
if (parsedApplicationYamlDocuments.length === 1 &&
|
|
50
46
|
parsedApplicationYamlDocuments[0].spring['web.resources.static-locations'] === undefined) {
|
|
51
47
|
const applicationYamlFirstDocument = parsedApplicationYamlDocuments[0];
|
|
52
48
|
applicationYamlFirstDocument.spring['web.resources.static-locations'] = `file:./${capCustomPathsApp}`;
|
|
53
|
-
fs.write(applicationYamlPath,
|
|
49
|
+
fs.write(applicationYamlPath, yamlDocumentToYamlString(applicationYamlFirstDocument));
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
52
|
catch (error) {
|
|
57
|
-
logger?.error(
|
|
53
|
+
logger?.error(t('error.updateApplicationYaml', { error: error }));
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
56
|
//# sourceMappingURL=tsconfig-and-yaml.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CapServiceCdsInfo, CapProjectSettings } from '../cap-config/types';
|
|
1
|
+
import type { CapServiceCdsInfo, CapProjectSettings } from '../cap-config/types.js';
|
|
2
2
|
import type { Editor } from 'mem-fs-editor';
|
|
3
3
|
/**
|
|
4
4
|
* Applies updates to a CAP project based on the provided options.
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const package_json_1 = require("./package-json");
|
|
5
|
-
const tsconfig_and_yaml_1 = require("./tsconfig-and-yaml");
|
|
6
|
-
const cap_config_1 = require("../cap-config");
|
|
1
|
+
import { updateRootPackageJson, updateAppPackageJson } from './package-json.js';
|
|
2
|
+
import { updateTsConfig } from './tsconfig-and-yaml.js';
|
|
3
|
+
import { enableCdsUi5Plugin as writeCdsUi5Plugin } from '../cap-config/index.js';
|
|
7
4
|
/**
|
|
8
5
|
* Applies updates to a CAP project based on the provided options.
|
|
9
6
|
*
|
|
@@ -20,25 +17,25 @@ const cap_config_1 = require("../cap-config");
|
|
|
20
17
|
* @param {boolean} capProjectSettings.disableRootPackageJsonUpdates - Indicates if updates to the root package.json should be disabled. If true, the root package.json will not be updated with the sapux array or the cds watch scripts.
|
|
21
18
|
* @returns {Promise<void>} A promise that resolves when the updates are applied.
|
|
22
19
|
*/
|
|
23
|
-
async function applyCAPUpdates(fs, capService, capProjectSettings) {
|
|
20
|
+
export async function applyCAPUpdates(fs, capService, capProjectSettings) {
|
|
24
21
|
const { appRoot, packageName, appId, sapux = false, enableCdsUi5Plugin = true, enableTypescript = false, disableRootPackageJsonUpdates = false } = capProjectSettings;
|
|
25
22
|
if (disableRootPackageJsonUpdates) {
|
|
26
23
|
// if root package.json updates are disabled, we will only write the cds ui5 plugin if enabled, but not update scripts or sapux array in the root package.jsonx
|
|
27
24
|
if (enableCdsUi5Plugin) {
|
|
28
|
-
await (
|
|
25
|
+
await writeCdsUi5Plugin(capService.projectPath, fs);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
else {
|
|
32
29
|
// update root package.json
|
|
33
|
-
await
|
|
30
|
+
await updateRootPackageJson(fs, packageName, sapux, capService, appId, enableCdsUi5Plugin);
|
|
34
31
|
}
|
|
35
32
|
if (enableTypescript) {
|
|
36
33
|
// update tsconfig.json if TypeScript is enabled
|
|
37
|
-
|
|
34
|
+
updateTsConfig(fs, appRoot);
|
|
38
35
|
}
|
|
39
36
|
if (capService.capType === 'Node.js' && enableCdsUi5Plugin) {
|
|
40
37
|
// update app package.json if CDS UI5 plugin is enabled
|
|
41
|
-
|
|
38
|
+
updateAppPackageJson(fs, appRoot);
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
//# sourceMappingURL=updates.js.map
|
package/dist/cap-writer/utils.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAppLaunchText = getAppLaunchText;
|
|
4
|
-
const i18n_1 = require("../i18n");
|
|
1
|
+
import { initI18n, t } from '../i18n.js';
|
|
5
2
|
/**
|
|
6
3
|
* Returns the url to the specified cap app as served by `cds serve` or `cds watch`.
|
|
7
4
|
*
|
|
@@ -29,13 +26,13 @@ function getCapUrl(capType, projectName, appId) {
|
|
|
29
26
|
* @param appId If appId is provided, it will be used to open the application instead of the project name. This option is available for use with npm workspaces.
|
|
30
27
|
* @returns The launch text for the application.
|
|
31
28
|
*/
|
|
32
|
-
async function getAppLaunchText(capType, projectName, appId) {
|
|
29
|
+
export async function getAppLaunchText(capType, projectName, appId) {
|
|
33
30
|
// Initialize i18n, since it may not have been initialized yet
|
|
34
|
-
await
|
|
31
|
+
await initI18n();
|
|
35
32
|
// Determine the Maven command if the project is a Java project
|
|
36
33
|
const mvnCommand = capType === 'Java' ? ' (```mvn spring-boot:run```)' : '';
|
|
37
34
|
const capUrl = getCapUrl(capType, projectName, appId);
|
|
38
35
|
// Return launch text
|
|
39
|
-
return `${
|
|
36
|
+
return `${t('launchCapText', { mvnCommand, capUrl })}`;
|
|
40
37
|
}
|
|
41
38
|
//# sourceMappingURL=utils.js.map
|
package/dist/i18n.js
CHANGED
|
@@ -1,23 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.i18n = void 0;
|
|
7
|
-
exports.initI18n = initI18n;
|
|
8
|
-
exports.t = t;
|
|
9
|
-
const i18next_1 = __importDefault(require("i18next"));
|
|
10
|
-
const cap_config_writer_i18n_json_1 = __importDefault(require("./translations/cap-config-writer.i18n.json"));
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import translations from './translations/cap-config-writer.i18n.json' with { type: 'json' };
|
|
11
3
|
const NS = 'cap-config-writer';
|
|
12
|
-
|
|
4
|
+
export const i18n = i18next.createInstance();
|
|
13
5
|
/**
|
|
14
6
|
* Initialize i18next with the translations for this module.
|
|
15
7
|
*/
|
|
16
|
-
async function initI18n() {
|
|
17
|
-
await
|
|
8
|
+
export async function initI18n() {
|
|
9
|
+
await i18n.init({
|
|
18
10
|
resources: {
|
|
19
11
|
en: {
|
|
20
|
-
[NS]:
|
|
12
|
+
[NS]: translations
|
|
21
13
|
}
|
|
22
14
|
},
|
|
23
15
|
lng: 'en',
|
|
@@ -34,8 +26,8 @@ async function initI18n() {
|
|
|
34
26
|
* @param options additional options
|
|
35
27
|
* @returns {string} localized string stored for the given key
|
|
36
28
|
*/
|
|
37
|
-
function t(key, options) {
|
|
38
|
-
return
|
|
29
|
+
export function t(key, options) {
|
|
30
|
+
return i18n.t(key, options);
|
|
39
31
|
}
|
|
40
32
|
initI18n().catch(() => {
|
|
41
33
|
// Ignore any errors since the write will still work
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { checkCdsUi5PluginEnabled } from '@sap-ux/project-access';
|
|
2
2
|
export { checkCdsUi5PluginEnabled };
|
|
3
|
-
export { enableCdsUi5Plugin } from './cap-config';
|
|
4
|
-
export type { CapService } from './cap-config/types';
|
|
3
|
+
export { enableCdsUi5Plugin } from './cap-config/index.js';
|
|
4
|
+
export type { CapService } from './cap-config/types.js';
|
|
5
5
|
export type { CapRuntime } from '@sap-ux/fiori-generator-shared';
|
|
6
|
-
export type { CapServiceCdsInfo, CapProjectSettings } from './cap-config/types';
|
|
7
|
-
export * from './cap-writer';
|
|
6
|
+
export type { CapServiceCdsInfo, CapProjectSettings } from './cap-config/types.js';
|
|
7
|
+
export * from './cap-writer/index.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.enableCdsUi5Plugin = exports.checkCdsUi5PluginEnabled = void 0;
|
|
18
|
-
const project_access_1 = require("@sap-ux/project-access");
|
|
19
|
-
Object.defineProperty(exports, "checkCdsUi5PluginEnabled", { enumerable: true, get: function () { return project_access_1.checkCdsUi5PluginEnabled; } });
|
|
20
|
-
var cap_config_1 = require("./cap-config");
|
|
21
|
-
Object.defineProperty(exports, "enableCdsUi5Plugin", { enumerable: true, get: function () { return cap_config_1.enableCdsUi5Plugin; } });
|
|
22
|
-
__exportStar(require("./cap-writer"), exports);
|
|
1
|
+
import { checkCdsUi5PluginEnabled } from '@sap-ux/project-access';
|
|
2
|
+
export { checkCdsUi5PluginEnabled };
|
|
3
|
+
export { enableCdsUi5Plugin } from './cap-config/index.js';
|
|
4
|
+
export * from './cap-writer/index.js';
|
|
23
5
|
//# sourceMappingURL=index.js.map
|
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.
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/SAP/open-ux-tools.git",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"bugs": {
|
|
11
11
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Acap-config-writer"
|
|
12
12
|
},
|
|
13
|
+
"type": "module",
|
|
13
14
|
"license": "Apache-2.0",
|
|
14
15
|
"main": "dist/index.js",
|
|
15
16
|
"files": [
|
|
@@ -24,12 +25,13 @@
|
|
|
24
25
|
"mem-fs-editor": "9.4.0",
|
|
25
26
|
"semver": "7.7.4",
|
|
26
27
|
"xml-js": "1.6.11",
|
|
27
|
-
"@sap-ux/logger": "0.
|
|
28
|
-
"@sap-ux/project-access": "
|
|
29
|
-
"@sap-ux/yaml": "0.
|
|
30
|
-
"@sap-ux/fiori-generator-shared": "0.
|
|
28
|
+
"@sap-ux/logger": "1.0.0",
|
|
29
|
+
"@sap-ux/project-access": "2.0.0",
|
|
30
|
+
"@sap-ux/yaml": "1.0.0",
|
|
31
|
+
"@sap-ux/fiori-generator-shared": "1.0.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
34
|
+
"@jest/globals": "30.3.0",
|
|
33
35
|
"@types/mem-fs": "1.1.2",
|
|
34
36
|
"@types/mem-fs-editor": "7.0.1",
|
|
35
37
|
"@types/semver": "7.7.1"
|
|
@@ -43,7 +45,7 @@
|
|
|
43
45
|
"format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
|
|
44
46
|
"lint": "eslint",
|
|
45
47
|
"lint:fix": "eslint --fix",
|
|
46
|
-
"test": "jest --ci --forceExit --detectOpenHandles --colors",
|
|
48
|
+
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
|
|
47
49
|
"watch": "tsc --watch"
|
|
48
50
|
}
|
|
49
51
|
}
|