From c05e0c9939c070e406784a1ed1f621ddc07092fa Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sun, 30 Jan 2022 15:11:31 -0500 Subject: [PATCH] refactor: upgrade to dprint-core 0.50 and use standardized plugin.wasm file --- .github/workflows/ci.yml | 25 +++---------------------- Cargo.toml | 2 +- LICENSE | 2 +- deployment/schema.json | 2 +- dprint.json | 8 ++++---- src/wasm_plugin.rs | 3 ++- 6 files changed, 12 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 042e14d..521e565 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,9 +88,9 @@ 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/') @@ -98,7 +98,7 @@ jobs: 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 @@ -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 diff --git a/Cargo.toml b/Cargo.toml index 230a58c..cc8f39c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } diff --git a/LICENSE b/LICENSE index 4d08264..c40f5a1 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/deployment/schema.json b/deployment/schema.json index 751502c..c24fce7 100644 --- a/deployment/schema.json +++ b/deployment/schema.json @@ -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": { diff --git a/dprint.json b/dprint.json index 93085cd..654450b 100644 --- a/dprint.json +++ b/dprint.json @@ -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" ] } diff --git a/src/wasm_plugin.rs b/src/wasm_plugin.rs index 439c176..be2bb7f 100644 --- a/src/wasm_plugin.rs +++ b/src/wasm_plugin.rs @@ -28,7 +28,8 @@ impl PluginHandler 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()), } }