Skip to content

Commit

Permalink
fix: Run Cosmos through Babel in examples (#648)
Browse files Browse the repository at this point in the history
* Run Cosmos through Babel in examples

* Update Browserify example
  • Loading branch information
ovidiuch committed Apr 14, 2018
1 parent aa5d052 commit b2e11ed
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"start:server": "babel-node server.js",
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"apollo-server-express": "^1.3.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/axios",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"axios": "^0.16.2",
Expand Down
10 changes: 10 additions & 0 deletions examples/browserify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
> **Note:** The Browserify example only works against the compiled monorepo packages. Follow these steps to make it work
>
> ```bash
> # In monorepo root
> yarn build
> yarn link-entries dist
>
> cd examples/browserify
> yarn start
> ```
4 changes: 3 additions & 1 deletion examples/browserify/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const onConnect = ev => {
const onUpdate = buffer => {
console.log('bundle - %d bytes', buffer.length);
};

const browserify = {
transform: ['babelify', 'require-globify'],
extensions: ['.js', '.json', '.jsx']
Expand All @@ -24,5 +25,6 @@ budo(path.join(__dirname, 'loader'), {
live: true,
host: 'localhost',
port: 8990,
browserify
browserify,
cors: true
}).on('update', onUpdate);
2 changes: 1 addition & 1 deletion examples/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/context",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"prop-types": "^15.5.10",
Expand Down
2 changes: 1 addition & 1 deletion examples/fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/fetch",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16",
Expand Down
2 changes: 1 addition & 1 deletion examples/local-state-old-fixtures/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/local-state",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16"
Expand Down
2 changes: 1 addition & 1 deletion examples/local-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/local-state",
"license": "MIT",
"scripts": {
"start": "cosmos",
"start": "babel-node node_modules/.bin/cosmos",
"test": "node ../../node_modules/jest-cli/bin/jest.js --watch --config ../../jest.config.json"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/localstorage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/localstorage",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16",
Expand Down
2 changes: 1 addition & 1 deletion examples/mixed-paths/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/mixed-paths",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16"
Expand Down
2 changes: 1 addition & 1 deletion examples/normalize-props-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/normalize-props-proxy",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16",
Expand Down
2 changes: 1 addition & 1 deletion examples/react-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/react-router",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16",
Expand Down
2 changes: 1 addition & 1 deletion examples/redux/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/redux",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16",
Expand Down
2 changes: 1 addition & 1 deletion examples/source-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/source-map",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"react-cosmos": "^4.0.0-beta.16"
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack-commons-chunk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/react-cosmos/react-cosmos/tree/master/examples/webpack-commons-chunk",
"license": "MIT",
"scripts": {
"start": "cosmos"
"start": "babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"moment": "^2.18.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack-dll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"scripts": {
"build-dll": "../../node_modules/.bin/webpack --config webpack.vendor.config.js",
"start": "yarn run build-dll && cosmos"
"start": "yarn run build-dll && babel-node node_modules/.bin/cosmos"
},
"dependencies": {
"moment": "^2.18.1",
Expand Down

0 comments on commit b2e11ed

Please sign in to comment.