Skip to content

Commit 7cf4416

Browse files
committed
refactor: modify react docker only
1 parent 2e52ea7 commit 7cf4416

12 files changed

Lines changed: 155 additions & 294 deletions

File tree

CHANGELOG.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,76 +2,76 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5-
## [2.1.0](https://github.com/imagine10255/bear-script/compare/v2.1.0-alpha.1...v2.1.0) (2022-06-19)
5+
## [2.1.0](https://github.com/imagine10255/bear-react-docker/compare/v2.1.0-alpha.1...v2.1.0) (2022-06-19)
66

7-
## [2.1.0-alpha.1](https://github.com/imagine10255/bear-script/compare/v2.1.0-alpha.0...v2.1.0-alpha.1) (2022-06-19)
7+
## [2.1.0-alpha.1](https://github.com/imagine10255/bear-react-docker/compare/v2.1.0-alpha.0...v2.1.0-alpha.1) (2022-06-19)
88

99

1010
### Bug Fixes
1111

12-
* fix args command and docs ([37d6e63](https://github.com/imagine10255/bear-script/commit/37d6e63cbf8594c1255c56918cad6ea6348841bd))
12+
* fix args command and docs ([37d6e63](https://github.com/imagine10255/bear-react-docker/commit/37d6e63cbf8594c1255c56918cad6ea6348841bd))
1313

14-
## [2.1.0-alpha.0](https://github.com/imagine10255/bear-script/compare/v2.0.1...v2.1.0-alpha.0) (2022-06-19)
14+
## [2.1.0-alpha.0](https://github.com/imagine10255/bear-react-docker/compare/v2.0.1...v2.1.0-alpha.0) (2022-06-19)
1515

1616

1717
### Features
1818

19-
* add svg command ([3330860](https://github.com/imagine10255/bear-script/commit/33308603f886f0df1a16d4411055ed2e362df724))
19+
* add svg command ([3330860](https://github.com/imagine10255/bear-react-docker/commit/33308603f886f0df1a16d4411055ed2e362df724))
2020

21-
### [2.0.1](https://github.com/imagine10255/bear-script/compare/v1.1.0-alpha.1...v2.0.1) (2022-06-19)
21+
### [2.0.1](https://github.com/imagine10255/bear-react-docker/compare/v1.1.0-alpha.1...v2.0.1) (2022-06-19)
2222

2323

2424
### Features
2525

26-
* 新增 指令改寫 ([c5adf4f](https://github.com/imagine10255/bear-script/commit/c5adf4ffc2eb863d38a582c6ec5fa5968acf8e45))
26+
* 新增 指令改寫 ([c5adf4f](https://github.com/imagine10255/bear-react-docker/commit/c5adf4ffc2eb863d38a582c6ec5fa5968acf8e45))
2727

28-
## [2.0.0](https://github.com/imagine10255/bear-script/compare/v1.1.0-alpha.1...v2.0.0) (2022-06-19)
28+
## [2.0.0](https://github.com/imagine10255/bear-react-docker/compare/v1.1.0-alpha.1...v2.0.0) (2022-06-19)
2929

3030

3131
### Features
3232

33-
* 新增 指令改寫 ([c5adf4f](https://github.com/imagine10255/bear-script/commit/c5adf4ffc2eb863d38a582c6ec5fa5968acf8e45))
33+
* 新增 指令改寫 ([c5adf4f](https://github.com/imagine10255/bear-react-docker/commit/c5adf4ffc2eb863d38a582c6ec5fa5968acf8e45))
3434

35-
## [1.1.0-alpha.1](https://github.com/imagine10255/bear-script/compare/v1.1.0-alpha.0...v1.1.0-alpha.1) (2022-06-19)
35+
## [1.1.0-alpha.1](https://github.com/imagine10255/bear-react-docker/compare/v1.1.0-alpha.0...v1.1.0-alpha.1) (2022-06-19)
3636

37-
## [1.1.0-alpha.0](https://github.com/imagine10255/bear-script/compare/v1.0.4-alpha.3...v1.1.0-alpha.0) (2022-06-18)
37+
## [1.1.0-alpha.0](https://github.com/imagine10255/bear-react-docker/compare/v1.0.4-alpha.3...v1.1.0-alpha.0) (2022-06-18)
3838

3939

4040
### Features
4141

42-
* add args ([f719614](https://github.com/imagine10255/bear-script/commit/f71961411c09b3020b25cf76d87d00a11f09fe7e))
42+
* add args ([f719614](https://github.com/imagine10255/bear-react-docker/commit/f71961411c09b3020b25cf76d87d00a11f09fe7e))
4343

44-
### [1.0.4-alpha.3](https://github.com/imagine10255/bear-script/compare/v1.0.4-alpha.2...v1.0.4-alpha.3) (2022-06-18)
44+
### [1.0.4-alpha.3](https://github.com/imagine10255/bear-react-docker/compare/v1.0.4-alpha.2...v1.0.4-alpha.3) (2022-06-18)
4545

46-
### [1.0.4-alpha.2](https://github.com/imagine10255/bear-script/compare/v1.0.4-alpha.1...v1.0.4-alpha.2) (2022-06-18)
46+
### [1.0.4-alpha.2](https://github.com/imagine10255/bear-react-docker/compare/v1.0.4-alpha.1...v1.0.4-alpha.2) (2022-06-18)
4747

48-
### [1.0.4-alpha.1](https://github.com/imagine10255/bear-script/compare/v1.0.4-alpha.0...v1.0.4-alpha.1) (2022-06-18)
48+
### [1.0.4-alpha.1](https://github.com/imagine10255/bear-react-docker/compare/v1.0.4-alpha.0...v1.0.4-alpha.1) (2022-06-18)
4949

50-
### [1.0.4-alpha.0](https://github.com/imagine10255/bear-script/compare/v1.0.3...v1.0.4-alpha.0) (2022-06-18)
50+
### [1.0.4-alpha.0](https://github.com/imagine10255/bear-react-docker/compare/v1.0.3...v1.0.4-alpha.0) (2022-06-18)
5151

52-
### [1.0.3](https://github.com/imagine10255/bear-script/compare/v0.0.18...v1.0.3) (2022-02-18)
52+
### [1.0.3](https://github.com/imagine10255/bear-react-docker/compare/v0.0.18...v1.0.3) (2022-02-18)
5353

54-
### [1.0.2](https://github.com/imagine10255/bear-script/compare/v0.0.18...v1.0.2) (2022-02-18)
54+
### [1.0.2](https://github.com/imagine10255/bear-react-docker/compare/v0.0.18...v1.0.2) (2022-02-18)
5555

56-
### [1.0.1](https://github.com/imagine10255/bear-script/compare/v0.0.18...v1.0.1) (2022-02-18)
56+
### [1.0.1](https://github.com/imagine10255/bear-react-docker/compare/v0.0.18...v1.0.1) (2022-02-18)
5757

58-
### [0.0.18](https://github.com/imagine10255/bear-script/compare/v2.0.0...v0.0.18) (2022-02-18)
58+
### [0.0.18](https://github.com/imagine10255/bear-react-docker/compare/v2.0.0...v0.0.18) (2022-02-18)
5959

6060

6161
### Bug Fixes
6262

63-
* 修正 package.json script ([d1de109](https://github.com/imagine10255/bear-script/commit/d1de109775796dd0779b7561c7c491529a95a2d3))
63+
* 修正 package.json script ([d1de109](https://github.com/imagine10255/bear-react-docker/commit/d1de109775796dd0779b7561c7c491529a95a2d3))
6464

65-
## [2.0.0](https://github.com/imagine10255/bear-script/compare/v1.0.2...v2.0.0) (2022-02-18)
65+
## [2.0.0](https://github.com/imagine10255/bear-react-docker/compare/v1.0.2...v2.0.0) (2022-02-18)
6666

67-
### [1.0.2](https://github.com/imagine10255/bear-script/compare/v1.0.1...v1.0.2) (2022-02-18)
67+
### [1.0.2](https://github.com/imagine10255/bear-react-docker/compare/v1.0.1...v1.0.2) (2022-02-18)
6868

6969
### 1.0.1 (2022-02-18)
7070

7171

7272
### Features
7373

74-
* 新增 發布指令 ([3b56f39](https://github.com/imagine10255/bear-script/commit/3b56f397653f17b725d5c95f522d8f8c7006fb9f))
74+
* 新增 發布指令 ([3b56f39](https://github.com/imagine10255/bear-react-docker/commit/3b56f397653f17b725d5c95f522d8f8c7006fb9f))
7575

7676
## [1.0.0](https://github.com/imagine10255/deploy/compare/v0.0.30...v1.0.0) (2022-02-17)
7777

README.md

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,52 @@
1-
# bear-script
1+
# bear-react-docker
22

33
> Common tools and methods for project development
44
5-
[![NPM](https://img.shields.io/npm/v/bear-script.svg)](https://www.npmjs.com/package/bear-script)
6-
[![npm](https://img.shields.io/npm/dm/bear-script.svg)](https://www.npmjs.com/package/bear-script)
5+
[![NPM](https://img.shields.io/npm/v/bear-react-docker.svg)](https://www.npmjs.com/package/bear-react-docker)
6+
[![npm](https://img.shields.io/npm/dm/bear-react-docker.svg)](https://www.npmjs.com/package/bear-react-docker)
77

88

99
## Install
1010

1111
```bash
12-
yarn add -D bear-script
12+
yarn add -D bear-react-docker
1313
```
1414

15-
## Document
1615

17-
- [bear-script docker](./docs/docker.md)
18-
- [bear-script svg-symbole](./docs/svg-symbole.md)
16+
17+
## Setting
18+
19+
```bash
20+
$ cp ./node_modules/bear-react-docker/config/nginx ./deploy/nginx
21+
```
22+
23+
in your package.json
24+
```json
25+
{
26+
"dockerRegistry": "docker.bearests.com:8443",
27+
"scripts": {
28+
"build": "react-scripts build",
29+
"publish": "yarn bear-react-docker docker --publicUrl=/recommend --dockerfile=./node_modules/bear-react-docker/config/Dockerfile"
30+
}
31+
}
32+
```
33+
34+
### [Options] Custom dockerfile
35+
```bash
36+
$ cp ./node_modules/bear-react-docker/config/Dockerfile ./
37+
```
38+
39+
package.json
40+
```json
41+
{
42+
"dockerRegistry": "docker.bearests.com:8443",
43+
"scripts": {
44+
"build": "bear-react-docker build --publicUrl=/recommend",
45+
"publish": "bear-react-docker push && bear-react-docker remove"
46+
}
47+
}
48+
```
49+
1950

2051
## License
2152

bin/cli.js

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

33
/* istanbul ignore if */
44
if (process.version.match(/v(\d+)\./)[1] < 10) {
5-
console.error('bear-script: Node v10 or greater is required. `bear-script` did not run.')
5+
console.error('bear-react-docker: Node v10 or greater is required. `bear-react-docker` did not run.')
66
} else {
77
const logger = require('../dist/script/logger');
88
const bearScript = require('../dist/index');

docs/docker.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# bear-script docker
1+
# bear-react-docker docker
22

33
> build docker image by reactjs
44
55

66
## Setting
77

88
```bash
9-
$ cp ./node_modules/bear-script/config/nginx ./deploy/nginx
9+
$ cp ./node_modules/bear-react-docker/config/nginx ./deploy/nginx
1010
```
1111

1212
in your package.json
@@ -15,14 +15,14 @@ in your package.json
1515
"dockerRegistry": "docker.bearests.com:8443",
1616
"scripts": {
1717
"build": "react-scripts build",
18-
"publish": "yarn bear-script docker --publicUrl=/recommend --dockerfile=./node_modules/bear-script/config/Dockerfile"
18+
"publish": "yarn bear-react-docker docker --publicUrl=/recommend --dockerfile=./node_modules/bear-react-docker/config/Dockerfile"
1919
}
2020
}
2121
```
2222

2323
### [Options] Custom dockerfile
2424
```bash
25-
$ cp ./node_modules/bear-script/config/Dockerfile ./
25+
$ cp ./node_modules/bear-react-docker/config/Dockerfile ./
2626
```
2727

2828
package.json
@@ -31,7 +31,7 @@ package.json
3131
"dockerRegistry": "docker.bearests.com:8443",
3232
"scripts": {
3333
"build": "react-scripts build",
34-
"publish": "yarn bear-script docker --publicUrl=/recommend"
34+
"publish": "yarn bear-react-docker docker --publicUrl=/recommend"
3535
}
3636
}
3737
```

docs/svg-symbole.md

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

lib/build-docker/index.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as child_process from 'child_process';
22
import chalk from 'chalk';
33
import ora from 'ora';
4-
import {bash} from '../script/utils';
4+
import {bash, renameDockerImage} from '../script/utils';
55
import {CLIError} from '../script/cli';
66
import logger from '../script/logger';
77

@@ -10,15 +10,6 @@ interface IArgs {
1010
dockerfile: string
1111
}
1212

13-
/**
14-
* 重新命名 Docker Image
15-
* @param imageName
16-
* @param version
17-
* @param remoteAddress
18-
*/
19-
function renameDockerImage(imageName: string, version: string, remoteAddress: string){
20-
return `${remoteAddress}/${imageName}:${version}`;
21-
}
2213

2314
function buildDockerImage(imageName: string, version: string, remoteAddress: string, publicUrl: string, dockerfile: string): Promise<string> {
2415

@@ -94,16 +85,8 @@ async function run(args: IArgs) {
9485
// Build Image
9586
const targetImageName = await buildDockerImage(imageName, imageVersion, remoteAddress, publicUrl, dockerfile);
9687

97-
// Push Image
98-
bash(`docker push ${targetImageName}`);
99-
logger.success(`Successfully push to ${remoteAddress}`);
100-
101-
// Remove Image
102-
bash(`docker rmi ${imageName} ${targetImageName}`);
103-
logger.info(`remove image ${imageName}`);
104-
10588
// By OSX Notice
106-
bash(`osascript -e 'display notification "${targetImageName} done" with title "publish done"'`);
89+
bash(`osascript -e 'display notification "${targetImageName} done" with title "build done"'`);
10790
}
10891

10992
export default run;

0 commit comments

Comments
 (0)