From 5309444d67b59d9551f1e3390bbf7c36ffc0a4dd Mon Sep 17 00:00:00 2001 From: plainheart Date: Mon, 17 Oct 2022 14:42:41 +0800 Subject: [PATCH 1/2] chore(workflow): always install the latest nightly version of zrender when publishing nightly echarts --- .github/workflows/nightly-next.yml | 4 +++- .github/workflows/nightly.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly-next.yml b/.github/workflows/nightly-next.yml index 35f3aeb6ac..39683fc6e0 100644 --- a/.github/workflows/nightly-next.yml +++ b/.github/workflows/nightly-next.yml @@ -28,7 +28,9 @@ jobs: registry-url: https://registry.npmjs.org/ - name: Setup and publish nightly run: | - npm ci + npm i + npm i zrender@npm:zrender-nightly@next + npm ls zrender npm run release npm run test npm run test:dts diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c609203595..19b3f051e5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -25,7 +25,9 @@ jobs: registry-url: https://registry.npmjs.org/ - name: Setup and publish nightly run: | - npm ci + npm i + npm i zrender@npm:zrender-nightly + npm ls zrender npm run release npm run test npm run test:dts From cd7ec4cc66fd9b6d165ce1793068b92e22102428 Mon Sep 17 00:00:00 2001 From: plainheart Date: Tue, 18 Oct 2022 13:46:21 +0800 Subject: [PATCH 2/2] fix(nightly-build): update echarts & zrender version to real nightly version --- .github/workflows/nightly-next.yml | 5 ++-- .github/workflows/nightly.yml | 5 ++-- build/nightly/post.js | 30 +++++++++++++++++++ .../{prepareNightly.js => nightly/prepare.js} | 7 ++--- 4 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 build/nightly/post.js rename build/{prepareNightly.js => nightly/prepare.js} (95%) diff --git a/.github/workflows/nightly-next.yml b/.github/workflows/nightly-next.yml index 39683fc6e0..2cd843edcb 100644 --- a/.github/workflows/nightly-next.yml +++ b/.github/workflows/nightly-next.yml @@ -28,13 +28,14 @@ jobs: registry-url: https://registry.npmjs.org/ - name: Setup and publish nightly run: | - npm i + node build/nightly/prepare.js --next npm i zrender@npm:zrender-nightly@next + npm ci npm ls zrender + node build/nightly/post.js npm run release npm run test npm run test:dts - node build/prepareNightly.js --next npm publish --tag next env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 19b3f051e5..ddbcd98412 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -25,13 +25,14 @@ jobs: registry-url: https://registry.npmjs.org/ - name: Setup and publish nightly run: | - npm i + node build/nightly/prepare.js npm i zrender@npm:zrender-nightly + npm ci npm ls zrender + node build/nightly/post.js npm run release npm run test npm run test:dts - node build/prepareNightly.js npm publish env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/build/nightly/post.js b/build/nightly/post.js new file mode 100644 index 0000000000..a06bf338a6 --- /dev/null +++ b/build/nightly/post.js @@ -0,0 +1,30 @@ +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +const fs = require('fs'); + +const root = __dirname + '/../../'; +const echartsPkg = JSON.parse(fs.readFileSync(root + 'package.json'), 'utf-8'); +const zrenderPkg = JSON.parse(fs.readFileSync(root + 'node_modules/zrender/package.json', 'utf-8')); + +const echartsCorePath = root + 'src/core/echarts.ts'; +const echartsCoreFile = fs.readFileSync(echartsCorePath, 'utf-8') + .replace(/export const version = '\S+'/, `export const version = '${echartsPkg.version}'`) + .replace(/(export const dependencies = {\s+zrender: ')\S+('\s+})/, `$1${zrenderPkg.version}$2`); +fs.writeFileSync(echartsCorePath, echartsCoreFile, 'utf-8'); diff --git a/build/prepareNightly.js b/build/nightly/prepare.js similarity index 95% rename from build/prepareNightly.js rename to build/nightly/prepare.js index 0dccab4efb..edec4a966d 100644 --- a/build/prepareNightly.js +++ b/build/nightly/prepare.js @@ -19,7 +19,7 @@ const fs = require('fs'); -const packageJsonPath = __dirname + '/../package.json'; +const packageJsonPath = __dirname + '/../../package.json'; const nightlyPackageName = 'echarts-nightly'; const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8')); @@ -57,8 +57,7 @@ packageJson.version = updateVersion(packageJson.version); fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf-8'); - -const readmePath = __dirname + '/../README.md'; +const readmePath = __dirname + '/../../README.md'; const readmeAttention = `

⚠️ ATTENTION PLEASE

This is nightly build of Apache ECharts. Please DON't use it in your production environment.

@@ -70,4 +69,4 @@ ${readmeAttention} ${readmeContent} `, 'utf-8'); -} \ No newline at end of file +}