Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(plugin-satp-hermes): dist/lib/knex/knexfile.ts not under rootDir #3708

Open
petermetz opened this issue Dec 19, 2024 · 2 comments
Open
Assignees
Labels
bug Something isn't working IETF-SATP-Hermes Related to the Secure Asset Transfer Protocol as defined by the Internet Engineering Task Force. P2 Priority 2: High
Milestone

Comments

@petermetz
Copy link
Contributor

Description

Broken on both main and satp-dev

 cd packages/cactus-plugin-satp-hermes/
yarn ncc build ./dist/lib/main/typescript/plugin-satp-hermes-gateway-cli.js --minify --out=./dist/bundle/ncc/

The interesting parts from the logs that the command above will produce:

[tsl] ERROR
      TS6059: File '/home/peter/a/cacti/packages/cactus-plugin-satp-hermes/dist/lib/knex/knexfile-remote.ts' is not under 'rootDir' '/home/peter/a/cacti/packages/cactus-plugin-satp-hermes/src'. 'rootDir' is expected to contain all source files.
  The file is in the program because:
    Root file specified for compilation
[tsl] ERROR
      TS6059: File '/home/peter/a/cacti/packages/cactus-plugin-satp-hermes/dist/lib/knex/knexfile.ts' is not under 'rootDir' '/home/peter/a/cacti/packages/cactus-plugin-satp-hermes/src'. 'rootDir' is expected to contain all source files.
  The file is in the program because:
    Root file specified for compilation
[tsl] ERROR in /home/peter/a/cacti/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts(11,3)
      TS2304: Cannot find name 'expect'.
[tsl] ERROR in /home/peter/a/cacti/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts(12,3)
      TS2304: Cannot find name 'expect'.
[tsl] ERROR in /home/peter/a/cacti/packages/cactus-plugin-satp-hermes/src/test/typescript/make-checks.ts(14,3)
      TS2304: Cannot find name 'expect'.

2024-12-18-satp-hermes-ncc-bundle.crash.log

Acceptance Criteria

  1. Bundling is passing
  2. tsconfig.json is fixed so that it follows the usual patterns established by the rest of the packages
  3. Build itself is passing as well (yarn tsc)

cc: @RafaelAPB

@petermetz petermetz added bug Something isn't working P2 Priority 2: High IETF-SATP-Hermes Related to the Secure Asset Transfer Protocol as defined by the Internet Engineering Task Force. labels Dec 19, 2024
@petermetz petermetz added this to the v2.2.0 milestone Dec 19, 2024
@petermetz petermetz self-assigned this Dec 19, 2024
@CarolinaMartinezr
Copy link

Thank you, Peter!

petermetz added a commit to petermetz/cacti that referenced this issue Dec 20, 2024
1. Moved the typescript knex sources into the appropriate directory to match
the established patterns we use for building the code (./src/main/typescript/)
This fixed the problem of the bundler not finding the knexfile sources.
2. Also refactored the runtime require calls of the knex files to be build-time
import statements instead. This came with the benefit that we no longer require
the linter to be turned off and also that compile time checks are in effect.
In the future if we want to go back to importing the knex files dynamically
we could do so by adding a parameter to the log repository constructor parameter
object which could be holding the path to a knex file to be included at runtime.
(though I would only do this if we have no other choice - by default we should
always thrive to use the compiler and do as much at build time as possible).

Fixes hyperledger-cacti#3708

Signed-off-by: Peter Somogyvari <[email protected]>
@LordKubaya
Copy link
Contributor

I encountered the same error initially when testing the command. However, after deleting the dist folder and building again, the error no longer occurred. It's possible that leftover files from previous builds were causing the issue. I also ran a git reset --hard on my folder to ensure everything was clean, and run it again.
If is not this I don't know what can be.

petermetz added a commit to petermetz/cacti that referenced this issue Jan 17, 2025
1. Moved the typescript knex sources into the appropriate directory to match
the established patterns we use for building the code (./src/main/typescript/)
This fixed the problem of the bundler not finding the knexfile sources.
2. Also refactored the runtime require calls of the knex files to be build-time
import statements instead. This came with the benefit that we no longer require
the linter to be turned off and also that compile time checks are in effect.
In the future if we want to go back to importing the knex files dynamically
we could do so by adding a parameter to the log repository constructor parameter
object which could be holding the path to a knex file to be included at runtime.
(though I would only do this if we have no other choice - by default we should
always thrive to use the compiler and do as much at build time as possible).

Fixes hyperledger-cacti#3708

Signed-off-by: Peter Somogyvari <[email protected]>
RafaelAPB pushed a commit that referenced this issue Jan 17, 2025
1. Moved the typescript knex sources into the appropriate directory to match
the established patterns we use for building the code (./src/main/typescript/)
This fixed the problem of the bundler not finding the knexfile sources.
2. Also refactored the runtime require calls of the knex files to be build-time
import statements instead. This came with the benefit that we no longer require
the linter to be turned off and also that compile time checks are in effect.
In the future if we want to go back to importing the knex files dynamically
we could do so by adding a parameter to the log repository constructor parameter
object which could be holding the path to a knex file to be included at runtime.
(though I would only do this if we have no other choice - by default we should
always thrive to use the compiler and do as much at build time as possible).

Fixes #3708

Signed-off-by: Peter Somogyvari <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working IETF-SATP-Hermes Related to the Secure Asset Transfer Protocol as defined by the Internet Engineering Task Force. P2 Priority 2: High
Projects
None yet
Development

No branches or pull requests

3 participants