Skip to content

Commit

Permalink
refactor: upgrade to dprint-core 0.50 and use standardized plugin.was…
Browse files Browse the repository at this point in the history
…m file
  • Loading branch information
dsherret committed Jan 30, 2022
1 parent a9d65a1 commit c05e0c9
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 30 deletions.
25 changes: 3 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ jobs:
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
run: |
# update config schema to have version
sed -i 's/dockerfile-0.0.0.json/dockerfile-${{ steps.get_tag_version.outputs.TAG_VERSION }}.json/' deployment/schema.json
sed -i 's/dockerfile\/0.0.0/dockerfile\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/' deployment/schema.json
# rename the wasm file
(cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_dockerfile.wasm dockerfile.wasm)
(cd target/wasm32-unknown-unknown/release/ && mv dprint_plugin_dockerfile.wasm plugin.wasm)
- name: Release
uses: softprops/action-gh-release@v1
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/wasm32-unknown-unknown/release/dockerfile.wasm
target/wasm32-unknown-unknown/release/plugin.wasm
deployment/schema.json
body: |
## Install
Expand Down Expand Up @@ -130,22 +130,3 @@ jobs:
* [JS Formatter](https://github.com/dprint/js-formatter) - Browser/Deno and Node
* [npm package](https://www.npmjs.com/package/@dprint/dockerfile)
draft: false

# PLUGIN PUBLISH
- name: Checkout plugins repo
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
uses: actions/checkout@v2
with:
repository: dprint/plugins
token: ${{ secrets.CI_REPO_PAT }} # github.token is scoped to current repo, so use this to push to other repo
path: dprint-plugins
- name: Plugin publish
if: matrix.config.kind == 'test_release' && startsWith(github.ref, 'refs/tags/')
run: |
cd dprint-plugins
node scripts/replace-plugin.js dprint-plugin-dockerfile ${{ steps.get_tag_version.outputs.TAG_VERSION }} dockerfile-${{ steps.get_tag_version.outputs.TAG_VERSION }}
git add .
git config user.name "David Sherret"
git config user.email "dsherret@users.noreply.github.com"
git commit -m "dprint-plugin-dockerfile ${{ steps.get_tag_version.outputs.TAG_VERSION }}"
git push origin main
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ tracing = ["dprint-core/tracing"]
[dependencies]
anyhow = "1.0.51"
dockerfile-parser = "0.8.0-alpha.1"
dprint-core = { version = "0.49.0", features = ["formatting"] }
dprint-core = { version = "0.50.0", features = ["formatting"] }
serde = { version = "1.0.88", features = ["derive"] }
serde_json = { version = "1.0", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 David Sherret
Copyright (c) 2021-2022 David Sherret

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion deployment/schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://plugins.dprint.dev/schemas/dockerfile-0.0.0.json",
"$id": "https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/0.0.0/schema.json",
"type": "object",
"definitions": {
"newLineKind": {
Expand Down
8 changes: 4 additions & 4 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"**/target"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.59.0.wasm",
"https://plugins.dprint.dev/json-0.13.1.wasm",
"https://plugins.dprint.dev/markdown-0.11.1.wasm",
"https://plugins.dprint.dev/toml-0.5.2.wasm",
"https://plugins.dprint.dev/typescript-0.62.1.wasm",
"https://plugins.dprint.dev/json-0.14.0.wasm",
"https://plugins.dprint.dev/markdown-0.12.1.wasm",
"https://plugins.dprint.dev/toml-0.5.3.wasm",
"https://plugins.dprint.dev/rustfmt-0.4.0.exe-plugin@c6bb223ef6e5e87580177f6461a0ab0554ac9ea6b54f78ea7ae8bf63b14f5bc2"
]
}
3 changes: 2 additions & 1 deletion src/wasm_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ impl PluginHandler<Configuration> for DockerfilePluginHandler {
file_extensions: vec!["dockerfile".to_string()],
file_names: vec!["Dockerfile".to_string()],
help_url: "https://dprint.dev/plugins/dockerfile".to_string(),
config_schema_url: format!("https://plugins.dprint.dev/schemas/dockerfile-{}.json", version),
config_schema_url: format!("https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/{}/schema.json", version),
update_url: Some("https://plugins.dprint.dev/dprint/dprint-plugin-dockerfile/latest.json".to_string()),
}
}

Expand Down

0 comments on commit c05e0c9

Please sign in to comment.