Skip to content

Commit b658b04

Browse files
authored
refactor: website in own workspace (patw0929#387)
* chore: move website into own workspace * chore: resolve linting problems * chore: website missing deps, peers * chore: ci, artifacts * docs: refs to start
1 parent 04ab817 commit b658b04

29 files changed

+4835
-2556
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@ jobs:
160160
- name: Deploy (dry)
161161
if: ${{ github.ref != 'refs/heads/master' }}
162162
run: |
163-
yarn deploy:dryrun
163+
yarn website:dryrun
164164
- name: Deploy
165165
if: ${{ github.ref == 'refs/heads/master' }}
166166
env:
167167
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
168168
run: |
169-
yarn deploy
169+
yarn website:deploy

.storybook/addons.js

-3
This file was deleted.

.storybook/config.js

-21
This file was deleted.

.storybook/helpers/helpers.js

-10
This file was deleted.

.storybook/stories/2.Props/Props.stories.js

-9
This file was deleted.

.storybook/stories/3.Playground/Playground.stories.js

-48
This file was deleted.

.storybook/stories/4.CustomCSS/CustomCSS.stories.js

-20
This file was deleted.

.storybook/stories/5.CustomStyle/CustomStyle.stories.js

-18
This file was deleted.

.storybook/stories/6.GeoIP/GeoIP.stories.js

-19
This file was deleted.

README.md

+3-6
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,18 @@ To build the examples locally, run:
2828

2929
```bash
3030
yarn
31-
yarn start
31+
yarn website:start
3232
```
3333

3434
Then open [`localhost:3000`](http://localhost:3000) in a browser.
3535

3636

3737
## Installation
3838

39-
The easiest way to use react-intl-tel-input is to install it from NPM and include it in your own React build process (using [Webpack](http://webpack.github.io/), etc).
40-
4139
```bash
4240
yarn add react-intl-tel-input
4341
```
4442

45-
4643
## Usage
4744

4845
```javascript
@@ -62,9 +59,9 @@ Please see the [Demo Page](https://patw0929.github.io/react-intl-tel-input/)
6259

6360
## Development (`src` and the build process)
6461

65-
To build, watch and serve the examples (which will also watch the component source), run `yarn start`.
62+
To build, watch and serve the examples (which will also watch the component source), run `yarn website:start`.
6663

67-
You can prepare a distribution build using `yarn run build`.
64+
You can prepare a distribution build using `yarn build`.
6865

6966
## Contributing
7067

config/paths.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var fs = require('fs')
33

44
// Make sure any symlinks in the project folder are resolved:
55
// https://github.com/facebookincubator/create-react-app/issues/637
6-
const appDirectory = fs.realpathSync(process.cwd())
6+
const appDirectory = fs.realpathSync(path.join(path.dirname(process.cwd())))
77

88
function resolveApp(relativePath) {
99
return path.resolve(appDirectory, relativePath)

package.json

+8-28
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.0.0",
44
"description": "Telephone input component. Rewrite intl-tel-input in React.js.",
55
"author": "patw",
6+
"workspaces": [
7+
"website"
8+
],
69
"contributors": [
710
{
811
"name": "Marc Cataford",
@@ -51,71 +54,48 @@
5154
"@babel/preset-react": "^7.0.0",
5255
"@commitlint/cli": "^8.3.5",
5356
"@commitlint/config-conventional": "^8.3.4",
54-
"@storybook/addon-actions": "4.1.11",
55-
"@storybook/addon-info": "^4.1.11",
56-
"@storybook/addon-knobs": "^4.1.11",
57-
"@storybook/addon-options": "^4.1.11",
58-
"@storybook/cli": "^4.1.6",
59-
"@storybook/react": "^4.1.6",
60-
"@storybook/storybook-deployer": "^2.8.1",
6157
"babel-core": "^7.0.0-bridge.0",
6258
"babel-eslint": "^10.0.1",
6359
"babel-jest": "^23.6.0",
64-
"babel-loader": "^8.0.4",
6560
"babel-plugin-dynamic-import-node": "^2.2.0",
6661
"babel-plugin-react-docgen": "^2.0.2",
6762
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
6863
"coveralls": "^2.11.9",
69-
"css-loader": "^1.0.1",
70-
"css-modules-require-hook": "^4.0.1",
7164
"enzyme": "^3.3.0",
7265
"enzyme-adapter-react-16": "^1.5.0",
7366
"eslint": "^7.32.0",
7467
"eslint-config-airbnb": "~17.1.0",
7568
"eslint-config-airbnb-base": "~13.1.0",
7669
"eslint-config-prettier": "^6.10.0",
77-
"eslint-loader": "^2.1.1",
7870
"eslint-plugin-import": "^2.14.0",
7971
"eslint-plugin-jsx-a11y": "^6.1.1",
8072
"eslint-plugin-prettier": "^3.1.2",
8173
"eslint-plugin-react": "^7.11.0",
8274
"eslint-plugin-security": "^1.3.0",
83-
"file-loader": "^2.0.0",
8475
"husky": "^4.2.3",
8576
"identity-obj-proxy": "^3.0.0",
86-
"image-webpack-loader": "^4.6.0",
8777
"jasmine-reporters": "^2.2.0",
8878
"jest": "^23.6.0",
8979
"jsdom": "^9.2.1",
9080
"lint-staged": "^11.1.1",
91-
"mini-css-extract-plugin": "^0.4.5",
92-
"optimize-css-assets-webpack-plugin": "^5.0.1",
9381
"packwatch": "^1.0.0",
94-
"postcss-safe-parser": "^4.0.1",
9582
"prettier": "^1.14.2",
9683
"prettier-eslint": "^9.0.1",
9784
"react": "^16.4.1",
9885
"react-dom": "^16.4.1",
99-
"react-hot-loader": "^1.3.0",
10086
"rimraf": "2.5.4",
10187
"sass": "^1.37.4",
102-
"sass-loader": "^7.1.0",
10388
"semantic-release": "^17.0.4",
104-
"sinon": "^1.17.4",
105-
"storybook-addon-react-docgen": "^1.0.4",
106-
"style-loader": "^0.23.1",
107-
"uglifyjs-webpack-plugin": "^2.0.1",
108-
"url-loader": "^1.1.2",
109-
"webpack": "^4.27.1"
89+
"sinon": "^1.17.4"
11090
},
11191
"scripts": {
11292
"prebuild": "yarn run clean",
11393
"build": "BABEL_ENV=production babel src -d dist && cp -r ./src/*.png ./dist && sass ./src/intlTelInput.scss ./dist/main.css",
11494
"clean": "rimraf dist",
115-
"start": "start-storybook -p 4000 -c .storybook",
116-
"deploy:dryrun": "storybook-to-ghpages --dry-run",
117-
"deploy": "storybook-to-ghpages -- --ci",
118-
"lint": "eslint src *.js",
95+
"website:start": "yarn workspace website run start",
96+
"website:dryrun": "yarn workspace website run deploy:dryrun",
97+
"website:deploy": "yarn workspace website run deploy",
98+
"lint": "eslint src website/.storybook *.js",
11999
"coverage": "yarn test --coverage",
120100
"coverage-upload": "NODE_ENV=development cat coverage/lcov.info | yarn coveralls",
121101
"test": "jest src",

website/.storybook/addons.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import '@storybook/addon-options/register'
2+
import '@storybook/addon-knobs/register'
3+
import '@storybook/addon-actions/register'

website/.storybook/config.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { configure, addDecorator } from '@storybook/react'
2+
import { withOptions } from '@storybook/addon-options'
3+
import { version } from '../../package.json'
4+
5+
const req = require.context('./stories', true, /.js*/)
6+
7+
function loadStories() {
8+
req.keys().forEach(filename => req(filename))
9+
// eslint-disable-next-line global-require
10+
require('./styles/styles.scss')
11+
}
12+
13+
addDecorator(
14+
withOptions({
15+
name: `react-intl-tel-input v${version}`,
16+
url: 'https://github.com/patw0929/react-intl-tel-input',
17+
sidebarAnimations: true,
18+
}),
19+
)
20+
21+
configure(loadStories, module)

website/.storybook/helpers/helpers.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// eslint-disable-next-line import/prefer-default-export
2+
export const lookup = callback => {
3+
const request = new XMLHttpRequest()
4+
5+
request.addEventListener('load', () => {
6+
callback(JSON.parse(request.responseText).country_code)
7+
})
8+
9+
request.open('GET', 'https://api.ipdata.co/?api-key=test')
10+
request.send()
11+
}

.storybook/stories/1.GettingStarted/GettingStarted.stories.js website/.storybook/stories/1.GettingStarted/GettingStarted.stories.js

+16-11
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
import React from 'react';
2-
import { storiesOf } from '@storybook/react';
3-
import { withInfo } from '@storybook/addon-info';
1+
import React from 'react'
2+
import { storiesOf } from '@storybook/react'
3+
import { withInfo } from '@storybook/addon-info'
44

5-
import IntlTelInput from '../../../src/components/IntlTelInput';
6-
import '../../../src/intlTelInput.scss'
5+
import IntlTelInput from '../../../../src/components/IntlTelInput'
6+
import '../../../../src/intlTelInput.scss'
77

88
storiesOf('Documentation', module)
99
.addParameters({ options: { showAddonPanel: false } })
10-
.add('Getting Started', withInfo({ inline: true, source: false, propTables: null })(() =>
11-
(
12-
<IntlTelInput />
13-
)), { info: {
14-
text: `
10+
.add(
11+
'Getting Started',
12+
withInfo({ inline: true, source: false, propTables: null })(() => (
13+
<IntlTelInput />
14+
)),
15+
{
16+
info: {
17+
text: `
1518
## Installation
1619
1720
~~~bash
@@ -41,4 +44,6 @@ storiesOf('Documentation', module)
4144
);
4245
~~~
4346
`,
44-
},});
47+
},
48+
},
49+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react'
2+
import { storiesOf } from '@storybook/react'
3+
import { withInfo } from '@storybook/addon-info'
4+
5+
import IntlTelInput from '../../../../src/components/IntlTelInput'
6+
import '../../../../src/intlTelInput.scss'
7+
8+
storiesOf('Documentation', module)
9+
.addParameters({ options: { showAddonPanel: false } })
10+
.add(
11+
'Props',
12+
withInfo({ inline: true, source: false })(() => <IntlTelInput />),
13+
)

0 commit comments

Comments
 (0)