From 561bba987fac9072460e081549ffc0fc237b822c Mon Sep 17 00:00:00 2001 From: "MEGAN V. BECVARIK" Date: Tue, 1 Nov 2016 12:29:07 -0400 Subject: [PATCH] Build ES6 to ES5 in prepublish step. Closes #177 (#196) * Build ES5. Closes #177 * dont lint es5 build * build es5 in deploy script * fix deploy, update readme * fix package name --- .gitignore | 3 ++ README.md | 86 +++++++++++++++++++++-------------------------- package.json | 15 ++++----- scripts/deploy.sh | 1 + 4 files changed, 49 insertions(+), 56 deletions(-) diff --git a/.gitignore b/.gitignore index 08e6954a1879..3965f7c2ebfd 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ node_modules # docs .gh-pages + +# distribution files +dist diff --git a/README.md b/README.md index 6a2ed5f45559..334c085b9e98 100644 --- a/README.md +++ b/README.md @@ -8,64 +8,56 @@ A set of React Components that implements [Bluemix Components](https://github.ib View available React Components [here](https://pages.github.ibm.com/Bluemix/bluemix-components-react/). ## Getting Started +Bluemix Components React is published to a private npm registry maintained by Bluemix Ops Console team. -> NPM package for `bluemix-components-react` is coming soon. +1. Before installing with npm, +you must create an **.npmrc** file - you can create this in the root of your project folder or on your computer's **~** directory. -Requires the use of -[Webpack](http://webpack.github.io/docs/tutorials/getting-started/) and the following dependencies below. -See [webpack.config.js](https://github.ibm.com/Bluemix/bluemix-components-react/blob/master/.storybook/webpack.config.js) for details. + ``` + $ touch .npmrc + ``` -All dependencies can be installed with `npm`. + Next, write the following into your **.npmrc** file: -- `json-loader` -- `postcss-loader` -- `sass-loader` -- `style-loader` -- `css-loader` -- `node-sass` + ``` + //dev-console-npm.stage1.ng.bluemix.net/:_authToken="u6vjQywpRv51/eKBiRcAFA==" + @console:registry=https://dev-console-npm.stage1.ng.bluemix.net/ + ``` -## Contributing - -First: Fork the repo, Clone your Fork and install dependencies with `npm` - -```sh -npm install -``` - -Start dev server (which uses [React Storybook](https://github.com/kadirahq/react-storybook)): + If you haven't done so already, create a **package.json** for your project: -```sh -npm run storybook -``` + ``` + $ npm init + ``` -Open browser to [http://localhost:9001/](http://localhost:9001/) and develop components in [.storybook](https://github.ibm.com/Bluemix/bluemix-components-react/tree/master/.storybook) folder. +2. Install bluemix-components-react with `npm`. -## Run tests + ``` + $ npm install --save @console/bluemix-components-react + ``` -```sh -npm run test -``` +3. These components require the use of +[Webpack](http://webpack.github.io/docs/tutorials/getting-started/) in your project. +See [webpack.config.js](https://github.ibm.com/Bluemix/bluemix-components-react/blob/master/.storybook/webpack.config.js) for an example config. -## Run coverage test + The following dependencies are required and can be installed with `npm`. -```sh -npm run coverage -``` + - `json-loader` + - `postcss-loader` + - `sass-loader` + - `style-loader` + - `css-loader` + - `node-sass` -## Run linting +4. Example Usage + ``` + import { Loading } from '@console/bluemix-components-react'; + ReactDOM.render( + , + document.getElementById('example-container') + ); + ``` -```sh -npm run lint -``` - -## Run lint and tests - -```sh -npm run check -``` - -## Deploy react-storybook to gh-pages +## Contributing -```sh -npm run deploy -``` +Please refer to our [Contributing Guidelines](https://github.ibm.com/Bluemix/bluemix-components-react/blob/master/CONTRIBUTING.md). diff --git a/package.json b/package.json index 12492cc0958b..cb0fd05f89f9 100644 --- a/package.json +++ b/package.json @@ -2,15 +2,16 @@ "name": "@console/bluemix-components-react", "version": "0.0.8-beta", "description": "A React wrapper for bluemix-components", - "main": "index.js", + "main": "dist/index.js", "scripts": { "check": "npm run lint && npm run test", "coverage": "jest --coverage && node scripts/create-badge.js", - "lint": "eslint .", + "lint": "eslint --ignore-pattern dist .", "storybook": "start-storybook -p 9001", "test": "jest", "test-watch": "jest --watch", - "deploy": "build-storybook -s .storybook -o .gh-pages && node scripts/gh-pages.js" + "deploy": "build-storybook -s .storybook -o .gh-pages && node scripts/gh-pages.js", + "build-es5": "babel . -d dist --ignore __tests__,node_modules,scripts,deploy.js" }, "keywords": [ "react", @@ -18,12 +19,7 @@ "bluemix-components" ], "files": [ - "components/**/*", - "containers/**/*", - "elements/**/*", - "internal/**/*", - "lib/**/*", - "index.js" + "dist/**/*" ], "contributors": [ { @@ -80,6 +76,7 @@ "@kadira/react-storybook-decorator-centered": "^1.0.0", "@kadira/storybook": "^2.29.0", "autoprefixer": "^6.3.7", + "babel-cli": "^6.18.0", "babel-eslint": "^6.1.2", "babel-jest": "^14.1.0", "babel-preset-es2015": "^6.14.0", diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 52e65263ad1e..9d9fce56d8a2 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -1,4 +1,5 @@ #! /bin/bash +npm run build-es5 npm install @console/console-npm-scripts ./node_modules/@console/console-npm-scripts/deploy.sh