Skip to content

Commit

Permalink
feat: add base package
Browse files Browse the repository at this point in the history
  • Loading branch information
auto200 committed Apr 16, 2024
1 parent 1fb84dd commit bc8f575
Show file tree
Hide file tree
Showing 38 changed files with 2,799 additions and 4,591 deletions.
10 changes: 5 additions & 5 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ const config = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended-type-checked',
'plugin:@typescript-eslint/recommended-type-checked'
],
plugins: ['@typescript-eslint'],
ignorePatterns:[".eslintrc.cjs", "example"],
ignorePatterns: ['.eslintrc.cjs', 'example', 'scripts'],
parserOptions: {
project:true,
tsconfigRootDir: __dirname,
},
project: true,
tsconfigRootDir: __dirname
}
}

module.exports = config
87 changes: 20 additions & 67 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,29 @@
name: Bump and Publish
name: Publish

on:
release:
types: [released]
# refs/tags/x.x.x
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
- name: 'Cache node Modules'
uses: actions/cache@v1
with:
path: ~.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: yarn
- run: npm run test
bump-and-build:
needs: tests
publish:
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: 'Cache node Modules'
uses: actions/cache@v1
with:
path: ~.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: yarn
- run: npm --no-git-tag-version --allow-same-version version ${{ steps.get_version.outputs.VERSION }}
- run: npm run build
- run: npm pack
- name: 'Upload Build Artifatc ${{ steps.get_version.outputs.VERSION }}'
uses: actions/upload-artifact@v2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
name: ${{ steps.get_version.outputs.VERSION }}.tgz
path: piwikpro-react-piwik-pro-${{ steps.get_version.outputs.VERSION }}.tgz
publish-npm:
needs: bump-and-build
runs-on: ubuntu-latest
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Download a Build Artifact
uses: actions/download-artifact@v2
with:
name: ${{ steps.get_version.outputs.VERSION }}.tgz
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm publish piwikpro-react-piwik-pro-${{ steps.get_version.outputs.VERSION }}.tgz
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install modules
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
24 changes: 14 additions & 10 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
name: Build and Tests
name: Test

on:
push:
branches:
- '**'
- master
pull_request:
branches:
- master

jobs:
run-tests:
if: "!contains(github.event.head_commit.message, 'skip ci')"
timeout-minutes: 30
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
with:
node-version: '16'
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install Modules
run: yarn
- name: Install modules
run: yarn install --frozen-lockfile

- name: Typecheck
run: yarn typecheck

- name: Running Tests
run: npm run test
# - name: Run tests
# run: yarn test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ yarn-error.log*

# ide
.idea

docs_raw
Loading

0 comments on commit bc8f575

Please sign in to comment.