@cap-js/cds-typer 0.28.0 → 0.28.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,7 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/).
6
6
 
7
- ## Version 0.29.0 - TBD
7
+ ## Version 0.28.1 - 2024-11-07
8
+ ### Fixed
9
+ - `cds build` no longer fails on Windows with an `EINVAL` error.
10
+ - `cds build` also supports custom model paths in `tsconfig.json` that do not end with `/index.ts`. This is the case for projects running with `tsx`.
8
11
 
9
12
  ## Version 0.28.0 - 24-10-24
10
13
  ### Added
package/cds-plugin.js CHANGED
@@ -75,12 +75,12 @@ cds.build?.register?.('typescript', class extends cds.build.Plugin {
75
75
  const outputDirectory = cds.env.typer?.outputDirectory
76
76
  if (outputDirectory) return outputDirectory
77
77
  try {
78
- // expected format: { '#cds-models/*': [ './@cds-models/*/index.ts' ] }
78
+ // expected format: { '#cds-models/*': [ './@cds-models/*' ] }
79
79
  // ^^^^^^^^^^^
80
80
  // relevant part - may be changed by user
81
81
  const config = JSON.parse(fs.readFileSync ('tsconfig.json', 'utf8'))
82
82
  const alias = config.compilerOptions.paths['#cds-models/*'][0]
83
- const directory = alias.match(/(?:\.\/)?(.*)\/\*\/index\.ts/)[1]
83
+ const directory = alias.match(/(?:\.\/)?(.*)\/\*/)[1]
84
84
  return normalize(directory) // could contain forward slashes in tsconfig.json
85
85
  } catch {
86
86
  DEBUG?.('tsconfig.json not found, not parsable, or inconclusive. Using default model directory name')
@@ -110,7 +110,7 @@ cds.build?.register?.('typescript', class extends cds.build.Plugin {
110
110
  DEBUG?.('building without config')
111
111
  // this will include gen/ that was created by the nodejs task
112
112
  // _within_ the project directory. So we need to remove it afterwards.
113
- await exec(`npx tsc --outDir "${this.task.dest}"`)
113
+ await exec(`npx tsc --outDir "${this.task.dest.replace(/\\/g, '/')}"`) // see https://github.com/cap-js/cds-typer/issues/374
114
114
  rmDirIfExists(path.join(this.task.dest, cds.env.build.target))
115
115
  rmDirIfExists(path.join(this.task.dest, this.#appFolder))
116
116
  }
package/lib/visitor.js CHANGED
@@ -486,6 +486,7 @@ class Visitor {
486
486
  // TODO find a better way to detect ABAP RFC actions
487
487
  const isRFC = Object.values(operation.params ?? {}).some(p => Object.keys(p).some(k => k.startsWith('@RFC')))
488
488
  file.addOperation(last(fq), params, returns, kind, docify(operation.doc), {named: true, positional: !isRFC})
489
+ file.addImport(baseDefinitions.path)
489
490
  }
490
491
 
491
492
  /**
@@ -545,6 +546,7 @@ class Visitor {
545
546
  }
546
547
  configuration.propertiesOptional = propOpt
547
548
  }, '}')
549
+ file.addImport(baseDefinitions.path)
548
550
  }
549
551
 
550
552
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/cds-typer",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "description": "Generates .ts files for a CDS model to receive code completion in VS Code",
5
5
  "main": "index.js",
6
6
  "repository": "github:cap-js/cds-typer",