-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Beta Release
- Loading branch information
Showing
23 changed files
with
5,553 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
name: Build CLI | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build-ubuntu-x64: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '21.x' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn run build | ||
- run: yarn run package | ||
- run: cp $(command -v node) filebase | ||
- run: npx postject filebase NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | ||
- name: Move Scripts | ||
run: cp scripts/* . | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: filebase_linux_x64 | ||
path: | | ||
install.sh | ||
install.zsh | ||
install.fish | ||
filebase | ||
README.md | ||
LICENSE | ||
- name: Compress Archive | ||
run: zip filebase_linux_x64.zip filebase README.md LICENSE install.sh install.zsh install.fish | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Upload Release Artifact | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: filebase_linux_x64.zip | ||
|
||
build-macos-x64: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '21.x' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn run build | ||
- run: yarn run package | ||
- run: cp $(command -v node) filebase | ||
- run: codesign --remove-signature filebase | ||
- run: npx postject filebase NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA | ||
- run: codesign --sign - filebase | ||
- name: Move Scripts | ||
run: cp scripts/* . | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: filebase_macos_x64 | ||
path: | | ||
install.sh | ||
install.zsh | ||
install.fish | ||
filebase | ||
README.md | ||
LICENSE | ||
- name: Compress Archive | ||
run: zip filebase_macos_x64.zip filebase README.md LICENSE install.sh install.zsh install.fish | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Upload Release Artifact | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: filebase_macos_x64.zip | ||
|
||
build-macos-arm64: | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '21.x' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn run build | ||
- run: yarn run package | ||
- run: cp $(command -v node) filebase | ||
- run: codesign --remove-signature filebase | ||
- run: npx postject filebase NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA | ||
- run: codesign --sign - filebase | ||
- name: Move Scripts | ||
run: cp scripts/* . | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: filebase_macos_arm64 | ||
path: | | ||
install.sh | ||
install.zsh | ||
install.fish | ||
filebase | ||
README.md | ||
LICENSE | ||
- name: Compress Archive | ||
run: zip filebase_macos_arm64.zip filebase README.md LICENSE install.sh install.zsh install.fish | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Upload Release Artifact | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: filebase_macos_arm64.zip | ||
|
||
build-windows-x64: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '21.x' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn run build | ||
- run: yarn run package | ||
- run: node -e "require('fs').copyFileSync(process.execPath, 'filebase.exe')" | ||
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 | ||
with: | ||
sdk-version: 22621 | ||
- run: '& "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86\signtool.exe" remove /s .\filebase.exe' | ||
- run: npx postject filebase.exe NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 | ||
- name: Move Scripts | ||
run: cp scripts/* . | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
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 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Upload Release Artifact | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: filebase_windows_x64.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Publish to NPM | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn run build | ||
- name: Publish package on NPM 📦 | ||
run: npm publish --access=public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Filebase, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,80 @@ | ||
# filebase-cli | ||
<h1 align="center">• Filebase CLI •</h1> | ||
<p align="center">Developer Friendly [ <a href="https://docs.ipfs.tech/concepts/what-is-ipfs/" title="What is IPFS?">IPFS</a> | <a href="https://docs.ipfs.tech/concepts/ipns/" title="What is IPNS?">IPNS</a> | S3 ]</p> | ||
|
||
## Beta | ||
|
||
This CLI is currently in Beta. If you find any issues please kindly file a report. | ||
Thank you for your patience while this project is developed! | ||
|
||
## About | ||
|
||
The Filebase CLI provides a hybrid data management solution, blending S3-compatible cloud storage with IPFS | ||
(InterPlanetary File System) pinning services. It features robust S3 bucket management, object handling for uploads and | ||
downloads, and seamless integration with IPFS and IPNS (InterPlanetary Naming System) for decentralized storage | ||
operations. The SDK supports advanced data tasks like compiling files into CAR (Content Addressable aRchive) formats and | ||
ensures secure transactions through strong authentication. Designed for varied applications, the Filebase CLI is ideal | ||
for scenarios demanding the dependability of cloud storage combined with the advantages of decentralized, peer-to-peer | ||
storage, catering to diverse needs such as content distribution, data backup, and archival. Developing InterPlanetary | ||
Applications has never been easier. | ||
|
||
### JS Client | ||
|
||
Install the package using npm or download a binary from the releases for your supported operating system. | ||
|
||
```shell | ||
npm install -g @filebase/cli | ||
``` | ||
|
||
or yarn: | ||
|
||
```shell | ||
yarn global add @filebase/cli | ||
``` | ||
|
||
### Getting started | ||
|
||
The snippet below shows how to create a new bucket, upload a new object to IPFS, publish the object to IPNS, | ||
delete the object and finally delete the bucket. | ||
|
||
To use the CLI in your project, use npm or yarn to install the [`@filebase/cli`](https://www.npmjs.com/package/@filebase/cli) module. Requires node.js 16+. | ||
You can also find pre-built binaries in the releases section. | ||
|
||
Using NPX | ||
```shell | ||
// Login | ||
npx @filebase/cli auth login [key] [secret] | ||
// Create Bucket | ||
npx @filebase/cli create bucket random-bucket-name | ||
// Set Default Bucket | ||
npx @filebase/cli auth bucket random-bucket-name | ||
// Upload Random File | ||
npx @filebase/cli object upload random-file ./random-file.txt | ||
// Download Random File | ||
npx @filebase/cli object download random-file | ||
// Create IPNS Name | ||
npx @filebase/cli name create myFirstIpnsKey QmQSQYNn2K6xTDLhfNcoTjBExz5Q5gpHHBTqZZKdxsPRB9 | ||
// Create IPFS Gateway | ||
npx @filebase/cli gateway create myFirstIpfsGateway | ||
// Create IPFS Pin | ||
npx @filebase/cli pin create my-pin QmTJkc7crTuPG7xRmCQSz1yioBpCW3juFBtJPXhQfdCqGF | ||
``` | ||
|
||
Using Binary | ||
```shell | ||
// Login | ||
filebase auth login [key] [secret] | ||
// Create Bucket | ||
filebase create bucket random-bucket-name | ||
// Set Default Bucket | ||
filebase auth bucket random-bucket-name | ||
// Upload Random File | ||
filebase object upload random-file ./random-file.txt | ||
// Download Random File | ||
filebase object download random-file | ||
// Create IPNS Name | ||
filebase name create myFirstIpnsKey QmQSQYNn2K6xTDLhfNcoTjBExz5Q5gpHHBTqZZKdxsPRB9 | ||
// Create IPFS Gateway | ||
filebase gateway create myFirstIpfsGateway | ||
// Create IPFS Pin | ||
filebase pin create my-pin QmTJkc7crTuPG7xRmCQSz1yioBpCW3juFBtJPXhQfdCqGF | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "@filebase/cli", | ||
"version": "0.0.1", | ||
"description": "CLI for Interacting with Filebase Services [S3(Buckets, Objects), IPFS(Gateways, Pins) IPNS(Names)]", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/filebase/filebase-cli.git" | ||
}, | ||
"license": "MIT", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"dist" | ||
], | ||
"bin": { | ||
"@filebase/cli": "dist/index.js", | ||
"filebase": "dist/index.js" | ||
}, | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=8.0.0" | ||
}, | ||
"scripts": { | ||
"build": "tsup src/index.mjs", | ||
"package": "node --experimental-sea-config sea-config.json" | ||
}, | ||
"keywords": [ | ||
"filebase", | ||
"filebase-cli", | ||
"s3", | ||
"ipfs", | ||
"ipns", | ||
"cli", | ||
"web3", | ||
"distributed" | ||
], | ||
"dependencies": { | ||
"@filebase/sdk": "1.0.3", | ||
"@inquirer/select": "2.0.0", | ||
"commander": "11.1.0", | ||
"inquirer": "9.2.14", | ||
"omelette": "0.4.17", | ||
"recursive-fs": "2.1.0", | ||
"tty-table": "4.2.3" | ||
}, | ||
"devDependencies": { | ||
"postject": "1.0.0-alpha.6", | ||
"prettier": "3.2.4", | ||
"tsup": "8.0.1", | ||
"typescript": "5.3.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
setlocal | ||
|
||
:: Define the application executable name and its current location | ||
set "appName=filebase.exe" | ||
set "currentAppPath=%appName%" | ||
|
||
:: Define the target installation directory in Program Files | ||
set "installPath=%ProgramFiles%\filebase" | ||
|
||
:: 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%" | ||
|
||
:: Add the application's directory to the system PATH environment variable | ||
:: This allows the application to be run from anywhere in the terminal | ||
setx PATH "%PATH%;%installPath%" /M | ||
|
||
echo Installation and configuration complete. You can now run %appName% from the terminal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env fish | ||
|
||
# Define the application executable name and its current location | ||
set appName "filebase" | ||
set currentAppPath "../$appName" | ||
|
||
# Function to check if a path is in the PATH environment variable | ||
function isInPath | ||
echo ":$PATH:" | grep -Fq ":$argv[1]:" | ||
end | ||
|
||
# Determine the installation path based on what's available in PATH | ||
if isInPath "/usr/local/bin" | ||
set installPath "/usr/local/bin" | ||
else if isInPath "/usr/bin" | ||
set installPath "/usr/bin" | ||
else if isInPath "/bin" | ||
set installPath "/bin" | ||
else | ||
echo "Error: None of the preferred installation paths are in your PATH." | ||
exit 1 | ||
end | ||
|
||
# Copy the application executable to the target directory | ||
sudo cp "$currentAppPath" "$installPath/$appName" | ||
|
||
# Make sure the executable has execution permissions | ||
sudo chmod +x "$installPath/$appName" | ||
|
||
# Setup Autocompletion | ||
echo 'filebase --completion-fish | source' >> ~/.config/fish/config.fish | ||
|
||
echo "Installation complete. You can now run $appName from the terminal." |
Oops, something went wrong.