@cap-js/cds-types 0.5.0 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/cds-types",
3
- "version": "0.5.0",
3
+ "version": "0.6.1",
4
4
  "description": "Type definitions for main packages of CAP, like `@sap/cds`",
5
5
  "repository": "github:cap-js/cds-types",
6
6
  "homepage": "https://cap.cloud.sap/",
@@ -14,6 +14,7 @@
14
14
  "typings": "dist/cds-types.d.ts",
15
15
  "files": [
16
16
  "dist/",
17
+ "scripts/",
17
18
  "LICENSE",
18
19
  "README.md"
19
20
  ],
@@ -26,10 +27,11 @@
26
27
  "lint": "npx eslint .",
27
28
  "lint:fix": "npx eslint . --fix",
28
29
  "setup": "npm i && npm i file:. --no-save --force",
29
- "prerelease:ci-fix": ".github/prerelease-fix.js"
30
+ "prerelease:ci-fix": "node .github/prerelease-fix.js",
31
+ "postinstall": "node ./scripts/postinstall.js"
30
32
  },
31
33
  "peerDependencies": {
32
- "@sap/cds": ">=7 || ^8.0.0-beta"
34
+ "@sap/cds": "^8.0.0"
33
35
  },
34
36
  "dependencies": {
35
37
  "@types/express": "^4.17.21"
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+
3
+ /* eslint-disable @typescript-eslint/no-var-requires*/
4
+ /* eslint-disable no-undef */
5
+ const fs = require('node:fs')
6
+ const { join, relative, dirname } = require('node:path')
7
+
8
+ if (!process.env.INIT_CWD) return
9
+ // TODO: check if were in a local install
10
+ const nodeModules = join(process.env.INIT_CWD, 'node_modules')
11
+ if (!fs.existsSync(nodeModules)) return
12
+ const typesDir = join(nodeModules, '@types')
13
+ if (!fs.existsSync(typesDir)) fs.mkdirSync(typesDir)
14
+
15
+ // use a relative target, in case the user moves the project
16
+ const target = join(typesDir, 'sap__cds')
17
+ const src = join(nodeModules, '@cap-js/cds-types')
18
+ const rel = relative(dirname(target), src) // need dirname or we'd land one level above node_modules (one too many "../")
19
+
20
+ // 'junction' is needed to make it work on windows, others ignore
21
+ fs.symlinkSync(rel, target, 'junction')