From a0bce27b5f7b4827d84763242e2342b2aed1a50b Mon Sep 17 00:00:00 2001 From: Aleksandr Grenishin Date: Fri, 8 Jul 2022 14:23:46 +0300 Subject: [PATCH] fix: type module (#333) * fix: add `type: module` field to the package.json to fix custom esm imports * chore: readme typo * chore: simplify shipjs configs * chore(readme): add index.js ending to the imports --- .github/workflows/shipjs-manual-prepare.yml | 32 +------------------ .github/workflows/shipjs-schedule-prepare.yml | 24 -------------- .github/workflows/shipjs-trigger.yml | 11 ++++--- README.md | 6 ++-- package.json | 1 + 5 files changed, 11 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/shipjs-schedule-prepare.yml diff --git a/.github/workflows/shipjs-manual-prepare.yml b/.github/workflows/shipjs-manual-prepare.yml index 77e34aa..a709676 100644 --- a/.github/workflows/shipjs-manual-prepare.yml +++ b/.github/workflows/shipjs-manual-prepare.yml @@ -1,14 +1,7 @@ - name: Ship js Manual Prepare -on: - issue_comment: - types: [created] +on: workflow_dispatch jobs: manual_prepare: - if: | - github.event_name == 'issue_comment' && - (github.event.comment.author_association == 'member' || github.event.comment.author_association == 'owner') && - startsWith(github.event.comment.body, '@shipjs prepare') runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -26,26 +19,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} - - create_done_comment: - if: success() - needs: manual_prepare - runs-on: ubuntu-latest - steps: - - uses: actions/github@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: comment "@${{ github.actor }} `shipjs prepare` done" - - create_fail_comment: - if: cancelled() || failure() - needs: manual_prepare - runs-on: ubuntu-latest - steps: - - uses: actions/github@v1.0.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: comment "@${{ github.actor }} `shipjs prepare` fail" - diff --git a/.github/workflows/shipjs-schedule-prepare.yml b/.github/workflows/shipjs-schedule-prepare.yml deleted file mode 100644 index bdc902b..0000000 --- a/.github/workflows/shipjs-schedule-prepare.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Ship js Schedule Prepare -on: - schedule: - # * is a special character in YAML so you have to quote this string - - cron: "0 8 * * 3" -jobs: - schedule_prepare: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: master - - uses: actions/setup-node@v2 - with: - node-version: '16' - - run: npm ci - - run: | - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" - - run: npm run release:prepare -- --yes --no-browse - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} diff --git a/.github/workflows/shipjs-trigger.yml b/.github/workflows/shipjs-trigger.yml index 297b9a7..8729f21 100644 --- a/.github/workflows/shipjs-trigger.yml +++ b/.github/workflows/shipjs-trigger.yml @@ -1,21 +1,22 @@ - name: Ship js trigger on: - push: - branches: - - master + pull_request: + types: + - closed jobs: build: name: Release runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v') steps: - uses: actions/checkout@v2 with: + fetch-depth: 0 ref: master - uses: actions/setup-node@v2 with: - node-version: '16' registry-url: "https://registry.npmjs.org" + node-version: '16' - run: npm ci - run: npm test - run: npm run release:trigger diff --git a/README.md b/README.md index 50d9216..e8bc84e 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,9 @@ You can refer to our [integration guide][react-guide] for more details. By default, npm and other package managers import the full (all locales) CommonJS or ESM bundle. To reduce your bundle size, you can also import one of the following: -* The english-only bundle (saves ~27% in bundle size) as `@uploadcare/react-widget/en` -* The minified all-locales bundle (saves ~44% in bundle size) as `@uploadcare/react-widget/min` -* The minified english-only bundle (saves ~60% in bundle size) as `@uploadcare/react-widget/en-min/` +* The english-only bundle (saves ~27% in bundle size) as `@uploadcare/react-widget/en/index.js` +* The minified all-locales bundle (saves ~44% in bundle size) as `@uploadcare/react-widget/min/index.js` +* The minified english-only bundle (saves ~60% in bundle size) as `@uploadcare/react-widget/en-min/index.js` ## Configuration diff --git a/package.json b/package.json index 7c45bcd..490e20d 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "@uploadcare/react-widget", "version": "2.1.2", "description": "React component for Uploadcare Widget", + "type": "module", "main": "dist/cjs/index.js", "module": "dist/esm/index.js", "types": "types/index.d.ts",