From c2d1d8518072c18cdc3a97346a34b735c564a16a Mon Sep 17 00:00:00 2001 From: Brandon Kalinowski Date: Mon, 8 Dec 2025 14:42:44 -0500 Subject: [PATCH] chore: publish command & oxfmt init --- Makefile | 1 + inkjet.md | 92 +++++++++++++++++++++++++++++++++++++++- provider/resources.go | 4 ++ sdk/.oxfmtrc.json | 5 +++ sdk/nodejs/.oxfmtrc.json | 7 --- 5 files changed, 101 insertions(+), 8 deletions(-) create mode 100644 sdk/.oxfmtrc.json delete mode 100644 sdk/nodejs/.oxfmtrc.json diff --git a/Makefile b/Makefile index a6423c0..55101df 100644 --- a/Makefile +++ b/Makefile @@ -163,6 +163,7 @@ build_nodejs: .make/build_nodejs .make/build_nodejs: .make/generate_nodejs cd sdk/nodejs/ && \ pnpm install && \ + pnpm oxfmt && \ pnpm tsc && \ cp ../../README.md ../../LICENSE package.json pnpm-lock.yaml ./bin/ @touch $@ diff --git a/inkjet.md b/inkjet.md index d114277..b5ec816 100644 --- a/inkjet.md +++ b/inkjet.md @@ -10,4 +10,94 @@ sops exec-env secrets.sops.env 'earthly --secret TOKEN=$TOKEN --push -i +nodejs' ```bash sops exec-env secrets.sops.env 'earthly --secret TOKEN=$TOKEN --push -i +provider' -``` \ No newline at end of file +``` + +## publish (version) + +> publish the provider to gitea host. Include version number without v prefix + +```bash +#===================================================================== +# upload_tarballs +# +# Upload every *.tar.gz file that contains a given version string from +# ./bin/ to a Gitea generic‑package repository. +# +# Authentication is taken from the default ~/.netrc file (via --netrc). +# +# Call signature (simplified): +# upload_tarballs +# +# – username and package in the form "user/pkg" +# – version string to match (required) +# +# Host resolution: +# * If $GITEA_HOST is set, it is used. +# * Otherwise the built‑in default https://gitea.example.com is used. +# +# Example: +# export GITEA_HOST="https://gitea.example.com" +# upload_tarballs alice/my_pkg 2.5.0 +#===================================================================== + +upload_tarballs() { + # ----------------------------------------------------------------- + # 1️⃣ Argument handling and defaults + # ----------------------------------------------------------------- + local user_pkg="${1:?Missing argument}" + local version="${2:?Missing argument}" + + # Extract username & generic‑package from the "user/pkg" argument + if [[ "$user_pkg" != */* ]]; then + echo "ERROR: must be in the form 'username/package'" >&2 + return 1 + fi + local username="${user_pkg%%/*}" + local package="${user_pkg##*/}" + + # Sanity checks + [[ -n "$username" && -n "$package" ]] || { + echo "ERROR: Could not parse username or package from '$user_pkg'" >&2 + return 1 + } + + # ----------------------------------------------------------------- + # 2️⃣ Find matching tarballs and upload them + # ----------------------------------------------------------------- + local files_found=0 + + # The while‑loop runs in the current shell (process substitution) so + # the counter is visible after the loop finishes. + while IFS= read -r -d '' file; do + files_found=$((files_found + 1)) + + local filename + filename="$(basename "$file")" + + # Build the Gitea API URL: + # https://HOST/api/packages/USERNAME/generic/PACKAGE/VERSION/FILE + local url="https://git.kalinow.ski/api/packages/${username}/generic/${package}/${version}/${filename}" + echo "Uploading $url" + curl --silent --show-error --fail --netrc --upload-file "$file" "$url" + local rc=$? + + if (( rc != 0 )); then + echo "❌ Upload failed for $file (curl exit code $rc)" >&2 + else + echo "✅ Uploaded $filename" + fi + done < <(find ./bin -type f -name "*${version}*.tar.gz" -print0) + + # ----------------------------------------------------------------- + # 4️⃣ Final report + # ----------------------------------------------------------------- + if (( files_found == 0 )); then + echo "⚠️ No *.tar.gz files containing version '${version}' were found in ./bin/." + return 1 + else + echo "✅ Done – $files_found file(s) processed." + fi +} + +upload_tarballs kiterun/pulumi-incus $version +``` diff --git a/provider/resources.go b/provider/resources.go index 908103d..fa7a31e 100644 --- a/provider/resources.go +++ b/provider/resources.go @@ -167,6 +167,10 @@ func Provider() tfbridge.ProviderInfo { PackageName: "@kiterun/incus", TypeScriptVersion: "^5.8.3", UseTypeOnlyReferences: true, + DevDependencies: map[string]string{ + "@types/node": "^24.10.1", + "oxfmt": "^0.17.0", + }, }, Python: &tfbridge.PythonInfo{ // RespectSchemaVersion ensures the SDK is generated linking to the correct version of the provider. diff --git a/sdk/.oxfmtrc.json b/sdk/.oxfmtrc.json new file mode 100644 index 0000000..5f2b945 --- /dev/null +++ b/sdk/.oxfmtrc.json @@ -0,0 +1,5 @@ +{ + "printWidth": 100, + "useTabs": true, + "tabWidth": 4 +} diff --git a/sdk/nodejs/.oxfmtrc.json b/sdk/nodejs/.oxfmtrc.json deleted file mode 100644 index 67c6859..0000000 --- a/sdk/nodejs/.oxfmtrc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "./node_modules/oxfmt/configuration_schema.json", - // Use 80 if migrating from Prettier; 100 is the Oxfmt default! - "printWidth": 100, - "useTabs": true, - "tabWidth": 4 -}