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

Generated vscode tasks.json file has invalid scripts that fail #786

Open
2 of 3 tasks
DavidTheProgrammer opened this issue Aug 13, 2023 · 1 comment
Open
2 of 3 tasks
Assignees

Comments

@DavidTheProgrammer
Copy link

Prerequisites

Please answer the following questions before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version of Node and the tools (Latest yo office but not latest node, v18.16.0)
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Expected behavior

The files generated after running yo office should work in VS Code without modification.

Current behavior

The run configurations fail as the "preLaunchTask" references a task with invalid syntax.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Run yo office --projectType taskpane --name "New Word AddIn" --host word --ts true
  2. In VSCode open the run and debug menu, select "Word Desktop (Edge Chromium)" and click run.
  3. Console output shows that the preLaunchTask failed due to a missing script.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Windows 11
  • Node version: v18.16.0
  • Office version:
  • Tool version: 4.3.1

Failure Logs

Please include any relevant log snippets, screenshots or code samples here.

Executing task: npm run "start:desktop -- --app word" 

npm ERR! Missing script: "start:desktop -- --app word"
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:

Suggestions

It seems if you create an npm task, as the plugin does, you cannot directly pass arguments as the piped output to npm will consider the full string as the script name "start:desktop -- --app word" and ofcourse that script doesn't exist. My fix is to rewrite the task to be of type shell instead of npm and pass the full npm command directly, below is the working version:

    {
      "label": "Debug: Word Desktop",
      "type": "shell",
      "command": "npm run start:desktop -- --app word",
      "presentation": {
        "clear": true,
        "panel": "dedicated",
      },
      "problemMatcher": []
    },

I have limited knowledge on how the tool works of course but if it's possible that the generator could instead generate tasks in this format, I believe this would be a non-issue. I also assume this affects all the tasks generated by the tool as they're in the same npm format.

@davidchesnut
Copy link
Member

Hi @DavidTheProgrammer, thanks for letting us know about this issue!

@millerds can you please help with this issue?
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