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

Use Typescript 4.0 build features #105

Closed
niemyjski opened this issue Jun 28, 2017 · 59 comments
Closed

Use Typescript 4.0 build features #105

niemyjski opened this issue Jun 28, 2017 · 59 comments

Comments

@niemyjski
Copy link
Contributor

I updated my local project to typescript 2.4 and ensured it was installed correctly and I removed my modules folder and made sure I don't have typescript installed globally. But every time my project runs it says version 2.3.4. I looked through the code and I don't see why this would be happing, do you have any ideas?

[TsProject] Building Project with: src/integrations/tsconfig.json
[TsProject] TypeScript compiler version:  2.3.4
@ToddThomson
Copy link
Owner

@niemyjski I had a request to update tsproject to the latest version of Typescript. Are you still using/interested in TsProject?

@niemyjski
Copy link
Contributor Author

Yes, we still use it and I don't think we can get off it unless it's easy to upgrade to something else. I noticed yesterday when I updated my deps that tsproject uses a specific version.

@niemyjski
Copy link
Contributor Author

Any ideas if real bundling will be built into typescript some day?

@ToddThomson ToddThomson changed the title Using latest versions of typescript. Use latest versions of typescript. Jan 11, 2018
@ToddThomson ToddThomson self-assigned this Jan 11, 2018
@ToddThomson
Copy link
Owner

@niemyjski I began updating TsProject to utilize the latest Typescript version. There is an issue with a Typescript AST change which restricts identifier names to be changes ( the field is marked readonly ). This makes the minifier with TsProject fail.
I will need to test a fix for the problem and then conduct further testing to see if other issues present themselves.

@niemyjski
Copy link
Contributor Author

Thanks for the update, really appreciate it.

@niemyjski
Copy link
Contributor Author

I was just checking in to see if there was any status updates on latest ts support :)

@slavafomin
Copy link

Hello! Thank you for your effort. Are you planning to finish adding support for the latest TypeScript? We are looking for a way to create a merged type definitions and this tool looks like a good fit.

@ToddThomson
Copy link
Owner

@slavafomin I just don't have any time to make the changes required for the latest Typescript version. My apologies! PR would be welcomed!

@niemyjski
Copy link
Contributor Author

niemyjski commented Jun 13, 2019

I know everyone has very little time these days including myself. I was wondering if there was any time to upgrade the deps to latest typescript? I'd be willing to donate to be on latest :)

@ToddThomson
Copy link
Owner

@niemyjski Hi Blake. If I remember correctly, (it has been a long while since I last looked at the code) there were a few changes to the Typescript AST that caused grief. I will take a few hours to at least determine the scope of work.

@ToddThomson
Copy link
Owner

@niemyjski I am updating TsProject to utilize Typescript 3.5.x. You may have to do some testing...

Currently, TsProject builds using TS 3.5.1. I will update the GitHub source once I have done some testing.

@ToddThomson ToddThomson changed the title Use latest versions of typescript. Use latest 3.5 version of Typescript. Jun 14, 2019
@ToddThomson
Copy link
Owner

ToddThomson commented Jun 20, 2019

@niemyjski @slavafomin OK. I've finished my research into the scope of work required to bring TsProject up to date with Typescript 3.5.
Typescript has come a long way over the last couple of years! I can now make use of Transforms!

I will update the following task list to keep you informed on my progress:

  • Update solution space (TsTools) to utilize latest vs 2019.
  • Breakout Compiler to Ts2Js component.
  • Breakout Minifier source to TsMinifier component.
  • Breakout Bundler source to TsBundler component.
  • Breakout Common code to TsToolsCommon.
  • Update TsProject to utilize Ts2Js, TsBundler, TsMinifier and TsToolsCommon components.
  • Add Mocha testing framework to TsTool components
  • Add tests for each TsTool component
  • Testing Ts2Js, TsMinifier, TsBundler

Ts2Js is feature complete and testing is almost complete. Continuing to develop tests for TsMinifier and TsBundler.

@ToddThomson ToddThomson added this to the TsProject Release 3.0 milestone Jun 26, 2019
@ToddThomson ToddThomson pinned this issue Jun 26, 2019
@ToddThomson
Copy link
Owner

@niemyjski I am adding Mocha as the testing framework for TsTools. What is your opinion of Mocha vs other testing frameworks?

@niemyjski
Copy link
Contributor Author

niemyjski commented Jun 28, 2019 via email

ToddThomson added a commit to ToddThomson/Ts2Js that referenced this issue Jun 29, 2019
@niemyjski
Copy link
Contributor Author

niemyjski commented Jul 3, 2019

I see you pushed a release to TS2JS, do you know exactly what I'd need to do to update to the latest releases? I get that this project is now split? Or will this just be a dependency on that and I won't have to change much?

@ToddThomson
Copy link
Owner

ToddThomson commented Jul 3, 2019

@niemyjski

Or will this just be a dependency on that and I won't have to change much?

The Compiler (Ts2Js), Minifier, and Bundler are now just dependencies that TsProject will require. The TsProject.Src() function that is used within your gulp build pipeline will not change.
TsProject will just contain Typescript "Build" related features.

@ToddThomson
Copy link
Owner

Weekly update: The 3.0.0 release of all TsTool components is progressing. I am currently working on TsBundler and converting it to run as a Typescript custom transformer. Likely another week or 2 to get to a RC release for each.

@niemyjski
Copy link
Contributor Author

Awesome, thank you for all of your work!

@ToddThomson
Copy link
Owner

@niemyjski I am currently working on release 3 of TsProject. Typescript 3.6 is opening the compiler API to project "build" features. I have decided that I will take a dependency on Typescript 3.6 for TsProject. It makes sense as the release of Typescript 3.6 will be in August and TsProject will likely be released towards the end of August.

@ToddThomson ToddThomson changed the title Use latest 3.5 version of Typescript. Use Typescript 3.6 build features Jul 30, 2019
@niemyjski
Copy link
Contributor Author

niemyjski commented Jul 30, 2019 via email

@niemyjski
Copy link
Contributor Author

Looks like typescript 3.7 is out with some amazing features. Hoping they made it easy to upgrade to.

@niemyjski
Copy link
Contributor Author

niemyjski commented Nov 3, 2020

I've been running into some issues running all my tests (CORS and outdated samples...) but I think it's unrelated and I'll continue testing but I haven't ran into any errors so far. It seems to be running good from the e2e samples I've ran so far with the updated code. But I did have a question: Any ideas why it's voiding out all the exports?

exports.NodeSubmissionAdapter = exports.NodeFileStorageProvider = exports.NodeRequestInfoCollector = exports.NodeModuleCollector = exports.NodeErrorParser = exports.NodeEnvironmentInfoCollector = exports.NodeFileStorage = exports.KeyValueStorageBase = exports.InMemoryStorage = exports.SubmissionMethodPlugin = exports.RequestInfoPlugin = exports.ModuleInfoPlugin = exports.EventExclusionPlugin = exports.ErrorPlugin = exports.EnvironmentInfoPlugin = exports.DuplicateCheckerPlugin = exports.ConfigurationDefaultsPlugin = exports.EventBuilder = exports.SettingsResponse = exports.Configuration = exports.ContextData = exports.ExceptionlessClient = exports.SubmissionResponse = exports.SettingsManager = exports.Utils = exports.DefaultSubmissionClient = exports.InMemoryStorageProvider = exports.DefaultEventQueue = exports.EventPluginManager = exports.EventPluginContext = exports.ReferenceIdPlugin = exports.HeartbeatPlugin = exports.NullLog = exports.ConsoleLog = exports.DefaultLastReferenceIdManager = void 0;

@ToddThomson
Copy link
Owner

@niemyjski I don't have a context to look at the issue with your exports all being assigned with void. It is likely better that I continue with my testing and if you encounter a problem then I can look at the specifics.

@niemyjski
Copy link
Contributor Author

niemyjski commented Nov 9, 2020

I was curious if you ran into any issues? I haven't seen any yet other than this build error on the ci server (https://github.com/exceptionless/Exceptionless.JavaScript/runs/1371996235?check_suite_focus=true) but I'm getting to the point I'm going to be running mass e2e testing very soon.

  gulp build
3
  shell: /bin/bash -e {0}
4
  env:
5
    npm_config_cache: /home/runner/.npm
7
Error: Cannot find module '/home/runner/work/Exceptionless.JavaScript/Exceptionless.JavaScript/node_modules/tsproject/lib/tsproject.js'. Please verify that the package.json has a valid "main" entry
8
    at tryPackage (internal/modules/cjs/loader.js:303:19)
9
    at Function.Module._findPath (internal/modules/cjs/loader.js:516:18)
10
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:867:27)
11
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
12
    at Module.require (internal/modules/cjs/loader.js:952:19)
13
    at require (internal/modules/cjs/helpers.js:88:18)
14
    at Object.<anonymous> (/home/runner/work/Exceptionless.JavaScript/Exceptionless.JavaScript/gulpfile.js:7:19)
15
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
16
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
17
    at Module.load (internal/modules/cjs/loader.js:928:32) {
18
  code: 'MODULE_NOT_FOUND',
19
  path: '/home/runner/work/Exceptionless.JavaScript/Exceptionless.JavaScript/node_modules/tsproject/package.json',
20
  requestPath: 'tsproject'
21
}```

It looks like you are missing a main entry in the package.json. The weird part is I don't see this locally.

@niemyjski
Copy link
Contributor Author

It looks like casing matters

  "main": "./lib/tsproject.js",
  "typings": "./lib/tsproject.d.ts",

image

@niemyjski
Copy link
Contributor Author

I just submitted a pr which I think will resolve this issue.

niemyjski added a commit to exceptionless/Exceptionless.JavaScript that referenced this issue Nov 9, 2020
* TypeScript 4.0 required src changes

* Update to latest tsproject and typescript

* npm install ts2js --save-dev

* Resolve tsproject upgrade errors

ToddThomson/tsproject#105

* Updated to latest beta

* Revert "Resolve tsproject upgrade errors"

This reverts commit dc61860.

* Cleanup tsconfig

* Updated packages

* Updated dist

* Upgraded to eslint

* Fixed eslint errors

* Added default exts

* Updates to how we run unit tests

* Added failing unit tests for resolving log levels based on settings order and null/empty sources

* Got the vs code test code runner working!

* Fixed unit test asserts for deep equality

* Fixed some unit test issues.

* Fixed several issues with resolving log levels and pattern matching

* set plugin context cancelled to default to false instead of undefined.

* Cleanup and update deps

* Update dist

* Fix quote
@ToddThomson
Copy link
Owner

@niemyjski Thank-you for your contribution to TsProject.

I have not found any issues with TsProject v4. I will soon publish a new NPM package with version 4.0.0-rc.1 with your changes ( and other small changes ).

@niemyjski
Copy link
Contributor Author

niemyjski commented Nov 9, 2020

Sounds great! Please let me know when you tag and push it

@ToddThomson
Copy link
Owner

@niemyjski NPM v4.0.0-rc.1 now published. Github dev branch has been updated to be in sync with my internal repository.

@niemyjski
Copy link
Contributor Author

Thanks!

That resolved that issue but for some reason on linux I'm getting

[TsProject] src/exceptionless.ts(1,27): error TS2307: Cannot find module 'TraceKit' or its corresponding type declarations.
50
Error: [TsProject] /home/runner/work/Exceptionless.JavaScript/Exceptionless.JavaScript/src/services/DefaultErrorParser.ts(1,27): error TS2307: Cannot find module 'TraceKit' or its corresponding type declarations.

No idea why it doesn't fail on macOS, I'm also going to try on windows.

@niemyjski
Copy link
Contributor Author

niemyjski commented Nov 10, 2020

Looking at this closer something doesn't add up as the exceptionless.node.json file doesn't even have a reference to this parser at all. So I don't know why it's being referenced. Also the main tsconfig is resolving everything properly.

[00:15:00] Starting 'typescript.node'...
[TsProject] Building Project with: src/tsconfig.node.json
[TsProject] TypeScript compiler version:  4.0.5
[TsProject] Compiling project files...
[TsProject] src/exceptionless.ts(1,27): error TS2307: Cannot find module 'TraceKit' or its corresponding type declarations.
[TsProject] /home/codespace/workspace/Exceptionless.JavaScript/src/services/DefaultErrorParser.ts(1,27): error TS2307: Cannot find module 'TraceKit' or its corresponding type declarations.
[TsProject] Build completed with errors. Outputs generated.

Is there a good way to output the logs for this?

@ToddThomson
Copy link
Owner

@niemyjski You could just run tsc with full output verbosity. The output from above, TsProject is just doing the Ts compilation phase.

It appears that the module resolution by the typescript compiler is picking up TraceKit from somewhere.

@niemyjski
Copy link
Contributor Author

Is there a good way to see what arguments tsproject is passing to tsc?

@ToddThomson
Copy link
Owner

TsProject does not use '''tsc'''. It uses the Typescript API.

All the configuration comes from the tsconfig.json file. TsProject doesn't add or change any config.

Try running tsc from the command line. It has many ways to peer into what Typescript module resolution is occurring.

@ToddThomson
Copy link
Owner

@niemyjski Try --traceresolution and perhaps --listfiles

@niemyjski
Copy link
Contributor Author

I'm not even sure how I'd pass that to tsproject via gulp, will need to figure that out. Perhaps an option we can set in our tsconfig file that tsproject could pick up?

@ToddThomson
Copy link
Owner

@niemyjski Use tsc with --traceresolution. You don't need to use TsProject to just compile your project.

@ToddThomson
Copy link
Owner

@niemyjski I will also see if I can include module resolution host tracing in the 4.0 milestone. It looks easy, but I have other features which I want to complete first.

@niemyjski
Copy link
Contributor Author

niemyjski commented Nov 13, 2020

I think I might have to setup a build matrix or something, I get one weird error on windows and works perfectly fine on Mac but fails on linux (will have to setup a vm or something). I ran node node_modules/typescript/bin/tsc src/exceptionless.node.ts --traceresolution --target es5 --module commonjs --listfiles on both windows and Mac and I didn't see the file it's complaining about anywhere in the log.

This really makes me wonder if I should move to lerna. Just so tests and dependencies can be split out better

@ToddThomson
Copy link
Owner

See issue #115

This is just a CI build issue, correct? I've found that cleaning state (everything) within the CI env usually fixes these kind of weird issues. What packages include TraceKit that you are using? Can you search the node_modules dir to TraceKit references? Sorry I can't really help you out on this!

@niemyjski
Copy link
Contributor Author

Thanks for #115!

I don't think so, there is something going on in linux as Windows and Mac work perfectly with rc2. I would think there would be extremely close similarities between macOS And Linux. If you were curious at the differences look at the linux build step https://github.com/exceptionless/Exceptionless.JavaScript/actions.

I take a hard dependency on TraceKit and there are no others that have a reference to it. I have a simple version of dependency injection. I define an interface in the core library that's shared and then at the entry point (each bundle target has it's own), I import the dependencies and set them on a singleton config instance (my di) and then these get flowed in. So in a bundle there is no way things are being resolved outside of the root file or across bundles unless something is being cached.

I'll try digging into this on linux dev container.

@ToddThomson
Copy link
Owner

@niemyjski Are you OK with me closing this issue? I'd like to push the production version of TsProject 4.0.0 to npm.

@niemyjski
Copy link
Contributor Author

Yes, my only concern is what ever tests you have you may want to have a build matrix for them :)

@ToddThomson ToddThomson unpinned this issue Nov 14, 2020
@niemyjski
Copy link
Contributor Author

@ToddThomson I just found a breaking issue in rc2 from rc1. In rc2 all the transpired files are placed next to the original (.d.ts, .js, .js.map). They shouldn't be created and they should be piped to the dist/temp folder in the same structure. I'm not sure what changed here I can try taking a look at the comit history

gulp.task('typescript', function typescript(done) {
  const stream = tsProject.src('src/tsconfig.json').pipe(gulp.dest('dist/temp'));
  stream.on('finish', done);
});

@ToddThomson
Copy link
Owner

@niemyjski Yes, the incremental compiler host now writes out the tsbuildinfo file and all individual js files. This is likely not the right thing to do. However, it will take a bit of time to determine the "right" thing to do. There is little info on the incremental API so I will need to go through the latest Typescript 4.1 code. Can you please start a new issue to track this?

@ToddThomson
Copy link
Owner

@niemyjski I have created issue #117 to track your issue.

Please also note issue #116. TsProject beyond release 4.0.x will become gulp-ts-bundler.

@niemyjski
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants