fnando / streamdeck

A lean framework for developing Elgato Stream Deck plugins.
MIT License
34 stars 3 forks source link

Bug: link doesn't work on windows #5

Open OmgImAlexis opened 2 years ago

OmgImAlexis commented 2 years ago

Description

Running link on windows doesn't work.

How to reproduce

  1. Use Windows
  2. Run npx @fnando/streamdeck link

What do you expect

The command to work.

What happened instead

❯  npx @fnando/streamdeck link
cli.js link

Link the dist directory to Stream Deck's plugin directory.

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]
  --force    Replace installed extension, if any.                      [boolean]

Error: ENOENT: no such file or directory, symlink 'C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\build\dev.me.wvvw.unraid-release-tracker.sdPlugin' -> 'C:\Users\xo\Library\Application Support\com.elgato.StreamDeck\Plugins\dev.me.wvvw.unraid-release-tracker.sdPlugin'
    at Object.symlinkSync (node:fs:1655:3)
    at C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\@fnando\streamdeck\dist\cli\linking.js:48:22
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\@fnando\streamdeck\dist\cli\linking.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4058,
  syscall: 'symlink',
  code: 'ENOENT',
  path: 'C:\\Users\\xo\\code\\OmgImAlexis\\unraid-release-tracker\\build\\dev.me.wvvw.unraid-release-tracker.sdPlugin',
  dest: 'C:\\Users\\xo\\Library\\Application Support\\com.elgato.StreamDeck\\Plugins\\dev.me.wvvw.unraid-release-tracker.sdPlugin'
}
fnando commented 2 years ago

@OmgImAlexis Thanks for the report. I'm going to try and install a virtual machine to debug this (I haven't used Windows for the past 20 years).

OmgImAlexis commented 2 years ago

One thing I noticed is the --dev flag causes the build to output nothing. Might be worth adding the debug module so we can track down what's going on.

fnando commented 2 years ago

Hi @OmgImAlexis! I just released v0.1.0-alpha.5, which attempts to fix the linking issue. Let me know if that works for you now.

I'm going to take a look at the bundle --dev issue separately.

OmgImAlexis commented 2 years ago
❯ npx @fnando/streamdeck link
cli.js link

Link the dist directory to Stream Deck's plugin directory.

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]
  --force    Replace installed extension, if any.                      [boolean]

Error: Build failed with 1 error:
src/inspector.ts:11:2: ERROR: Expected identifier but found "}"
    at failureErrorWithLog (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:1599:15)
    at C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:1245:28
    at runOnEndCallbacks (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:1158:65)
    at buildResponseToResult (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:1243:7)
    at C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:1352:14
    at C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:662:9
    at handleIncomingPacket (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:759:9)
    at Socket.readFromStdout (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\esbuild\lib\main.js:629:7)
    at Socket.emit (node:events:526:28)
    at addChunk (node:internal/streams/readable:324:12) {
  errors: [
    {
      detail: undefined,
      location: [Object],
      notes: [],
      pluginName: '',
      text: 'Expected identifier but found "}"'
    }
  ],
  warnings: []
}
fnando commented 2 years ago

huh. That's super strange. What Windows version are you currently using? Maybe that's the issue. I just tried in a Win 11 virtual machine.

OmgImAlexis commented 2 years ago

Okay ignore the above comment, that was my code being the issue.

I guess the output if the build fails should be displayed better and without the help text. Here's the output now that I fixed my code.

❯ npx @fnando/streamdeck link
cli.js link

Link the dist directory to Stream Deck's plugin directory.

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]
  --force    Replace installed extension, if any.                      [boolean]

Error: ENOENT: no such file or directory, symlink 'C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\build\dev.me.wvvw.unraid-release-tracker.sdPlugin' -> 'C:\Users\xo\Library\Application Support\com.elgato.StreamDeck\Plugins\dev.me.wvvw.unraid-release-tracker.sdPlugin'
    at Object.symlinkSync (node:fs:1655:3)
    at C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\@fnando\streamdeck\dist\cli\linking.js:48:22
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\node_modules\@fnando\streamdeck\dist\cli\linking.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  errno: -4058,
  syscall: 'symlink',
  code: 'ENOENT',
  path: 'C:\\Users\\xo\\code\\OmgImAlexis\\unraid-release-tracker\\build\\dev.me.wvvw.unraid-release-tracker.sdPlugin',
  dest: 'C:\\Users\\xo\\Library\\Application Support\\com.elgato.StreamDeck\\Plugins\\dev.me.wvvw.unraid-release-tracker.sdPlugin'
}

unraid-release-tracker on  main [?] via  v17.5.0
❯ ls .\build\dev.me.wvvw.unraid-release-tracker.sdPlugin\

    Directory: C:\Users\xo\code\OmgImAlexis\unraid-release-tracker\build\dev.me.wvvw.unraid-release-tracker.sdPlugin

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----          27/03/2022 10:13 AM                css
d----          27/03/2022 10:13 AM                images
d----          27/03/2022 10:13 AM                inspectors
-a---          21/03/2022  8:11 PM           1035 inspector.html
-a---          27/03/2022 10:13 AM          39658 inspector.js
-a---          27/03/2022 10:13 AM           1009 manifest.json
-a---          27/03/2022 10:13 AM             33 plugin.html
-a---          27/03/2022 10:13 AM          39380 plugin.js
OmgImAlexis commented 2 years ago

Ah, you'll need to run a mkdir on the parent where you're trying to make the symlink incase the user doesn't have it already.

❯ ls C:\\Users\\xo\\Library\\Application Support\\com.elgato.StreamDeck\\Plugins\
Get-ChildItem: Cannot find path 'C:\Users\xo\Library\Application' because it does not exist.
fnando commented 2 years ago

This path is wrong. It should not have "Library\Application Support", as this is a mac thing. The correct path for Windows is "~/AppData/Roaming/Elgato/StreamDeck/Plugins".

Edit: make sure you're running 0.1.0-alpha.5.