All Projects → sinclairzx81 → hammer

sinclairzx81 / hammer

Licence: MIT license
Build Tool for Browser and Node Applications

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hammer

Klap
zero config, zero dependency bundler for tiny javascript packages
Stars: ✭ 143 (-36.73%)
Mutual labels:  bundle, watch
bundle
An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
Stars: ✭ 475 (+110.18%)
Mutual labels:  bundle, esbuild
AnimeDLR
AnimeDLR
Stars: ✭ 47 (-79.2%)
Mutual labels:  watch
BeelabTagBundle
🏷 A simple implementation of tags for Symfony and Doctrine ORM
Stars: ✭ 45 (-80.09%)
Mutual labels:  bundle
breadcrumb-bundle
Symfony bundle for easy breadcrumbs management
Stars: ✭ 26 (-88.5%)
Mutual labels:  bundle
IphpFileStoreBundle
Symfony 2 file upload for doctrine entities
Stars: ✭ 51 (-77.43%)
Mutual labels:  bundle
async
async is a tiny C++ header-only high-performance library for async calls handled by a thread-pool, which is built on top of an unbounded MPMC lock-free queue.
Stars: ✭ 25 (-88.94%)
Mutual labels:  tasks
rituals
🔧 📦 Project automation task library for ‘Invoke’ tasks that are needed again and again.
Stars: ✭ 30 (-86.73%)
Mutual labels:  tasks
cdk-esbuild
CDK constructs for esbuild, an extremely fast JavaScript bundler
Stars: ✭ 44 (-80.53%)
Mutual labels:  esbuild
LiipSoapRecorderBundle
[DEPRECATED] Recorder/Player for SOAP communications
Stars: ✭ 12 (-94.69%)
Mutual labels:  bundle
tailwind-layouts
Collection of Tailwind Layouts
Stars: ✭ 53 (-76.55%)
Mutual labels:  esbuild
DForumBundle
Forum Bundle for symfony 3
Stars: ✭ 28 (-87.61%)
Mutual labels:  bundle
ptScheduler
Pretty tiny Scheduler or ptScheduler is an Arduino library for writing non-blocking periodic tasks easily.
Stars: ✭ 14 (-93.81%)
Mutual labels:  tasks
eye drops
Configurable Elixir mix task to watch file changes and run the corresponding command.
Stars: ✭ 51 (-77.43%)
Mutual labels:  watch
docker-node-example
An example Node / Express app that's using Docker and Docker Compose.
Stars: ✭ 122 (-46.02%)
Mutual labels:  esbuild
redparty
Host Youtube watch party with friends. Sync videos and chat in real-time
Stars: ✭ 70 (-69.03%)
Mutual labels:  watch
gowatch
watch go files for developer, support run test case and auto reload server application
Stars: ✭ 18 (-92.04%)
Mutual labels:  watch
metana
Abstract task migration tool written in Go for Golang services. Database and non database migration management brought to the CLI.
Stars: ✭ 61 (-73.01%)
Mutual labels:  tasks
Parceler
简单的Bundle数据注入框架
Stars: ✭ 107 (-52.65%)
Mutual labels:  bundle
gow
Missing watch mode for Go commands. Watch Go files and execute a command like "go run" or "go test"
Stars: ✭ 343 (+51.77%)
Mutual labels:  watch

Hammer

Build Tool for Browser and Node Applications

npm version

Install

$ npm install @sinclair/hammer -g

Usage

Create an index.html file

<!DOCTYPE html>
<html>
  <head>
    <link href="index.css" rel="stylesheet" />
    <script src="index.tsx"></script>
  </head>
  <body>
    <img src="banner.png" />
  </body>
</html>

Run Hammer

$ hammer build index.html

Done

Overview

Hammer is a command line tool for browser and node application development. It provides a command line interface to trivially run both browser and node applications and offers appropriate watch and reload workflows for each environment. It is designed with rapid application development in mind and requires little to no configuration to use.

Hammer was written to consolidate several disparate tools related to monitoring node processes (nodemon), building from HTML (parcel), mono repository support (lerna, nx) and project automation (gulp, grunt). It takes esbuild as its only dependency and is as much concerned with build performance as it is with dramatically reducing the number of development dependencies required for modern web application development.

License MIT

Serve

Use the serve command to start a development server that reloads pages on save.

<!DOCTYPE html>
<html>
  <head>
    <script type="module" src="index.tsx"></script>
  </head>
  <body>
    <h1>Hello World</h1>
  </body>
</html>
$ hammer serve index.html

Run

Use the run command to start a node process that restarts on save.

$ hammer run index.ts

$ hammer run "index.ts arg1 arg2" # use quotes to pass arguments

$ hammer run index.mts            # node esm modules supported via .mts

Watch

Use the watch command to start a compiler watch process only.

$ hammer watch worker.ts

Monitor

Use the monitor command to execute shell commands on file change.

$ hammer monitor index.ts "deno run --allow-all index.ts"

Tasks

Hammer provides a built-in task runner for automating various workflow at the command line. Tasks are created with JavaScript functions specified in a file named hammer.mjs. Hammer will search for the hammer.mjs file in the current working directory and setup a callable command line interface to each exported function. Hammer provides a global shell(...) function that can be used to start command line processes within each task. Additional functionality can be imported via ESM import. The following shows running a Hammer website and server watch process in parallel.

//
// file: hammer.mjs
//
export async function start() {
    await Promise.all([
        shell(`hammer serve apps/website/index.html --dist dist/website`),
        shell(`hammer run apps/server/index.ts --dist dist/server`)
    ])
}
$ hammer task start

Libs

In mono repository projects, you can import shared libraries by using TypeScript tsconfig.json path aliasing.

/apps
  /server
    index.ts    ───────────┐
  /website                 │
    index.html             │
    index.ts    ───────────┤ depends on
/libs                      │
  /shared                  │
    index.ts    <──────────┘
tsconfig.json

To enable website and server to import the shared library. Configure tsconfig.json in the project root as follows.

{
    "compilerOptions": {
        "baseUrl": ".",
        "paths": {
            "@libs/shared": ["libs/shared/index.ts"],
        }
    }
}

Once configured the server and website applications can import with the following.

import { Foo } from '@libs/shared'

Cli

Hammer provides the following command line interface.

Commands:

   $ hammer run     <script path>     <...options>
   $ hammer build   <file or folder>  <...options>
   $ hammer watch   <file or folder>  <...options>
   $ hammer serve   <file or folder>  <...options>
   $ hammer monitor <file or folder>  <shell command>
   $ hammer task    <name>            <...arguments>
   $ hammer version
   $ hammer help

Options:

   --target      targets     The es build targets.
   --platform    platform    The target platform.
   --dist        directory   The target directory.
   --port        port        The port to listen on.
   --external    packages    Omits external packages.
   --esm                     Use esm module target.
   --minify                  Minifies the output.
   --sourcemap               Generate sourcemaps.
   --sabs                    (serve) Enable shared array buffer.
   --cors                    (serve) Enable cors.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].