npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

siroc

v0.16.0

Published

Zero-config build tooling for Node

Downloads

6,427

Readme

siroc

🌬️ siroc

npm version Github Actions alerts grade

siroc is a zero-config but extensible framework for developing Node applications and libraries

Features

  • 💯 Zero-config required: Intelligent support for your package
    • Supports running and compiling TypeScript and the latest JavaScript syntax
  • ⚒️ Extensible: Write your own commands and build hooks
  • 💪 Typescript: Fully typed and self-documenting

siroc is still a work in progress. Feedback is welcome, and changes will be frequent.

Quick start

Just install siroc.

# You can install siroc as a development dependency
yarn add siroc --dev

# ... or install globally
yarn global add siroc

Configuration

You can configure siroc by creating a siroc.config.ts, siroc.config.js or siroc.config.json file at the same level as your package.json.

In a monorepo, any configuration options at the root level are inherited by your workspaces, though of course you can override them.

import { defineSirocConfig } from 'siroc'

export default defineSirocConfig({
  // fully typed options
})

Commands

siroc build

siroc knows what to build based on your package.json.

By default, siroc will build your src/index.js or src/index.ts file into whatever output file is specified in your package.json's main field.

If you have specified additional binaries, siroc will look for input files matching their names.

Under the hood, siroc uses rollup and esbuild to build and produce type definitions for your files.

Monorepos

If you have enabled yarn workspaces, siroc will build each of your workspaces. You can choose to build only some of these by specifying what to build.

yarn siroc build @mypackage/cli

Watch mode

You can build in watch mode, which will rebuild as necessary when source files change:

yarn siroc build --watch

Configuration

At the most basic level, your entrypoints are configured in your package.json:

  • bin (see npm docs)
  • main, module and browser (see npm docs)
  • types if you want a TS declaration file to be generated for your main/module/browser entrypoints
  • exports (see npm docs)

There are some conventions in place of configuration that are worth noting:

  • the file type is inferred from the file name if possible (e.g. babel.es.js will be in 'es' format)
  • main defaults to CJS, module to ES, browser to UMD, and bin to CJS
  • if you have a folder mapped using subpath patterns and it matches a folder within your src folder, the files within will be copied across and lightly transpiled using mkdist.
Example
{
  "exports": {
    ".": {
      // This will be compiled in CJS and matched to src/index.ts
      "require": "./dist/index.js",
      // This will be compiled in ES and matched to src/index.ts
      "import": "./dist/index.es.js"
    },
    // src/templates will be lightly transpiled with mkdist and copied to dist/templates
    "./templates/*": "./dist/templates/*",
    // siroc will not touch this
    "./package.json": "./package.json"
  },
  // This will be compiled in CJS and matched to src/index.ts
  "main": "./dist/index.js",
  // This will be compiled in ES and matched to src/index.ts
  "module": "./dist/index.es.js",
  // Types will be generated for src/index.ts
  "types": "./dist/index.d.ts",
  "bin": {
    // This will be compiled in CJS and matched to src/cli/index.ts
    "siroc": "bin/cli.js",
    // This will be compiled in CJS and matched to src/cli/runtime.ts
    "siroc-runner": "bin/runtime.js"
  }
}

Build hooks

siroc makes available three hooks for customising your build, if you need it.

  1. build:extend
  2. build:extendRollup
  3. build:done

siroc dev

If you're working in a monorepo, it can be helpful to have accurate and up-to-date intellisense when importing from other libraries in a monorepo, without having to rebuild every time you make changes.

Running siroc dev will replace your package entrypoints with stubs that point to your source files. Your binaries will run your source files directly using jiti.

siroc run

You can run arbitrary shell commands or node scripts using the power of the jiti runtime.

For example:

# You can run a node script written in TypeScript
yarn siroc run myfile.ts

# You can run a command in all your workspaces
yarn siroc run ls --workspaces

Contributors

Contributions are very welcome.

  1. Clone this repo

    git clone https://github.com/unjs/siroc
  2. Install dependencies and build project

    yarn
    
    # Stub modules for rapid development
    yarn siroc dev
    
    # Test (on changes)
    yarn siroc jest

Tip: You can also run yarn link within a package directory to test the module locally with another project.

License

MIT License - Made with 💖