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

sagat

v0.1.2

Published

Tiger Uppercut your build process!

Downloads

5

Readme

Sagat

Configure your build process in 1 minute and start coding!

Idea

All developers spend at least 30min - 1h in the build configuration of a new project. sagat is here to speed up this configuration, with some keys on your package.json file you can start coding in no time.

sagat uses Webpack under the hood.

Instalation

Optionally install it globally on your machine, it'll make things even easier.

npm install sagat {-g}

Configuration

To have your build process ready to go, you just need to add 2 properties to your package.json file:

// package.json
...
"sagat": {
  "entry": "src/index.js",
  "output": {
    "path": "bundle",
    "filename": "bundle.js"
  }
}
...

These configuration are mandatory for sagat to work.

With this simple config you'll be able to use a full common.js enviroment on your project. Also you can require css files on your js files (thanks Webpack!).

Custom Configuration

As we all know, ES6/7 is a thing, and CSS pre/post processors are the stuff!

You can easily add any babel presets or custom modules for your js/css builds.

Babel Presets

To add custom babel presets just add a .babelrc config file to the root of your project, and add your custom presets on it:

{
  "presets": ["es2015", "react"]
}

After that you'll have to install these preset`s locally on your project:

npm i babel-preset-es2015 babel-preset-react --save-dev

Now you're good to go!

Loaders

You can configure any loader on your project using the configuration inside package.json,

CSS webpack loaders

For using CSS loaders, you should configure something like this:

// package.json
...
"sagat": {
  ...
  "loaders": {
    "style": {
      "test": "sass",
      "loaders": ["sass"]
    }
  }
}
...

Then install the required modules for SASS to work with webpack:

npm i sass-loader node-sass --save-dev

The tests property is used to change the default extension test in webpack configuration.

Now it'll test for .sass files instead of .css.

JS webpack loaders

Similar to CSS loaders, you can configure it on the package.json as well, just change the key style to javascript and use any loader you want.

Using

Sagat has a list of commands you can use:

sagat -w --watch: starts the build in watch mode

sagat -b --build: build your project once

sagat -h --help: list all available commands

Docs

entry (string): the path for your entry point file.

ex: "entry": "src/index.js"

output (hash): configuration for your output file.

ex:

"output": {
  "path": "bundle",
  "filename": "bundle.js"
}

loaders (array): An array of loaders configuration.

ex:

"loaders": {
  "style": {
    "test": "sass",
    "loaders": ["sass"]
  },
  "javascript": {
    "test": "jsx?"
  }
}

Final Thoughts

With all this configuration you'll be able to do something like this:

// src/index.js

import React from 'react';
import 'index.sass';

class Root extends React.Component {
  render() {
    return (
      <div>teste</div>
    );
  }
}

This is not (yet) a production ready builder, but it's handy when you want to work on personal projects.

TODO

  • [ ] add a test build process
  • [ ] add a linting build process
  • [ ] add a production build process
  • [ ] support multiple entries and outputs
  • [ ] support direct css entry (multiple as well)
  • [ ] custom module directories

License

MIT