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

port app/index and it's referenced files to ts #4083

Merged
merged 2 commits into from Dec 20, 2019

Conversation

LabhanshAgrawal
Copy link
Collaborator

@LabhanshAgrawal LabhanshAgrawal commented Dec 18, 2019

Added type augmentation for App and BrowserWindow types to include the fields which we are populating. There were some issues in putting this declaration in a d.ts file because of a tsc error getting triggered for electron typings, so it's in index.ts atm.

Replaced Window class with a newWindow function which returns a BrowserWindow instance, as BrowserWindow class cannot be extended ref

As ui/window had large number of lines changed(mostly indentation because of class->function) included the rename in a separate commit

@LabhanshAgrawal
Copy link
Collaborator Author

Can't reproduce the ci error, don't have windows pc with me. @Stanzilla can you please check.

@Stanzilla
Copy link
Collaborator

Hrm I get these locally as well

The exported identifier "getRootGroups" is not declared in Babel's scope tracker
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.

This problem is likely caused by another plugin injecting
"getRootGroups" without registering it in the scope tracker. If you are the author
 of that plugin, please use "scope.registerDeclaration(declarationPath)".
The exported identifier "HeaderContainer" is not declared in Babel's scope tracker
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.

This problem is likely caused by another plugin injecting
"HeaderContainer" without registering it in the scope tracker. If you are the author
 of that plugin, please use "scope.registerDeclaration(declarationPath)".

@Stanzilla
Copy link
Collaborator

Looks like babel/babel#10264 to me?

@LabhanshAgrawal
Copy link
Collaborator Author

LabhanshAgrawal commented Dec 18, 2019

That issue is closed but still doesn't seem to fix the babel message. Changing the code a bit to avoid it is possible though see
This doesn't stop the build though.
In CI the error that's stopping the build is this

app/ui/window.ts(6,19): error TS2307: Cannot find module 'electron-is-dev'.
app/index.ts(55,19): error TS2307: Cannot find module 'electron-is-dev'.
4:33:28 PM - Project 'tsconfig.json' can't be built because its dependency 'app/tsconfig.json' has errors
4:33:28 PM - Skipping build of project 'C:/projects/hyper-1b303/tsconfig.json' because its dependency 'C:/projects/hyper-1b303/app/tsconfig.json' has errors

Are you getting it while running yarn run dist?

@Stanzilla
Copy link
Collaborator

Nope, here's my full log:

❯ yarn run dist
yarn run v1.21.1
$ yarn run build && cross-env BABEL_ENV=production babel --out-file target/renderer/bundle.js --no-comments --minified target/renderer/bundle.js && electron-builder --publish=never
$ cross-env NODE_ENV=production webpack && tsc -b -v
Hash: c196eb9a25da369b3694465810bd05166a830efb6288ac7dfa402647df83
Version: webpack 4.41.3
Child hyper-app:
    Hash: c196eb9a25da369b3694
    Time: 1580ms
    Built at: 12/18/2019 9:45:05 PM
                   Asset        Size  Chunks             Chunk Names
          ignore_this.js    3.57 KiB       0  [emitted]  main
              index.html   874 bytes          [emitted]
     keymaps/darwin.json    1.62 KiB          [emitted]
      keymaps/linux.json    1.54 KiB          [emitted]
      keymaps/win32.json    1.32 KiB          [emitted]
             notify.html   149 bytes          [emitted]
            package.json  1000 bytes          [emitted]
         static/icon.png    4.78 KiB          [emitted]
    static/icon96x96.png    5.72 KiB          [emitted]
           tsconfig.json   207 bytes          [emitted]
    Entrypoint main = ignore_this.js
    [0] ./app/index.ts 0 bytes {0} [built]
Child hyper:
    Hash: 465810bd05166a830efb
    Time: 3700ms
    Built at: 12/18/2019 9:45:07 PM
               Asset      Size  Chunks                   Chunk Names
    assets/icons.svg  3.32 KiB          [emitted]
           bundle.js  2.12 MiB       0  [emitted]        main
       bundle.js.map   2.6 MiB       0  [emitted] [dev]  main
    Entrypoint main = bundle.js bundle.js.map
      [0] ./lib/index.tsx 6.07 KiB {0} [built]
      [1] external "electron" 42 bytes {0} [built]
     [46] ./lib/rpc.ts 56 bytes {0} [built]
     [49] ./lib/actions/index.ts 210 bytes {0} [built]
     [51] ./lib/utils/config.ts 473 bytes {0} [built]
     [52] ./lib/utils/plugins.ts 11.3 KiB {0} [built]
     [62] ./lib/utils/file.ts 794 bytes {0} [built]
     [64] ./lib/actions/ui.ts 6.65 KiB {0} [built]
     [69] ./lib/actions/sessions.ts 3.41 KiB {0} [built]
     [73] ./lib/actions/term-groups.ts 4.18 KiB {0} [built]
     [82] ./lib/actions/updater.js 397 bytes {0} [built]
     [84] ./lib/actions/notifications.ts 345 bytes {0} [built]
     [86] ./lib/actions/config.js 279 bytes {0} [built]
     [88] ./lib/containers/hyper.tsx 4.1 KiB {0} [built]
    [226] ./lib/store/configure-store.js 258 bytes {0} [built]
        + 227 hidden modules
Child hyper-cli:
    Hash: 6288ac7dfa402647df83
    Time: 3202ms
    Built at: 12/18/2019 9:45:06 PM
     Asset      Size  Chunks             Chunk Names
    cli.js  1.09 MiB       0  [emitted]  main
    Entrypoint main = cli.js
      [0] ./cli/index.ts 4.8 KiB {0} [built]
      [1] external "child_process" 42 bytes {0} [built]
      [2] external "path" 42 bytes {0} [built]
      [3] external "fs" 42 bytes {0} [built]
      [4] ./app/package.json 1000 bytes {0} [built]
     [10] (webpack)/buildin/module.js 497 bytes {0} [built]
     [16] external "os" 42 bytes {0} [built]
     [31] ./node_modules/args/lib sync 160 bytes {0} [built]
     [39] external "tty" 42 bytes {0} [built]
     [44] external "util" 42 bytes {0} [built]
     [58] external "events" 42 bytes {0} [built]
     [65] external "stream" 42 bytes {0} [built]
     [81] external "http" 42 bytes {0} [built]
    [112] external "readline" 42 bytes {0} [built]
    [130] ./cli/api.ts 3.64 KiB {0} [built]
        + 168 hidden modules

    WARNING in ./node_modules/args/lib/version.js 18:11-24
    Critical dependency: the request of a dependency is an expression
     @ ./node_modules/args/lib/index.js
     @ ./cli/index.ts

    WARNING in ./node_modules/keyv/src/index.js 18:14-40
    Critical dependency: the request of a dependency is an expression
     @ ./node_modules/cacheable-lookup/index.js
     @ ./node_modules/got/dist/source/normalize-arguments.js
     @ ./node_modules/got/dist/source/create.js
     @ ./node_modules/got/dist/source/index.js
     @ ./cli/index.ts
[9:45:07 PM] Projects in this build: 
    * app/tsconfig.json
    * tsconfig.json

[9:45:07 PM] Project 'app/tsconfig.json' is out of date because oldest output 'target/auto-updater-linux.js' is older than newest input 'app/rpc.ts'

[9:45:07 PM] Building project '/mnt/c/Users/Stan/projects/personal/hyper/app/tsconfig.json'...

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name ''[''. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name ''\x18''. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'Frame'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'Keyboard'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'Log'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'MessageManager'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'PreferenceManager'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'RowCol'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'Screen'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'ScrollPort'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'Size'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'Terminal'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'TestManager'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'TestRun'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'TextAttributes'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

app/dist/bundle.js:1:10 - error TS9005: Declaration emit for this file requires using private name 'VT'. An explicit type annotation may unblock declaration emit.

1 /******/ (function(modules) { // webpackBootstrap
           ~

[9:45:15 PM] Project 'tsconfig.json' can't be built because its dependency 'app/tsconfig.json' has errors

[9:45:15 PM] Skipping build of project '/mnt/c/Users/Stan/projects/personal/hyper/tsconfig.json' because its dependency '/mnt/c/Users/Stan/projects/personal/hyper/app/tsconfig.json' has errors


Found 16 errors.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@Stanzilla
Copy link
Collaborator

I only just realised that I ran that on WSL and not normal Windows, tried that then and it just failed on random node-gyp stuff again, I'm not sure I want to bother with that right now ./

@LabhanshAgrawal
Copy link
Collaborator Author

LabhanshAgrawal commented Dec 20, 2019

Found the culprit sindresorhus/cpy-cli#9
added the fix in a separate pr #4085
will rebase and push when that merges

@Stanzilla
Copy link
Collaborator

Heh, "I couldn't care less about Windows". Awesome investigation!

@Stanzilla
Copy link
Collaborator

👍

@LabhanshAgrawal LabhanshAgrawal deleted the ts_port branch December 20, 2019 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants