@cap-js/cds-types 0.6.1 → 0.6.3
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 +1 -1
- package/scripts/postinstall.js +14 -2
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -17,5 +17,17 @@ const target = join(typesDir, 'sap__cds')
|
|
|
17
17
|
const src = join(nodeModules, '@cap-js/cds-types')
|
|
18
18
|
const rel = relative(dirname(target), src) // need dirname or we'd land one level above node_modules (one too many "../")
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
|
|
20
|
+
// remove the existing symlink
|
|
21
|
+
try {
|
|
22
|
+
fs.unlinkSync(target)
|
|
23
|
+
} catch {
|
|
24
|
+
// symlink did not exist, continue
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// 'junction' is needed to make it work on windows, others ignore
|
|
29
|
+
fs.symlinkSync(rel, target, 'junction')
|
|
30
|
+
} catch (e) {
|
|
31
|
+
if (e.code !== 'EEXIST') throw e
|
|
32
|
+
// else: symlink exists (the previous unlink hasn't worked), ignore
|
|
33
|
+
}
|