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

scrimp

v0.0.6

Published

Scrimp is a portable SCRIpt teMPlating tool that integrates with your existing npm project. It allows you to create scripts based on templates installed within making it easy for anyone to work with and extend your code while minimizing the need to instal

Downloads

9

Readme

#Scrimp

Scrimp is a portable SCRIpt teMPlating tool that integrates with your existing npm project. It allows you to create scripts based on templates installed within making it easy for anyone to work with and extend your code while minimizing the need to install global tools.

##Installation

There are two methods of installing scrimp. Both result in having installed a local npm script, "npm run scrimp", that will run without further global dependencies.

###Global to Local

Install scrimp globally.

npm install --g scrimp

After installing scrimp globally, the 'initialize-scrimp' command will be available. Simply run it in your project's directory, and it will install scrimp locally as well as add the local script to package.json.

initialize-scrimp

This will automatically install scrimp locally and add the appropriate script to the project's package.json file.

###Direct

Install scrimp locally within your project.

npm install --save scrimp

Add a script referencing scrimp locally to the "scripts" section of you're project's package.json file.


...
  "scripts":{
      "scrimp":"./node_modules/scrimp/bin/scrimp"
  }
...

Initialize scrimp manually.

npm run scrimp init

##Usage Once installed, invoke scrimp as an npm script.

npm run scrimp <command> -- [options]

###Commands Once installed, invoke scrimp as an npm script.

###init

npm run scrimp init

###add-repo Add a repository

npm run scrimp add-repo <repo name> <github url>

####Example

npm run scrimp add-repo main https://github.com/johnhenry/scrimp

Note: the main repo is added by default.

###list List repositories and

npm run scrimp list [repository name]

####Example

npm run scrimp list

or

npm run scrimp list main

Note: Installed templates are marked with a " * ";

###install Install a template from an added repository

npm run scrimp install <template name>

####Example

npm run scrimp install main/js-edge

or

npm run scrimp install js-edge

Note: If you omit the leading repository name, it will default to "main";

###template Create an npm script from an installed template.

npm run scrimp template <new script name> <template name> -- [options]

####Example

npm run scrimp template js <template name> -- [options]

###add-script Create an npm script manually.

npm run scrimp add-script <new script name> <new script content>

####Example

npm run scrimp add-script css 'cat ./style/index.css ./style/responsive.css > ./dist/style.css'

###remove-script Remove a previously created script.

npm run scrimp remove-script <new script name> <script content>

####Example

npm run scrimp remove-script build

##Extending

###Repository Creating a repository is easy. Simply create a github repository with a package.json file in it. Ensure that the file has a "scrimp" property who's value is a dictionary. This dictionary maps template names to the github urls.

{
  ...
  "scrimp":{
    "<template name>":"<github url>",
    "<template name>":"<github url>"
  }
  ...
}

I'm working on better versioning in the future.

###Templates Creating a template is easy. Simply create a github repository with an index.js file and a package.json file in it.

####index.js

The index.js file is a normal node module that exports a function. The function must return a either string or a Promise fulfilled with a string. This string that will be the body of the script

#####Example

module.exports = ()=>{
  return String(require('hat')());
}

####package.json Be sure to include any dependencies that index.js depends upon as devDependencies.

#####Example

{
  ...
  "devDependencies":{
    "hat":"0.0.3",
    "<template name>":"<github url>"
  }
  ...
}

I should find a way to versions these things better.