Skip to content

Commit

Permalink
Merge pull request #4594 from gabrielcsapo/update-ember-ergonomics
Browse files Browse the repository at this point in the history
[ember] update ember ergonomics to not require any manual setup
  • Loading branch information
shilman committed Oct 31, 2018
1 parent ee1a312 commit f716ee8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 54 deletions.
38 changes: 4 additions & 34 deletions docs/src/pages/basics/guide-ember/index.md
Expand Up @@ -37,50 +37,20 @@ npm init

Then add the following NPM script to your package json in order to start the storybook later in this guide:

> In order for your storybook to run properly be sure to be either run `ember serve` or `ember build` before running any storybook commands.
> In order for your storybook to run properly be sure to be either run `ember serve` or `ember build` before running any storybook commands. Running `ember serve` before storybook will enable live reloading.
```json
{
"scripts": {
"storybook": "start-storybook -p 9001 -s dist"
"build-storybook": "ember build && build-storybook -p 9001 -s dist",
"storybook": "ember serve & start-storybook -p 9001 -s dist"
}
}
```

## Setup environment

### Adding preview-head.html

In order for storybook to register your ember application you must add the following file to `.storybook/preview-head.html`

> These scripts may not contain everything you need, a good point of reference is to look at what is in the head tag in your applications `dist/index.html` file when you build.
```
<meta name="{ember-app-name}/config/environment" content="%7B%22modulePrefix%22%3A%22{ember-app-name}%22%2C%22environment%22%3A%22test%22%2C%22rootURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%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%22name%22%3A%22{ember-app-name}%22%2C%22version%22%3A%224.0.0-alpha.23+4f61a2fb%22%7D%7D" />
<link integrity="" rel="stylesheet" href="./assets/vendor.css">
<link integrity="" rel="stylesheet" href="./assets/{ember-app-name}.css">
<script src="./assets/vendor.js"></script>
<script>
runningTests = true;
</script>
<script src="./assets/{ember-app-name}.js"></script>
```

> Adding the runningTests script is extremely important don't forget to add this as it will result in your application binding multiple times.
Substitute `ember-app-name` with the name of your ember application.

> This is found by going to `package.json` and referencing the name field
### Adding .env

A file named `.env` is needed in the root directory with the following contents:

```
STORYBOOK_NAME={ember-app-name}
```
Your environment will be preconfigured using `ember-cli-storybook`. This will add a `preview-head.html`, a `.env` and make sure that your environment is configured to work with live reload.

## Create the config file

Expand Down
3 changes: 1 addition & 2 deletions examples/ember-cli/.env
@@ -1,2 +1 @@
STORYBOOK_EXAMPLE_APP=true
STORYBOOK_NAME=ember-example
STORYBOOK_NAME=ember-example
2 changes: 2 additions & 0 deletions examples/ember-cli/.gitignore
Expand Up @@ -13,3 +13,5 @@ build
.DS_Store
npm-debug.log
tmp
.env
.storybook/preview-head.html
10 changes: 0 additions & 10 deletions examples/ember-cli/.storybook/preview-head.html

This file was deleted.

4 changes: 3 additions & 1 deletion examples/ember-cli/package.json
Expand Up @@ -6,7 +6,8 @@
"build": "ember build",
"build-storybook": "yarn build && cp -r public/* dist && build-storybook -s dist",
"dev": "ember serve",
"storybook": "yarn build && start-storybook -p 9009 -s dist, public"
"storybook": "yarn build && start-storybook -p 9009 -s dist",
"storybook:dev": "yarn dev & start-storybook -p 9009 -s dist"
},
"devDependencies": {
"@babel/core": "^7.1.2",
Expand Down Expand Up @@ -34,6 +35,7 @@
"ember-cli-inject-live-reload": "^2.0.1",
"ember-cli-shims": "^1.2.0",
"ember-cli-sri": "^2.1.0",
"ember-cli-storybook": "^0.0.1",
"ember-cli-uglify": "^2.0.0",
"ember-load-initializers": "^1.1.0",
"ember-resolver": "^5.0.1",
Expand Down
27 changes: 20 additions & 7 deletions yarn.lock
Expand Up @@ -5477,13 +5477,13 @@ browserslist@^4.0.0, browserslist@^4.1.0, browserslist@^4.1.1:
node-releases "^1.0.0-alpha.12"

browserslist@^4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.2.1.tgz#257a24c879d1cd4016348eee5c25de683260b21d"
integrity sha512-1oO0c7Zhejwd+LXihS89WqtKionSbz298rJZKJgfrHIZhrV8AC15gw553VcB0lcEugja7IhWD7iAlrsamfYVPA==
version "4.3.4"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.3.4.tgz#4477b737db6a1b07077275b24791e680d4300425"
integrity sha512-u5iz+ijIMUlmV8blX82VGFrB9ecnUg5qEt55CMZ/YJEhha+d8qpBfOFuutJ6F/VKRXjZoD33b6uvarpPxcl3RA==
dependencies:
caniuse-lite "^1.0.30000890"
electron-to-chromium "^1.3.79"
node-releases "^1.0.0-alpha.14"
caniuse-lite "^1.0.30000899"
electron-to-chromium "^1.3.82"
node-releases "^1.0.1"

browserstack@^1.5.1:
version "1.5.1"
Expand Down Expand Up @@ -5774,11 +5774,16 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000884, can
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000890.tgz#86a18ffcc65d79ec6a437e985761b8bf1c4efeaf"
integrity sha512-4NI3s4Y6ROm+SgZN5sLUG4k7nVWQnedis3c/RWkynV5G6cHSY7+a8fwFyn2yoBDE3E6VswhTNNwR3PvzGqlTkg==

caniuse-lite@^1.0.30000890, caniuse-lite@^1.0.30000892:
caniuse-lite@^1.0.30000890:
version "1.0.30000892"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000892.tgz#344d2b51ee3ff5977537da4aa449c90eec40b759"
integrity sha512-X9rxMaWZNbJB5qjkDqPtNv/yfViTeUL6ILk0QJNxLV3OhKC5Acn5vxsuUvllR6B48mog8lmS+whwHq/QIYSL9w==

caniuse-lite@^1.0.30000892:
version "1.0.30000900"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000900.tgz#015cfe37897a3386a3075a914498800c29afe77e"
integrity sha512-xDVs8pBFr6bzq9pXUkLKpGQQnzsF/l6/yX38UnCkTcUcwC0rDl1NGZGildcJVTU+uGBxfsyniK/ZWagPNn1Oqw==

canonical-path@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/canonical-path/-/canonical-path-0.0.2.tgz#e31eb937a8c93ee2a01df1839794721902874574"
Expand Down Expand Up @@ -8172,6 +8177,14 @@ ember-cli-sri@^2.1.0:
dependencies:
broccoli-sri-hash "^2.1.0"

ember-cli-storybook@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/ember-cli-storybook/-/ember-cli-storybook-0.0.1.tgz#63908e3b81d08de7a7e51dc18c618a398ca2357a"
integrity sha512-dmPNYEvVLefodAgA/JZQxazdMqcBjvEB+4SNE9ba37jOx8HS3sWvcd31RXCam+KfGaFbrR/u2c8FCZ59SC3jOQ==
dependencies:
cheerio "^1.0.0-rc.2"
ember-cli-babel "^7.1.2"

ember-cli-string-utils@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/ember-cli-string-utils/-/ember-cli-string-utils-1.1.0.tgz#39b677fc2805f55173735376fcef278eaa4452a1"
Expand Down

0 comments on commit f716ee8

Please sign in to comment.