Giter VIP home page Giter VIP logo

just's Introduction

Just GitHub tag (latest SemVer pre-release) NPM Version GitHub GitHub Actions Workflow Status

Zero config TypeScript build and development toolkit.

Features

  • Fast SWC compiler
  • TypeScript type check support
  • Live reload support
  • .env file support
  • Path alias support
  • Typescript script runner
  • REPL support

Install

# Locally in your project.
npm install -D @sonnyt/just

# Or globally
npm install -g @sonnyt/just

Usage

To start a dev server in the root of your project just (😉) run:

just dev

To build:

just build

Commands

Build

just build [options] [files]

Compiles the application for production deployment.

Arguments

  • files - glob file path to compile. If not present, includes from config.json is used.

Options

Option Default Description
--transpile-only off disables type checking
--out-dir <outDir> compilerOptions.outDir output folder for all emitted files
--no-color off disables output color
--debug false enables debug logging
-c, --config <config> default path to typescript configuration file

Dev

just dev [options] [entry]

Starts the application in development mode. Watches for any file changes and live reloads the server.

Arguments

  • entry - server entry path to start. If not present, main from package.json is used.

Options

Option Default Description
-p, --port <port> null server port used in process.env.PORT
--type-check false enables type checking
--no-color off disables output color
--debug false enables debug logging
-c, --config <config> default path to typescript configuration file

Run

just run [options] <command> [args...]

Runs .ts file scripts.

Arguments

  • <command> - script/command to run.
  • [args...] - arguments passed to the script/command.

Options

Option Default Description
--no-color off disables output color
--debug false enables debug logging
-c, --config <config> default path to typescript configuration file

Programmatic

You can require Just runner programmatically two ways:

Import Just as early as possible in your application code.

require('@sonnyt/just/register');

Or you can use the --require (-r) command line option to preload Just. By doing this, you do not need to require and load Just in your application code.

node -r @sonnyt/just/register myscript.ts

Please note that runner does not support type checking.

Default Config File

Just automatically finds and loads tsconfig.json or jsconfig.json. By default, this search is performed relative to the entrypoint script. If neither file is found nor the file is not provided as an argument. Just falls back to using default settings shown below.

{
  "compilerOptions": {
    "module": "CommonJS",
    "target": "ES2021",
    "moduleResolution": "Node",
    "inlineSourceMap": true,
    "strict": true,
    "baseUrl": "./",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "importHelpers": true,
    "outDir": "dist",
    "paths": {}
  },
  "include": [
    "./"
  ],
  "exclude": [
    "node_modules"
  ]
}

Environment Variables

When using the dev or run commands. Just automatically finds and loads environment variables from a .env file into process.env. By default, this search is performed relative to the entrypoint script.

Path Alias

Based on the paths configuration, Just replaces all alias paths with relative paths after typescript compilation.

FAQ

Does Just work with ES Modules?

Currently, Just only supports building ES Module files.

What's the REPL use case?

Just REPL enables you to execute TypeScript files on Node.js directly without precompiling. It serves as a replacement for ts-node.

Does Just compile alias paths?

Out of the box, Just supports build and runtime path aliases. All output file alias imports are replaced with relative paths.

What happens to my non-JavaScript/TypeScript files?

If your source directory includes non-compilable files (i.e., JSON, SVG, etc.), Just automatically copies them into your output directory.

How can I help?

If you would like to contribute, please see the issues labeled as help-wanted.

Roadmap

  • Build watch option #7
  • Init option - copy over the default config file to the working directory #5
  • TypeScript ESLint support #6
  • Prettier support
  • REPL ES module support
  • jsconfig.json support
  • .swcrc support

just's People

Contributors

sonnyt avatar thomas-crane avatar

Stargazers

 avatar Ray Thurn Void avatar Matt Turnbull avatar Rahul Kalkani avatar  avatar IrukNuj avatar  avatar Bart avatar Fred Souza avatar Justin Obney avatar Angius avatar  avatar Carl Furrow avatar Andrea avatar Teerapat Prommarak avatar Thomas Blommaert avatar Nick avatar Davide Vercelli avatar Masahiro Yokoyama avatar Rob avatar Señor Gus avatar tosh shimayama (satake) avatar Thomas Off avatar Duc-Thien Bui avatar Björn Schotte avatar Filipe Sarturi avatar youssef nabil avatar Timo Mämecke avatar  avatar Heru Gunawan avatar Eike Foken avatar Leonid Shirmanov avatar Gibran Putra avatar Mahmoud Alaskalany avatar Marco avatar 爱可可-爱生活 avatar Will Ceolin avatar  avatar  avatar Max Sommer avatar Mehrdad Shokri avatar linrium avatar  avatar Junheon Lee avatar L avatar  avatar Justin Sisley avatar Eduardo Rabelo avatar Miki Oracle avatar Arvid Gerstmann avatar Masanori Ogino avatar Sebastian Richter avatar Adam Snodgrass avatar Loki avatar Aodaruma avatar Shrujal Shah avatar kelsy gagnebin avatar Fran Messina avatar Sevket Ufuk Gün avatar Guido Curcio avatar Wess Cope avatar Olavo Amorim Santos avatar  avatar  avatar Arif Datoo avatar Zaher Ghaibeh avatar Andrey (Andrii) Los avatar Stefan Schonert avatar Glenn 'devalias' Grant avatar Fritz Blueford avatar Ian avatar Nikita avatar Andrejs Agejevs avatar Ozair Patel avatar Ayan Yenbekbay avatar Noel Towa avatar ぐるぐる avatar Sena SUZUKI avatar Snehesh avatar murajun1978 avatar Aziz Ahtas avatar Valerio De Carolis avatar yamaimo avatar TOMIKAWA Sotaro avatar Santi Bivacqua avatar Kartik Setia avatar Yusuke Wada avatar Joohun, Maeng avatar Sayan Mallick avatar  avatar Logan Speck avatar Yuji Yamaguchi avatar Gabriel Nunes avatar Isaac McEachin avatar Sean  avatar Arjun Nemani avatar Wilson Gichu avatar Neos21 avatar Steven Chim avatar Jaeyoung, Choi avatar

Watchers

Pavlos Vinieratos avatar  avatar  avatar  avatar

Forkers

thomas-crane

just's Issues

[Help Wanted] ESLint

Add support for ESLint using their API. Set up a basic config file similar to just.tsconfig.json and use it if config is not provided or not found in the working directory.

There should be an ability to skip/bypass this using a command option during run, dev, and build commands.

Exporting types

Hi,

Is it possible to export types?
Without this, just cannot be used to build TypeScript libraries.

[Help Wanted] Build --watch option

Add an optional --watch -w parameter for the build command. There is already a similar functionality used in the run command so it shouldn't be difficult to port it over.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.