This is an automated email from the ASF dual-hosted git repository.
fanjia pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/seatunnel-website.git
The following commit(s) were added to refs/heads/main by this push:
new e7a696fcb3d fix version script (#323)
e7a696fcb3d is described below
commit e7a696fcb3d5f92b6f4db7679970d95aff49bdff
Author: zhiwei liu <[email protected]>
AuthorDate: Fri Aug 16 15:44:00 2024 +0800
fix version script (#323)
---
.npmrc | 2 +-
README.md | 2 +-
README_ZH.md | 2 +-
package-lock.json | 290 ++++++++++++++++++++++++++++++++++++++----
package.json | 9 +-
src/pages/versions/index.less | 5 +-
tools/build-docs.ts | 11 +-
tools/common.ts | 35 +++--
tools/image-copy.ts | 15 +--
tools/version.ts | 75 +++++++++++
10 files changed, 383 insertions(+), 63 deletions(-)
diff --git a/.npmrc b/.npmrc
index 5660f81af2f..918fa4a9947 100644
--- a/.npmrc
+++ b/.npmrc
@@ -1 +1 @@
-registry=https://registry.npmjs.org/
\ No newline at end of file
+registry=https://registry.npmmirror.com/
\ No newline at end of file
diff --git a/README.md b/README.md
index 08aa4e0e125..0025ffdebc9 100644
--- a/README.md
+++ b/README.md
@@ -167,5 +167,5 @@ Located in `src/pages/versions`
### 3.9 add a new version for documents
-- 1、Run `npm run docusaurus docs:version replace_by_target_version` locally to
copy a document.
+- 1、Run `npm run version replace_by_target_version` locally to copy a document.
- 2、Modify `/src/pages/version/config.json` for the latest and history
versions.
diff --git a/README_ZH.md b/README_ZH.md
index 0bb1e1033b4..846097c98af 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -167,5 +167,5 @@ css等样式文件放在`src/css`目录下
### 3.9 为文档添加新版本
-- 1、在本地运行 npm run version replace_by_target_version 以复制文档。
+- 1、在本地运行 `npm run version replace_by_target_version` 以复制文档。
- 2、修改 `/src/pages/version/config.json` 中的最新的版本以及历史版本。
diff --git a/package-lock.json b/package-lock.json
index 81859bcc728..36c17c095a4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27,9 +27,11 @@
"@types/fs-extra": "^11.0.4",
"cross-env": "^7.0.3",
"docusaurus-plugin-less": "^2.0.2",
+ "execa": "^9.3.1",
"fs-extra": "^11.2.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
+ "picocolors": "^1.0.1",
"tsx": "^3.14.0",
"typescript": "^4.5.5"
}
@@ -3061,6 +3063,13 @@
"version": "1.0.0-next.21",
"license": "MIT"
},
+ "node_modules/@sec-ant/readable-stream": {
+ "version": "0.4.1",
+ "resolved":
"https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz",
+ "integrity":
"sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@sideway/address": {
"version": "4.1.3",
"license": "BSD-3-Clause",
@@ -3087,6 +3096,19 @@
"node": ">=6"
}
},
+ "node_modules/@sindresorhus/merge-streams": {
+ "version": "4.0.0",
+ "resolved":
"https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz",
+ "integrity":
"sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/@slorber/static-site-generator-webpack-plugin": {
"version": "4.0.7",
"license": "MIT",
@@ -5559,6 +5581,83 @@
"node": ">= 10"
}
},
+ "node_modules/default-gateway/node_modules/execa": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
+ "integrity":
"sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+ "license": "MIT",
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^6.0.0",
+ "human-signals": "^2.1.0",
+ "is-stream": "^2.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^4.0.1",
+ "onetime": "^5.1.2",
+ "signal-exit": "^3.0.3",
+ "strip-final-newline": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
+ }
+ },
+ "node_modules/default-gateway/node_modules/get-stream": {
+ "version": "6.0.1",
+ "resolved":
"https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz",
+ "integrity":
"sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/default-gateway/node_modules/human-signals": {
+ "version": "2.1.0",
+ "resolved":
"https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz",
+ "integrity":
"sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=10.17.0"
+ }
+ },
+ "node_modules/default-gateway/node_modules/is-stream": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
+ "integrity":
"sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/default-gateway/node_modules/npm-run-path": {
+ "version": "4.0.1",
+ "resolved":
"https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
+ "integrity":
"sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/default-gateway/node_modules/strip-final-newline": {
+ "version": "2.0.0",
+ "resolved":
"https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz",
+ "integrity":
"sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/defer-to-connect": {
"version": "1.1.3",
"license": "MIT"
@@ -6088,36 +6187,75 @@
}
},
"node_modules/execa": {
- "version": "5.1.1",
+ "version": "9.3.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-9.3.1.tgz",
+ "integrity":
"sha512-gdhefCCNy/8tpH/2+ajP9IQc14vXchNdd0weyzSJEFURhRMGncQ+zKFxwjAufIewPEJm9BPOaJnvg2UtlH2gPQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
+ "@sindresorhus/merge-streams": "^4.0.0",
"cross-spawn": "^7.0.3",
- "get-stream": "^6.0.0",
- "human-signals": "^2.1.0",
- "is-stream": "^2.0.0",
- "merge-stream": "^2.0.0",
- "npm-run-path": "^4.0.1",
- "onetime": "^5.1.2",
- "signal-exit": "^3.0.3",
- "strip-final-newline": "^2.0.0"
+ "figures": "^6.1.0",
+ "get-stream": "^9.0.0",
+ "human-signals": "^8.0.0",
+ "is-plain-obj": "^4.1.0",
+ "is-stream": "^4.0.1",
+ "npm-run-path": "^5.2.0",
+ "pretty-ms": "^9.0.0",
+ "signal-exit": "^4.1.0",
+ "strip-final-newline": "^4.0.0",
+ "yoctocolors": "^2.0.0"
},
"engines": {
- "node": ">=10"
+ "node": "^18.19.0 || >=20.5.0"
},
"funding": {
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
"node_modules/execa/node_modules/get-stream": {
- "version": "6.0.1",
+ "version": "9.0.1",
+ "resolved":
"https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz",
+ "integrity":
"sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==",
+ "dev": true,
"license": "MIT",
+ "dependencies": {
+ "@sec-ant/readable-stream": "^0.4.1",
+ "is-stream": "^4.0.1"
+ },
"engines": {
- "node": ">=10"
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/execa/node_modules/is-plain-obj": {
+ "version": "4.1.0",
+ "resolved":
"https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz",
+ "integrity":
"sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/execa/node_modules/signal-exit": {
+ "version": "4.1.0",
+ "resolved":
"https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
+ "integrity":
"sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/express": {
"version": "4.19.2",
"license": "MIT",
@@ -6302,6 +6440,22 @@
"node": ">=0.4.0"
}
},
+ "node_modules/figures": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-6.1.0.tgz",
+ "integrity":
"sha512-d+l3qxjSesT4V7v2fh+QnmFnUWv9lSpjarhShNTgBOfA0ttejbQUAlHLitbjkoRiDulW0OPoQPYIGhIC8ohejg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-unicode-supported": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/file-loader": {
"version": "6.2.0",
"license": "MIT",
@@ -7281,10 +7435,13 @@
}
},
"node_modules/human-signals": {
- "version": "2.1.0",
+ "version": "8.0.0",
+ "resolved":
"https://registry.npmjs.org/human-signals/-/human-signals-8.0.0.tgz",
+ "integrity":
"sha512-/1/GPCpDUCCYwlERiYjxoczfP0zfvZMU/OWgQPMya9AbAE24vseigFdhAMObpc8Q4lc/kjutPfUddDYyAmejnA==",
+ "dev": true,
"license": "Apache-2.0",
"engines": {
- "node": ">=10.17.0"
+ "node": ">=18.18.0"
}
},
"node_modules/iconv-lite": {
@@ -7637,10 +7794,13 @@
}
},
"node_modules/is-stream": {
- "version": "2.0.1",
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz",
+ "integrity":
"sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==",
+ "dev": true,
"license": "MIT",
"engines": {
- "node": ">=8"
+ "node": ">=18"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -7650,6 +7810,19 @@
"version": "1.0.0",
"license": "MIT"
},
+ "node_modules/is-unicode-supported": {
+ "version": "2.0.0",
+ "resolved":
"https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.0.0.tgz",
+ "integrity":
"sha512-FRdAyx5lusK1iHG0TWpVtk9+1i+GjrzRffhDg4ovQ7mcidMQ6mj+MhKPmvh7Xwyv5gIS06ns49CA7Sqg7lC22Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/is-what": {
"version": "3.14.1",
"dev": true,
@@ -8285,6 +8458,8 @@
},
"node_modules/mimic-fn": {
"version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity":
"sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
"license": "MIT",
"engines": {
"node": ">=6"
@@ -8525,13 +8700,32 @@
}
},
"node_modules/npm-run-path": {
- "version": "4.0.1",
+ "version": "5.3.0",
+ "resolved":
"https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz",
+ "integrity":
"sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==",
+ "dev": true,
"license": "MIT",
"dependencies": {
- "path-key": "^3.0.0"
+ "path-key": "^4.0.0"
},
"engines": {
- "node": ">=8"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npm-run-path/node_modules/path-key": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
+ "integrity":
"sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/nprogress": {
@@ -8615,6 +8809,8 @@
},
"node_modules/onetime": {
"version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
+ "integrity":
"sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
"license": "MIT",
"dependencies": {
"mimic-fn": "^2.1.0"
@@ -8779,6 +8975,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/parse-ms": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-ms/-/parse-ms-4.0.0.tgz",
+ "integrity":
"sha512-TXfryirbmq34y8QBwgqCVLi+8oA3oWx2eAnSn62ITyEhEYaWRlVZ2DvMM9eZbMs/RfxPu/PK/aBLyGj4IrqMHw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/parse-node-version": {
"version": "1.0.1",
"dev": true,
@@ -8894,7 +9103,9 @@
}
},
"node_modules/picocolors": {
- "version": "1.0.0",
+ "version": "1.0.1",
+ "resolved":
"https://registry.npmmirror.com/picocolors/-/picocolors-1.0.1.tgz",
+ "integrity":
"sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==",
"license": "ISC"
},
"node_modules/picomatch": {
@@ -9565,6 +9776,22 @@
"renderkid": "^3.0.0"
}
},
+ "node_modules/pretty-ms": {
+ "version": "9.1.0",
+ "resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-9.1.0.tgz",
+ "integrity":
"sha512-o1piW0n3tgKIKCwk2vpM/vOV13zjJzvP37Ioze54YlTHE06m4tjEbzg9WsKkvTuyYln2DHjo5pY4qrZGI0otpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "parse-ms": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/pretty-time": {
"version": "1.1.0",
"license": "MIT",
@@ -11139,10 +11366,16 @@
}
},
"node_modules/strip-final-newline": {
- "version": "2.0.0",
+ "version": "4.0.0",
+ "resolved":
"https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz",
+ "integrity":
"sha512-aulFJcD6YK8V1G7iRB5tigAP4TsHBZZrOV8pjV++zdUwmeV8uzbY7yn6h9MswN62adStNZFuCIx4haBnRuMDaw==",
+ "dev": true,
"license": "MIT",
"engines": {
- "node": ">=6"
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/strip-json-comments": {
@@ -12726,6 +12959,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/yoctocolors": {
+ "version": "2.1.1",
+ "resolved":
"https://registry.npmjs.org/yoctocolors/-/yoctocolors-2.1.1.tgz",
+ "integrity":
"sha512-GQHQqAopRhwU8Kt1DDM8NjibDXHC8eoh1erhGAJPEyveY9qqVeXvVikNKrDz69sHowPMorbPUrH/mx8c50eiBQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/zwitch": {
"version": "1.0.5",
"license": "MIT",
diff --git a/package.json b/package.json
index 400d57d21a7..b222a304aa5 100644
--- a/package.json
+++ b/package.json
@@ -3,6 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
+ "1": "npm run image-copy",
"docusaurus": "docusaurus",
"sync": "tsx tools/build-docs.ts",
"start": "docusaurus start",
@@ -15,9 +16,9 @@
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
- "image-copy":"tsx tools/image-copy.ts",
- "version": "npm run sync && docusaurus docs:version",
- "postversion": "npm run image-copy"
+ "image-copy": "tsx tools/image-copy.ts",
+ "version-back": "npm run sync && docusaurus docs:version",
+ "version": "tsx tools/version.ts"
},
"dependencies": {
"@docusaurus/core": "^2.4.3",
@@ -39,9 +40,11 @@
"@types/fs-extra": "^11.0.4",
"cross-env": "^7.0.3",
"docusaurus-plugin-less": "^2.0.2",
+ "execa": "^9.3.1",
"fs-extra": "^11.2.0",
"less": "^4.1.2",
"less-loader": "^10.2.0",
+ "picocolors": "^1.0.1",
"tsx": "^3.14.0",
"typescript": "^4.5.5"
},
diff --git a/src/pages/versions/index.less b/src/pages/versions/index.less
index a09ddfd1ad5..c7968998133 100644
--- a/src/pages/versions/index.less
+++ b/src/pages/versions/index.less
@@ -1,5 +1,4 @@
.div-one {
- width: 50%;
- height: 960px;
- margin: 0 auto;
+ width: 50%;
+ margin: 0 auto;
}
diff --git a/tools/build-docs.ts b/tools/build-docs.ts
index 28b368f93fb..946bf9f3bfb 100644
--- a/tools/build-docs.ts
+++ b/tools/build-docs.ts
@@ -1,6 +1,5 @@
import * as child_process from "child_process";
import * as fs from "fs";
-import * as path from "path";
import { copySync } from "fs-extra";
import {
PROJECT_NAME,
@@ -18,10 +17,10 @@ import {
PROJECT_SITE_ZH_DOC_DIR,
replaceImagesPath,
} from "./common";
-
+const PROJECT_TAG_NAME = process.argv[2];
// Determine protocol mode
const PROTOCOL_MODE = process.env.PROTOCOL_MODE || "HTTP";
-const PROJECT_REPO =
+let PROJECT_REPO =
PROTOCOL_MODE === "ssh"
? `[email protected]:apache/${PROJECT_NAME}.git`
: `https://github.com/apache/${PROJECT_NAME}.git`;
@@ -68,7 +67,11 @@ function prepareDocs() {
rmExistsFiles(DOCUSAURUS_DOC_SIDEBARS_FILE);
console.log("===>>>: Clone project main codebase repositories.");
- cloneRepo(PROJECT_REPO, PROJECT_BRANCH_NAME, PROJECT_DIR);
+ cloneRepo(
+ PROJECT_REPO,
+ PROJECT_TAG_NAME ? PROJECT_TAG_NAME : PROJECT_BRANCH_NAME,
+ PROJECT_DIR
+ );
console.log(`===>>>: Rsync sidebars.js to ${DOCUSAURUS_DOC_SIDEBARS_FILE}`);
fs.copyFileSync(PROJECT_SIDEBAR_PATH, DOCUSAURUS_DOC_SIDEBARS_FILE);
diff --git a/tools/common.ts b/tools/common.ts
index 3bc3c23f422..8833a081447 100644
--- a/tools/common.ts
+++ b/tools/common.ts
@@ -3,42 +3,49 @@ import * as fs from "fs";
import { readJsonSync } from "fs-extra";
// Set up constants
-export const SOURCE_PATH = path.join(__dirname, "..");
+export const SOURCE_PATH = path.resolve(__dirname, "..");
+export const VERSION_FILE = path.resolve(
+ SOURCE_PATH,
+ "src",
+ "pages",
+ "versions",
+ "config.json"
+);
export const PROJECT_NAME = "seatunnel";
export const PROJECT_BRANCH_NAME = "dev";
-export const SWAP_DIR = path.join(SOURCE_PATH, "swap");
-export const PROJECT_SITE_IMG_DIR = path.join(
+export const SWAP_DIR = path.resolve(SOURCE_PATH, "swap");
+export const PROJECT_SITE_IMG_DIR = path.resolve(
SOURCE_PATH,
"static",
"image_en"
);
-export const PROJECT_SITE_ZH_IMG_DIR = path.join(
+export const PROJECT_SITE_ZH_IMG_DIR = path.resolve(
SOURCE_PATH,
"static",
"image_zh"
);
-export const PROJECT_SITE_DOC_DIR = path.join(SOURCE_PATH, "docs");
-export const PROJECT_SITE_ZH_DOC_DIR = path.join(
+export const PROJECT_SITE_DOC_DIR = path.resolve(SOURCE_PATH, "docs");
+export const PROJECT_SITE_ZH_DOC_DIR = path.resolve(
SOURCE_PATH,
"i18n",
"zh-CN",
"docusaurus-plugin-content-docs",
"current"
);
-export const PROJECT_DIR = path.join(SWAP_DIR, PROJECT_NAME);
-export const PROJECT_IMG_DIR = path.join(PROJECT_DIR, "docs", "images");
-export const PROJECT_DOC_DIR = path.join(PROJECT_DIR, "docs", "en");
-export const PROJECT_ZH_DOC_DIR = path.join(PROJECT_DIR, "docs", "zh");
-export const PROJECT_SIDEBAR_PATH = path.join(
+export const PROJECT_DIR = path.resolve(SWAP_DIR, PROJECT_NAME);
+export const PROJECT_IMG_DIR = path.resolve(PROJECT_DIR, "docs", "images");
+export const PROJECT_DOC_DIR = path.resolve(PROJECT_DIR, "docs", "en");
+export const PROJECT_ZH_DOC_DIR = path.resolve(PROJECT_DIR, "docs", "zh");
+export const PROJECT_SIDEBAR_PATH = path.resolve(
PROJECT_DIR,
"docs",
"sidebars.js"
);
-export const DOCUSAURUS_DOC_SIDEBARS_FILE = path.join(
+export const DOCUSAURUS_DOC_SIDEBARS_FILE = path.resolve(
SOURCE_PATH,
"sidebars.js"
);
-export const VERSION = readJsonSync(path.join(SOURCE_PATH, "versions.json"));
+export const VERSION = readJsonSync(path.resolve(SOURCE_PATH,
"versions.json"));
// Utility function to replace image paths
export function replaceImagesPath(
@@ -48,7 +55,7 @@ export function replaceImagesPath(
) {
const regex = new RegExp(`(\\.\\.\\/)*${from}`, "g");
for (const fileName of fs.readdirSync(replaceDir)) {
- const filePath = path.join(replaceDir, fileName);
+ const filePath = path.resolve(replaceDir, fileName);
if (fs.statSync(filePath).isDirectory()) {
replaceImagesPath(filePath, to, from);
} else if (filePath.endsWith(".md") || filePath.endsWith(".mdx")) {
diff --git a/tools/image-copy.ts b/tools/image-copy.ts
index f8355b00b38..bd4b4bb12aa 100644
--- a/tools/image-copy.ts
+++ b/tools/image-copy.ts
@@ -1,22 +1,9 @@
-import * as child_process from "child_process";
-import * as fs from "fs";
import * as path from "path";
-import { copySync, readJsonSync } from "fs-extra";
+import { copySync } from "fs-extra";
import {
VERSION,
- PROJECT_NAME,
- SWAP_DIR,
- PROJECT_SITE_DOC_DIR,
PROJECT_SITE_IMG_DIR,
- DOCUSAURUS_DOC_SIDEBARS_FILE,
- PROJECT_BRANCH_NAME,
- PROJECT_DIR,
- PROJECT_SIDEBAR_PATH,
- PROJECT_IMG_DIR,
PROJECT_SITE_ZH_IMG_DIR,
- PROJECT_DOC_DIR,
- PROJECT_ZH_DOC_DIR,
- PROJECT_SITE_ZH_DOC_DIR,
SOURCE_PATH,
replaceImagesPath,
} from "./common";
diff --git a/tools/version.ts b/tools/version.ts
new file mode 100644
index 00000000000..33566e721a7
--- /dev/null
+++ b/tools/version.ts
@@ -0,0 +1,75 @@
+import { execa } from "execa";
+import { readJSONSync, writeJSONSync } from "fs-extra";
+import { VERSION_FILE } from "./common";
+import color from "picocolors";
+
+const version = process.argv[2];
+
+async function stepFour() {
+ const json = readJSONSync(VERSION_FILE);
+ const current = {
+ versionLabel: version,
+ docUrl: `/docs/${version}/about`,
+ downloadUrl: `https://github.com/apache/seatunnel/releases/tag/${version}`,
+ sourceTag: version,
+ };
+ json.en.table.latestData = [current];
+ json.en.table.historyData = [current, ...json.en.table.historyData];
+
+ json["zh-CN"].table.latestData = [current];
+ json["zh-CN"].table.historyData = [
+ current,
+ ...json["zh-CN"].table.historyData,
+ ];
+ writeJSONSync(VERSION_FILE, json, { spaces: 2 });
+}
+
+async function main() {
+ if (!version) {
+ throw new Error("Missing version number");
+ }
+ // step one
+ const stepOne = execa("npm", ["run", "sync", version], {
+ stdio: "pipe",
+ });
+ stepOne.stdout.on("data", (data) => {
+ console.log(`sync: ${data}`);
+ });
+ stepOne.stderr.on("data", (data) => {
+ console.error(color.red(`syncerr: ${data}`));
+ });
+ await stepOne;
+
+ // step two
+ const stepTwo = execa("docusaurus", ["docs:version", version], {
+ stdio: "pipe",
+ });
+ stepTwo.stdout.on("data", (data) => {
+ console.log(`sync: ${data}`);
+ });
+ stepTwo.stderr.on("data", (data) => {
+ console.error(color.red(`syncerr: ${data}`));
+ process.exit(1);
+ });
+ await stepTwo;
+
+ // step three
+ const stepThree = execa("npm", ["run", "image-copy"], {
+ stdio: "pipe",
+ });
+ stepThree.stdout.on("data", (data) => {
+ console.log(`sync: ${data}`);
+ });
+ stepThree.stderr.on("data", (data) => {
+ console.error(color.red(`syncerr: ${data}`));
+ process.exit(1);
+ });
+ await stepThree;
+
+ await stepFour();
+}
+
+main().catch((e) => {
+ console.error(color.red(e));
+ process.exit(1);
+});