Skip to content

Commit

Permalink
Merge pull request #407 from iCHEF/release/6.0.0
Browse files Browse the repository at this point in the history
Release v6.0.0
  • Loading branch information
kyoyadmoon committed Jun 27, 2023
2 parents 0ecf5c9 + 5c4c3e6 commit b986c24
Show file tree
Hide file tree
Showing 17 changed files with 713 additions and 269 deletions.
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,17 @@ Gypcrete does not publish develop builds to the `dist` branch anymore. It now pu
* When pushed to `develop` branch --> publish a canary build
* When pushed to `master` branch --> publish a relase build

### Releasing

We're relying on Lerna for versioning and publishing. When you create a Release on Github, it will trigger task on Travis CI to publish with Lerna. It also converts the lightweight tag created by Github Release to an annotated tag for Lerna to calculate versions.

When releasing a new version for Gypcrete, follow the steps:

1. Create a release branch `release/x.y.z`
2. *(Optional)* Release beta builds with `yarn release:pre` locally to specify version.
3. Bump version for `package.json` and `CHANGELOG`.
4. Bump children packages version with script:
```sh
yarn bumpversion
```
This will run `lerna version`, which updates all `package.json` files in `packages/`.

5. Commit above changes, then create a pull request for this release branch.
6. *[Important]* Create a new Release on Github in format of `v3.4.5` once it's merged into `master`.
Please be sure to prefix the tag name with `v` as Lerna uses them to calculate changes.

7. Backport changes from `master` back to `develop` by creating a `backport/x.y.y` branch and create a pull request for that.

At the time Github Release is created, it should trigger `yarn release` on Travis CI and publishes packages to npm.
## Release

1. 從 develop 開出新的 release branch,release branch 的格式必須符合 `release/x.y.z`,例如 `release/1.2.3``x.y.z` 的部分為欲發佈的版號,必須符合 semantic versioning。
2. 以這支新的 release branch 開出新的 PR,base branch 設為 `master`
3. 當 PR 被 merge 時,會觸發 github action 的 [Release workflow](https://github.com/iCHEF/fe-modules/blob/master/.github/workflows/release.yml),此 workflow 會在 master branch 做下列動作:
- 更新 package.json 的 version 並 commit
- 執行 `yarn changelog` 更新 CHANGELOG.md
- 打 git tag 並將 tag push 上 github
- 發佈新版本到 npm
- 開出 backport 到 develop branch 的 PR
4. merge backport PR。至此完成 release 流程。

## LICENSE
This project is licensed under the terms of the [Apache License 2.0](https://github.com/ichef/gypcrete/blob/master/LICENSE)
2 changes: 1 addition & 1 deletion configs/jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';

Enzyme.configure({ adapter: new Adapter() });
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@babel/preset-react": "^7.0.0",
"@babel/runtime": "^7.4.4",
"@babel/runtime-corejs3": "^7.4.4",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"autoprefixer": "^9.6.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
Expand All @@ -50,7 +51,6 @@
"coveralls": "^3.0.0",
"css-loader": "^0.28.8",
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.6.0",
"eslint": "7.8",
"eslint-config-airbnb": "18.2",
"eslint-config-ichef": "8.0",
Expand All @@ -69,9 +69,9 @@
"node-sass": "^4.12.0",
"postcss-loader": "^3.0.0",
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-test-renderer": "^16.6.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-test-renderer": "^17.0.2",
"sass-loader": "^6.0.2",
"style-loader": "^0.19.1",
"stylelint": "^10.1.0",
Expand Down
9 changes: 4 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,22 @@
"peerDependencies": {
"@babel/runtime-corejs3": "^7.4.4",
"prop-types": "^15.5.8",
"react": "^16.6.0",
"react-dom": "^16.6.0"
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"dependencies": {
"classnames": "^2.2.5",
"create-react-context": "^0.2.3",
"document-offset": "^1.0.4",
"keycode": "^2.1.9",
"lodash.omit": "^4.5.0",
"memoize-one": "^4.0.3",
"react-textarea-autosize": "^7.1.0",
"react-textarea-autosize": "^8.4.1",
"warning": "^4.0.3"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"enzyme": "^3.7.0",
"react-is": "^16.6.1",
"react-is": "^17.0.2",
"webpack": "^3.10.0",
"webpack-merge": "^4.1.2"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/EditableBasicRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class EditableBasicRow extends PureComponent {
focused: false,
};

// eslint-disable-next-line react/no-deprecated
componentWillReceiveProps(nextProps) {
// eslint-disable-next-line react/no-deprecated, camelcase
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.value !== this.props.value) {

Check warning on line 98 in packages/core/src/EditableBasicRow.js

View workflow job for this annotation

GitHub Actions / Lint and test

Must use destructuring props assignment
this.setState({ currentValue: nextProps.value });
}
Expand Down
30 changes: 15 additions & 15 deletions packages/core/src/EditableTextLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,6 @@ class EditableTextLabel extends PureComponent {
dblTouchTimeout: null,
};

// eslint-disable-next-line react/no-deprecated
componentWillReceiveProps(nextProps) {
/**
* If the edit-state of <EditableTextLabel> is *controlled* by `inEdit` prop.
* If the prop is `undefined`, this component became *uncontrolled*
* and should run itself.
*/
if (this.getEditabilityControlled(nextProps)) {
this.setState({ inEdit: nextProps.inEdit });
}
}

getEditabilityControlled(fromProps = this.props) {
return fromProps.inEdit !== undefined;
}
Expand All @@ -86,6 +74,18 @@ class EditableTextLabel extends PureComponent {
});
}

// eslint-disable-next-line react/no-deprecated, camelcase
UNSAFE_componentWillReceiveProps(nextProps) {
/**
* If the edit-state of <EditableTextLabel> is *controlled* by `inEdit` prop.
* If the prop is `undefined`, this component became *uncontrolled*
* and should run itself.
*/
if (this.getEditabilityControlled(nextProps)) {
this.setState({ inEdit: nextProps.inEdit });
}
}

leaveEditModeIfNotControlled() {
if (!this.getEditabilityControlled(this.props)) {
this.setState({ inEdit: false });
Expand All @@ -94,9 +94,9 @@ class EditableTextLabel extends PureComponent {

handleDoubleClick = (event) => {
/**
* If `inEdit` isn't controlled, this component by default
* goes into edit mode on double click/touch.
*/
* If `inEdit` isn't controlled, this component by default
* goes into edit mode on double click/touch.
*/
if (!this.getEditabilityControlled()) {
this.setState({ inEdit: true });
}
Expand Down
16 changes: 8 additions & 8 deletions packages/core/src/StatusIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ class StatusIcon extends PureComponent {
hideIcon: false,
};

// eslint-disable-next-line react/no-deprecated
componentWillMount() {
componentWillUnmount() {
clearTimeout(this.hideIconTimeout);
}

// eslint-disable-next-line react/no-deprecated, camelcase
UNSAFE_componentWillMount() {
this.autoToggleStatusIcon();
}

// eslint-disable-next-line react/no-deprecated
componentWillReceiveProps(nextProps) {
// eslint-disable-next-line react/no-deprecated, camelcase
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.status !== this.props.status) {

Check warning on line 62 in packages/core/src/StatusIcon.js

View workflow job for this annotation

GitHub Actions / Lint and test

Must use destructuring props assignment
this.autoToggleStatusIcon(nextProps.status);
}
Expand All @@ -65,10 +69,6 @@ class StatusIcon extends PureComponent {
}
}

componentWillUnmount() {
clearTimeout(this.hideIconTimeout);
}

/**
* Auto hides status icon after being SUCCESS for 2 secs,
* or shows icon when component leaves SUCCESS state.
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/contexts/listSpacing.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// #FIXME: use React navive context API when upgraded to v16+
import createReactContext from 'create-react-context';
import React from 'react';

const ListSpacingContext = createReactContext(true);
const ListSpacingContext = React.createContext(true);

export default ListSpacingContext;
4 changes: 3 additions & 1 deletion packages/core/src/mixins/__tests__/closable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe.each`
const handleClose = jest.fn();
const closableOptions = { onClickInside, onClickOutside };

mount(
const wrapper = mount(
<ClosableFoo closable={closableOptions} onClose={handleClose} />,
{ attachTo: rootNode },
);
Expand All @@ -139,6 +139,8 @@ describe.each`
keyEvent = new KeyboardEvent('keyup', { keyCode: keycode('Escape') });
document.dispatchEvent(keyEvent);
expect(handleClose).toHaveBeenCalledTimes(shouldBeCalled ? 1 : 0);

wrapper.unmount();
});
});

Expand Down

0 comments on commit b986c24

Please sign in to comment.