Skip to content

Commit 727eefa

Browse files
committed
chore: migrate demo app to create-react-app
1 parent 87a87d1 commit 727eefa

47 files changed

Lines changed: 10936 additions & 3126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
public
1+
app
22
dist

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ jobs:
4141
run: yarn lint
4242
- name: Run test
4343
run: yarn test:cov
44-
- name: Run build
45-
run: yarn build:dist
44+
- name: Run build package
45+
run: yarn build:prod
4646

4747
- name: Coveralls GitHub Action
4848
uses: coverallsapp/github-action@master
@@ -69,13 +69,13 @@ jobs:
6969
${{ runner.os }}-yarn-
7070
- name: Install dependencies
7171
run: yarn install --frozen-lockfile
72-
- name: Run build
72+
- name: Run build demo app
7373
run: yarn build:demo
7474

7575
- name: Netlify GitHub Action
7676
uses: netlify/actions/cli@master
7777
with:
78-
args: deploy --prod --dir=public
78+
args: deploy --prod --dir=app/build
7979
env:
8080
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
8181
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

.github/workflows/size.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ jobs:
1111
- uses: preactjs/compressed-size-action@v2
1212
with:
1313
repo-token: "${{ secrets.GITHUB_TOKEN }}"
14-
build-script: "build:dist"
14+
build-script: "build:prod"

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
*.log
33

44
node_modules
5-
demo/.dev
6-
public
75
dist
86
coverage
9-
.size-snapshot.json
7+
.size-snapshot.json

.prettierignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
*.log
2-
demo/.dev
3-
public
2+
app
43
dist
54
coverage
6-
.size-snapshot.json
5+
.size-snapshot.json

.stylelintrc.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,38 @@ Please note we have a [code of conduct](CODE_OF_CONDUCT.md), please follow it in
1313
3. If you’ve fixed a bug or added code that should be tested.
1414
4. Ensure the test suite passes by running `yarn test`.
1515
5. Update the [README.md](README.md) with details of changes to the interface.
16-
6. Update the [demo app](demo/App) if needed.
16+
6. Update the [demo app](app/src) if needed.
1717
7. Make sure your code lints by running `yarn lint`.
1818

1919
## Development Workflow
2020

21-
After cloning REACT COOL DIMENSIONS, run `yarn` to fetch its dependencies. Then, you can run several commands:
21+
You can test new features or debug an issue by the way that I'm using.
2222

23-
- `yarn dev` runs the [demo app](demo/App) as your playground at `localhost:10001`. Support live reloading.
23+
1. Run `yarn link-pkg` to link the package into the [app directory](app).
24+
2. Run `yarn start` to create an `ESM` build and type definition file by `rollup` watch mode.
25+
3. Access the [app directory](app).
26+
4. In the **app directory**, run `yarn link-pkg` to link with the package then run `yarn start` to start development.
27+
5. Try something cool via the [demo app](app/src).
28+
29+
## Development Workflow
30+
31+
There're several useful commands that you can use during the development:
32+
33+
- `yarn link-pkg` links the package into the [app directory](app). You can develop or debug it via the [demo app](app/src).
34+
- `yarn start` creates a `dist` folder with an `ESM` build and type definition file by `rollup` watch mode.
2435
- `yarn lint:code` lints all `.js` and `.tsx?` files.
2536
- `yarn lint:type` runs the [TypeScript](https://www.typescriptlang.org) type-checks.
26-
- `yarn lint:style` lints all `.css` and `.tsx?` (for [Emotion](https://emotion.sh)) files.
2737
- `yarn lint:format` formats all files except the file list of `.prettierignore`.
28-
- `yarn lint` lints `code`, `type`, `style`, and `format`.
38+
- `yarn lint` lints `code`, `type`, and `format`.
2939
- `yarn test` runs the complete test suite.
3040
- `yarn test:watch` runs an interactive test watcher (helpful in development).
3141
- `yarn test:cov` runs the complete test suite with coverage report.
32-
- `yarn build:demo` creates a `public` folder with all the static files.
33-
- `yarn build:dist` creates a `dist` folder with package builds (`CJS` & `ESM`) and type definition file. You can test the package locally via [yarn link](https://yarnpkg.com/lang/en/docs/cli/link).
34-
- `yarn build` creates both `public` and `dist`.
35-
- `yarn clean:dev` deletes the `demo/.dev` build folder.
36-
- `yarn clean:demo` deletes the `public` build folder.
42+
- `yarn build:dev` creates a `dist` folder with an `ESM` build and type definition file for development.
43+
- `yarn build:prod` creates a `dist` folder with package builds (`CJS` & `ESM`) and type definition file. You can test the package locally via [yarn link](https://yarnpkg.com/lang/en/docs/cli/link).
3744
- `yarn clean:dist` deletes the `dist` build folder.
45+
- `yarn clean:size` deletes the `.size-snapshot.json` file.
3846
- `yarn clean:cov` deletes the `coverage` report folder.
39-
- `yarn clean` deletes all the build/coverage folders.
47+
- `yarn clean` deletes build, test, and size relevant files.
4048

4149
## Style Guide
4250

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const App = () => {
187187
The `onResize` event will be triggered whenever the size of the target element is changed. We can reduce the frequency of the event callback by activating the [responsive mode](#responsive-components) or implementing our own throttled/debounced function as below. Note that in order to throttle/debounce the function correctly, it will need to be memorized else it will be recreated on every render call.
188188
189189
```js
190-
import { useMemo } from 'react';
190+
import { useMemo } from "react";
191191
import _ from "lodash";
192192

193193
const returnObj = useDimensions({

app/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

app/.eslintrc.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
extends: ["react-app", "welly"],
3+
rules: {
4+
"react/react-in-jsx-scope": "off",
5+
},
6+
};

0 commit comments

Comments
 (0)