From dd76aa3c98250c7a90cef586e9ca9dc82dff73df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E5=88=A9?= <372736560@qq.com>
Date: Wed, 21 Sep 2022 16:14:35 +0800
Subject: [PATCH 01/18] refactor: remove files
---
.gitignore | 23 ---------------
.workflow/BranchPipeline.yml | 55 ------------------------------------
.workflow/MasterPipeline.yml | 53 ----------------------------------
.workflow/PRPipeline.yml | 38 -------------------------
README.md | 1 -
app.js | 12 --------
package.json | 25 ----------------
test/assert.sh | 12 --------
test/spec.js | 20 -------------
9 files changed, 239 deletions(-)
delete mode 100644 .gitignore
delete mode 100644 .workflow/BranchPipeline.yml
delete mode 100644 .workflow/MasterPipeline.yml
delete mode 100644 .workflow/PRPipeline.yml
delete mode 100644 README.md
delete mode 100644 app.js
delete mode 100644 package.json
delete mode 100755 test/assert.sh
delete mode 100644 test/spec.js
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 4d29575..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
-
-# dependencies
-/node_modules
-/.pnp
-.pnp.js
-
-# testing
-/coverage
-
-# production
-/build
-
-# misc
-.DS_Store
-.env.local
-.env.development.local
-.env.test.local
-.env.production.local
-
-npm-debug.log*
-yarn-debug.log*
-yarn-error.log*
diff --git a/.workflow/BranchPipeline.yml b/.workflow/BranchPipeline.yml
deleted file mode 100644
index cbe1b45..0000000
--- a/.workflow/BranchPipeline.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-version: '1.0'
-name: branch-pipeline
-displayName: BranchPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - cd vue-demo && npm install && rm -rf ./dist && npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./vue-demo/dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 构建产物制品库,默认default,系统默认创建
- artifactRepository: default
- # 上传到制品库时的制品命名,默认build
- artifactName: output
- dependsOn: build_nodejs
- - stage:
- name: release
- displayName: 发布
- steps:
- - step: publish@release_artifacts
- name: publish_release_artifacts
- displayName: '发布'
- # 上游上传制品任务的产出
- dependArtifact: output
- # 发行版制品库,默认release,系统默认创建
- artifactRepository: release
- # 发布制品版本号
- version: '1.0.0.0'
- # 是否开启版本号自增,默认开启
- autoIncrement: true
-triggers:
- push:
- branches:
- exclude:
- - master
- include:
- - .*
diff --git a/.workflow/MasterPipeline.yml b/.workflow/MasterPipeline.yml
deleted file mode 100644
index 70a1845..0000000
--- a/.workflow/MasterPipeline.yml
+++ /dev/null
@@ -1,53 +0,0 @@
-version: '1.0'
-name: master-pipeline
-displayName: MasterPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - cd vue-demo && npm install && rm -rf ./dist && npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./vue-demo/dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 构建产物制品库,默认default,系统默认创建
- artifactRepository: default
- # 上传到制品库时的制品命名,默认build
- artifactName: output
- dependsOn: build_nodejs
- - stage:
- name: release
- displayName: 发布
- steps:
- - step: publish@release_artifacts
- name: publish_release_artifacts
- displayName: '发布'
- # 上游上传制品任务的产出
- dependArtifact: output
- # 发行版制品库,默认release,系统默认创建
- artifactRepository: release
- # 发布制品版本号
- version: '1.0.0.0'
- # 是否开启版本号自增,默认开启
- autoIncrement: true
-triggers:
- push:
- branches:
- include:
- - master
diff --git a/.workflow/PRPipeline.yml b/.workflow/PRPipeline.yml
deleted file mode 100644
index c5cce54..0000000
--- a/.workflow/PRPipeline.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-version: '1.0'
-name: pr-pipeline
-displayName: PRPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - cd vue-demo && npm install && rm -rf ./dist && npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./vue-demo/dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 构建产物制品库,默认default,系统默认创建
- artifactRepository: default
- # 上传到制品库时的制品命名,默认build
- artifactName: output
- dependsOn: build_nodejs
-triggers:
- pr:
- branches:
- include:
- - master
diff --git a/README.md b/README.md
deleted file mode 100644
index 8ec5172..0000000
--- a/README.md
+++ /dev/null
@@ -1 +0,0 @@
-# Gitee Go Nodejs 使用示例
diff --git a/app.js b/app.js
deleted file mode 100644
index b56f1bb..0000000
--- a/app.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var express = require('express');
-var app = express();
-
-app.get('/', function (req, res) {
- res.send('Hello World!');
-});
-
-var server = app.listen(3000, function () {
- console.log('Example app listening on port 3000!');
-});
-
-module.exports = server;
\ No newline at end of file
diff --git a/package.json b/package.json
deleted file mode 100644
index d4ac28e..0000000
--- a/package.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "name": "expressjs-hello",
- "version": "1.0.0",
- "description": "",
- "main": "app.js",
- "scripts": {
- "start": "node app.js",
- "test": "mocha --reporter mochawesome"
- },
- "repository": {
- "type": "git",
- "url": "git@code.aliyun.com:flow-example/node-expressjs.git"
- },
- "author": "",
- "license": "ISC",
- "dependencies": {
- "express": "^4.17.1",
- "node-sass": "^4.14.1"
- },
- "devDependencies": {
- "mocha": "^6.2.2",
- "mochawesome": "^4.1.0",
- "supertest": "^4.0.2"
- }
-}
diff --git a/test/assert.sh b/test/assert.sh
deleted file mode 100755
index e5a7956..0000000
--- a/test/assert.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-# /bin/sh
-# usage export REQUIRED_NODE_VERSION=v14.8.1 && ./test/assert.sh
-REQUIRED_NODE_VERSION=${REQUIRED_NODE_VERSION:-unknow}
-echo "校验版本 $REQUIRED_NODE_VERSION"
-CURRENT_NODE_VERSION=$(node --version)
-if [[ "$REQUIRED_NODE_VERSION" == "$CURRENT_NODE_VERSION" ]]; then
- echo "[INFO] 版本校验成功 期望版本 $REQUIRED_NODE_VERSION 当前版本$CURRENT_NODE_VERSION "
- exit 0
-else
- echo "[ERROR] 版本校验失败 期望版本 $REQUIRED_NODE_VERSION 当前版本$CURRENT_NODE_VERSION "
- exit 1
-fi
\ No newline at end of file
diff --git a/test/spec.js b/test/spec.js
deleted file mode 100644
index befe914..0000000
--- a/test/spec.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var request = require('supertest');
-describe('loading express', function () {
- var server;
- beforeEach(function () {
- server = require('../app');
- });
- afterEach(function () {
- server.close();
- });
- it('responds to /', function testSlash(done) {
- request(server)
- .get('/')
- .expect(200, done);
- });
- it('404 everything else', function testPath(done) {
- request(server)
- .get('/foo/bar')
- .expect(404, done);
- });
-});
\ No newline at end of file
--
Gitee
From c611c2ff386ef1231de3e144ae205ae2c59d6950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E5=88=A9?= <372736560@qq.com>
Date: Wed, 21 Sep 2022 16:18:32 +0800
Subject: [PATCH 02/18] Revert "refactor: remove files"
This reverts commit dd76aa3c98250c7a90cef586e9ca9dc82dff73df.
---
.gitignore | 23 +++++++++++++++
.workflow/BranchPipeline.yml | 55 ++++++++++++++++++++++++++++++++++++
.workflow/MasterPipeline.yml | 53 ++++++++++++++++++++++++++++++++++
.workflow/PRPipeline.yml | 38 +++++++++++++++++++++++++
README.md | 1 +
app.js | 12 ++++++++
package.json | 25 ++++++++++++++++
test/assert.sh | 12 ++++++++
test/spec.js | 20 +++++++++++++
9 files changed, 239 insertions(+)
create mode 100644 .gitignore
create mode 100644 .workflow/BranchPipeline.yml
create mode 100644 .workflow/MasterPipeline.yml
create mode 100644 .workflow/PRPipeline.yml
create mode 100644 README.md
create mode 100644 app.js
create mode 100644 package.json
create mode 100755 test/assert.sh
create mode 100644 test/spec.js
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4d29575
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,23 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# production
+/build
+
+# misc
+.DS_Store
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
+
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
diff --git a/.workflow/BranchPipeline.yml b/.workflow/BranchPipeline.yml
new file mode 100644
index 0000000..cbe1b45
--- /dev/null
+++ b/.workflow/BranchPipeline.yml
@@ -0,0 +1,55 @@
+version: '1.0'
+name: branch-pipeline
+displayName: BranchPipeline
+stages:
+ - stage:
+ name: compile
+ displayName: 编译
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
+ nodeVersion: 14.16.0
+ # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
+ commands:
+ - cd vue-demo && npm install && rm -rf ./dist && npm run build
+ # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
+ artifacts:
+ # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
+ - name: BUILD_ARTIFACT
+ # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
+ path:
+ - ./vue-demo/dist
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
+ dependArtifact: BUILD_ARTIFACT
+ # 构建产物制品库,默认default,系统默认创建
+ artifactRepository: default
+ # 上传到制品库时的制品命名,默认build
+ artifactName: output
+ dependsOn: build_nodejs
+ - stage:
+ name: release
+ displayName: 发布
+ steps:
+ - step: publish@release_artifacts
+ name: publish_release_artifacts
+ displayName: '发布'
+ # 上游上传制品任务的产出
+ dependArtifact: output
+ # 发行版制品库,默认release,系统默认创建
+ artifactRepository: release
+ # 发布制品版本号
+ version: '1.0.0.0'
+ # 是否开启版本号自增,默认开启
+ autoIncrement: true
+triggers:
+ push:
+ branches:
+ exclude:
+ - master
+ include:
+ - .*
diff --git a/.workflow/MasterPipeline.yml b/.workflow/MasterPipeline.yml
new file mode 100644
index 0000000..70a1845
--- /dev/null
+++ b/.workflow/MasterPipeline.yml
@@ -0,0 +1,53 @@
+version: '1.0'
+name: master-pipeline
+displayName: MasterPipeline
+stages:
+ - stage:
+ name: compile
+ displayName: 编译
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
+ nodeVersion: 14.16.0
+ # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
+ commands:
+ - cd vue-demo && npm install && rm -rf ./dist && npm run build
+ # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
+ artifacts:
+ # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
+ - name: BUILD_ARTIFACT
+ # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
+ path:
+ - ./vue-demo/dist
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
+ dependArtifact: BUILD_ARTIFACT
+ # 构建产物制品库,默认default,系统默认创建
+ artifactRepository: default
+ # 上传到制品库时的制品命名,默认build
+ artifactName: output
+ dependsOn: build_nodejs
+ - stage:
+ name: release
+ displayName: 发布
+ steps:
+ - step: publish@release_artifacts
+ name: publish_release_artifacts
+ displayName: '发布'
+ # 上游上传制品任务的产出
+ dependArtifact: output
+ # 发行版制品库,默认release,系统默认创建
+ artifactRepository: release
+ # 发布制品版本号
+ version: '1.0.0.0'
+ # 是否开启版本号自增,默认开启
+ autoIncrement: true
+triggers:
+ push:
+ branches:
+ include:
+ - master
diff --git a/.workflow/PRPipeline.yml b/.workflow/PRPipeline.yml
new file mode 100644
index 0000000..c5cce54
--- /dev/null
+++ b/.workflow/PRPipeline.yml
@@ -0,0 +1,38 @@
+version: '1.0'
+name: pr-pipeline
+displayName: PRPipeline
+stages:
+ - stage:
+ name: compile
+ displayName: 编译
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
+ nodeVersion: 14.16.0
+ # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
+ commands:
+ - cd vue-demo && npm install && rm -rf ./dist && npm run build
+ # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
+ artifacts:
+ # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
+ - name: BUILD_ARTIFACT
+ # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
+ path:
+ - ./vue-demo/dist
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
+ dependArtifact: BUILD_ARTIFACT
+ # 构建产物制品库,默认default,系统默认创建
+ artifactRepository: default
+ # 上传到制品库时的制品命名,默认build
+ artifactName: output
+ dependsOn: build_nodejs
+triggers:
+ pr:
+ branches:
+ include:
+ - master
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..8ec5172
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# Gitee Go Nodejs 使用示例
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..b56f1bb
--- /dev/null
+++ b/app.js
@@ -0,0 +1,12 @@
+var express = require('express');
+var app = express();
+
+app.get('/', function (req, res) {
+ res.send('Hello World!');
+});
+
+var server = app.listen(3000, function () {
+ console.log('Example app listening on port 3000!');
+});
+
+module.exports = server;
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..d4ac28e
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "expressjs-hello",
+ "version": "1.0.0",
+ "description": "",
+ "main": "app.js",
+ "scripts": {
+ "start": "node app.js",
+ "test": "mocha --reporter mochawesome"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@code.aliyun.com:flow-example/node-expressjs.git"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "express": "^4.17.1",
+ "node-sass": "^4.14.1"
+ },
+ "devDependencies": {
+ "mocha": "^6.2.2",
+ "mochawesome": "^4.1.0",
+ "supertest": "^4.0.2"
+ }
+}
diff --git a/test/assert.sh b/test/assert.sh
new file mode 100755
index 0000000..e5a7956
--- /dev/null
+++ b/test/assert.sh
@@ -0,0 +1,12 @@
+# /bin/sh
+# usage export REQUIRED_NODE_VERSION=v14.8.1 && ./test/assert.sh
+REQUIRED_NODE_VERSION=${REQUIRED_NODE_VERSION:-unknow}
+echo "校验版本 $REQUIRED_NODE_VERSION"
+CURRENT_NODE_VERSION=$(node --version)
+if [[ "$REQUIRED_NODE_VERSION" == "$CURRENT_NODE_VERSION" ]]; then
+ echo "[INFO] 版本校验成功 期望版本 $REQUIRED_NODE_VERSION 当前版本$CURRENT_NODE_VERSION "
+ exit 0
+else
+ echo "[ERROR] 版本校验失败 期望版本 $REQUIRED_NODE_VERSION 当前版本$CURRENT_NODE_VERSION "
+ exit 1
+fi
\ No newline at end of file
diff --git a/test/spec.js b/test/spec.js
new file mode 100644
index 0000000..befe914
--- /dev/null
+++ b/test/spec.js
@@ -0,0 +1,20 @@
+var request = require('supertest');
+describe('loading express', function () {
+ var server;
+ beforeEach(function () {
+ server = require('../app');
+ });
+ afterEach(function () {
+ server.close();
+ });
+ it('responds to /', function testSlash(done) {
+ request(server)
+ .get('/')
+ .expect(200, done);
+ });
+ it('404 everything else', function testPath(done) {
+ request(server)
+ .get('/foo/bar')
+ .expect(404, done);
+ });
+});
\ No newline at end of file
--
Gitee
From 131bc6d8d50d89626df2cfd721afa22436636e13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E5=88=A9?= <372736560@qq.com>
Date: Wed, 21 Sep 2022 17:04:07 +0800
Subject: [PATCH 03/18] feat: add mocha webpack demo
---
.gitignore | 5 ++++-
README.md | 17 +++++++++++++++-
babel.config.js | 16 +++++++++++++++
index.html | 4 ++++
package.json | 51 ++++++++++++++++++++++++++++++++---------------
src/app.js | 3 +++
src/index.js | 8 ++++++++
test/app.spec.js | 15 ++++++++++++++
webpack.config.js | 29 +++++++++++++++++++++++++++
9 files changed, 130 insertions(+), 18 deletions(-)
create mode 100644 babel.config.js
create mode 100644 index.html
create mode 100644 src/app.js
create mode 100644 src/index.js
create mode 100644 test/app.spec.js
create mode 100644 webpack.config.js
diff --git a/.gitignore b/.gitignore
index 4d29575..1315f75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@
# production
/build
-
+/lib
# misc
.DS_Store
.env.local
@@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
+
+# test
+mochawesome-report
diff --git a/README.md b/README.md
index 8ec5172..2c98313 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,16 @@
-# Gitee Go Nodejs 使用示例
+# React, webpack
+
+Full documentation about it [here](https://mochajs.org/#-require-module-r-module)
+
+## Commands
+
+- `npm run build` - run webpack using the local `webpack.config.js` file. Builds the client-side code into `/lib`.
+- `npm start` - builds the code and opens `index.html` inside the browser.
+- `npm test` - run the tests using the local `.mocharc.js` config file. As the config includes the Babel transpilation hook `@babel/register` it does not require pre-compilation before running.
+
+## Makes use of
+
+- [babel](https://babeljs.io/) - transpilation
+- [enzyme](https://airbnb.io/enzyme/) - React component testing library
+- [chai](https://www.chaijs.com/api/assert/) - assertion library
+- [jsx](https://reactjs.org/docs/introducing-jsx.html) - syntax extension to JavaScript
diff --git a/babel.config.js b/babel.config.js
new file mode 100644
index 0000000..f4bcef9
--- /dev/null
+++ b/babel.config.js
@@ -0,0 +1,16 @@
+module.exports = (api) => {
+ // Cache configuration is a required option
+ api.cache(false);
+
+ const presets = [
+ [
+ "@babel/preset-env",
+ {
+ useBuiltIns: false
+ }
+ ],
+ "@babel/preset-react"
+ ];
+
+ return { presets };
+};
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..be2d109
--- /dev/null
+++ b/index.html
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/package.json b/package.json
index d4ac28e..af28bc9 100644
--- a/package.json
+++ b/package.json
@@ -1,25 +1,44 @@
{
- "name": "expressjs-hello",
+ "name": "example-react-webpack-app",
"version": "1.0.0",
- "description": "",
- "main": "app.js",
+ "description": "React Webpack example",
+ "main": "src/index.js",
+ "browser": "lib/index_bundle.js",
"scripts": {
- "start": "node app.js",
- "test": "mocha --reporter mochawesome"
+ "build": "webpack",
+ "start": "npm run build && opn index.html",
+ "test": "mocha --require @babel/register --reporter mochawesome --exit"
},
- "repository": {
- "type": "git",
- "url": "git@code.aliyun.com:flow-example/node-expressjs.git"
+ "directories": {
+ "lib": "./lib",
+ "src": "./src",
+ "test": "./test"
},
- "author": "",
- "license": "ISC",
"dependencies": {
- "express": "^4.17.1",
- "node-sass": "^4.14.1"
+ "express": "^4.18.1",
+ "opn-cli": "^5.0.0",
+ "react": "^17.0.2",
+ "react-dom": "^17.0.2"
},
"devDependencies": {
- "mocha": "^6.2.2",
- "mochawesome": "^4.1.0",
- "supertest": "^4.0.2"
- }
+ "@babel/cli": "^7.2.3",
+ "@babel/core": "^7.3.4",
+ "@babel/preset-env": "^7.3.4",
+ "@babel/preset-react": "^7.0.0",
+ "@babel/register": "^7.18.9",
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
+ "babel-loader": "^8.0.5",
+ "chai": "^4.2.0",
+ "cheerio": "1.0.0-rc.3",
+ "enzyme": "^3.9.0",
+ "mocha": "latest",
+ "mochawesome": "^7.1.3",
+ "supertest": "^6.2.4",
+ "webpack": "^5.35.1",
+ "webpack-cli": "^4.6.0"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "license": "ISC"
}
diff --git a/src/app.js b/src/app.js
new file mode 100644
index 0000000..5c5b827
--- /dev/null
+++ b/src/app.js
@@ -0,0 +1,3 @@
+import React from 'react';
+
+export default () => (Welcome to the React application.
);
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..aa1e0ec
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,8 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import App from './app';
+
+ReactDOM.render(
+ ,
+ document.getElementById('root')
+);
diff --git a/test/app.spec.js b/test/app.spec.js
new file mode 100644
index 0000000..0859405
--- /dev/null
+++ b/test/app.spec.js
@@ -0,0 +1,15 @@
+import React from 'react';
+import { expect } from 'chai';
+import { shallow } from 'enzyme';
+import Enzyme from 'enzyme';
+import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
+import App from '../src/app.js';
+
+Enzyme.configure({ adapter: new Adapter() });
+
+describe('', () => {
+ it('renders our app with welcome text', () => {
+ const wrapper = shallow();
+ expect(wrapper.text()).to.equal("Welcome to the React application.")
+ });
+});
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..d8597a6
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,29 @@
+const path = require('path');
+
+/**
+Below we configure webpack to build a client-side bundle with the following instruction:
+ - use the "babel-loader" module for preprocessing of ES6
+ - in "development" mode so webpack will not use any built-in optimisations
+ - start processing code from file "./src/index.js"
+ - output bundle to "lib/index_bundle.js"
+*/
+
+module.exports = {
+ entry: './src/index.js',
+ output: {
+ path: path.resolve('lib'),
+ filename: 'index_bundle.js'
+ },
+ mode: 'development',
+ module: {
+ rules: [
+ {
+ test: /\.m?js$/,
+ exclude: /(node_modules)/,
+ use: {
+ loader: 'babel-loader',
+ }
+ }
+ ]
+ }
+}
--
Gitee
From 0f60cb3841a59a4af0fb13fa7d3f475576ed5ab1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9C=B1=E5=A4=A9=E5=88=A9?= <372736560@qq.com>
Date: Wed, 21 Sep 2022 17:11:14 +0800
Subject: [PATCH 04/18] refactor(mocha-webpack-demo): output path to dist
---
.gitignore | 2 +-
webpack.config.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 1315f75..51b5c12 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,7 @@
# production
/build
-/lib
+/dist
# misc
.DS_Store
.env.local
diff --git a/webpack.config.js b/webpack.config.js
index d8597a6..af1bdc8 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -11,7 +11,7 @@ Below we configure webpack to build a client-side bundle with the following inst
module.exports = {
entry: './src/index.js',
output: {
- path: path.resolve('lib'),
+ path: path.resolve('dist'),
filename: 'index_bundle.js'
},
mode: 'development',
--
Gitee
From 334a9ecff44f778a5967f20627658615a499076a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=97=AD?= <22476705@qq.com>
Date: Wed, 21 Sep 2022 09:46:00 +0000
Subject: [PATCH 05/18] update master-pipeline.yml
---
.workflow/master-pipeline.yml | 49 +++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 .workflow/master-pipeline.yml
diff --git a/.workflow/master-pipeline.yml b/.workflow/master-pipeline.yml
new file mode 100644
index 0000000..f39fc23
--- /dev/null
+++ b/.workflow/master-pipeline.yml
@@ -0,0 +1,49 @@
+version: '1.0'
+name: master-pipeline
+displayName: MasterPipeline
+triggers:
+ trigger: auto
+ push:
+ branches:
+ include:
+ - master
+stages:
+ - name: compile
+ displayName: 编译
+ strategy: naturally
+ trigger: auto
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ nodeVersion: 14.16.0
+ commands:
+ - '# 设置NPM源,提升安装速度'
+ - npm config set registry https://registry.npmmirror.com
+ - '# 安装依赖'
+ - npm install
+ - '# 执行构建'
+ - npm run build
+ artifacts:
+ - name: BUILD_ARTIFACT
+ path:
+ - ./dist
+ strategy: {}
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ dependArtifact: BUILD_ARTIFACT
+ artifactName: output
+ strategy: {}
+ dependsOn: build_nodejs
+ - name: release
+ displayName: 发布
+ strategy: naturally
+ trigger: auto
+ steps:
+ - step: publish@release_artifacts
+ name: publish_release_artifacts
+ displayName: 发布
+ dependArtifact: output
+ version: 1.0.0.0
+ autoIncrement: true
--
Gitee
From b19ded9aa5743fa87d09cad6f96f7abfa6d32665 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=97=AD?= <22476705@qq.com>
Date: Wed, 21 Sep 2022 09:46:37 +0000
Subject: [PATCH 06/18] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20.w?=
=?UTF-8?q?orkflow/master-pipeline.yml?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.workflow/master-pipeline.yml | 49 -----------------------------------
1 file changed, 49 deletions(-)
delete mode 100644 .workflow/master-pipeline.yml
diff --git a/.workflow/master-pipeline.yml b/.workflow/master-pipeline.yml
deleted file mode 100644
index f39fc23..0000000
--- a/.workflow/master-pipeline.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-version: '1.0'
-name: master-pipeline
-displayName: MasterPipeline
-triggers:
- trigger: auto
- push:
- branches:
- include:
- - master
-stages:
- - name: compile
- displayName: 编译
- strategy: naturally
- trigger: auto
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- nodeVersion: 14.16.0
- commands:
- - '# 设置NPM源,提升安装速度'
- - npm config set registry https://registry.npmmirror.com
- - '# 安装依赖'
- - npm install
- - '# 执行构建'
- - npm run build
- artifacts:
- - name: BUILD_ARTIFACT
- path:
- - ./dist
- strategy: {}
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- dependArtifact: BUILD_ARTIFACT
- artifactName: output
- strategy: {}
- dependsOn: build_nodejs
- - name: release
- displayName: 发布
- strategy: naturally
- trigger: auto
- steps:
- - step: publish@release_artifacts
- name: publish_release_artifacts
- displayName: 发布
- dependArtifact: output
- version: 1.0.0.0
- autoIncrement: true
--
Gitee
From c0583c45c5874cf4ef0dbd339edb888c2aca4553 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=97=AD?= <22476705@qq.com>
Date: Wed, 21 Sep 2022 09:47:33 +0000
Subject: [PATCH 07/18] update .workflow/MasterPipeline.yml.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 徐旭 <22476705@qq.com>
---
.workflow/MasterPipeline.yml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/.workflow/MasterPipeline.yml b/.workflow/MasterPipeline.yml
index 70a1845..b6d5be1 100644
--- a/.workflow/MasterPipeline.yml
+++ b/.workflow/MasterPipeline.yml
@@ -13,14 +13,19 @@ stages:
nodeVersion: 14.16.0
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
commands:
- - cd vue-demo && npm install && rm -rf ./dist && npm run build
+ - # 设置NPM源,提升安装速度
+ - npm config set registry https://registry.npmmirror.com
+ - # 安装依赖
+ - npm install
+ - # 执行构建
+ - npm run build
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
artifacts:
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- name: BUILD_ARTIFACT
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
path:
- - ./vue-demo/dist
+ - ./dist
- step: publish@general_artifacts
name: publish_general_artifacts
displayName: 上传制品
--
Gitee
From 472fcb1ade4763e9fd414cc8baebaf6672736f3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=97=AD?= <22476705@qq.com>
Date: Wed, 21 Sep 2022 09:49:04 +0000
Subject: [PATCH 08/18] update .workflow/BranchPipeline.yml.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 徐旭 <22476705@qq.com>
---
.workflow/BranchPipeline.yml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/.workflow/BranchPipeline.yml b/.workflow/BranchPipeline.yml
index cbe1b45..aac56c0 100644
--- a/.workflow/BranchPipeline.yml
+++ b/.workflow/BranchPipeline.yml
@@ -13,14 +13,19 @@ stages:
nodeVersion: 14.16.0
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
commands:
- - cd vue-demo && npm install && rm -rf ./dist && npm run build
+ - # 设置NPM源,提升安装速度
+ - npm config set registry https://registry.npmmirror.com
+ - # 安装依赖
+ - npm install
+ - # 执行构建
+ - npm run build
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
artifacts:
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- name: BUILD_ARTIFACT
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
path:
- - ./vue-demo/dist
+ - ./dist
- step: publish@general_artifacts
name: publish_general_artifacts
displayName: 上传制品
--
Gitee
From dd2dacfe31433dc27aa474248f1dafcfe4525f71 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=97=AD?= <22476705@qq.com>
Date: Wed, 21 Sep 2022 09:49:29 +0000
Subject: [PATCH 09/18] update .workflow/PRPipeline.yml.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: 徐旭 <22476705@qq.com>
---
.workflow/PRPipeline.yml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/.workflow/PRPipeline.yml b/.workflow/PRPipeline.yml
index c5cce54..5531c32 100644
--- a/.workflow/PRPipeline.yml
+++ b/.workflow/PRPipeline.yml
@@ -13,14 +13,19 @@ stages:
nodeVersion: 14.16.0
# 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
commands:
- - cd vue-demo && npm install && rm -rf ./dist && npm run build
+ - # 设置NPM源,提升安装速度
+ - npm config set registry https://registry.npmmirror.com
+ - # 安装依赖
+ - npm install
+ - # 执行构建
+ - npm run build
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
artifacts:
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- name: BUILD_ARTIFACT
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
path:
- - ./vue-demo/dist
+ - ./dist
- step: publish@general_artifacts
name: publish_general_artifacts
displayName: 上传制品
--
Gitee
From 332335965f688d6cda45d0cbcd13284d75d3c56d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=97=AD?= <22476705@qq.com>
Date: Wed, 9 Nov 2022 07:45:01 +0000
Subject: [PATCH 10/18] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20.w?=
=?UTF-8?q?orkflow?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.workflow/BranchPipeline.yml | 60 ------------------------------------
.workflow/MasterPipeline.yml | 58 ----------------------------------
.workflow/PRPipeline.yml | 43 --------------------------
3 files changed, 161 deletions(-)
delete mode 100644 .workflow/BranchPipeline.yml
delete mode 100644 .workflow/MasterPipeline.yml
delete mode 100644 .workflow/PRPipeline.yml
diff --git a/.workflow/BranchPipeline.yml b/.workflow/BranchPipeline.yml
deleted file mode 100644
index aac56c0..0000000
--- a/.workflow/BranchPipeline.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-version: '1.0'
-name: branch-pipeline
-displayName: BranchPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - # 设置NPM源,提升安装速度
- - npm config set registry https://registry.npmmirror.com
- - # 安装依赖
- - npm install
- - # 执行构建
- - npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 构建产物制品库,默认default,系统默认创建
- artifactRepository: default
- # 上传到制品库时的制品命名,默认build
- artifactName: output
- dependsOn: build_nodejs
- - stage:
- name: release
- displayName: 发布
- steps:
- - step: publish@release_artifacts
- name: publish_release_artifacts
- displayName: '发布'
- # 上游上传制品任务的产出
- dependArtifact: output
- # 发行版制品库,默认release,系统默认创建
- artifactRepository: release
- # 发布制品版本号
- version: '1.0.0.0'
- # 是否开启版本号自增,默认开启
- autoIncrement: true
-triggers:
- push:
- branches:
- exclude:
- - master
- include:
- - .*
diff --git a/.workflow/MasterPipeline.yml b/.workflow/MasterPipeline.yml
deleted file mode 100644
index b6d5be1..0000000
--- a/.workflow/MasterPipeline.yml
+++ /dev/null
@@ -1,58 +0,0 @@
-version: '1.0'
-name: master-pipeline
-displayName: MasterPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - # 设置NPM源,提升安装速度
- - npm config set registry https://registry.npmmirror.com
- - # 安装依赖
- - npm install
- - # 执行构建
- - npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 构建产物制品库,默认default,系统默认创建
- artifactRepository: default
- # 上传到制品库时的制品命名,默认build
- artifactName: output
- dependsOn: build_nodejs
- - stage:
- name: release
- displayName: 发布
- steps:
- - step: publish@release_artifacts
- name: publish_release_artifacts
- displayName: '发布'
- # 上游上传制品任务的产出
- dependArtifact: output
- # 发行版制品库,默认release,系统默认创建
- artifactRepository: release
- # 发布制品版本号
- version: '1.0.0.0'
- # 是否开启版本号自增,默认开启
- autoIncrement: true
-triggers:
- push:
- branches:
- include:
- - master
diff --git a/.workflow/PRPipeline.yml b/.workflow/PRPipeline.yml
deleted file mode 100644
index 5531c32..0000000
--- a/.workflow/PRPipeline.yml
+++ /dev/null
@@ -1,43 +0,0 @@
-version: '1.0'
-name: pr-pipeline
-displayName: PRPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - # 设置NPM源,提升安装速度
- - npm config set registry https://registry.npmmirror.com
- - # 安装依赖
- - npm install
- - # 执行构建
- - npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 构建产物制品库,默认default,系统默认创建
- artifactRepository: default
- # 上传到制品库时的制品命名,默认build
- artifactName: output
- dependsOn: build_nodejs
-triggers:
- pr:
- branches:
- include:
- - master
--
Gitee
From 2d21eb81d04c039d09e6b28dffd67c456818d7a5 Mon Sep 17 00:00:00 2001
From: Admin <10531940+shenzhen-hexun-huagu_0@user.noreply.gitee.com>
Date: Thu, 13 Apr 2023 13:15:46 +0000
Subject: [PATCH 11/18] create pipeline-20230413.yml
---
.workflow/pipeline-20230413.yml | 36 +++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 .workflow/pipeline-20230413.yml
diff --git a/.workflow/pipeline-20230413.yml b/.workflow/pipeline-20230413.yml
new file mode 100644
index 0000000..d3d2c60
--- /dev/null
+++ b/.workflow/pipeline-20230413.yml
@@ -0,0 +1,36 @@
+version: '1.0'
+name: pipeline-20230413
+displayName: pipeline-20230413
+triggers:
+ trigger: auto
+ push:
+ branches:
+ prefix:
+ - ''
+stages:
+ - name: stage-dfb5662b
+ displayName: 未命名
+ strategy: naturally
+ trigger: auto
+ executor: []
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ nodeVersion: 14.16.0
+ commands:
+ - '# 设置NPM源,提升安装速度'
+ - npm config set registry https://registry.npmmirror.com
+ - ''
+ - '# 执行编译命令'
+ - npm install && npm run build
+ artifacts:
+ - name: BUILD_ARTIFACT
+ path:
+ - ./dist
+ caches:
+ - ~/.npm
+ - ~/.yarn
+ notify: []
+ strategy:
+ retry: '0'
--
Gitee
From 95c0f36e215dbfd51dcf49733cd30e726236f4e2 Mon Sep 17 00:00:00 2001
From: nicexmx
Date: Tue, 19 Dec 2023 04:20:00 +0000
Subject: [PATCH 12/18] update README.md.
Signed-off-by: nicexmx
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 2c98313..c408592 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# React, webpack
-Full documentation about it [here](https://mochajs.org/#-require-module-r-module)
+Full documentation about it [here](fhttps://mochajs.org/#-require-module-r-module)
## Commands
--
Gitee
From 997e7309850fa31460d131f9fbed9a700191ac11 Mon Sep 17 00:00:00 2001
From: gaojunjienpu
Date: Thu, 13 Mar 2025 03:18:14 +0000
Subject: [PATCH 13/18] update package.json.
Signed-off-by: gaojunjienpu
---
package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index af28bc9..e868a8c 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"scripts": {
"build": "webpack",
"start": "npm run build && opn index.html",
- "test": "mocha --require @babel/register --reporter mochawesome --exit"
+ "test": "mocha --require @babel/register --reporter mocha-junit-reporter --reporter-options mochaFile=junit.xml --exit"
},
"directories": {
"lib": "./lib",
@@ -16,6 +16,7 @@
},
"dependencies": {
"express": "^4.18.1",
+ "mocha-junit-reporter": "^2.2.1",
"opn-cli": "^5.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
--
Gitee
From e52000af532b9e28cd2dc6b035c5afa6c6973251 Mon Sep 17 00:00:00 2001
From: gaojunjienpu
Date: Thu, 13 Mar 2025 03:18:48 +0000
Subject: [PATCH 14/18] add default pipeline template yaml
---
.workflow/branch-pipeline.yml | 51 +++++++++++++++++++++++++++++++++++
.workflow/master-pipeline.yml | 49 +++++++++++++++++++++++++++++++++
.workflow/pr-pipeline.yml | 36 +++++++++++++++++++++++++
3 files changed, 136 insertions(+)
create mode 100644 .workflow/branch-pipeline.yml
create mode 100644 .workflow/master-pipeline.yml
create mode 100644 .workflow/pr-pipeline.yml
diff --git a/.workflow/branch-pipeline.yml b/.workflow/branch-pipeline.yml
new file mode 100644
index 0000000..1128d8a
--- /dev/null
+++ b/.workflow/branch-pipeline.yml
@@ -0,0 +1,51 @@
+version: '1.0'
+name: branch-pipeline
+displayName: BranchPipeline
+stages:
+ - stage:
+ name: compile
+ displayName: 编译
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
+ nodeVersion: 14.16.0
+ # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
+ commands:
+ - npm install && rm -rf ./dist && npm run build
+ # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
+ artifacts:
+ # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
+ - name: BUILD_ARTIFACT
+ # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
+ path:
+ - ./dist
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
+ dependArtifact: BUILD_ARTIFACT
+ # 上传到制品库时的制品命名,默认output
+ artifactName: output
+ dependsOn: build_nodejs
+ - stage:
+ name: release
+ displayName: 发布
+ steps:
+ - step: publish@release_artifacts
+ name: publish_release_artifacts
+ displayName: '发布'
+ # 上游上传制品任务的产出
+ dependArtifact: output
+ # 发布制品版本号
+ version: '1.0.0.0'
+ # 是否开启版本号自增,默认开启
+ autoIncrement: true
+triggers:
+ push:
+ branches:
+ exclude:
+ - master
+ include:
+ - .*
diff --git a/.workflow/master-pipeline.yml b/.workflow/master-pipeline.yml
new file mode 100644
index 0000000..8faf2bc
--- /dev/null
+++ b/.workflow/master-pipeline.yml
@@ -0,0 +1,49 @@
+version: '1.0'
+name: master-pipeline
+displayName: MasterPipeline
+stages:
+ - stage:
+ name: compile
+ displayName: 编译
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
+ nodeVersion: 14.16.0
+ # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
+ commands:
+ - npm install && rm -rf ./dist && npm run build
+ # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
+ artifacts:
+ # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
+ - name: BUILD_ARTIFACT
+ # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
+ path:
+ - ./dist
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
+ dependArtifact: BUILD_ARTIFACT
+ # 上传到制品库时的制品命名,默认output
+ artifactName: output
+ dependsOn: build_nodejs
+ - stage:
+ name: release
+ displayName: 发布
+ steps:
+ - step: publish@release_artifacts
+ name: publish_release_artifacts
+ displayName: '发布'
+ # 上游上传制品任务的产出
+ dependArtifact: output
+ # 发布制品版本号
+ version: '1.0.0.0'
+ # 是否开启版本号自增,默认开启
+ autoIncrement: true
+triggers:
+ push:
+ branches:
+ include:
+ - master
diff --git a/.workflow/pr-pipeline.yml b/.workflow/pr-pipeline.yml
new file mode 100644
index 0000000..1a05dd0
--- /dev/null
+++ b/.workflow/pr-pipeline.yml
@@ -0,0 +1,36 @@
+version: '1.0'
+name: pr-pipeline
+displayName: PRPipeline
+stages:
+ - stage:
+ name: compile
+ displayName: 编译
+ steps:
+ - step: build@nodejs
+ name: build_nodejs
+ displayName: Nodejs 构建
+ # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
+ nodeVersion: 14.16.0
+ # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
+ commands:
+ - npm install && rm -rf ./dist && npm run build
+ # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
+ artifacts:
+ # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
+ - name: BUILD_ARTIFACT
+ # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
+ path:
+ - ./dist
+ - step: publish@general_artifacts
+ name: publish_general_artifacts
+ displayName: 上传制品
+ # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
+ dependArtifact: BUILD_ARTIFACT
+ # 上传到制品库时的制品命名,默认output
+ artifactName: output
+ dependsOn: build_nodejs
+triggers:
+ pr:
+ branches:
+ include:
+ - master
--
Gitee
From 4fe87da8dbc68a0148e02cfebdc9e7e115b28d64 Mon Sep 17 00:00:00 2001
From: gaojunjienpu
Date: Thu, 13 Mar 2025 03:32:27 +0000
Subject: [PATCH 15/18] update branch-pipeline.yml
---
.workflow/branch-pipeline.yml | 72 ++++++++++++++---------------------
1 file changed, 29 insertions(+), 43 deletions(-)
diff --git a/.workflow/branch-pipeline.yml b/.workflow/branch-pipeline.yml
index 1128d8a..9d8df59 100644
--- a/.workflow/branch-pipeline.yml
+++ b/.workflow/branch-pipeline.yml
@@ -1,51 +1,37 @@
version: '1.0'
name: branch-pipeline
displayName: BranchPipeline
-stages:
- - stage:
- name: compile
- displayName: 编译
- steps:
- - step: build@nodejs
- name: build_nodejs
- displayName: Nodejs 构建
- # 支持8.16.2、10.17.0、12.16.1、14.16.0、15.12.0五个版本
- nodeVersion: 14.16.0
- # 构建命令:安装依赖 -> 清除上次打包产物残留 -> 执行构建 【请根据项目实际产出进行填写】
- commands:
- - npm install && rm -rf ./dist && npm run build
- # 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
- artifacts:
- # 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
- - name: BUILD_ARTIFACT
- # 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
- path:
- - ./dist
- - step: publish@general_artifacts
- name: publish_general_artifacts
- displayName: 上传制品
- # 上游构建任务定义的产物名,默认BUILD_ARTIFACT
- dependArtifact: BUILD_ARTIFACT
- # 上传到制品库时的制品命名,默认output
- artifactName: output
- dependsOn: build_nodejs
- - stage:
- name: release
- displayName: 发布
- steps:
- - step: publish@release_artifacts
- name: publish_release_artifacts
- displayName: '发布'
- # 上游上传制品任务的产出
- dependArtifact: output
- # 发布制品版本号
- version: '1.0.0.0'
- # 是否开启版本号自增,默认开启
- autoIncrement: true
triggers:
+ trigger: auto
push:
branches:
- exclude:
- - master
include:
- .*
+ exclude:
+ - master
+stages:
+ - name: compile
+ displayName: 编译
+ strategy: naturally
+ trigger: auto
+ steps:
+ - step: ut@nodejs
+ name: unit_test_nodejs
+ displayName: Nodejs 单元测试
+ nodeVersion: 14.16.0
+ commands:
+ - '# 设置NPM源,提升安装速度'
+ - npm config set registry https://registry.npmmirror.com
+ - '# 在这里输入测试命令'
+ - npm install && npm run test
+ report:
+ path: .
+ file: junit.xml
+ index: junit.xml
+ checkpoints: []
+ caches:
+ - ~/.npm
+ - ~/.yarn
+ notify: []
+ strategy:
+ retry: '0'
--
Gitee
From 0df5a80e1cb06c15e698b4f1653cc47ee54f8e07 Mon Sep 17 00:00:00 2001
From: gaojunjienpu
Date: Thu, 13 Mar 2025 05:10:53 +0000
Subject: [PATCH 16/18] update branch-pipeline.yml
---
.workflow/branch-pipeline.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.workflow/branch-pipeline.yml b/.workflow/branch-pipeline.yml
index 9d8df59..15e1382 100644
--- a/.workflow/branch-pipeline.yml
+++ b/.workflow/branch-pipeline.yml
@@ -23,7 +23,7 @@ stages:
- '# 设置NPM源,提升安装速度'
- npm config set registry https://registry.npmmirror.com
- '# 在这里输入测试命令'
- - npm install && npm run test
+ - npm install && npm run test || true
report:
path: .
file: junit.xml
--
Gitee
From d94ff42bac52dcace7228bc9e3f12d1060161c64 Mon Sep 17 00:00:00 2001
From: gaojunjienpu
Date: Thu, 13 Mar 2025 05:12:26 +0000
Subject: [PATCH 17/18] update branch-pipeline.yml
---
.workflow/branch-pipeline.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.workflow/branch-pipeline.yml b/.workflow/branch-pipeline.yml
index 15e1382..1926930 100644
--- a/.workflow/branch-pipeline.yml
+++ b/.workflow/branch-pipeline.yml
@@ -18,7 +18,7 @@ stages:
- step: ut@nodejs
name: unit_test_nodejs
displayName: Nodejs 单元测试
- nodeVersion: 14.16.0
+ nodeVersion: 20.10.0
commands:
- '# 设置NPM源,提升安装速度'
- npm config set registry https://registry.npmmirror.com
--
Gitee
From 7c8a3391b621149923a92ef0d5e7f4b0795d9def Mon Sep 17 00:00:00 2001
From: gaojunjienpu
Date: Thu, 13 Mar 2025 05:20:30 +0000
Subject: [PATCH 18/18] update branch-pipeline.yml
---
.workflow/branch-pipeline.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.workflow/branch-pipeline.yml b/.workflow/branch-pipeline.yml
index 1926930..ce2fb18 100644
--- a/.workflow/branch-pipeline.yml
+++ b/.workflow/branch-pipeline.yml
@@ -23,7 +23,7 @@ stages:
- '# 设置NPM源,提升安装速度'
- npm config set registry https://registry.npmmirror.com
- '# 在这里输入测试命令'
- - npm install && npm run test || true
+ - ls
report:
path: .
file: junit.xml
--
Gitee