Skip to content

Commit

Permalink
Fix Windows EMFile (#3)
Browse files Browse the repository at this point in the history
Fixes Windows EMFile issue by updating @filebase/sdk to v1.0.4
Fixes Windows Installer .bat
Removes uninstaller in favor of OS support
  • Loading branch information
jtsmedley committed Mar 18, 2024
1 parent fa7f213 commit d2ad44b
Show file tree
Hide file tree
Showing 6 changed files with 1,224 additions and 943 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,11 @@ jobs:
name: filebase_windows_x64
path: |
install.bat
install.ps1
filebase.exe
README.md
LICENSE
- name: Compress Archive
run: Compress-Archive -Path ".\filebase.exe", ".\README.md", ".\LICENSE", ".\install.bat", ".\install.ps1" filebase_windows_x64.zip
run: Compress-Archive -Path ".\filebase.exe", ".\README.md", ".\LICENSE", ".\install.bat" filebase_windows_x64.zip
if: startsWith(github.ref, 'refs/tags/')
- name: Upload Release Artifact
uses: softprops/action-gh-release@v1
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@filebase/cli",
"version": "0.0.1",
"version": "0.0.2",
"description": "CLI for Interacting with Filebase Services [S3(Buckets, Objects), IPFS(Gateways, Pins) IPNS(Names)]",
"repository": {
"type": "git",
Expand All @@ -12,7 +12,6 @@
"dist"
],
"bin": {
"@filebase/cli": "dist/index.js",
"filebase": "dist/index.js"
},
"engines": {
Expand All @@ -34,7 +33,7 @@
"distributed"
],
"dependencies": {
"@filebase/sdk": "1.0.3",
"@filebase/sdk": "1.0.4",
"@inquirer/select": "2.0.0",
"commander": "11.1.0",
"inquirer": "9.2.14",
Expand Down
8 changes: 4 additions & 4 deletions scripts/install.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
setlocal

:: Define the application executable name and its current location
set "appName=filebase.exe"
set "currentAppPath=%appName%"
set "appName=filebase"
set "currentAppPath=%appName%.exe"

:: Define the target installation directory in Program Files
set "installPath=%ProgramFiles%\filebase"
set "installPath=%ProgramFiles%\%appName%"

:: Create the target directory if it doesn't exist
if not exist "%installPath%" mkdir "%installPath%"

:: Copy the application executable to the target directory
copy "%currentAppPath%" "%installPath%"
copy "%currentAppPath%" "%installPath%" /y

:: Add the application's directory to the system PATH environment variable
:: This allows the application to be run from anywhere in the terminal
Expand Down
5 changes: 1 addition & 4 deletions src/index.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/env node
// threading setup
import os from "node:os";
const CPU_COUNT = os.cpus().length;
const CPU_COUNT = os.cpus().length > 4 ? os.cpus().length : 4;
process.env.UV_THREADPOOL_SIZE = String(CPU_COUNT);
// node imports
import { constants as fsConstants } from "node:fs";
Expand All @@ -20,7 +20,6 @@ import NameModule from "./modules/name.mjs";
import ObjectModule from "./modules/object.mjs";
import PinModule from "./modules/pin.mjs";
import VersionModule from "./modules/version.mjs";
import UninstallModule from "./modules/uninstall.mjs";

(async () => {
const program = new Command(),
Expand Down Expand Up @@ -91,7 +90,6 @@ import UninstallModule from "./modules/uninstall.mjs";
name: ["create", "import", "delete", "list", "toggle", "update", "help"],
object: ["upload", "get", "download", "delete", "list", "copy", "help"],
pin: ["create", "replace", "download", "get", "delete", "list", "help"],
uninstall: [],
version: [],
});
completion.init();
Expand All @@ -112,7 +110,6 @@ import UninstallModule from "./modules/uninstall.mjs";
new AuthModule(program, credentials);
new BucketModule(program, credentials);
new GatewayModule(program, credentials);
new UninstallModule(program, credentials);
new NameModule(program, credentials);
new ObjectModule(program, credentials, stdin);
new PinModule(program, credentials);
Expand Down
10 changes: 6 additions & 4 deletions src/modules/object.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createReadStream } from "node:fs";
import { stat, writeFile } from "node:fs/promises";
import { createReadStream, statSync } from "node:fs";
import { writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import { ObjectManager } from "@filebase/sdk";
import inquirer from "inquirer";
Expand Down Expand Up @@ -45,15 +45,17 @@ export default class ObjectModule {
throw new Error(`Source must be defined if not piping in a file`);
}
const resolvedSource = resolve(source);
const pathStats = await stat(resolvedSource);
const pathStats = statSync(resolvedSource);
if (pathStats.isFile()) {
objectToUpload = createReadStream(resolvedSource);
} else {
const { files } = await rfs.read(resolvedSource);
objectToUpload = files.map((file) => {
const pathStats = statSync(file);
return {
path: file.replace(resolvedSource, ""),
content: createReadStream(file),
type: "import",
content: pathStats.isFile() ? file : null,
};
});
}
Expand Down
Loading

0 comments on commit d2ad44b

Please sign in to comment.