Skip to content

Commit

Permalink
fix: module.exports being overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
skypesky committed Sep 11, 2024
1 parent 75c28d7 commit c781caa
Show file tree
Hide file tree
Showing 27 changed files with 8,530 additions and 38 deletions.
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### 关联 Issue

<!-- 请用 fixes、closes、resolves、relates 这些关键词来关联 issue,原则上,所有 PR 都应该有关联 Issue -->

### 主要改动

<!--
@example:
1. 修复了 xxx
2. 改进了 xxx
3. 调整了 xxx
-->

### 界面截图

<!-- 如果改动的是跟 UI 相关的,不论是 CLI 还是 WEB 都应该截图 -->

### 测试计划

<!-- 如果本次变更没有自动化测试覆盖,你整理的测试用例集是什么?需要编写成 todo list 放到下面 -->

### 检查清单

- [ ] CHANGELOG.md 是否更新好了
- [ ] 版本升级过了吗?
20 changes: 20 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: check-pr-title

on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize
branches:
- main
- dev

jobs:
lint-title:
runs-on: ubuntu-latest
steps:
- uses: ArcBlock/action-lint-pull-request-title@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/publish-beta-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: publish-beta-to-npm

on:
push:
branches: [main]

jobs:
publish-beta-to-npm:
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
steps:
- name: Checkout release branch code
uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
registry-url: "https://registry.npmjs.org"

- name: Install deps
run: pnpm install

- name: Build
run: pnpm build

- name: Publish to NPM
run: |
node scripts/update-beta-package-version.js
cat package.json | grep version
npm publish --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/publish-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: publish-to-npm

on:
push:
branches: [release]

jobs:
publish-to-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout release branch code
uses: actions/checkout@v3
with:
fetch-depth: 1

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
registry-url: "https://registry.npmjs.org"

- name: Install deps
run: pnpm install

- name: Build
run: pnpm build

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/task-list-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: task-list-checker
on:
pull_request:
types: [opened, edited, synchronize, reopened]
jobs:
task-list-checker:
runs-on: ubuntu-latest
steps:
- name: Check for incomplete task list items
uses: Shopify/task-list-checker@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: unit-test

on:
pull_request:
branches:
- release
- main

jobs:
integration:
runs-on: ubuntu-latest

if: "! contains(toJSON(github.event.commits.*.message), '[skip actions]')"

steps:
- name: Checkout repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- name: Install deps
run: pnpm install

- name: Lint package
run: pnpm run lint

- name: Run unit test
run: pnpm run test
43 changes: 43 additions & 0 deletions .github/workflows/version-check-for-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: version-check-for-npm
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true

on:
pull_request:
branches:
- release

jobs:
version-check-for-npm:
timeout-minutes: 30
runs-on: ubuntu-latest
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: '16'

- name: Extract current version
id: get_version
run: |
PACKAGE_NAME=$(node -p -e "require('./package.json').name")
echo "PACKAGE_NAME=${PACKAGE_NAME}" >> $GITHUB_ENV
CURRENT_VERSION=$(node -p -e "require('./package.json').version")
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Publish to NPM
run: |
LATEST_VERSION=$(npm show $PACKAGE_NAME version)
# https://www.npmjs.com/package/compare-versions-cli
npm install -g compare-versions-cli
COMPARE=$(compare-versions-cli $CURRENT_VERSION $LATEST_VERSION)
if [ $COMPARE -le 0 ]
then
echo "CURRENT_VERSION($CURRENT_VERSION) must greater than LATEST_VERSION($LATEST_VERSION)"
echo "npm: https://www.npmjs.com/package/$PACKAGE_NAME"
exit 1
fi
32 changes: 0 additions & 32 deletions build.js

This file was deleted.

121 changes: 121 additions & 0 deletions coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1726041571140" clover="3.2.0">
<project timestamp="1726041571140" name="All files">
<metrics statements="112" coveredstatements="53" conditionals="114" coveredconditionals="50" methods="42" coveredmethods="6" elements="268" coveredelements="109" complexity="0" loc="112" ncloc="112" packages="1" files="1" classes="1"/>
<file name="index.js" path="/Users/skypesky/workSpaces/javascript/github/xbytes/lib/index.js">
<metrics statements="112" coveredstatements="53" conditionals="114" coveredconditionals="50" methods="42" coveredmethods="6"/>
<line num="11" count="1" type="cond" truecount="3" falsecount="1"/>
<line num="12" count="1" type="cond" truecount="8" falsecount="0"/>
<line num="13" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="14" count="1" type="stmt"/>
<line num="16" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="18" count="1" type="cond" truecount="4" falsecount="4"/>
<line num="20" count="1" type="cond" truecount="4" falsecount="2"/>
<line num="21" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="22" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="25" count="1" type="cond" truecount="1" falsecount="1"/>
<line num="28" count="1" type="stmt"/>
<line num="30" count="1" type="stmt"/>
<line num="32" count="1" type="stmt"/>
<line num="34" count="1" type="stmt"/>
<line num="38" count="3" type="cond" truecount="3" falsecount="1"/>
<line num="39" count="3" type="stmt"/>
<line num="40" count="3" type="cond" truecount="1" falsecount="1"/>
<line num="41" count="3" type="stmt"/>
<line num="52" count="3" type="stmt"/>
<line num="57" count="3" type="cond" truecount="3" falsecount="1"/>
<line num="58" count="3" type="stmt"/>
<line num="59" count="3" type="stmt"/>
<line num="65" count="3" type="stmt"/>
<line num="69" count="4" type="stmt"/>
<line num="73" count="0" type="stmt"/>
<line num="77" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="82" count="4" type="cond" truecount="4" falsecount="0"/>
<line num="83" count="4" type="cond" truecount="5" falsecount="1"/>
<line num="84" count="3" type="stmt"/>
<line num="85" count="3" type="stmt"/>
<line num="88" count="4" type="stmt"/>
<line num="92" count="0" type="stmt"/>
<line num="100" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="101" count="0" type="stmt"/>
<line num="104" count="0" type="cond" truecount="0" falsecount="4"/>
<line num="109" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="110" count="0" type="stmt"/>
<line num="113" count="0" type="stmt"/>
<line num="114" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="115" count="0" type="cond" truecount="0" falsecount="4"/>
<line num="116" count="0" type="stmt"/>
<line num="121" count="0" type="stmt"/>
<line num="122" count="0" type="stmt"/>
<line num="123" count="0" type="stmt"/>
<line num="124" count="0" type="stmt"/>
<line num="125" count="0" type="stmt"/>
<line num="126" count="0" type="stmt"/>
<line num="130" count="0" type="stmt"/>
<line num="131" count="0" type="stmt"/>
<line num="132" count="0" type="stmt"/>
<line num="134" count="1" type="stmt"/>
<line num="135" count="1" type="stmt"/>
<line num="136" count="1" type="stmt"/>
<line num="137" count="1" type="stmt"/>
<line num="138" count="1" type="stmt"/>
<line num="139" count="0" type="stmt"/>
<line num="140" count="0" type="stmt"/>
<line num="141" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="142" count="0" type="stmt"/>
<line num="148" count="0" type="stmt"/>
<line num="152" count="0" type="stmt"/>
<line num="153" count="0" type="stmt"/>
<line num="158" count="0" type="stmt"/>
<line num="159" count="0" type="stmt"/>
<line num="164" count="0" type="stmt"/>
<line num="165" count="0" type="stmt"/>
<line num="170" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="175" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="176" count="0" type="stmt"/>
<line num="177" count="0" type="stmt"/>
<line num="181" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="182" count="0" type="stmt"/>
<line num="186" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="187" count="0" type="stmt"/>
<line num="188" count="0" type="stmt"/>
<line num="192" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="193" count="0" type="stmt"/>
<line num="194" count="0" type="stmt"/>
<line num="198" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="199" count="0" type="stmt"/>
<line num="200" count="0" type="stmt"/>
<line num="204" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="205" count="0" type="stmt"/>
<line num="206" count="0" type="stmt"/>
<line num="210" count="0" type="stmt"/>
<line num="214" count="0" type="stmt"/>
<line num="218" count="0" type="stmt"/>
<line num="222" count="0" type="stmt"/>
<line num="226" count="0" type="cond" truecount="0" falsecount="2"/>
<line num="227" count="0" type="stmt"/>
<line num="230" count="0" type="stmt"/>
<line num="234" count="0" type="stmt"/>
<line num="239" count="0" type="stmt"/>
<line num="242" count="1" type="stmt"/>
<line num="243" count="1" type="stmt"/>
<line num="244" count="1" type="stmt"/>
<line num="245" count="1" type="stmt"/>
<line num="247" count="1" type="stmt"/>
<line num="248" count="1" type="stmt"/>
<line num="249" count="1" type="stmt"/>
<line num="250" count="1" type="stmt"/>
<line num="251" count="1" type="stmt"/>
<line num="253" count="1" type="stmt"/>
<line num="254" count="1" type="stmt"/>
<line num="255" count="1" type="stmt"/>
<line num="256" count="1" type="stmt"/>
<line num="258" count="1" type="stmt"/>
<line num="259" count="1" type="stmt"/>
<line num="260" count="1" type="stmt"/>
<line num="261" count="1" type="stmt"/>
<line num="262" count="1" type="stmt"/>
<line num="264" count="1" type="stmt"/>
</file>
</project>
</coverage>
2 changes: 2 additions & 0 deletions coverage/coverage-final.json

Large diffs are not rendered by default.

Loading

0 comments on commit c781caa

Please sign in to comment.