This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

crosis4furrets
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

Crosis4Furrets

An abstraction layer on top of @replit/crosis that makes Repl connection management and operations so easy, a Furret could do it! 🎉

Install

# with NPM
$ npm install crosis4furrets

# with Yarn
$ yarn add crosis4furrets

Usage

Main API

import { Crosis } from "crosis4furrets";

const client = new Crosis({ token: '', replId: '' });

which returns a <Client>

Options

  • token: A user's connect.sid cookie from Replit.
  • replId: An ID connected to any public Repl (or a user's private Repls).
  • ignore?: Optionally override a Repl's .gitignore file with your own. Used when created a recursed directory.

Client

A <Client> opens up many operations that you can perform on a Repl. Note, several of these operations will be limited on Repls that you do not own:

Connection

  • <Client>.connect(): Connect a client the specified Repl.
  • <Client>.persist(): Persist file changes in a Repl from this connection.
  • <Client>.close(): Close a client connection.

Config

  • <Client>.dotEnv(): Provide the parsed contents of the secrets in a Repl.
  • <Client>.updateDotEnv(env): Update the secrets in a Repl.
  • <Client>.dotReplit(): Provide the parsed contents of the .replit file.
  • <Client>.updateDotReplit(ops): Update the .replit file.
  • <Client>.gitignore(): Provide the text content of the .gitignore file.

File Operations

  • <Client>.read(path[, encoding]): Read a file at a specific path. Specify an encoding to parse the file, otherwise returns a Buffer.
  • <Client>.readdir(path): List files in a specific directory.
  • <Client>.recursedir(path[, withIgnore = true]): Recurse through files in a specific directory. Automatically reads .gitignore files and skips those files.
  • <Client>.write(path, content): Write content to a file. Can be Buffer or string content.
  • <Client>.mkdir(path): Make a directory at a specific path.
  • <Client>.remove(path): Remove a file at a specific path.
  • <Client>.removeAll(): Remove all files in the Repl.
  • <Client>.move(oldPath, newPath): Move a file to a specific location.
  • <Client>.snapshot(): Capture a filesystem snapshot of the Repl.

Language Server

  • <Client>.lspMessage(message): If the Repl is legacy and has an LSP, send a message to it.
  • <Client>.lspStart(language): If the Repl is legacy and has an LSP, start a language's LSP.

Packager (via UPM)

  • <Client>.packageInstall(): Install the Repl's packages.
  • <Client>.packageAdd(packages): Add packages to the Repl.
  • <Client>.packageRemove(): Remove packages from the Repl.
  • <Client>.packageList(): List the Repl's packages.
  • <Client>.packageSearch(): Search for packages via UPM.
  • <Client>.packageInfo(): Pull package information via UPM.

Nix Packager

  • <Client>.nixPackageAdd(packages): Add Nix packages to the Repl.
  • <Client>.nixPackageRemove(): Remove Nix packages from the Repl.
  • <Client>.nixPackageList(): List the Repl's Nix packages.
  • <Client>.nixPackageSearch(): Search for Nix packages on the Nix channel.
  • <Client>.nixChannels(): Pull available Nix channels.
  • <Client>.nixChannelLatest(): Pull the latest Nix channel.

Runner (via ShellRun)

  • <Client>.shellRun([, timeout]): Run the current Repl's main command.
  • <Client>.shellExec(command[, args, timeout]): Run a command (with optional arguments) on the Repl's shell.
  • <Client>.shellStop([, timeout]): Stop the Repl's current process.

Example

// using ESM, if in CommonJS use an async context!
import { Crosis } from "crosis4furrets";

const client = new Crosis({
  token: process.env.REPLIT_TOKEN, // connect.sid
  replId: "68fff490-4ce3-4123-b429-c11622fb8dd3" // id of a repl
});

await client.connect();
console.log("Read:\n", await client.read("index.js", "utf-8"));

Note: If you want an easy way to get ReplID's, visit this Repl.

Contributing

This project is in active development and we would love some fabulous contributions! To get started, visit our Contributing documentation.

Licensing

This project is licensed under the MIT License. For more information, see LICENSE.

Package Sidebar

Install

npm i crosis4furrets

Weekly Downloads

36

Version

1.2.2

License

MIT

Unpacked Size

86.1 kB

Total Files

8

Last publish

Collaborators

  • rayhanadev