Skip to content

Commit

Permalink
chore: reorganize monorepo, improved linting, testing and ci (#58)
Browse files Browse the repository at this point in the history
<!--- Provide a general summary of your changes in the Title above -->

## Description
- merged controller packages into widget package
- added better linting
- removed unnecessary typescript compiling
- improved ci (added testing)
- configured release-please

No code logic changes in this PR

## Related Issue Or Context

<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Otherwise, describe context and motivation for change here -->

Closes: #<issue>

## How Has This Been Tested? Testing details.

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have ensured that all acceptance criteria (or expected behavior)
from issue are met
- [ ] I have updated the documentation locally and in sygma-docs.
- [ ] I have added tests to cover my changes.
- [ ] I have ensured that all the checks are passing and green, I've
signed the CLA bot

---------

Signed-off-by: Marin Petrunic <[email protected]>
Co-authored-by: Filip Štoković <[email protected]>
Co-authored-by: Filip Štoković <[email protected]>
  • Loading branch information
3 people authored Jan 19, 2024
1 parent e46f3cb commit 1e2fc9e
Show file tree
Hide file tree
Showing 66 changed files with 1,723 additions and 2,207 deletions.
59 changes: 7 additions & 52 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,10 @@
{
"extends": [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"plugin:lit/recommended",
"plugin:wc/recommended",
"plugin:prettier/recommended"
],
"parserOptions": {
"sourceType": "module",
"ecmaVersion": "latest"
},
"env": {
"browser": true
},
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"import/extensions": "off",
"import/no-import-module-exports": "off",
"import/no-unresolved": "off",
"import/prefer-default-export": "off",
"lit/no-template-map": "off",
"lit/prefer-static-styles": "off",
"class-methods-use-this": [
"error",
{
"exceptMethods": ["render", "update"]
}
],
"no-console": ["warn", { "allow": ["warn"] }],
"no-param-reassign": "off",
"no-plusplus": "off",
"no-underscore-dangle": "off",
"prefer-destructuring": "off"
},
"plugins": ["@typescript-eslint", "wc", "prettier"],
"root": true,
"extends": "@chainsafe",
"parser": "@typescript-eslint/parser",
"overrides": [
{
"files": ["src/@types/*.d.ts"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
},
{
"files": ["scripts/*.js"],
"rules": {
"import/no-extraneous-dependencies": "off",
"no-console": "off",
"no-restricted-syntax": "off"
}
}
]
"parserOptions": {
"project": ["'./packages/*/tsconfig.json'", "'./examples/*/tsconfig.json'"],
"ecmaVersion": 2020,
"sourceType": "module"
}
}
30 changes: 0 additions & 30 deletions .github/workflows/build-react.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/build-sdk-manager.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/build-wallet-manager.yml

This file was deleted.

30 changes: 0 additions & 30 deletions .github/workflows/build-widget.yml

This file was deleted.

55 changes: 25 additions & 30 deletions .github/workflows/widget.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,62 +1,57 @@
name: Publish Widget to NPM
name: Publish packages to NPM

on:
push:
branches:
- main
paths:
- 'packages/widget/**'
- '!packages/sdk-manager/**'
- '!packages/wallet-manager/**'
jobs:
maybe-release:
name: release
runs-on: ubuntu-latest
# add check if ci is successfull
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
# you should probably do this after your regular CI checks passes
- uses: google-github-actions/release-please-action@v3 # it will analyze commits and create PR with new version and updated CHANGELOG:md file. On merging it will create github release page with changelog
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
command: manifest
token: ${{secrets.RELEASE_TOKEN}}
path: packages/widget
monorepo-tags: true
default-branch: main
package-name: '@buildwithsygma/widget'
release-type: node
monorepo-tags: true
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"revert","hidden":true}]'

- uses: actions/checkout@v3
# these if statements ensure that a publication only occurs when
# a new release is created:
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.releases_created }}

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.releases_created }}
with:
cache: 'yarn'
node-version: 18
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.releases_created }}

- name: Enable corepack
run: corepack enable
- run: corepack enable
if: ${{ steps.release.outputs.releases_created }}

- name: Install yarn
run: yarn set version stable

- uses: actions/setup-node@v4
with:
cache: 'yarn'
node-version: 18
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.releases_created }}

- name: Install dependencies
run: yarn install
run: yarn install --immutable
if: ${{ steps.release.outputs.releases_created }}

- name: Build all packages
run: yarn build:all
run: yarn build
if: ${{ steps.release.outputs.releases_created }}

- run: npm publish --workspace=@buildwithsygma/sygmaprotocol-widget --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.releases_created }}
run: |
echo npmAuthToken: "$NODE_AUTH_TOKEN" >> ./.yarnrc.yml
- run: yarn workspaces foreach -v --exclude root --no-private npm publish --tolerate-republish --access public
if: ${{ steps.release.outputs.releases_created }}
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "ci / test"

on:
push:
branches:
- main # runs on push to master, add more branches if you use them
pull_request:
branches:
- '**' # runs on update to pull request on any branch

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- run: yarn install --immutable
- run: yarn run lint
- run: yarn run build
- run: yarn run test:unit
63 changes: 0 additions & 63 deletions .github/workflows/react-widget.yml

This file was deleted.

Loading

0 comments on commit 1e2fc9e

Please sign in to comment.