-
Notifications
You must be signed in to change notification settings - Fork 2
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
settings: npm command for run storybook #571
Comments
As a workaround, I think these settings should work: {
"storyExplorer.server.internal.storybookBinaryPath": "./node_modules/.bin/ng",
"storyExplorer.server.internal.commandLineArgs": [
"run",
"my-default-project:storybook"
]
} (Depending on your project/environment, you may need to adjust the path to |
nice idea, thanks! |
it is also possible to run an npm command (what I originally wanted 😄). a little more generic {
"storyExplorer.server.internal.storybookBinaryPath": "C:/Program Files/nodejs/npm.cmd",
"storyExplorer.server.internal.commandLineArgs": ["run", "storybook"]
} |
I have configured maybe it would be better to run a not npm/executable command from an extension, but custom existing tasks from I found a solution for myself: // launch.json
{
"name": "storybook",
"type": "chrome",
"request": "launch",
"port": 9222,
"preLaunchTask": "run storybook",
"url": "http://localhost:6006",
"urlFilter": "http://localhost:6006",
"userDataDir": false,
"cleanUp": "onlyTab"
} // tasks.json
{
// instead of running storybrook command, I run the extension command
"command": "${command:storyExplorer.startStorybookServer}",
"label": "run storybook",
"isBackground": false
} this works as expected: if the server is already running, then debug starts instantly |
I think it might be useful to have some configuration here: launch the storybook script directly, run an npm script, or launch an existing task. I could see situations where any of those options could be useful. |
Add support for new launch strategies for launching a Storybook developer server. This allows the server to be launched via direct invocation (`storybook` for Storybook 7 or `start-storybook` for Storybook 6), npm script, VS Code task, or custom script. The existing settings for configuring the `start-storybook` binary path and arguments are deprecated in favor of new options. Fixes #571 Fixes #605
Add support for new launch strategies for launching a Storybook developer server. This allows the server to be launched via direct invocation (`storybook` for Storybook 7 or `start-storybook` for Storybook 6), npm script, VS Code task, or custom script. The existing settings for configuring the `start-storybook` binary path and arguments are deprecated in favor of new options. Fixes #571 Fixes #605
Add support for new launch strategies for launching a Storybook developer server. This allows the server to be launched via direct invocation (`storybook` for Storybook 7 or `start-storybook` for Storybook 6), npm script, VS Code task, or custom script. The existing settings for configuring the `start-storybook` binary path and arguments are deprecated in favor of new options. Fixes #571 Fixes #605
With #803, launching a Storybook server via an npm script is now supported. There are a handful of new options now documented in the README that you can check out if you want to customize further. But if you were using a workaround with One other new launch option is launching an existing VS Code task, which should work as long as the task uses process execution under the hood. (That said, if you tell Story Explorer to run a task that runs a Story Explorer command to start the server, which will run a task that runs a Story Explorer command to start the server... that probably won't work. But it should for other tasks, or other launch strategies. 🙂) Sidenote: I haven't really done much to improve debugging workflows here, but I think there's a fair bit that could be done in that space. Flexibility in launch strategies is a small improvement, but I think there's more opportunity--if you have ideas or suggestions here, feel free to open a new issue to explore the space a bit more. This has been broached vaguely before in #383. |
First of all, I want to say thank you! 🙂 I also tried the task strategy If I run task twice from VS Code I get a message I've checked the first random extension: |
Thanks for pointing out the relaunch behavior--what you describe should happen is in fact what I intended, but it turns out there was a bug that prevented it from working as expected. I just merged #812, which should fix that. FWIW, there are some cases where the extension can't reuse an existing task the way things are, including:
These scenarios are hopefully rare, but they could happen. The extra launch ought to succeed in general, even if there's a port conflict--are you using Storybook 7 by chance? If so, there's a bug in the current beta which causes the port conflict prompt you're seeing there. (If not, then the way I'm doing it might not be working the way I thought. 🤔)
Yes, I think this is correct. In that case, AFAICT, the "label" is effectively derived from the other properties. So you could target that task using It's not super intuitive--I had to test that out to figure out what the right values were. I am matching on what VS Code internally presents as the task's |
no, we are currently using SB 6
I debugged your code and figured out how it works. for experiment I duplicated I have not yet been able to reproduce the problem stably 😔 |
Sorry for I continued on this thread 🙂 |
First of all: I just love this extension! 😄
According to the official documentation:
https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13
Starting from
Angular 13
i have to use angular.json to setup storybookSo my command to run
sotorybook
isng run my-default-project:storybook
Which is why I have to use the "external server" option and run the
storybook
manuallyIt would be cool if in the settings you could just specify the npm command to start the internal storybook server!
The text was updated successfully, but these errors were encountered: