@cap-js/postgres 1.4.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@
4
4
  - The format is based on [Keep a Changelog](http://keepachangelog.com/).
5
5
  - This project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [1.4.1](https://github.com/cap-js/cds-dbs/compare/postgres-v1.4.0...postgres-v1.4.1) (2023-11-24)
8
+
9
+
10
+ ### Fixed
11
+
12
+ * `cds build` now generates the correct output folder structure for Node.js and Java apps. ([#353](https://github.com/cap-js/cds-dbs/issues/353)) ([875aca4](https://github.com/cap-js/cds-dbs/commit/875aca4f5a0ee71bcfbb13be47d4349970b40605))
13
+
7
14
  ## [1.4.0](https://github.com/cap-js/cds-dbs/compare/postgres-v1.3.1...postgres-v1.4.0) (2023-11-20)
8
15
 
9
16
 
package/lib/build.js CHANGED
@@ -2,21 +2,31 @@ const cds = require('@sap/cds')
2
2
  const { fs, path } = cds.utils
3
3
 
4
4
  module.exports = class PostgresBuildPlugin extends cds.build.BuildPlugin {
5
-
6
5
  static hasTask() {
7
6
  return cds.requires.db?.kind === 'postgres'
8
7
  }
9
8
 
9
+ init() {
10
+ // different from the default build output structure
11
+ this.task.dest = path.join(cds.root, cds.env.build.target !== '.' ? cds.env.build.target : 'gen', 'pg')
12
+ }
13
+
10
14
  async build() {
11
15
  const model = await this.model()
12
16
  if (!model) return
13
17
 
14
18
  const promises = []
15
- promises.push(this.write({
16
- dependencies: { '@sap/cds': '^7', '@cap-js/postgres': '^1' },
17
- scripts: { start: 'cds-deploy' },
18
- }).to('pg/package.json'))
19
- promises.push(this.write(cds.compile.to.json(model)).to(path.join('pg/db', 'csn.json')))
19
+ if (fs.existsSync(path.join(this.task.src, 'package.json'))) {
20
+ promises.push(this.copy(path.join(this.task.src, 'package.json')).to('package.json'))
21
+ } else {
22
+ promises.push(
23
+ this.write({
24
+ dependencies: { '@sap/cds': '^7', '@cap-js/postgres': '^1' },
25
+ scripts: { start: 'cds-deploy' },
26
+ }).to('package.json'),
27
+ )
28
+ }
29
+ promises.push(this.write(cds.compile.to.json(model)).to(path.join('db', 'csn.json')))
20
30
 
21
31
  let data
22
32
  if (fs.existsSync(path.join(this.task.src, 'data'))) {
@@ -25,7 +35,7 @@ module.exports = class PostgresBuildPlugin extends cds.build.BuildPlugin {
25
35
  data = 'csv'
26
36
  }
27
37
  if (data) {
28
- promises.push(this.copy(data).to(path.join('pg/db', 'data')))
38
+ promises.push(this.copy(data).to(path.join('db', 'data')))
29
39
  }
30
40
  return Promise.all(promises)
31
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/postgres",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "CDS database service for Postgres",
5
5
  "homepage": "https://github.com/cap-js/cds-dbs/tree/main/postgres#cds-database-service-for-postgres",
6
6
  "repository": {