Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Include Typescript sources in packages to support local debugging #13

Conversation

stephan-noel
Copy link
Contributor

@stephan-noel stephan-noel commented Aug 12, 2020

Description

Includes the src directory in all packages which also included lib.

No unit tests added, as this is a functionality of the package installer itself.

Fixes #10

How Has This Been Tested?

The following steps were done for both @garment/cli and @garment/plugin-runner-ts:

  1. Use yarn pack in package directory
  2. Install zip files resulting from yarn pack in a repo that uses garment. Verify that src files are included in correct location upon installation.
  3. Debug original TypeScript files in Chrome Node inspector.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests to cover my changes
  • I have made corresponding changes to the documentation

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

@stephan-noel stephan-noel changed the title WIP: Include Typescript sources in packages to support local debugging Include Typescript sources in packages to support local debugging Aug 19, 2020
@beshanoe
Copy link
Contributor

After the discussion, I would rather strip all the map files when building for publishing. The code should still be readable enough to debug I believe

@luisvieiragmr
Copy link
Contributor

luisvieiragmr commented Sep 4, 2020

Hey should we close this issue then? I'm actually not against publishing source files but I would avoid it if possible

@beshanoe
Copy link
Contributor

beshanoe commented Sep 4, 2020

it needs to be changed in order to build on CI without source maps, cause issue is still there

@stephan-noel
Copy link
Contributor Author

Sorry guys, I've been a bit busy lately. I can try to take care of this ASAP.

@stephan-noel
Copy link
Contributor Author

stephan-noel commented Sep 6, 2020

This is giving me a lot more trouble than I expected. The crux of the problem seems to be that currently -- build does NOT support mixing with other tsc flags. There is a supposedly planned change in the future as stated here, but I'm not sure when or if it will include --sourceMap.

My plan was to introduce a build:dev command in package.json that would pass --sourceMap.

Other failed alternatives:

  • Passing multiple config files with tsc --build tsconfig.json tsconfig.dev.json: Doesn't seem to be how multiple json files was meant to be used
  • Create a tsconfig.dev.json file which extends tsconfig.json: Cannot do this, references are not inherited with extends
  • Create a separate file tsconfig.dev.json which duplicates all references in tsconfig.json and add compilerOptions: { sourceMap: true } to it: Referenced projects ignored this option, they seem to only respect what they directly extend from.

Other alternatives not investigated:

  • Use the TypeScript compiler API for incremental builds (seems a bit much)

Successful but unmaintainable alternative:

  • We place a tsconfig.dev.json file in each project that has sourceMap set to true, extends the project-specific tsconfig.json and duplicates the references in the project-specific tsconfig.json since they are not inherited. We create another solution file at the top level named tsconfig.dev.json whose paths instead of pointing to the project, point to the project-level tsconfig.dev.json. With this solution we have duplication at both the top level and the project level.

Maybe I'm missing something obvious. @beshanoe, @luisvieiragmr, any thoughts on a possible strategy to proceed with?

@beshanoe
Copy link
Contributor

beshanoe commented Sep 7, 2020

Wow that was really unexpected :D Thanks for the thorough investigation of alternatives. To be honest I don't see any good alternative here except turning off sourcemaps whatsoever. I'm working now on building garment with garment and it seems to be the best alternative cause we don't need to use references and can pass any config with a flag

@stephan-noel
Copy link
Contributor Author

stephan-noel commented Sep 7, 2020

Yeaa it was pretty frustrating 😄. Yeaa, building garment with garment seems like the best approach. What do you think I should do with this issue? Close, or leave it until we can try implementing it with garment building itself?

@beshanoe
Copy link
Contributor

@stephan-noel now I'm in the process of building it with garment but I already found issues there so I`m on it, if I manage to finish it this week, we'll decide what to do then

@beshanoe
Copy link
Contributor

should be fixed by #20 so Im closing this one

@beshanoe beshanoe closed this Sep 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debugging installed garment package is broken
3 participants