diff --git a/README.md b/README.md index a69ae71..9880a8c 100644 --- a/README.md +++ b/README.md @@ -80,7 +80,7 @@ fluentci # Run the pipeline fluentci --help Usage: fluentci [pipeline] [jobs...] -Version: 0.12.8 +Version: 0.12.9 Description: diff --git a/deno.lock b/deno.lock index 458c84b..3280309 100644 --- a/deno.lock +++ b/deno.lock @@ -2,23 +2,12 @@ "version": "3", "packages": { "specifiers": { - "jsr:@std/io": "jsr:@std/io@0.217.0", - "npm:@types/node": "npm:@types/node@18.16.19", "npm:buffer": "npm:buffer@6.0.3", "npm:dayjs": "npm:dayjs@1.11.10", "npm:toml@3.0.0": "npm:toml@3.0.0", - "npm:typescript": "npm:typescript@5.3.3" - }, - "jsr": { - "@std/io@0.217.0": { - "integrity": "08d3dd7c10956d1433be95306ec15179cdebe49a0ce5a74238fabf140bb74382" - } + "npm:typescript": "npm:typescript@5.4.5" }, "npm": { - "@types/node@18.16.19": { - "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", - "dependencies": {} - }, "base64-js@1.5.1": { "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "dependencies": {} @@ -42,8 +31,8 @@ "integrity": "sha512-y/mWCZinnvxjTKYhJ+pYxwD0mRLVvOtdS2Awbgxln6iEnt4rk0yBxeSBHkGJcPucRiG0e55mwWp+g/05rsrd6w==", "dependencies": {} }, - "typescript@5.3.3": { - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "typescript@5.4.5": { + "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", "dependencies": {} } } @@ -283,6 +272,7 @@ "https://deno.land/std@0.221.0/bytes/concat.ts": "9cac3b4376afbef98ff03588eb3cf948e0d1eb6c27cfe81a7651ab6dd3adc54a", "https://deno.land/std@0.221.0/io/_constants.ts": "3c7ad4695832e6e4a32e35f218c70376b62bc78621ef069a4a0a3d55739f8856", "https://deno.land/std@0.221.0/io/read_all.ts": "876c1cb20adea15349c72afc86cecd3573335845ae778967aefb5e55fe5a8a4a", + "https://deno.land/std@0.221.0/io/types.ts": "acecb3074c730b5ff487ba4fe9ce51e67bd982aa07c95e5f5679b7b2f24ad129", "https://deno.land/std@0.52.0/fmt/colors.ts": "ec9d653672a9a3c7b6eafe53c5bc797364a2db2dcf766ab649c1155fea7a80b2", "https://deno.land/std@0.99.0/_util/assert.ts": "2f868145a042a11d5ad0a3c748dcf580add8a0dbc0e876eaa0026303a5488f58", "https://deno.land/std@0.99.0/_util/os.ts": "e282950a0eaa96760c0cf11e7463e66babd15ec9157d4c9ed49cc0925686f6a7", @@ -482,13 +472,14 @@ "https://deno.land/x/zod@v3.22.2/locales/en.ts": "a7a25cd23563ccb5e0eed214d9b31846305ddbcdb9c5c8f508b108943366ab4c", "https://deno.land/x/zod@v3.22.2/mod.ts": "64e55237cb4410e17d968cd08975566059f27638ebb0b86048031b987ba251c4", "https://deno.land/x/zod@v3.22.2/types.ts": "18cbe3d895f42977c43fa9411da214b06d0d682cf2f4c9dd26cc8c3737740d40", - "https://esm.sh/@dagger.io/dagger@0.9.3": "9bd1df6375031727868e2a7aa24e7517d1eba916b49529a412f9a214a0d58992", + "https://esm.sh/@dagger.io/dagger@0.9.3": "f954af5e24f31e7052eaa1198ca3cd33d234c10e3844d29ec111f9c4b8b949eb", "https://esm.sh/v128/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", "https://esm.sh/v128/graphql-request@6.1.0": "17f00c323eb825811ce14e2b0e88a0c873acb666c382ac963d1edeb03e01f372", "https://esm.sh/v128/graphql-request@6.1.0/denonext/graphql-request.mjs": "0b15f49d44489423ae6f06004725b6d050b6359da4969e6569bd6ad45065bd94", "https://esm.sh/v128/graphql@16.7.1/denonext/graphql.mjs": "418ad7c07b0f2d687f33b6275d3b5f317f4afbef1f462f318229f458dff45416", "https://esm.sh/v135/@dagger.io/dagger@0.9.3/denonext/dagger.mjs": "998e8e63729621141c0a9b74128db8f81ab7446d1a5d4ff41a6a6b0944db4ddf", "https://esm.sh/v135/adm-zip@0.5.10/denonext/adm-zip.mjs": "9441de5c60a276046d55945f45775d674a319e8e5fd3a8ab7131d8d192d9abb3", + "https://esm.sh/v135/adm-zip@0.5.12/denonext/adm-zip.mjs": "ee50b99aa1a4945229e9ca3e54d6ca17c3ab50a1de6f401eb16fee02d46be244", "https://esm.sh/v135/chownr@2.0.0/denonext/chownr.mjs": "d7282b2612a9f13c62084c76fc72cdfb20503bccce959178b77b6def14d3ffd2", "https://esm.sh/v135/cross-fetch@3.1.8/denonext/cross-fetch.mjs": "8fba9e7c3fbaf0d2168beb63ce0cd21b5bfbfbd77e2fcbf8d957d533a71222f6", "https://esm.sh/v135/cross-spawn@7.0.3/denonext/cross-spawn.mjs": "4d5a257de3627fb09c512b23fed30f1b393e29a2c13f8325e89720b8ca6673c1", @@ -520,6 +511,7 @@ "https://esm.sh/v135/signal-exit@4.1.0/denonext/signal-exit.mjs": "c450b9024df3b59ded71e7b52aada1ac4b3856aad93e9d64bbc6ea3cdd181824", "https://esm.sh/v135/strip-final-newline@3.0.0/denonext/strip-final-newline.mjs": "139c0958b1fb9387d8ae5b95941682245a3f3d9ae531f5de9638c2e9109831e0", "https://esm.sh/v135/tar@6.2.0/denonext/tar.mjs": "e13b56d41286f4935cb29acae60a040148af6e2649326a70e04c5ca6fe5ef04d", + "https://esm.sh/v135/tar@6.2.1/denonext/tar.mjs": "d0026ba9f9ab1ba2b89493af4717ee3b099c8cf06c7d5c16d7174c66647dd88b", "https://esm.sh/v135/tslib@2.6.2/denonext/tslib.mjs": "29782bcd3139f77ec063dc5a9385c0fff4a8d0a23b6765c73d9edeb169a04bf1", "https://esm.sh/v135/which@2.0.2/denonext/which.mjs": "360f7d0aa13233975c86f120e2b1aa9695252b16e287ccdc651d3123473a3482", "https://esm.sh/v135/yallist@4.0.0/denonext/yallist.mjs": "61f180d807dda50bac17028eda05d5722a3fecef6e98a9064e2353ea6864fd82" diff --git a/flake.nix b/flake.nix index 73ca898..1ec955b 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ packages.default = pkgs.deno2nix.mkExecutable { pname = "fluentci"; - version = "0.12.6"; + version = "0.12.9"; src = ./.; lockfile = "./deno.lock"; diff --git a/src/cmd/publish.ts b/src/cmd/publish.ts index 6a3c550..2d08de5 100644 --- a/src/cmd/publish.ts +++ b/src/cmd/publish.ts @@ -1,5 +1,6 @@ import { readAllSync, toml } from "../../deps.ts"; import { walk, ZipWriter, BlobWriter, brightGreen, wait } from "../../deps.ts"; +import { currentPluginDirExists } from "../utils.ts"; import { isLogged, getAccessToken, setupRust } from "../utils.ts"; import { validatePackage, validateConfigFiles } from "../validate.ts"; import "https://deno.land/x/xhr@0.1.0/mod.ts"; @@ -32,7 +33,7 @@ const publish = async ( }); } - if (paths.length === 0) { + if (paths.length === 0 && !options.wasm) { console.error("No files found in the current directory"); Deno.exit(1); } @@ -46,7 +47,7 @@ const publish = async ( Deno.exit(1); } - if (!validatePackage(paths.map((x) => x.path))) { + if (!validatePackage(paths.map((x) => x.path)) && !options.wasm) { console.error( `A valid FluentCI package must contain ${brightGreen( "mod.ts" @@ -55,7 +56,9 @@ const publish = async ( Deno.exit(1); } - validateConfigFiles(); + if (!options.wasm) { + validateConfigFiles(); + } if (options.wasm) { await publishWasm(); @@ -125,6 +128,11 @@ const parseIgnoredFiles = () => { }; const publishWasm = async () => { + let pluginDir = "."; + if (await currentPluginDirExists()) { + pluginDir = "plugin"; + } + await setupRust(); const wasm32 = new Deno.Command("rustup", { @@ -138,12 +146,12 @@ const publishWasm = async () => { args: ["-c", "cargo build --target wasm32-unknown-unknown --release"], stderr: "inherit", stdout: "inherit", - cwd: "plugin", + cwd: pluginDir, }); await spawnCommand(build); const cargoToml = toml.parse( - Deno.readTextFileSync("plugin/Cargo.toml") + Deno.readTextFileSync(`${pluginDir}/Cargo.toml`) // deno-lint-ignore no-explicit-any ) as Record; @@ -152,7 +160,7 @@ const publishWasm = async () => { const ls = new Deno.Command("bash", { args: [ "-c", - `ls plugin/target/wasm32-unknown-unknown/release/${cargoToml.package.name.replaceAll( + `ls ${pluginDir}/target/wasm32-unknown-unknown/release/${cargoToml.package.name.replaceAll( "-", "_" )}.wasm`, diff --git a/src/consts.ts b/src/consts.ts index 027643c..dd452dc 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -1,6 +1,6 @@ import { dir } from "../deps.ts"; -export const VERSION = "0.12.8"; +export const VERSION = "0.12.9"; export const BASE_URL = "https://api.fluentci.io/v1"; diff --git a/src/utils.ts b/src/utils.ts index 01cf122..d63d648 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -85,6 +85,16 @@ export async function fluentciDirExists(): Promise { } } +export async function currentPluginDirExists(): Promise { + try { + const fluentciDir = await Deno.stat("plugin"); + await Deno.stat("plugin/Cargo.toml"); + return fluentciDir.isDirectory; + } catch (_) { + return false; + } +} + export async function verifyRequiredDependencies( dependencies = ["deno", "dagger", "docker"] ) {