💻
Cheatsheets
  • Most Useful Command Line Tools: 50 Cool Tools to Improve Your Workflow, Boost Productivity, and More
  • 7_tips_to_reverse_engineer_javascript
  • Configuring a Repl
  • How to create your command-line program (CLI) with NodeJS and Commander.js | by Duc N. | JavaScript
  • replit Node.JS 24/7 Project Hoster
  • cheatsheets
  • Alacritty, Tmux, and Vim
  • amethyst
  • Android
  • Installing Arch Linux
  • Arch Linux
  • aria2
  • bin
  • bspwm
  • Chocolately Notes
  • command_line_pipes
  • CSS Grid
  • curl
  • The curl guide to HTTP requests
  • Docker
  • Easymotion
  • Emmet
  • Favorite figlet fonts
  • FFMPEG
  • figlet
  • File Serve
  • File Transfer
  • fish shell
  • Front End Dev Links
  • How to use Git.io to shorten GitHub URLs and create vanity URLs
  • Git
  • Downloading a Tarball from GitHub
  • Make Infinite Gmail Addresses For One Inbox
  • How To Use GPG on the Command Line
  • guide_to_fish_completions
  • Homebrew
  • How to clean Arch Linux
  • HTML5 Boilerplate
  • Install
  • All the keyboard shortcuts you’ll ever need for Safari on iPad
  • iosevka
  • iPhone
  • ish (iOS)
  • Javascript Notes
  • jq
  • Jupyter Notebooks
  • Lettering
  • lf-wiki
  • lf
  • Command Line
  • Adding a swapfile after a clean installation without swap partition
  • mac_bluetooth_issues
  • Mac Terminal
  • maim
  • markdown-sample
  • Markdown Notes
  • Images in README.md Markdown Files
  • Organizing information with tables
  • md_cheatsheet
  • NiftyWindows Help
  • nix
  • Justin Restivo - A Portable Text Editor: Nix <3 Neovim
  • NPM
  • neovim configuration
  • Pastery
  • Powershell
  • Table of Basic PowerShell Commands | Scripting Blog
  • Powershell Modules
  • Puppeteer
  • Python
  • rclone-colab
  • replit
  • Hi there, I'm Raju Ghorai - a.k.a. [coderj001]
  • Scriptable
  • Servor
  • Replacing Postlight’s Mercury scraping service with your self-hosted copy
  • Shell Scripts
  • skhd
  • Spicetify
  • SSH
  • SurfingKeys
  • tar
  • Terminal Web Browser Docker
  • Text Generators
  • tmux shortcuts & cheatsheet
  • unicode
  • VIM
  • VIM Diff
  • vi Complete Key Binding List
  • 8 Essential Vim Editor Navigation Fundamentals
  • Vim Shortcut Keys
  • Vite
  • VNC
  • web-servers
  • Web Server
  • Windows Command Line
  • Writeguard
  • WSL Cheatsheet
  • youtube-dl
  • zsh Plugins
  • zspotify
Powered by GitBook
On this page
  • Configuring a Repl
  • Configuring a Cloned Repl
  • Other Configuration
  • Example .replit File
  • HTML
  • Node.js .replit

Was this helpful?

Configuring a Repl

Previous7_tips_to_reverse_engineer_javascriptNextHow to create your command-line program (CLI) with NodeJS and Commander.js | by Duc N. | JavaScript

Last updated 3 years ago

Was this helpful?

Configuring a Repl

A file named .replit can be added to any repl in order to customize the behavior of the repl. Used in combination with for installed linux packages, the sky is the limit! Written in , a .replit file looks something like:

# The command that is executed when the run button is clicked.
run = ["cargo", "run"]

# The default file opened in the editor.
entrypoint = "src/main.rs"

# Packager configuration for the Universal Package Manager
# See https://github.com/replit/upm for supported languages.
[packager]
language = "rust"

  [packager.features]
  # Enables the package search sidebar
  packageSearch = true
  # Enabled package guessing
  guessImports = false

# Per language configuration: language.<lang name> 
[languages.rust]
# The glob pattern to match files for this programming language
pattern = "**/*.rs"

    # LSP configuration for code intelligence
    [languages.rust.languageServer]
    start = ["rust-analyzer"]

Here's a short video on how to use the .replit file or read the text explanation below.

Here is an example of a repl using .replit to print "hello world" instead of running the code:

Configuring a Cloned Repl

When you clone a repository without a .replit file, we automatically show the visual .replit editor:

This will automatically create the .replit file and make it possible to customize how the repl will run. You can use the shell to run any command and then set the "Run" button once you've decided what it should do. Clicking "done" will finalize the repl's configuration and close the visual editor. It's always possible to make changes later by visiting the .replit file from the filetree. Adding .replit to a repository makes cloning fast with no configuration necessary.

Other Configuration

The .replit file can also provide other configuration hints. The full specification is provided below:

  • run: Command - Command that is executed when the run button is clicked

  • language: Reserved

  • onBoot: Command - Command that is executed once when the repl first starts up

  • packager: Package management configuration.

    • afterInstall: Command - Command that is executed after a new package is installed

    • features: UPM features that are supported by the specified languages.

      • packageSearch: Boolean - If enabled, a package search panel will be available in the sidebar.

      • guessImports: Boolean - If enabled, UPM will attempt to guess which packages need to be installed prior to running the repl.

  • languages.<language name>: Per-language configuration. The language name has no special meaning other than to allow multiple languages to be configured at once.

      • start: Command - The command used to start the LSP server

Command

A command can either be a string or a list of strings. If the command is a string ("node index.js"), it will be executed via sh -c "<command>". If the command is a list of strings (["node", "index.js"]), it will be directly executed with the list of strings passed as arguments. When possible, it is preferred to pass a list of strings.

Example .replit File

run="python main.py"
language="python3"
onBoot="echo Booting up!"

[packager]
afterInstall="date >> package_install_log"
ignoredPaths=[".git"]
ignoredPackages=["twitter", "discord"]

HTML

For HTML projects, you can keep the run command empty and we will serve the project for you automatically. As per web standards, the entrypoint file is index.html. If you want to serve a different file, you can roll your own webserver in one of the languages that we support.

Node.js .replit

entrypoint = "index.js"

[interpreter]
command = [
    "prybar-nodejs",
    "-q",
    "--ps1",
    "\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ",
    "-i"
]

[nix]
channel = "stable-21_11"

[env]
XDG_CONFIG_HOME = "/home/runner/.config"

[packager]
language = "nodejs"

  [packager.features]
  packageSearch = true
  guessImports = true
  enabledForHosting = false

[unitTest]
language = "nodejs"

[languages.javascript]
pattern = "**/{*.js,*.jsx,*.ts,*.tsx}"

  [languages.javascript.languageServer]
  start = [ "typescript-language-server", "--stdio" ]

[debugger]
support = true

  [debugger.interactive]
  transport = "localhost:0"
  startCommand = [ "dap-node" ]

    [debugger.interactive.initializeMessage]
    command = "initialize"
    type = "request"

      [debugger.interactive.initializeMessage.arguments]
      clientID = "replit"
      clientName = "replit.com"
      columnsStartAt1 = true
      linesStartAt1 = true
      locale = "en-us"
      pathFormat = "path"
      supportsInvalidatedEvent = true
      supportsProgressReporting = true
      supportsRunInTerminalRequest = true
      supportsVariablePaging = true
      supportsVariableType = true

    [debugger.interactive.launchMessage]
    command = "launch"
    type = "request"
    
      [debugger.interactive.launchMessage.arguments]  
      args = []
      console = "externalTerminal"
      cwd = "."
      environment = []
      pauseForSourceMap = false
      program = "./index.js"
      request = "launch"
      sourceMaps = true
      stopOnEntry = false
      type = "pwa-node"

In the snippet above, run is a string which will be executed in the shell whenever you hit the "Run" button. The language helps the IDE understand how to provide features like and . This is normally configured for you when you clone from a Git repository.

visual config editor

audio: Boolean - Whether is enabled for this repl.

ignoredPaths: List of Strings - List of paths to ignore while attempting to guess packages ()

ignoredPackages: List of strings - List of modules to never attempt to guess a package for, when installing packages ()

language: String - Specified the language to use for package operations. See available languages in the repository.

pattern: String - A used to identify which files belong to this language configuration. (Example: **/*.js)

languageServer: Configuration for setting up for this language. This allows for code intelligence (autocomplete, underlined errors, etc...)

We created an for you in NodeJS that serves foo.html instead of index.html. Otherwise it works like any other HTML project.

nix
toml
packaging
code intelligence
system-wide audio
More about installing packages
More about installing packages
Universal Package Manager
glob
LSP
example