Skip to content

Commit

Permalink
Merge pull request #12018 from NervJS/feat/3.5-theta
Browse files Browse the repository at this point in the history
Feat/3.5 theta
  • Loading branch information
ZakaryCode authored Jul 7, 2022
2 parents 2191078 + d58199a commit 7229db9
Show file tree
Hide file tree
Showing 321 changed files with 42,463 additions and 43,462 deletions.
3 changes: 0 additions & 3 deletions .commitlintrc.js

This file was deleted.

52 changes: 35 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,58 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'jest', 'react', 'simple-import-sort', 'import'],
plugins: [
'@typescript-eslint',
'import',
'jest',
'react',
'simple-import-sort',
'prettier'
],
extends: [
'eslint:recommended',
'standard',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended'
'plugin:react/jsx-runtime',
'plugin:react/recommended',
'prettier'
],
rules: {
// 'camelcase': ['error', {allow: ['^internal_', '^unstable_']}]
camelcase: 0,
indent: 'off',
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/camelcase': 0,
'@typescript-eslint/explicit-function-return-type': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/indent': [2, 2],
'@typescript-eslint/interface-name-prefix': 0,
'@typescript-eslint/member-delimiter-style': ['warn', { multiline: { delimiter: 'none' }, singleline: { delimiter: 'comma' } }],
'@typescript-eslint/member-delimiter-style': [1, { multiline: { delimiter: 'none' }, singleline: { delimiter: 'comma' } }],
'@typescript-eslint/no-empty-function': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', args: 'after-used' }],
'@typescript-eslint/no-use-before-define': ['warn', { functions: false, classes: false }],
'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/no-unused-vars': [2, { argsIgnorePattern: '^_', args: 'after-used' }],
'@typescript-eslint/no-use-before-define': [1, { functions: false, classes: false }],
'@typescript-eslint/no-var-requires': 0,
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'no-console': ['error', { allow: ['warn', 'error'] }],
camelcase: 0,
'import/first': 2,
'import/newline-after-import': 2,
'import/no-duplicates': 2,
indent: 'off',
'no-console': [2, { allow: ['warn', 'error'] }],
'no-prototype-builtins': 0,
'no-unused-expressions': 0,
'no-unused-vars': 'off',
'no-use-before-define': 0,
'no-empty': 1,
'prefer-spread': 0,
'prefer-rest-params': 0,
'react/jsx-uses-vars': 'warn',
'react/jsx-uses-vars': 1,
'react/prop-types': 0,
'react/no-find-dom-node': 0,
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
quotes: [2, 'single', { avoidEscape: true, allowTemplateLiterals: true }],
semi: [2, 'never'],
'simple-import-sort/imports': 2,
'simple-import-sort/exports': 2,
'space-before-function-paren': [2, 'always'],
'standard/no-callback-literal': 0
},
env: {
Expand All @@ -66,5 +79,10 @@ module.exports = {
ecmaFeatures: {
jsx: true
}
},
settings: {
react: {
version: 'detect'
}
}
}
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Don't allow people to merge changes to these generated files, because the result
# may be invalid. You need to run "rush update" again.
pnpm-lock.yaml merge=text
shrinkwrap.yaml merge=binary
npm-shrinkwrap.json merge=binary
yarn.lock merge=binary

# Rush's JSON config files use JavaScript-style code comments. The rule below prevents pedantic
# syntax highlighters such as GitHub's from highlighting these comments as errors. Your text editor
# may also require a special configuration to allow comments in JSON.
#
# For more information, see this issue: https://github.com/microsoft/rushstack/issues/1088
#
*.json linguist-language=JSON-with-Comments
67 changes: 32 additions & 35 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- next
- feat/use-h5
- feat/**
pull_request:
branches:
- next
Expand All @@ -20,38 +20,35 @@ jobs:
node-version: [14.x, 16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
# - name: restore lerna
# uses: actions/cache@v2
# with:
# path: |
# node_modules
# */*/node_modules
# key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Checkout
uses: actions/checkout@v3
with :
ref : ${{ github.head_ref }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: npm install -g yarn
- run: yarn config set registry https://registry.yarnpkg.com
- name: install
run: yarn
- name: lint
run: yarn run lint
- name: build
run: yarn run build
- name: test
run: yarn test
env:
CI: true
# Bootstrap project
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: install
uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: lint
run: pnpm run lint
- name: build
run: pnpm run build
- name: test
run: pnpm run test
env:
CI: true
88 changes: 49 additions & 39 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ on:
# When Release Pull Request is merged
push:
branches:
- '**'
- 'feat/**'
pull_request:
branches:
- next
types: [closed]

env:
CI: true
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
publish:
name: Publish
runs-on: ubuntu-18.04
steps:
# Setup
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with :
ref : ${{ github.head_ref }}
- name: Setup Node ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
Expand All @@ -42,43 +45,40 @@ jobs:
- name: Get commit message
run: |
COMMIT_MESSAGE=$(git log --format=%s -n 1)
echo "commitmsg=${COMMIT_MESSAGE}" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
- name: Show commit message
run : echo "$commitmsg"
run : echo "$COMMIT_MESSAGE"

# ------------------ If commit message not satisfied, skip -------------
- name: Commit message compliance verification
if: startsWith( env.COMMIT_MESSAGE , 'chore(release):' ) != true
uses: andymckay/cancel-action@0.2

# Get & check npm publish dist-tag when event is push
- name: Get dist tag
if: startsWith( env.commitmsg , 'chore(release):' ) && github.event_name == 'push' && contains( env.commitmsg , '--tag=' )
run: |
TEMP=`echo $commitmsg | grep -oP "\-\-tag=(\w+)"`
DIST_TAG=`echo ${TEMP:6}`
echo "disttag=${DIST_TAG}" >> $GITHUB_ENV
- name: Show dist tag
if: startsWith( env.commitmsg , 'chore(release):' ) && github.event_name == 'push' && contains( env.commitmsg , '--tag=' )
run : echo "$disttag"
- name: Check dist tag
if: startsWith( env.commitmsg , 'chore(release):' ) && github.event_name == 'push' && !env.disttag
run: |
echo "Publish by pushing must provide parameter named tag, just like: chore(release): publish 1.0 --tag=beta"
- name: Cancelling
if: startsWith( env.commitmsg , 'chore(release):' ) && github.event_name == 'push' && !env.disttag
- name: Publish push tag verification
if: github.event_name == 'push' && contains( env.COMMIT_MESSAGE , '--tag=' ) != true
uses: andymckay/cancel-action@0.2

# ------------------ If event is push but there is no dist tag, exit -------------
# ------------------ If event is push -------------

# Get & check npm publish
- name: Get publish params
if: github.event_name == 'push'
run: |
PUBLISH_PARAMS=`echo $COMMIT_MESSAGE | grep -oE "^chore\(release\): publish \S*\s(.*)" | cut -d " " -f 4-`
echo "PUBLISH_PARAMS=${PUBLISH_PARAMS}" >> $GITHUB_ENV
- name: Show publish params
if: github.event_name == 'push'
run: echo "Publish pushing provide parameter [$PUBLISH_PARAMS]."

# Define ${CURRENT_VERSION}
- name: Set Current Version
if: startsWith( env.commitmsg , 'chore(release):' )
shell: bash -ex {0}
run: |
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')
CURRENT_VERSION=$(node -p 'require("./package.json").version')
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
# Check git tag
- name: Tag Check
if: startsWith( env.commitmsg , 'chore(release):' )
id: tag_check
shell: bash -ex {0}
run: |
Expand All @@ -95,24 +95,36 @@ jobs:

# ------------------ If git tag already exists, skip -------------

- name: Git tag verification
if: steps.tag_check.outputs.exists_tag == false
uses: andymckay/cancel-action@0.2

# Bootstrap project
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: install
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: yarn
uses: pnpm/action-setup@v2.2.2
with:
version: 7
run_install: |
- recursive: true
args: [--frozen-lockfile]
- name: build
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: yarn build
run: pnpm run build

# Git stash
- name: Drop current changes
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: |
git add .
git stash
# Create git tag
- name: Create Git Tag
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
uses: azu/action-package-version-to-git-tag@v1
with:
version: ${{ env.CURRENT_VERSION }}
Expand All @@ -121,27 +133,25 @@ jobs:
git_commit_sha: ${{ github.sha }}
git_tag_prefix: "v"

# ------------------ Before publish -------------
# ------------------ publish -------------

# Publish
- name: Publish
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false'
run: |
if [ '${{ github.event_name }}' == 'pull_request' ] ; then
yarn lerna publish from-package --yes
pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ env.BRANCH_NAME }} -r
elif [ '${{ github.event_name }}' == 'push' ] ; then
yarn lerna publish from-package --dist-tag ${{ env.disttag }} --yes
pnpm publish --registry=https://registry.npmjs.org/ --publish-branch=${{ env.BRANCH_NAME }} -r ${{ env.PUBLISH_PARAMS }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# ------------------ After publish -------------

# Create relase when event is PR
# Create release when event is PR
- name: Create Release
id: create_release
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true
if: github.event.pull_request.merged == true
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -156,7 +166,7 @@ jobs:

# Create PR page comment when event is PR
- uses: actions/github-script@0.8.0
if: startsWith( env.commitmsg , 'chore(release):' ) && steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true
if: github.event.pull_request.merged == true
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
Expand Down
Loading

0 comments on commit 7229db9

Please sign in to comment.