cds-plugin-ui5 0.2.0 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.2.2](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.2.1...cds-plugin-ui5@0.2.2) (2023-08-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **cds-plugin-ui5:** also include root app dir HTML files ([#789](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/789)) ([d6cdfb6](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/d6cdfb615b2bfffd44559689a68659a80eb57680))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.2.1](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.2.0...cds-plugin-ui5@0.2.1) (2023-08-01)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **cds-plugin-ui5:** delay server start until bootstrap is completed ([#783](https://github.com/ui5-community/ui5-ecosystem-showcase/issues/783)) ([88380ba](https://github.com/ui5-community/ui5-ecosystem-showcase/commit/88380ba91ff9d4539a746edf7dc36f3bd4228137))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.2.0](https://github.com/ui5-community/ui5-ecosystem-showcase/compare/cds-plugin-ui5@0.1.7...cds-plugin-ui5@0.2.0) (2023-07-31)
7
29
 
8
30
 
package/cds-plugin.js CHANGED
@@ -10,6 +10,23 @@ const applyUI5Middleware = require("./lib/applyUI5Middleware");
10
10
  // to disable the ui5-middleware-cap if used in apps
11
11
  process.env["cds-plugin-ui5"] = true;
12
12
 
13
+ // promise to await the bootstrap and lock the
14
+ // served event to delay the startup a bit
15
+ let bootstrapped;
16
+ const bootstrapCompleted = new Promise((r) => {
17
+ bootstrapped = r;
18
+ });
19
+
20
+ // hook into the "served" event to delay the startup of the
21
+ // CDS server until the bootstrap is completed and the UI5
22
+ // middlewares for the UI5 applications are properly available
23
+ cds.on("served", async function served(/* cdsServices */) {
24
+ log.debug("served");
25
+ await bootstrapCompleted;
26
+ });
27
+
28
+ // hook into the "bootstrap" event to startup the UI5 middlewares
29
+ // for the available UI5 applications in the CDS server and its deps
13
30
  cds.on("bootstrap", async function bootstrap(app) {
14
31
  log.debug("bootstrap");
15
32
 
@@ -115,6 +132,8 @@ cds.on("bootstrap", async function bootstrap(app) {
115
132
  log.error(`Failed to inject application pages to CAP overview page! You need to manually open the application pages!`);
116
133
  }
117
134
  }
135
+ // bootstrap completed, unlock the "served" event
136
+ bootstrapped();
118
137
  });
119
138
 
120
139
  // return callback for plugin activation
@@ -26,6 +26,8 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
26
26
  if (!skipLocalApps) {
27
27
  const appDir = path.join(cwd, "app");
28
28
  if (fs.existsSync(appDir)) {
29
+ // lookup all dirs inside the root app directory for
30
+ // being either a local app or a UI5 application
29
31
  fs.readdirSync(appDir, { withFileTypes: true })
30
32
  .filter((f) => f.isDirectory())
31
33
  .forEach((d) => localApps.add(d.name));
@@ -36,12 +38,22 @@ module.exports = async function findUI5Modules({ cwd, skipLocalApps, skipDeps })
36
38
  appDirs.push(d);
37
39
  }
38
40
  });
39
- }
40
41
 
41
- // look for a single app if no apps were found in the app directories
42
- if (appDirs.length === 0) {
43
- if (fs.existsSync(path.join(appDir, "ui5.yaml"))) {
44
- appDirs.push(appDir);
42
+ // also include all root app directory HTML files if no ui5.yaml is present
43
+ if (!fs.existsSync(path.join(appDir, "ui5.yaml"))) {
44
+ fs.readdirSync(appDir, { withFileTypes: true })
45
+ .filter((f) => {
46
+ return f.isFile();
47
+ })
48
+ .forEach((f) => {
49
+ localApps.add(f.name);
50
+ });
51
+ } else {
52
+ // if a ui5.yaml is present in the root app directory consider this
53
+ // as a UI5 application to be included into the mounting
54
+ if (appDirs.length === 0) {
55
+ appDirs.push(appDir);
56
+ }
45
57
  }
46
58
  }
47
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cds-plugin-ui5",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A CAP server cds-plugin to inject the middlewares of all related UI5 tooling based projects.",
5
5
  "author": "Peter Muessig",
6
6
  "license": "Apache-2.0",
@@ -24,5 +24,5 @@
24
24
  "@sap/cds": ">=6.8.2",
25
25
  "express": ">=4.18.2"
26
26
  },
27
- "gitHead": "c6e94b130e72603fc05d70bcaf982bd681b72604"
27
+ "gitHead": "5c08d4699b0f4c0d55bb800f323905ffde4624c0"
28
28
  }