@sap-ux/ui5-library-reference-writer 0.3.2 → 1.0.1

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.js CHANGED
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ManifestReuseType = exports.yamlFiles = void 0;
4
- const project_access_1 = require("@sap-ux/project-access");
5
- exports.yamlFiles = [project_access_1.FileName.Ui5Yaml, project_access_1.FileName.Ui5LocalYaml, project_access_1.FileName.Ui5MockYaml];
6
- var ManifestReuseType;
1
+ import { FileName } from '@sap-ux/project-access';
2
+ export const yamlFiles = [FileName.Ui5Yaml, FileName.Ui5LocalYaml, FileName.Ui5MockYaml];
3
+ export var ManifestReuseType;
7
4
  (function (ManifestReuseType) {
8
5
  ManifestReuseType["Library"] = "libs";
9
6
  ManifestReuseType["Component"] = "components";
10
- })(ManifestReuseType || (exports.ManifestReuseType = ManifestReuseType = {}));
7
+ })(ManifestReuseType || (ManifestReuseType = {}));
11
8
  //# sourceMappingURL=constants.js.map
package/dist/helpers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { ReuseLibConfig } from './types';
2
+ import type { ReuseLibConfig } from './types.js';
3
3
  /**
4
4
  * Updates manifest with references for the chosen reuse libs.
5
5
  *
package/dist/helpers.js CHANGED
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateManifest = updateManifest;
4
- exports.updateYaml = updateYaml;
5
- const ui5_config_1 = require("@sap-ux/ui5-config");
6
- const project_access_1 = require("@sap-ux/project-access");
7
- const node_path_1 = require("node:path");
8
- const constants_1 = require("./constants");
1
+ import { UI5Config } from '@sap-ux/ui5-config';
2
+ import { getWebappPath } from '@sap-ux/project-access';
3
+ import { join, relative } from 'node:path';
4
+ import { yamlFiles, ManifestReuseType } from './constants.js';
9
5
  /**
10
6
  * Updates manifest with references for the chosen reuse libs.
11
7
  *
@@ -13,12 +9,12 @@ const constants_1 = require("./constants");
13
9
  * @param reuseLibs reuse libraries for referencing
14
10
  * @param fs mem-fs editor instance
15
11
  */
16
- async function updateManifest(projectPath, reuseLibs, fs) {
17
- const webapp = await (0, project_access_1.getWebappPath)(projectPath);
18
- const manifestPath = (0, node_path_1.join)(webapp, 'manifest.json');
12
+ export async function updateManifest(projectPath, reuseLibs, fs) {
13
+ const webapp = await getWebappPath(projectPath);
14
+ const manifestPath = join(webapp, 'manifest.json');
19
15
  const manifest = fs.readJSON(manifestPath);
20
16
  reuseLibs.forEach((lib) => {
21
- const reuseType = lib.type === 'library' ? constants_1.ManifestReuseType.Library : constants_1.ManifestReuseType.Component;
17
+ const reuseType = lib.type === 'library' ? ManifestReuseType.Library : ManifestReuseType.Component;
22
18
  if (manifest['sap.ui5']?.dependencies && !manifest['sap.ui5']?.dependencies?.[reuseType]) {
23
19
  manifest['sap.ui5'].dependencies[reuseType] = {};
24
20
  }
@@ -35,11 +31,11 @@ async function updateManifest(projectPath, reuseLibs, fs) {
35
31
  * @param reuseLibs reuse libraries for referencing
36
32
  * @param fs mem-fs editor instance
37
33
  */
38
- function updateYaml(projectPath, reuseLibs, fs) {
39
- constants_1.yamlFiles.forEach(async (yaml) => {
40
- const yamlPath = (0, node_path_1.join)(projectPath, yaml);
34
+ export function updateYaml(projectPath, reuseLibs, fs) {
35
+ yamlFiles.forEach(async (yaml) => {
36
+ const yamlPath = join(projectPath, yaml);
41
37
  if (fs.exists(yamlPath)) {
42
- const ui5Config = await ui5_config_1.UI5Config.newInstance(fs.read(yamlPath));
38
+ const ui5Config = await UI5Config.newInstance(fs.read(yamlPath));
43
39
  const serveStaticPaths = getServeStaticPaths(reuseLibs, projectPath);
44
40
  ui5Config.addServeStaticConfig(serveStaticPaths);
45
41
  fs.write(yamlPath, ui5Config.toString());
@@ -59,14 +55,14 @@ function getServeStaticPaths(reuseLibs, projectPath) {
59
55
  const reuseLibRefs = [
60
56
  {
61
57
  path: `/resources/${lib.name.replace(/\./g, '/')}`,
62
- src: (0, node_path_1.relative)(projectPath, lib.path),
58
+ src: relative(projectPath, lib.path),
63
59
  fallthrough: false
64
60
  }
65
61
  ];
66
62
  if (lib.uri) {
67
63
  reuseLibRefs.push({
68
64
  path: `${lib.uri.replace(/\/bsp\//g, '/ui5_ui5/')}`,
69
- src: (0, node_path_1.relative)(projectPath, lib.path),
65
+ src: relative(projectPath, lib.path),
70
66
  fallthrough: false
71
67
  });
72
68
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'mem-fs-editor';
2
- import type { ReuseLibConfig } from './types';
2
+ import type { ReuseLibConfig } from './types.js';
3
3
  /**
4
4
  * Writes the file updates to the memfs editor instance.
5
5
  *
package/dist/index.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generate = generate;
4
- const mem_fs_1 = require("mem-fs");
5
- const mem_fs_editor_1 = require("mem-fs-editor");
6
- const helpers_1 = require("./helpers");
1
+ import { create as createStorage } from 'mem-fs';
2
+ import { create } from 'mem-fs-editor';
3
+ import { updateManifest, updateYaml } from './helpers.js';
7
4
  /**
8
5
  * Writes the file updates to the memfs editor instance.
9
6
  *
@@ -14,10 +11,11 @@ const helpers_1 = require("./helpers");
14
11
  */
15
12
  async function generate(basePath, referenceLibraries, fs) {
16
13
  if (!fs) {
17
- fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
14
+ fs = create(createStorage());
18
15
  }
19
- (0, helpers_1.updateYaml)(basePath, referenceLibraries, fs);
20
- await (0, helpers_1.updateManifest)(basePath, referenceLibraries, fs);
16
+ updateYaml(basePath, referenceLibraries, fs);
17
+ await updateManifest(basePath, referenceLibraries, fs);
21
18
  return fs;
22
19
  }
20
+ export { generate };
23
21
  //# sourceMappingURL=index.js.map
package/dist/types.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@sap-ux/ui5-library-reference-writer",
3
3
  "description": "Writer module to add library/component references to an existing Fiori application",
4
+ "type": "module",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/SAP/open-ux-tools.git",
7
8
  "directory": "packages/ui5-library-reference-writer"
8
9
  },
9
- "version": "0.3.2",
10
+ "version": "1.0.1",
10
11
  "license": "Apache-2.0",
11
12
  "main": "dist/index.js",
12
13
  "files": [
@@ -21,8 +22,8 @@
21
22
  "dependencies": {
22
23
  "mem-fs": "2.1.0",
23
24
  "mem-fs-editor": "9.4.0",
24
- "@sap-ux/project-access": "1.38.1",
25
- "@sap-ux/ui5-config": "0.31.1"
25
+ "@sap-ux/project-access": "2.0.1",
26
+ "@sap-ux/ui5-config": "1.0.0"
26
27
  },
27
28
  "devDependencies": {
28
29
  "@types/fs-extra": "11.0.4",
@@ -37,8 +38,8 @@
37
38
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
38
39
  "lint": "eslint",
39
40
  "lint:fix": "eslint --fix",
40
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
41
- "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
41
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
42
+ "test-u": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors -u",
42
43
  "link": "pnpm link --global",
43
44
  "unlink": "pnpm unlink --global"
44
45
  }