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 instal
Last updated 4 years ago by johnhenry .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install scrimp 
SYNC missed versions from official npm registry.

#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.

Current Tags

  • 0.0.6                                ...           latest (4 years ago)

7 Versions

  • 0.0.6                                ...           4 years ago
  • 0.0.5                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
  • 0.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 4
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |