Skip to content

fix: remove trailing comma for single type param in default export (#… #1044

fix: remove trailing comma for single type param in default export (#…

fix: remove trailing comma for single type param in default export (#… #1044

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
jobs:
build:
name: ${{ matrix.config.kind }} ${{ matrix.config.os }}
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- os: ubuntu-latest
kind: test_release
- os: ubuntu-latest
kind: test_debug
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v2
- uses: dsherret/rust-toolchain-file@v1
- name: Install wasm32 target
if: matrix.config.kind == 'test_release'
run: rustup target add wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Build debug
if: matrix.config.kind == 'test_debug'
run: cargo build
- name: Lint
if: matrix.config.kind == 'test_debug'
run: cargo clippy
- name: Test debug
if: matrix.config.kind == 'test_debug'
run: cargo test
- name: Build release
if: matrix.config.kind == 'test_release'
run: cargo build --target wasm32-unknown-unknown --features "wasm" --release
- name: Test release
if: matrix.config.kind == 'test_release'
run: cargo test --release
- name: Wasm integration test - Setup
if: matrix.config.kind == 'test_release'
run: |
echo '{ "plugins": ["./target/wasm32-unknown-unknown/release/dprint_plugin_typescript.wasm"] }' >> dprint.test.json
- name: Wasm integration test - Run
if: matrix.config.kind == 'test_release'
uses: dprint/check@v2.2
with:
config-path: dprint.test.json
- name: Wasm integration test - Cleanup
if: matrix.config.kind == 'test_release'
run: rm dprint.test.json
- name: Get tag version
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
id: get_tag_version
run: echo ::set-output name=TAG_VERSION::${GITHUB_REF/refs\/tags\//}
# NPM
- uses: actions/setup-node@v2
if: matrix.config.kind == 'test_release'
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- name: Setup and test npm deployment
if: matrix.config.kind == 'test_release'
run: |
cd deployment/npm
npm install
node setup.js ${{ steps.get_tag_version.outputs.TAG_VERSION }}
npm run test
- name: npm publish
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'dprint/dprint-plugin-typescript'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
cd deployment/npm
npm publish --access public
git reset --hard
# CARGO PUBLISH
- name: Cargo login
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'dprint/dprint-plugin-typescript'
run: cargo login ${{ secrets.CRATES_TOKEN }}
- name: Cargo publish
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') && github.repository == 'dprint/dprint-plugin-typescript'
run: cargo publish
# GITHUB RELEASE
- name: Pre-release
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
run: |
# update config schema to have version
sed -i 's/typescript\/0.0.0/typescript\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json
# rename the wasm file
(cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_typescript.wasm plugin.wasm)
- name: Release
uses: softprops/action-gh-release@59c3b4891632ff9a897f99a91d7bc557467a3a22
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/wasm32-unknown-unknown/release/plugin.wasm
deployment/schema.json
body: |
## Install
[Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint.
Then in your project's dprint configuration file:
1. Specify the plugin url in the `"plugins"` array.
2. Add a `"typescript"` configuration property if desired.
```jsonc
{
// ...etc...
"typescript": {
// TypeScript & JavaScript config goes here
},
"excludes": [
"**/node_modules"
],
"plugins": [
"https://plugins.dprint.dev/typescript-${{ steps.get_tag_version.outputs.TAG_VERSION }}.wasm"
]
}
```
## JS Formatting API
* [JS Formatter](https://github.com/dprint/js-formatter) - Browser/Deno and Node
* [npm package](https://www.npmjs.com/package/@dprint/typescript)
draft: false