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

change(web/utils): add and distribute type declaration #3145

Merged
merged 4 commits into from May 20, 2020

Conversation

eddieantonio
Copy link
Contributor

It would be useful if the index.d.ts was usable in other packages. This PR:

  1. builds an index.d.ts
  2. lists it in the package.json as the types of this package
  3. runs the build automatically before the package is "published"; in this case, during a lerna bootstrap. This makes the index.d.ts available to all internal packages that depend on this one.

Note: merging this would help out #3128 a lot ^.^

@eddieantonio
Copy link
Contributor Author

Note: since I re-indented the tsconfig.json file, it might help to ignore whitespace in the diff! https://github.com/keymanapp/keyman/pull/3145/files?diff=split&w=1

@eddieantonio eddieantonio merged commit 204b765 into master May 20, 2020
@eddieantonio eddieantonio deleted the change/web/utils/add-type-declaration branch May 20, 2020 18:04
@mcdurdin
Copy link
Member

mcdurdin commented May 20, 2020

Note: this PR failed the Windows build test:

[02:54:17][Step 3/3] > @keymanapp/web-utils@14.0.78 build C:\BuildAgent\work\7ac43416c45637e9\keyman\common\core\web\utils
[02:54:17][Step 3/3] > tsc -p ./src/tsconfig.json
[02:54:17][Step 3/3] 
[02:54:20][Step 3/3] src/version.ts(2,22): error TS6053: File 'C:/BuildAgent/work/7ac43416c45637e9/keyman/common/core/web/utils/src/environment.inc.ts' not found.
[02:54:20][Step 3/3] src/version.ts(10,61): error TS2339: Property 'environment' does not exist on type 'typeof keyman'.
[02:54:20][Step 3/3] npm ERR! code ELIFECYCLE
[02:54:20][Step 3/3] npm ERR! errno 2
[02:54:20][Step 3/3] npm ERR! @keymanapp/web-utils@14.0.78 build: `tsc -p ./src/tsconfig.json`
[02:54:20][Step 3/3] npm ERR! Exit status 2
[02:54:20][Step 3/3] npm ERR! 
[02:54:20][Step 3/3] npm ERR! Failed at the @keymanapp/web-utils@14.0.78 build script.
[02:54:20][Step 3/3] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] npm ERR! A complete log of this run can be found in:
[02:54:20][Step 3/3] npm ERR!     C:\Users\bob\AppData\Roaming\npm-cache\_logs\2020-05-20T16_54_20_121Z-debug.log
[02:54:20][Step 3/3] lerna info lifecycle @keymanapp/web-utils@14.0.78~prepare: Failed to exec prepare script
[02:54:20][Step 3/3] lerna ERR! lifecycle "prepare" errored in "@keymanapp/web-utils", exiting 2
[02:54:20][Step 3/3] npm ERR! code ELIFECYCLE
[02:54:20][Step 3/3] npm ERR! errno 2
[02:54:20][Step 3/3] npm ERR! root@ bootstrap: `lerna bootstrap -- --no-optional`
[02:54:20][Step 3/3] npm ERR! Exit status 2
[02:54:20][Step 3/3] npm ERR! 
[02:54:20][Step 3/3] npm ERR! Failed at the root@ bootstrap script.
[02:54:20][Step 3/3] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] npm ERR! A complete log of this run can be found in:
[02:54:20][Step 3/3] npm ERR!     C:\Users\bob\AppData\Roaming\npm-cache\_logs\2020-05-20T16_54_20_322Z-debug.log
[02:54:20][Step 3/3] Build environment setup error detected!  Please ensure Node.js is installed!
[02:54:20][Step 3/3]  [H [J
[02:54:20][Step 3/3] ** error 1 ** deleting pull-keymanweb
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] ** error 1 ** deleting tike
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] ** error 1 ** deleting build
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] ** error 1 ** deleting developer

Can @jahorton (or perhaps @eddieantonio?) please check that the Windows build is okay and why this might have happened?

@eddieantonio
Copy link
Contributor Author

@jahorton: what I didn't notice is that src/environment.inc.ts is generated... somehow... somewhere. This needs to occur before this package is installed in other projects. Can we add that as part of the package.json scripts?

@eddieantonio
Copy link
Contributor Author

Note: this PR failed the Windows build test:

[02:54:17][Step 3/3] > @keymanapp/web-utils@14.0.78 build C:\BuildAgent\work\7ac43416c45637e9\keyman\common\core\web\utils
[02:54:17][Step 3/3] > tsc -p ./src/tsconfig.json
[02:54:17][Step 3/3] 
[02:54:20][Step 3/3] src/version.ts(2,22): error TS6053: File 'C:/BuildAgent/work/7ac43416c45637e9/keyman/common/core/web/utils/src/environment.inc.ts' not found.
[02:54:20][Step 3/3] src/version.ts(10,61): error TS2339: Property 'environment' does not exist on type 'typeof keyman'.
[02:54:20][Step 3/3] npm ERR! code ELIFECYCLE
[02:54:20][Step 3/3] npm ERR! errno 2
[02:54:20][Step 3/3] npm ERR! @keymanapp/web-utils@14.0.78 build: `tsc -p ./src/tsconfig.json`
[02:54:20][Step 3/3] npm ERR! Exit status 2
[02:54:20][Step 3/3] npm ERR! 
[02:54:20][Step 3/3] npm ERR! Failed at the @keymanapp/web-utils@14.0.78 build script.
[02:54:20][Step 3/3] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] npm ERR! A complete log of this run can be found in:
[02:54:20][Step 3/3] npm ERR!     C:\Users\bob\AppData\Roaming\npm-cache\_logs\2020-05-20T16_54_20_121Z-debug.log
[02:54:20][Step 3/3] lerna info lifecycle @keymanapp/web-utils@14.0.78~prepare: Failed to exec prepare script
[02:54:20][Step 3/3] lerna ERR! lifecycle "prepare" errored in "@keymanapp/web-utils", exiting 2
[02:54:20][Step 3/3] npm ERR! code ELIFECYCLE
[02:54:20][Step 3/3] npm ERR! errno 2
[02:54:20][Step 3/3] npm ERR! root@ bootstrap: `lerna bootstrap -- --no-optional`
[02:54:20][Step 3/3] npm ERR! Exit status 2
[02:54:20][Step 3/3] npm ERR! 
[02:54:20][Step 3/3] npm ERR! Failed at the root@ bootstrap script.
[02:54:20][Step 3/3] npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] npm ERR! A complete log of this run can be found in:
[02:54:20][Step 3/3] npm ERR!     C:\Users\bob\AppData\Roaming\npm-cache\_logs\2020-05-20T16_54_20_322Z-debug.log
[02:54:20][Step 3/3] Build environment setup error detected!  Please ensure Node.js is installed!
[02:54:20][Step 3/3]  [H [J
[02:54:20][Step 3/3] ** error 1 ** deleting pull-keymanweb
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] ** error 1 ** deleting tike
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] ** error 1 ** deleting build
[02:54:20][Step 3/3] 
[02:54:20][Step 3/3] ** error 1 ** deleting developer

Can @jahorton (or perhaps @eddieantonio?) please check that the Windows build is okay and why this might have happened?

I made a fix in #3146

@darcywong00 darcywong00 added this to the P10S7 milestone May 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants