|
1 | 1 | name: CI |
2 | | -# taken from main dprint plugins |
3 | | -# without npm for now |
4 | 2 |
|
5 | 3 | on: [push, pull_request] |
6 | 4 |
|
|
50 | 48 | id: get_tag_version |
51 | 49 | run: echo ::set-output name=TAG_VERSION::"${GITHUB_REF/refs\/tags\//}" |
52 | 50 |
|
| 51 | + # NPM |
| 52 | + - uses: actions/setup-node@v2 |
| 53 | + if: matrix.config.kind == 'test_release' |
| 54 | + with: |
| 55 | + node-version: '14.x' |
| 56 | + registry-url: 'https://registry.npmjs.org' |
| 57 | + |
| 58 | + - name: Setup and test npm deployment |
| 59 | + if: matrix.config.kind == 'test_release' |
| 60 | + run: | |
| 61 | + npm install |
| 62 | + node setup.js ${{ steps.get_tag_version.outputs.TAG_VERSION }} |
| 63 | + npm run test |
| 64 | + working-directory: ./deployment/npm |
| 65 | + |
| 66 | + - name: npm publish |
| 67 | + if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') |
| 68 | + env: |
| 69 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 70 | + run: | |
| 71 | + npm publish --access public |
| 72 | + git reset --hard |
| 73 | + working-directory: ./deployment/npm |
| 74 | + |
53 | 75 | # CARGO PUBLISH |
54 | 76 | - name: Cargo login |
55 | 77 | if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') |
|
64 | 86 | if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/') |
65 | 87 | run: | |
66 | 88 | # update config schema to have version |
67 | | - sed -i 's/0.0.0/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json |
| 89 | + sed -i 's/css\/0.0.0/css\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json |
68 | 90 | # rename the wasm file |
69 | 91 | (cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_css.wasm plugin.wasm) |
70 | 92 | - name: Release |
|
76 | 98 | files: | |
77 | 99 | target/wasm32-unknown-unknown/release/plugin.wasm |
78 | 100 | deployment/schema.json |
79 | | - body: "" |
| 101 | + body: | |
| 102 | + ## Install |
| 103 | +
|
| 104 | + [Install](https://dprint.dev/install/) and [setup](https://dprint.dev/setup/) dprint. |
| 105 | +
|
| 106 | + Then in your project's dprint configuration file: |
| 107 | +
|
| 108 | + 1. Specify the plugin url in the `"plugins"` array. |
| 109 | + 2. Ensure `.css` file extensions are matched in an `"includes"` pattern. |
| 110 | + 3. Add a `"css"` configuration property if desired. |
| 111 | + ```jsonc |
| 112 | + { |
| 113 | + // ...etc... |
| 114 | + "css": { |
| 115 | + // css config goes here |
| 116 | + }, |
| 117 | + "includes": [ |
| 118 | + "**/*.{css}" |
| 119 | + ], |
| 120 | + "plugins": [ |
| 121 | + "https://github.com/disrupted/dprint-plugin-css/raw/${{ steps.get_tag_version.outputs.TAG_VERSION }}/deployment/npm/plugin.wasm" |
| 122 | + ] |
| 123 | + } |
| 124 | + ``` |
| 125 | +
|
| 126 | + ## JS Formatting API |
| 127 | +
|
| 128 | + * [JS Formatter](https://github.com/dprint/js-formatter) - Browser/Deno and Node |
| 129 | + * [npm package](https://www.npmjs.com/package/dprint-plugin-css) |
80 | 130 | draft: false |
0 commit comments