Skip to content

Commit

Permalink
Merge pull request #88 from shimataro/develop
Browse files Browse the repository at this point in the history
version 1.0.0
  • Loading branch information
shimataro committed Dec 23, 2022
2 parents 49b52c9 + 0e11913 commit 1749c68
Show file tree
Hide file tree
Showing 40 changed files with 16,927 additions and 37,851 deletions.
35 changes: 35 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: Build
description: Composite action (build)

inputs:
node-version:
description: Node.js version for build
required: false
default: "18"
registry-url:
description: Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
required: false
default: ""

runs:
using: composite
steps:
- name: Install Node.js (build)
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
- name: Output versions
run: |
node -v
npm -v
shell: bash

# Build
- name: Install dependencies
run: npm ci
shell: bash
- name: Build
run: npm run build
shell: bash
52 changes: 52 additions & 0 deletions .github/actions/example/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
name: Run example
description: Composite action (run example)

inputs:
node-version-build:
description: Node.js version (build)
required: false
default: "6.9.0" # minimum version Babel CLI works
node-version-run:
description: Node.js version (run)
required: true
directory-example:
description: Directory of example
required: true

runs:
using: composite
steps:
# Build
- name: Install Node.js (build example)
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version-build }}
- name: Output versions
run: |
node -v
npm -v
shell: bash
- name: Install dependencies (example)
run: yarn
working-directory: ./examples/${{ inputs.directory-example }}
shell: bash
- name: Build example
run: npm run build
working-directory: ./examples/${{ inputs.directory-example }}
shell: bash

# Run
- name: Install Node.js (run example)
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version-run }}
- name: Output versions
run: |
node -v
npm -v
shell: bash
- name: Run example
run: node ./dist/index.js
working-directory: ./examples/${{ inputs.directory-example }}
shell: bash
74 changes: 74 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# https://help.github.com/en/articles/workflow-syntax-for-github-actions

on: push
name: Examples
jobs:
examples-cjs:
name: Build and run examples (CommonJS)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- macos-latest
- ubuntu-latest
nodejs:
- "4.0.0" # target version
example:
- "babel-cjs"
- "ts-babel-cjs"
- "ts-tsc-cjs"
exclude:
- os: windows-latest # not work "babel --extensions '.ts'" on Windows?
example: "ts-babel-cjs"
fail-fast: false
steps:
- name: Checkout source codes
uses: actions/checkout@v3

- name: Build plugin
uses: ./.github/actions/build
- name: Prune modules for build
run: npm ci --only=production
shell: bash

- name: Run example
uses: ./.github/actions/example
with:
node-version-run: ${{ matrix.nodejs }}
directory-example: ${{ matrix.example }}

examples-esm:
name: Build and run examples (ES Modules)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- macos-latest
- ubuntu-latest
nodejs:
- "12.17.0" # minimum version {"type": "module"} supports in package.json
example:
- "babel-esm"
- "ts-babel-esm"
- "ts-tsc-esm"
exclude:
- os: windows-latest # not work "babel --extensions '.ts'" on Windows?
example: "ts-babel-esm"
fail-fast: false
steps:
- name: Checkout source codes
uses: actions/checkout@v3

- name: Build plugin
uses: ./.github/actions/build
- name: Prune modules for build
run: npm ci --only=production
shell: bash

- name: Run example
uses: ./.github/actions/example
with:
node-version-run: ${{ matrix.nodejs }}
directory-example: ${{ matrix.example }}
17 changes: 5 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source codes
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
uses: actions/checkout@v3

- name: Build
uses: ./.github/actions/build
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Output versions
run: |
node -v
npm -v
- name: Install dependencies
run: npm ci
- name: Build package
run: npm run build

- name: Publish package
run: npm publish
env:
Expand Down
114 changes: 0 additions & 114 deletions .github/workflows/verify-examples.yml

This file was deleted.

16 changes: 5 additions & 11 deletions .github/workflows/verify-on-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source codes
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Output versions
run: |
node -v
npm -v
- name: Install dependencies
run: npm ci || npm i
uses: actions/checkout@v3

- name: Build
uses: ./.github/actions/build

- name: Verify
run: npm run verify
16 changes: 5 additions & 11 deletions .github/workflows/verify-on-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout source codes
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Output versions
run: |
node -v
npm -v
- name: Install dependencies
run: npm ci || npm i
uses: actions/checkout@v3

- name: Build
uses: ./.github/actions/build

- name: Verify
run: npm run verify
20 changes: 5 additions & 15 deletions .github/workflows/verify-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,10 @@ jobs:
- name: Turn off auto-crlf
run: git config --global core.autocrlf false
- name: Checkout source codes
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Output versions
run: |
node -v
npm -v
- name: Install dependencies
run: |
npm ci
if (!$?) {
npm i
}
uses: actions/checkout@v3

- name: Build
uses: ./.github/actions/build

- name: Verify
run: npm run verify
10 changes: 4 additions & 6 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# dotfiles
.*

# files for build
/examples/
/scripts/
/src/
.github/
node_modules/
.babelrc
.editorconfig
.eslintrc.yml
.markdownlint.yml
tsconfig.json

# temporary files
Expand All @@ -25,5 +24,4 @@ Thumbs.db
*.rej

# IDE files
/.vscode/
*.code-workspace
Loading

0 comments on commit 1749c68

Please sign in to comment.