GithubHelp home page GithubHelp logo

storybookjs / ember-cli-storybook Goto Github PK

View Code? Open in Web Editor NEW
37.0 50.0 39.0 289 KB

๐Ÿ“’ Ember storybook adapter

License: MIT License

JavaScript 67.88% HTML 32.01% Handlebars 0.11%
ember storybook

ember-cli-storybook's Introduction

ember-cli-storybook

๐Ÿ“’ Ember storybook adapter

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v16 or above

Installation

ember install @storybook/ember-cli-storybook

Usage

This will be triggered automatically as a post build action when running ember build

package.json options (defaults)

"storybook": {
  "ignoreTestFiles": true,
  "config": {}
}

ember-cli-build options (defaults)

"ember-cli-storybook": {
  "componentFilePathPatterns": [],
  "enableAddonDocsIntegration": true, // enables yuidoc generation
}

It's recommended to add the following commands in package.json to build, test and deploy Storybook with Ember:

"storybook": "start-storybook -p 6006 -s dist --ci",
"storybook-dev": "npm-run-all --continue-on-error --parallel start storybook",
"prebuild-storybook": "ember build",
"build-storybook": "build-storybook -s dist"

Config

The config object represents anything that could be parsed from an index.html file. This must be in the format as below:

{
  "meta": [{
    "attributes": ["name", "content"]
  }, {
    "attributes": ["name", "content"]
  }, {
    "attributes": ["name", "content", "id"]
  }],
  "link": [{
    "selector": "link",
    "attributes": ["rel", "href"]
  }],
  "script": [{
    "selector": "script",
    "attributes": ["src"]
  }]
}

So in order to add a script tag to the generated preview-head.html a potential config would look like:

"storybook": {
  "config": {
    "script": {
      "src": "./assets/foo.js"
    }
  }
}

It is important to note that storybook will by default serve any files out of the public folder. If you have custom files you would like to serve they need to exist there.

Embroider & YUIDoc

If you want to use YUIDoc with Embroider, you will need to modify your ember-cli-build.js to be able to compile the documentation.

const { Webpack } = require('@embroider/webpack');
- return require('@embroider/compat').compatBuild(app, Webpack);
+ const compiledApp = require('@embroider/compat').compatBuild(app, Webpack);
+
+ return require('@storybook/ember-cli-storybook').prerender(app, compiledApp);

Troubleshooting

Components that need routing for query parameters

The Storybook integration for Ember renders stories into a custom component in a router-less environment. This works for many situations but is insufficient when you have a story that requires query parameters, like a component that persists sorting or pagination information to the URL. Thereโ€™s no official way to accomplish this as of yet, but you can work around it by dynamically adding a route, visiting it using the private startRouting API, and injecting a pseudo-controller, such as in this utility function:

function injectRoutedController(controllerClass) {
  return on('init', function() {
    let container = getOwner(this);
    container.register('controller:storybook', controllerClass);

    let routerFactory = container.factoryFor('router:main');
    routerFactory.class.map(function() {
      this.route('storybook');
    });

    let router = container.lookup('router:main');
    router.initialURL = 'storybook';
    router.startRouting(true);

    this.set('controller', container.lookup('controller:storybook'));
  });
}

Then you can use it in a story like this:

export let SortableColumns = () => {
  return {
    template: hbs`
      <ListTable @source={{sortedShortList}} @sortProperty={{controller.sortProperty}} @sortDescending={{controller.sortDescending}} as |t|>
        <t.head>
          <t.sort-by @prop="name">Name</t.sort-by>
          <t.sort-by @prop="lang">Language</t.sort-by>
        </t.head>
        <t.body @key="model.name" as |row|>
          <tr>
            <td>{{row.model.name}}</td>
            <td>{{row.model.lang}}</td>
          </tr>
        </t.body>
      </ListTable>
      `,
    context: {
      injectRoutedController: injectRoutedController(
        Controller.extend({
          queryParams: ['sortProperty', 'sortDescending'],
          sortProperty: 'name',
          sortDescending: false,
        })
      ),

      sortedShortList: computed('controller.sortProperty', 'controller.sortDescending', function() {
        let sorted = productMetadata.sortBy(this.get('controller.sortProperty') || 'name');
        return this.get('controller.sortDescending') ? sorted.reverse() : sorted;
      }),
    },
  };
};

Working with store

As said above, Storybook integration for Ember renders stories into a custom component, that are store-less. If your component relies on an Ember model, for example, you can work around with the same way you would do for query params.

function createUser() {
  return on('init', function () {
    this.user = getOwner(this)
      .lookup('service:store')
      .createRecord('user', { lastName: 'Doe', email: '[email protected]' });
  });
}

And then in your story:

export const storeExample = () => {
  return {
    template: hbs`
      <SomeComponent
        @model={{this.user}}
        />
    `,
    context: {
      createUser: createUser(),
    },
  };
};

Making Ember import work

Because Ember uses a mapping to resolve import like @ember/array or @ember/object for example, they may not work in Storybook. However, and because the module is already declared in the babel preset for ember, you should be able to make them work by adding babel-plugin-ember-modules-api-polyfill to our package.json.

preview-head generation race condition

The .storybook/preview-head.html file is auto-generated and changes based on your config/environment.js and whether itโ€™s a static or live-updating build of Storybook. This means that youโ€™ll often see version control diffs for it, which can be bothersome.

Since the file is auto-generated, it would be nice to add it to .gitignore so it no longer shows up in diffs. Unfortunately, the documented way of starting a live-updating Storybook launches Ember CLI and Storybook in parallel, which means that in many cases, the preview-head file will not have been generated by the time Storybook needs it. To work around this if you want to ignore preview-head, you could either start Ember CLI and Storybook separately or create a script to launch them in sequence.

Stories that render blank or distorted

In some situations, components donโ€™t render properly in stories, such as when dynamically-calculated container widths are zero or contents are blank. The cause for this is as-yet unknown, but an unfortunate workaround like this utility class can help in the meantime, by delaying the insertion of the component until the container element has been fully rendered:

import EmberObject from '@ember/object';
import { next } from '@ember/runloop';

export default EmberObject.extend({
  init() {
    this._super(...arguments);
    this.set('complete', false);

    next(this, () => {
      this.set('complete', true);
    });
  },
});

Hereโ€™s an example of it being used in a story:

export let Standard = () => {
  return {
    template: hbs`
      <div class="block" style="height:50px; width:200px;">
        {{#if delayedTruth.complete}}
          <DistributionBar @data={{distributionBarData}} />
        {{/if}}
      </div>
      `,
    context: {
      delayedTruth: DelayedTruth.create(),
      distributionBarData: [
        { label: 'one', value: 10 },
        { label: 'two', value: 20 },
      ],
    },
  };
};

See the Contributing guide for details.

License

This project is licensed under the MIT License.

ember-cli-storybook's People

Contributors

arthur5005 avatar backspace avatar barrythepenguin avatar benedikt avatar billpull avatar dbendaou avatar dependabot[bot] avatar dingoeatingfuzz avatar ember-tomster avatar francois2metz avatar gabrielcsapo avatar gorzas avatar gossi avatar jimmyandrade avatar jtxz avatar meirish avatar nlepage avatar nlfurniss avatar sergeastapov avatar shilman avatar stormwarning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ember-cli-storybook's Issues

Specific configs for storybook

Is it possible to add a hook to be able to modify the parsed config before generating the preview_head.html file?
I would for example like to be able to enable ember-cli-mirage when using storybook, without enabling it in the regular development environment.

`ember-cli-storybook` config key was removed in v0.3.0

Describe the bug

The config key for this addon was changed in https://github.com/storybookjs/ember-cli-storybook/pull/50/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346L11-R11,
from ember-cli-storybook to the name of this package (@storybook/ember-cli-storybook)

Instead of breaking everyone, we could reinstate the old key and print a deprecation message instead.
We'll want to update any documentation too..

Additional context

See storybookjs/storybook#13429 (comment)

Automatic dotenv file generation

We use .envrc instead of .env for our app. It'd be great if we could configure this code to check for .envrc instead so that we don't have to deal with an extra dotenv file.

Doesn't work with ember v3.21

Getting the following error

ember install @storybook/ember-cli-storybook
..../storybook-app/node_modules/ember-cli/lib/cli/index.js:69
module.exports = async function (options) {
                       ^^^^^^^^

SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (.../storybook-app/node_modules/ember-cli/bin/ember:31:11)

Vulnerabilities found when adding the cli

While working on the intro to storybook for ember, while adding the ember-cli-storybook to my test code i came across some vulnerabilities. It seems that some of the ones used by this have need of update.

npm audit

                       === npm audit security report ===


                                 Manual Review
             Some vulnerabilities require your attention to resolve

          Visit https://go.npm.me/audit-guide for additional guidance


  Moderate        Regular Expression Denial of Service

  Package         hawk

  Patched in      >=3.1.3 < 4.0.0 || >=4.1.1

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > hawk

  More info       https://npmjs.com/advisories/77


  Moderate        Remote Memory Exposure

  Package         request

  Patched in      >=2.68.0

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request

  More info       https://npmjs.com/advisories/309


  Moderate        Regular Expression Denial of Service

  Package         mime

  Patched in      >= 1.4.1 < 2.0.0 || >= 2.0.3

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > form-data > mime

  More info       https://npmjs.com/advisories/535


  Moderate        Prototype Pollution

  Package         hoek

  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > hawk > boom > hoek

  More info       https://npmjs.com/advisories/566


  Moderate        Prototype Pollution

  Package         hoek

  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > hawk > cryptiles > boom > hoek

  More info       https://npmjs.com/advisories/566


  Moderate        Prototype Pollution

  Package         hoek

  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > hawk > hoek

  More info       https://npmjs.com/advisories/566


  Moderate        Prototype Pollution

  Package         hoek

  Patched in      > 4.2.0 < 5.0.0 || >= 5.0.3

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > hawk > sntp > hoek

  More info       https://npmjs.com/advisories/566


  Moderate        Memory Exposure

  Package         tunnel-agent

  Patched in      >=0.6.0

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > tunnel-agent

  More info       https://npmjs.com/advisories/598


  Low             Regular Expression Denial of Service

  Package         clean-css

  Patched in      >=4.1.11

  Dependency of   ember-cli [dev]

  Path            ember-cli > ember-cli-preprocess-registry >
                  broccoli-clean-css > clean-css-promise > clean-css

  More info       https://npmjs.com/advisories/785


  Low             Prototype Pollution

  Package         minimist

  Patched in      >=0.2.1 <1.0.0 || >=1.2.3

  Dependency of   ember-cli [dev]

  Path            ember-cli > bower-config > optimist > minimist

  More info       https://npmjs.com/advisories/1179


  High            Insufficient Entropy

  Package         cryptiles

  Patched in      >=4.1.2

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > hawk > cryptiles

  More info       https://npmjs.com/advisories/1464


  High            Prototype Pollution Protection Bypass

  Package         qs

  Patched in      >=6.0.4 <6.1.0 || >=6.1.2 <6.2.0 || >=6.2.3 <6.3.0 ||
                  >=6.3.2

  Dependency of   @storybook/ember-cli-storybook [dev]

  Path            @storybook/ember-cli-storybook > ember-cli-addon-docs-yuidoc
                  > yuidocjs > yui > request > qs

  More info       https://npmjs.com/advisories/1469

found 12 vulnerabilities (2 low, 8 moderate, 2 high) in 313040 scanned packages
  12 vulnerabilities require manual review. See the full report for details.

And based on that i thought of reporting this as it might be of some concern for other users aswell.

Feel free to provide feedback

Testing user interactions

Hello ๐Ÿ‘‹

Not really an issue, just a question:

I was wondering if there is a way to use the interaction API from storybook to test user interactions in stories?

If not, I would be keen to invest some time adding it to ember-cli-storybook if it makes sense, I would just need some guidance on how to do it :)

LinkTo doesn't generate href

I've created a few components that use LinkTo, but I can't get the href attribute to generate. I'm using the preview version of Ember Octant with angle bracket components.

// actor-name.hbs
<h5 class="actor-name">
    <LinkTo @route='people.person' @model={{this.args.actor}} class="actor-link" >
      {{this.actorName}}
    </LinkTo>
</h5>
<!-- generated mark-up -->
<h5 class="actor-name">
    <a id="ember209" class="ember-view actor-link">
      Actor Name
    </a>
</h5>

I'm not getting any errors and the component works perfectly in the Ember app, just not in Storybook. I've tried passing in an object with an id property and an id number, but neither seem to work, even though both work in the app. Is there something I can do to get it to work properly?

Install storybook for ember

After a discussion in discord:

Installing storybook for ember should be straightforward and only minimal effort.

  1. Installation:

With ember:

ember install @storybook/ember-cli-storybook

With npx (as mentioned on the Quickstart Guide):

npx -p @storybook/cli sb init

(that command should detect ember and then install ember-cli-storybook)

  1. Configuration:

After installation is run, developers make their changes in .storybook/ folder.

How to prevent incremental storybook builds when running `ember test -s`

When running ember test -s, after any file save, storybook will incrementally build and slow down testing a lot. Is there a way to prevent incremental storybook buildings when running ember test -s?

Below is a screenshot of storybook building after a file save when running ember test -s
Screen Shot 2020-07-08 at 10 55 47 AM

Using decorators

Is it possible to use decorators with Storybook for Ember?

Something like this doesn't seem to work:

export default {
  title: 'Component name',
  decorators: [storyFn => <div style={{ backgroundColor: 'yellow' }}>{storyFn()}</div>],
};

It returns:

Module parse failed: Unexpected token (108:11)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
 * ./node_modules/@storybook/source-loader/dist/server/index.js
You may need an additional loader to handle the result of these loaders.
|   },
|   decorators: [function (storyFn) {
>     return <div style={{
|       backgroundColor: 'yellow'
|     }}>{storyFn()}</div>;
 @ ./.storybook/config.js 35:281-337
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/config.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=true

0.4.0 publish

I have setup everything to have 0.4.0 published to npm. I don't have publish rights of the npm package @shilman do you have someone who can publish?

Livereload URL in preview-head.html returns 404

The livereload URL generated in the preview-head.html file is trying to perform a GET at

http://localhost:7020/_lr/livereload.js?port=7020&host=localhost

but that returns a 404.

Screen Shot 2020-02-04 at 3 56 43 PM

When I load up the ember app locally I noticed that the livereload URL that it is using is

http://localhost:7020/livereload.js?port=7020&host=localhost

Notice it doesn't use _lr/ in the URL . I went ahead and changed preview-head.html manually to use the same URL that the ember app uses for livereload and it worked.

I also noticed that it's been hardcoded this way from the beginning. Any reason this addon is hardcoded to include _lr/ in the livereload URL? Is this breaking any other storybook + ember setups?

Problem with fresh install

I am running into an issue on a fresh installation of storybook on my rock n roll app.

Screenshot from 2020-02-23 17-20-48

Npm: 6.13.4
Node: v10.19.0
ember-cli: 3.12.1
os: linux x64

๐Ÿค”

Make imports from `ember-cli-htmlbars-inline-precompile` work

The package ember-cli-htmlbars-inline-precompile updated to support using the proper package name (eg import hbs from 'ember-cli-htmlbars-inline-precompile') in addition to the existing import hbs from 'htmlbars-inline-precompile' but this package seems to break that. I've updated the package to 2.1.0 and when using hbs inside a story file, I get a lot of errors, mostly to do with Module not found: Error: Can't resolve 'fs' and storybook stops working.

UnhandledPromiseRejectionWarning while running `ember serve`

Thank you for this excellent addon! And for your work to bring storybook to Ember users ๐Ÿ™Œ.

While running ember serve after following the (workaround) install instructions in this issue:

ember install @storybook/ember-cli-storybook
npx -p @storybook/cli sb init
ember generate ember-cli-storybook

I'm getting a UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'content' of undefined error.

The fuller stacktrace is:

(node:16479) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'content' of undefined
    at removeRootURL (/Users/bfitch/src/icisstaff/facesheet/node_modules/@storybook/ember-cli-storybook/util.js:61:64)
    at parse (/Users/bfitch/src/icisstaff/facesheet/node_modules/@storybook/ember-cli-storybook/util.js:97:10)
    at Class.outputReady (/Users/bfitch/src/icisstaff/facesheet/node_modules/@storybook/ember-cli-storybook/index.js:84:26)
    at addonPromises.project.addons.reduce (/Users/bfitch/src/icisstaff/facesheet/node_modules/ember-cli/lib/models/builder.js:183:28)
    at Array.reduce (<anonymous>)
    at Builder.processAddonBuildSteps (/Users/bfitch/src/icisstaff/facesheet/node_modules/ember-cli/lib/models/builder.js:180:43)
    at tryCatcher (/Users/bfitch/src/icisstaff/facesheet/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:326:21)
    at invokeCallback (/Users/bfitch/src/icisstaff/facesheet/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:498:33)
    at publish (/Users/bfitch/src/icisstaff/facesheet/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:484:9)
    at flush (/Users/bfitch/src/icisstaff/facesheet/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:2441:7)
    at process._tickCallback (internal/process/next_tick.js:61:11)
(node:16479) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

From my initial debugging, it looks like the parse() method in util.js is expecting a meta tag with a URLencoded representation of the host app's config/environment.js file?

According to the corresponding test for parse(), it's expecting a JS object that looks like:

{
      meta: [{
        name: 'storybook-ember-3-1/config/environment',
        content: '%7B%22modulePrefix%22%3A%22storybook-ember-3-1%22%2C%22environment%22%3A%22test%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22none%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%7D%2C%22APP%22%3A%7B%22LOG_ACTIVE_GENERATION%22%3Afalse%2C%22LOG_VIEW_LOOKUPS%22%3Afalse%2C%22rootElement%22%3A%22%23ember-testing%22%2C%22autoboot%22%3Afalse%2C%22name%22%3A%22storybook-ember-3-1%22%2C%22version%22%3A%220.0.0+eebe77e5%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D'
      }]

// other tags omitted

}

But, while running ember serve and console.loging the config value (in removeRootURL()), that meta tag appears to be missing, which is what's causing the rejected promise:

{ meta: [],
  link:
   [ { rel: 'stylesheet', href: '/chirp/assets/vendor.css' },
     { rel: 'stylesheet', href: '/chirp/assets/app.css' } ],
  script:
   [ { src: '/chirp/ember-cli-live-reload.js' },
     { src: '/chirp/assets/vendor.js' },
     { src: '/chirp/assets/app.js' } ] }

I'm at the limits of my understanding of the addon build process, but it seems that that meta tag, with the expected config, is dynamically built and injected into index.html in the broccoli build process, but it's not there for some reason.

Is there a a missing file or config option I'm missing or a workaround so I can get storybook to load when I run yarn run storybook?

Thank you!


node: 10.15.0
ember-source: 3.15.0
@storybook/ember: 5.3.19
@storybook/ember-cli-storybook: 0.2.1

Storybook installation in an ember-addon fails [Bug]

Describe the bug

Running ember install @storybook/ember-cli-storybook in a fresh ember-addon fails:

The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.

Steps to reproduce the behavior

  1. Generate a fresh ember-addon ember addon dumy-addon
  2. Cd into dummy-addon cd dummy-addon
  3. Install '@storybook/ember-cli-storybook' via ember install @storybook/ember-cli-storybook --yarn
  4. See error
$ ember install @storybook/ember-cli-storybook

๐Ÿšง  Installing packages... This might take a couple of minutes.
Yarn: Installed @storybook/ember-cli-storybook
installing ember-cli-storybook
The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.

Environment

os: linux x64 (Fedora 33)
node: 14.7.0
yarn: 1.22.5
ember-cli: 3.22.0

[Bug] Dependency conflicts on freshly-created ember app

Describe the bug

When I create a new ember app and follow the instructions here, I make it to ember install @storybook/ember-cli-storybook at which point I get the following errors:

Command failed with exit code 1: npm install --save-dev --loglevel error @storybook/ember-cli-storybook
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @storybook/[email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/babel-plugin-ember-modules-api-polyfill
npm ERR!   babel-plugin-ember-modules-api-polyfill@"^3.5.0" from [email protected]
npm ERR!   node_modules/babel-plugin-htmlbars-inline-precompile
npm ERR!     babel-plugin-htmlbars-inline-precompile@"^5.0.0" from [email protected]
npm ERR!     node_modules/@ember/test-helpers/node_modules/ember-cli-htmlbars
npm ERR!       ember-cli-htmlbars@"^5.7.1" from @ember/[email protected]
npm ERR!       node_modules/@ember/test-helpers
npm ERR!         peer @ember/test-helpers@"^2.4.0" from [email protected]
npm ERR!         node_modules/ember-qunit
npm ERR!         1 more (the root project)
npm ERR!     babel-plugin-htmlbars-inline-precompile@"^5.2.1" from [email protected]
npm ERR!     node_modules/ember-auto-import
npm ERR!       ember-auto-import@"^2.2.4" from @ember-data/[email protected]
npm ERR!       node_modules/@ember-data/adapter
npm ERR!         @ember-data/adapter@"4.4.0" from [email protected]
npm ERR!         node_modules/ember-data
npm ERR!       8 more (@ember-data/debug, @ember-data/model, ...)
npm ERR!     2 more (ember-cli-htmlbars, the root project)
npm ERR!   babel-plugin-ember-modules-api-polyfill@"^3.5.0" from [email protected]
npm ERR!   node_modules/ember-auto-import
npm ERR!     ember-auto-import@"^2.2.4" from @ember-data/[email protected]
npm ERR!     node_modules/@ember-data/adapter
npm ERR!       @ember-data/adapter@"4.4.0" from [email protected]
npm ERR!       node_modules/ember-data
npm ERR!         dev ember-data@"~4.4.0" from the root project
npm ERR!     ember-auto-import@"^2.2.4" from @ember-data/[email protected]
npm ERR!     node_modules/@ember-data/debug
npm ERR!       @ember-data/debug@"4.4.0" from [email protected]
npm ERR!       node_modules/ember-data
npm ERR!         dev ember-data@"~4.4.0" from the root project
npm ERR!     7 more (@ember-data/model, @ember-data/record-data, ...)
npm ERR!   2 more (ember-cli-babel, the root project)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer babel-plugin-ember-modules-api-polyfill@"^2.12.0" from @storybook/[email protected]
npm ERR! node_modules/@storybook/ember
npm ERR!   dev @storybook/ember@"^6.5.9" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/babel-plugin-ember-modules-api-polyfill
npm ERR!   peer babel-plugin-ember-modules-api-polyfill@"^2.12.0" from @storybook/[email protected]
npm ERR!   node_modules/@storybook/ember
npm ERR!     dev @storybook/ember@"^6.5.9" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Steps to reproduce the behavior

ember new test-app;
cd test-app;
npx storybook init;
ember install @storybook/ember-cli-storybook;

Environment

ember-cli: 4.4.0
node: 16.15.1
os: darwin x64

Backport of `src` fix

Would it be possible to get a release of 0.5.0 with the src fix (found here: 9f693aa) backported to it?

For those of us stuck on versions of node below 16 we're unable to take the version including the fix as 0.6.0 bumped the minimum node engine version from 10.* || >= 12 to >= 16

[Embroider] yuidoc generation not working with Embroider app

The doc is generated in the postprocessTree in the index.json file, which is never triggered with Embroider build.
Therefore, the doc is not working, and when trying to import the doc in the preview.js file, it breaks Storybook.

We should rework the way the doc is generated to avoid doing it in the postprocessTree hook.

[Bug] npm install breaks with npm version 8

Describe the bug

When trying to install @storybook/ember-cli-storybook with npm in version 8.11.0 it always gives me the following error:

npm ERR! Invalid Version: 3.5.0pr2

The error comes from the npm package yui which is dragged in by ember-cli-addon-docs-yuidoc. The root cause of this issue has to do with a problem of npm itself, for more details see here: npm/cli#5017

When we run npm i with the --no-audit flag everything runs just fine but this also feels a little bit weird

I wonder if it's possible to use something else than ember-cli-addon-docs-yuidoc because I think that yuidoc is already a very old project (last published 6 years ago).

Just let me know what you think and feel free to just close the ticket if it's not relevant or not an option to switch away from ember-cli-addon-docs-yuidoc.

Steps to reproduce the behavior

If you have volta installed, skip step 1 and 2

  1. Install node version 16.15.1 // I think every 16.x is fine
  2. Install npm version 8.11.0 // I think every 8.x is fine
  3. check out the repo: https://github.com/tschoartschi/storybook-ember-cli-storybook-problems
  4. try to npm i without --no-audit flag
  5. now you should see the error: npm ERR! Invalid Version: 3.5.0pr2

Expected behavior

npm i also works without --no-audit

Environment

  • OS: MacOS BigSur 11.4
  • Node.js version: 16.15.1
  • NPM version: 8.11.0
  • Device: Mac Book Pro 15-inch 2017

More options to configure the app running in storybook

I've been playing around with storybook and ember and it's very nice.

What I realized, there is little to no configuration been able to do for the app that is loaded within storybook. E.g. it is loading an app as it was 2 years ago, e.g. with the application wrapper element.

What I'd like to do:

  • More configuration options as we have nowadays (e.g. optional-features)
  • An application route that I can modify ๐Ÿ™ˆ (I'm loading my theme in the application route, in storybook my components don't have a theme and are black and white)
  • Maybe even have a sample app, that is mounted in storybook. If I do run storybook, it's the dummy app inside storybook, but if I go to localhost:4200 it looks different.

The sample app could be located at .storybook/app and is allowed to only have an application route that is loaded from storybook.

What do you think? If there is an agreement, I will also find time to help implement :)

outputReady hook not working correctly

When running this addon in my (large, old, sophisticated) app the outputReady hook is not functioning correct and cannot generate the config files necessary for this to work.

The following section of code:

outputReady: function() {
  if (!this.app) {
    // You will need ember-cli >= 1.13 to use ember-cli-deploy's postBuild integration.
    // This is because prior to 1.13, `this.app` is not available in the outputReady hook.
    this.ui.writeLine('please upgrade to ember-cli >= 1.13')
    return;
  }
โ€ฆ

this.app is undefined for some reason, despite being on Ember and Ember-CLI 3.8. If I create a new project it works okay (though the app still does not run properlyโ€ฆ). I don't know enough about ember-cli and addons to know whether or not it's expected behaviour for this.app to be undefined under some scenarios or if my project is misconfigured somehow. Any ideas?

$ ember --version
ember-cli: 3.8.1
node: 10.15.1
os: darwin x64

Update documentation

AFAIU, there's some more documentation needed to make ember-cli-storybook work. It would need the following scripts in package.json for make it work (again, from Chromatic template):

"storybook": "start-storybook -p 6006 -s dist --ci",
"storybook-dev": "npm-run-all --continue-on-error --parallel start storybook",
"prebuild-storybook": "ember build",
"build-storybook": "build-storybook -s dist"

Ember build post scripts are not enough. I think we can add this info in the README file, I don't know if it's possible to concat this scripts in the package.json file when running the blueprint.

Runtime error on import { hbs } from 'ember-cli-htmlbars'

Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
    at includes (http://localhost:6006/vendors~main.925bee91ab6e54312329.bundle.js:113614:31)
    at push../node_modules/resolve-package-path/lib/should-preserve-symlinks.js.module.exports (http://localhost:6006/vendors~main.925bee91ab6e54312329.bundle.js:113622:52)
    at Object.<anonymous> (http://localhost:6006/vendors~main.925bee91ab6e54312329.bundle.js:113404:25)

This happens because ember-cli-htmlbars/utils.js requires hash-for-dep
https://github.com/ember-cli/ember-cli-htmlbars/blob/aee846034a6b6772fef7675dad2156e69b40df8e/lib/utils.js#L5

hash-for-dep/module-entry.js requires resolve-package-path
https://github.com/stefanpenner/hash-for-dep/blob/f4cc06e526a36f83427b8ce1a6da2ea616112278/lib/module-entry.js#L3

Which accesses process.execArgv which is not defined on webpack's process shim
https://github.com/stefanpenner/resolve-package-path/blob/3e9b74512521c69609e84736e64d8e21c52a0c55/lib/should-preserve-symlinks.ts#L17

webpack/node-libs-browser#78

Is this issue exclusive to me? Are others facing this as well? Am I missing some config

Constant Churn with preview-head.hbs

It seems like the <meta name="your-app/config/environment" tag in preview-head.hbs is constantly changing. Normally we don't see these changes because they're injected at runtime, whereas this harness seems to be hard coding them. Some questions:

  • Why is that?
  • Can we ignore these changes?

[Bug] Error: Ember is not defined (Ember v4.1.1)

Component in Storybook page is displayed with an error:

Button - Text โ‹… Storybook 2022-02-07 01-45-56

Button - Emoji โ‹… Storybook 2022-02-07 02-02-13

package.json:

"devDependencies": {
    "@babel/core": "^7.17.0",
    "@ember/optional-features": "^2.0.0",
    "@ember/test-helpers": "^2.6.0",
    "@glimmer/component": "^1.0.4",
    "@glimmer/tracking": "^1.0.4",
    "@storybook/addon-actions": "^6.4.18",
    "@storybook/addon-essentials": "^6.4.18",
    "@storybook/addon-links": "^6.4.18",
    "@storybook/builder-webpack5": "^6.4.18",
    "@storybook/ember": "^6.4.18",
    "@storybook/ember-cli-storybook": "^0.4.0",
    "@storybook/manager-webpack5": "^6.4.18",
    "autoprefixer": "^10.0.0",
    "babel-eslint": "^10.1.0",
    "babel-loader": "^8.2.3",
    "babel-plugin-ember-modules-api-polyfill": "^3.5.0",
    "babel-plugin-htmlbars-inline-precompile": "^5.3.1",
    "broccoli-asset-rev": "^3.0.0",
    "ember-auto-import": "^2.2.4",
    "ember-cli": "~4.1.1",
    "ember-cli-app-version": "^5.0.0",
    "ember-cli-babel": "^7.26.11",
    "ember-cli-dependency-checker": "^3.2.0",
    "ember-cli-htmlbars": "^6.0.1",
    "ember-cli-inject-live-reload": "^2.1.0",
    "ember-cli-sri": "^2.1.1",
    "ember-cli-terser": "^4.0.2",
    "ember-cli-typescript": "^5.0.0",
    "ember-cli-typescript-blueprints": "^3.0.0",
    "ember-data": "~4.1.0",
    "ember-export-application-global": "^2.0.1",
    "ember-fetch": "^8.1.1",
    "ember-load-initializers": "^2.1.2",
    "ember-page-title": "^7.0.0",
    "ember-qunit": "^5.1.5",
    "ember-resolver": "^8.0.3",
    "ember-source": "~4.1.0",
    "ember-template-lint": "^4.0.0",
    "ember-welcome-page": "^6.0.0",
    "eslint": "^8.8.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-ember": "^10.5.8",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-qunit": "^7.2.0",
    "eslint-plugin-storybook": "^0.5.6",
    "html-webpack-plugin": "^5.5.0",
    "loader.js": "^4.7.0",
    "npm-run-all": "^4.1.5",
    "postcss": "^8.4.6",
    "prettier": "^2.5.1",
    "qunit": "^2.17.2",
    "qunit-dom": "^2.0.0",
    "tailwindcss": "^3.0.0",
    "typescript": "^4.5.5",
    "webpack": "^5.68.0"
  },

Steps to reproduce the behavior

  1. ember install @storybook/ember-cli-storybook
  2. npx sb init
  3. npm run storybook
  4. See error

Environment

  • OS: macOS Monterey 12.1
  • Node.js version: v14.17.6
  • NPM version: 8.1.2
  • Browser: Chrome
  • Browser version: 98.0.4758.80

Ember Addon Cannot Run Storybook

So I have an ember add-on that I want to use storybook with. I followed the install steps and when I try to run the project I get this

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.array.filter' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 5:0-42
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.array.for-each' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 7:0-44
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./stories/Introduction.stories.mdx
Module not found: Error: Can't resolve 'core-js/modules/es.array.index-of' in '/Users/jcostanzo/Development/mbkit-ember/stories'
 @ ./stories/Introduction.stories.mdx 2:0-43
 @ ./stories sync ^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.mdx)$
 @ ./.storybook/generated-stories-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./stories/1-Button.stories.js
Module not found: Error: Can't resolve 'core-js/modules/es.function.bind' in '/Users/jcostanzo/Development/mbkit-ember/stories'
 @ ./stories/1-Button.stories.js 1:0-42
 @ ./stories sync ^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(js|jsx|ts|tsx))$
 @ ./.storybook/generated-stories-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./stories/1-Button.stories.js
Module not found: Error: Can't resolve 'core-js/modules/es.object.assign' in '/Users/jcostanzo/Development/mbkit-ember/stories'
 @ ./stories/1-Button.stories.js 2:0-42
 @ ./stories sync ^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.(js|jsx|ts|tsx))$
 @ ./.storybook/generated-stories-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./stories/Introduction.stories.mdx
Module not found: Error: Can't resolve 'core-js/modules/es.object.assign' in '/Users/jcostanzo/Development/mbkit-ember/stories'
 @ ./stories/Introduction.stories.mdx 3:0-42
 @ ./stories sync ^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.mdx)$
 @ ./.storybook/generated-stories-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.object.define-properties' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 9:0-54
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.object.define-property' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 11:0-52
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.object.get-own-property-descriptor' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 13:0-64
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.object.get-own-property-descriptors' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 15:0-65
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.object.keys' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 17:0-41
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./stories/Introduction.stories.mdx
Module not found: Error: Can't resolve 'core-js/modules/es.object.keys' in '/Users/jcostanzo/Development/mbkit-ember/stories'
 @ ./stories/Introduction.stories.mdx 4:0-40
 @ ./stories sync ^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.mdx)$
 @ ./.storybook/generated-stories-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/es.symbol' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 3:0-36
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./stories/Introduction.stories.mdx
Module not found: Error: Can't resolve 'core-js/modules/es.symbol' in '/Users/jcostanzo/Development/mbkit-ember/stories'
 @ ./stories/Introduction.stories.mdx 1:0-35
 @ ./stories sync ^\.(?:(?:^|\/|(?:(?:(?!(?:^|\/)\.).)*?)\/)(?!\.)(?=.)[^/]*?\.stories\.mdx)$
 @ ./.storybook/generated-stories-entry.js
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined

ERROR in ./.storybook/preview.js-generated-config-entry.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom-collections.for-each' in '/Users/jcostanzo/Development/mbkit-ember/.storybook'
 @ ./.storybook/preview.js-generated-config-entry.js 19:0-55
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/storybook-init-framework-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/common/config.js-generated-other-entry.js ./node_modules/@storybook/addon-docs/dist/frameworks/ember/config.js-generated-other-entry.js ./node_modules/@storybook/addon-links/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addDecorator.js-generated-other-entry.js ./node_modules/@storybook/addon-actions/dist/preset/addArgs.js-generated-other-entry.js ./node_modules/@storybook/addon-backgrounds/dist/preset/defaultParameters.js-generated-other-entry.js ./.storybook/preview.js-generated-config-entry.js ./.storybook/generated-stories-entry.js ./node_modules/webpack-hot-middleware/client.js?reload=true&quiet=false&noInfo=undefined
Child HtmlWebpackCompiler:
                          Asset      Size               Chunks  Chunk Names
    __child-HtmlWebpackPlugin_0  6.34 KiB  HtmlWebpackPlugin_0  HtmlWebpackPlugin_0
    Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
    [./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/core/dist/server/templates/index.ejs] 2.13 KiB {HtmlWebpackPlugin_0} [built]

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

Is it because I am using an addon? Here is the link to the repo https://github.com/jrock2004/mbkit-ember/tree/story-book

'@storybook/ember-cli-storybook@latest' is not in the npm registry

It looks like the name in package.json was updated, but maybe it hasn't been published to npm under the new name yet? Or maybe the access wasn't explicitly made public (scoped packages are private by default).

Side note: ember install ember-cli-storybook seems to add the appropriate packages, but exits with this error:

The `ember generate <entity-name>` command requires an entity name to be specified. For more details, use `ember help`.

Storybook 7

Hey,
I'm opening this issue to track any progress or work that needs to be done in order to be compatible with Storybook 7

It seems that we may need to convert this addon to Embroider v2 format.

The first step (to confirm) would be to migrate this repo to use Embroider

runningTests = true; Should come after vendor not before.

ember-cli-storybook/util.js

Lines 126 to 129 in 4b3cc72

if(value.src.indexOf('assets/vendor.js') > -1) {
// make sure we push this before vendor gets loaded to ensure the application does not bind to the window
doc.push('<script>runningTests = true;</script>');
}

I'm on Ember 3.13 and I'm not sure if it's as a result of being on the latest version, but Ember builds vendor.js by setting runningTests=false as one of its first lines.

Screen Shot 2019-10-17 at 4 23 27 PM

The application attachment and the check for this global variable doesn't come until the very end of app-name.js, which comes later.

So as far as I can tell, this variable should be set in between vendor.js and app-name.js.

An aside: Is there anyway to prevent storybook calling generatePreviewHead when I start it up?

[Bug] Ember install doesn't run blueprint

Describe the bug

In a new Ember project, I've run the command ember install ember-cli-storybook but it doesn't run blueprint. So it doesn't add the necessary dependencies into package.json neither creates config files.

Running the command doesn't show any error:

ember install @storybook/ember-cli-storybook                                                                                                                                                       

๐Ÿšง  Installing packages... This might take a couple of minutes.
npm: Installed @storybook/ember-cli-storybook
Installed addon package.

Steps to reproduce the behavior

  1. Create new Ember project.
  2. Run ember install ember-cli-storybook

Expected behavior

It should add dependencies into package.json and create .storybook folder and config files.

Environment

  • OS: Ubuntu 20.04
  • Node.js version: 14.18.3
  • NPM version: 6.14.15
  • Ember cli version: 4.2

Intended to be a standalone install?

Is this intended to be a standalone install - ie, any ember app could just ember install ember-cli-storybook and be up and running with storybook? If not, how should this be used with the storybook quick-start guide?

https://github.com/storybooks/storybook/tree/master/lib/cli
https://github.com/storybooks/storybook/blob/master/docs/src/pages/basics/guide-ember/index.md

Just doing an ember install with this repo, I ran into some troubles - such as there was no .storybook folder present.

[Bug] yuidoc failure

Describe the bug

Kills server, unrunnable. yuidoc is unmaintained and we should most likely remove it.

Proxy: [ember-cli -> Fastlane]: GET /voyager/manifest.json 200 - - 167.412 ms
error: --------------------------------------------------------------------------
error: An uncaught YUIDoc error has occurred, stack trace given below
error: --------------------------------------------------------------------------
error: Error: read ECONNRESET
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
error: --------------------------------------------------------------------------
error: Node.js version: v16.14.0
error: YUI version: 3.18.1
error: YUIDoc version: 0.10.2
error: Please file all tickets here: http://github.com/yui/yuidoc/issues
error: --------------------------------------------------------------------------
cleaning up..

Steps to reproduce the behavior

  1. Use node 16.14.0
  2. ember serve
  3. application failures

Expected behavior

Server doesn't fail to load.

Environment

  • OS: MacOS
  • Node.js version: 16.14.0
  • Yarn version: 1

Transitions between states not showing when changeing a knob

When changing a knob the transitions between states arent showing.

It seems likee the whole component is reinserted everytume. How can I avoid a full re-render/remount?

This is for ember components. I dont know if other frameworks have the same problem.

in app

(animating in/out icon, gif is not fully 60 fps.. :))

CleanShot 2020-05-26 at 22 50 32

in storybook

(not animating in/out icon)

CleanShot 2020-05-26 at 22 49 27

preview-head.html bug when rootURL is /

When tests/index.html file contains CDN links and rootURL configured to be /, then preview-head generation works slightly wrong. Issue is reproducible with default environment.js, generated by ember new.

Example:

'use strict'

module.exports = function (environment) {
  return {
    rootURL: '/'
  }
}

Input index.html link:

<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto&display=swap" />

Output preview-head.html link:

<link rel="stylesheet" href="https:.//fonts.googleapis.com/css?family=Roboto&display=swap" />
                                   ^ here is an issue

Adding basics tests

In order to ease contribution and be more confident to merge contributors PRs, we should have at least some basics test like:

  • Make sure ember-cli-storybook build
  • Try it with an example repo
  • something else?

[Bug] Fails to `build-storybook`

Describe the bug

Hey ๐Ÿ‘‹๐Ÿป

I'm unable to build a deployable Storybook. Starting a Storybook works, but when I run build-storybook -s dist, the generated iframe.html presents "No Preview". This is (apparently) preventing me from using Chromatic, Storybook's recommended provider.
T

Thanks in advance!

Steps to reproduce the behavior

  1. Run build-storybook -s dist
  2. npx http-server storybook-static
  3. Visit localhost:8080/iframe.html
  4. Verify that "No Preview" appears

Edit: After switching from serve to http-server, it doesn't show "No Preview" for Storybook, but it does for iframe.html

Expected behavior

Expected to be able to view my components

Screenshots and/or logs

Visiting localhost:8080 does indeed show my components

Screenshot 2021-03-25 at 15 56 34

Visiting localhost:8080/iframe.html shows "No Preview"

Screenshot 2021-03-25 at 15 31 08

Environment

  • OS: macOS Big Sur 11.2.1
  • Node.js version: 12.13.1
  • NPM version: 6.12.1
  • Browser (if applicable): N/A
  • Browser version (if applicable): N/A
  • Device (if applicable): N/A

Additional context

  • ember-source & ember-cli: 3.24
  • @storybook/ember: 6.2.0-rc.9
  • @storybook/ember-cli-storybook: 0.3.1

[Bug] `Error: Ember is not defined`(Ember ~v4.4.0) in production builds

Describe the bug

We're running into the exact same issue as #103 with the exception that in only happens when creating a production build of the "dummy" app.

Steps to reproduce the behavior

  1. set up Storybook in an Ember v4 based addon blueprint
  2. run ember build --environment=production to create a production build of the dummy app
  3. run build-storybook
  4. serve the final output npx http-server ./storybook-static
  5. open a Story that contains a component
  6. The Ember is not defined message will be shown in the preview section

Expected behavior

The component is rendered as normal.

Environment

  • Node.js version: 14.20.1
  • NPM version: 6.14.17

Additional context

This check fails because assets/vendor.js does not exist in production builds. The file will contain a hash instead: assets/vendor-some-hash-1234.js.

Addon Typescript

Doesn't appear to work for ts files coming from an addon.
I tried setting it:

'ember-cli-storybook': {
      enableAddonDocsIntegration: true,
      componentFilePathPatterns: [
        '*.ts',
        'lib/**/addon/components/*.ts'
      ]
  }

However, storybook still errors out:
image

How to handle/mock dynamic segment

I have a component that outputs link-to component the links to a route that requires a model that is loaded from a parent routes dynamic segment.

I get this error:

You attempted to generate a link for the "jobs.job.activity.candidate" route, but did not pass the models required for generating its dynamic segments. You must provide param company_id to generate.

Can I set a dynamic segment programatically or mock them so that the link-to will find the company model in storybook, like it does in the app (by the root route)

I am using this solution for accessing routing information at all.

How to add custom head tags?

Hi,

I was wondering how to add custom head tags like typescript or other external files. The documentation of Storybook points to this page and suggest to add these to the preview-head.html file. That will only work until ember-cli-storybook regenerates the file. Any pointers how to solve this issue?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.