Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
grunt-template-coffee
Advanced tools
Grunt-init scaffolding template for CoffeeScript applications with support for CoffeeLint, Mocha & Should.js, and Codo via Grunt tasks
If you are new to using templates with Grunt, take a look at Grunt-Init.
This template uses Grunt-Init to transform a template into an actual project and CoffeeLint to lint the CoffeeScript files - you must have it installed and globally available, including one CoffeeLint plugin which provides additional linting check:
[sudo] npm install -g coffeelint coffeelint-newline-at-eof
This package is available in the NPM Registry, so you can install it via npm
:
npm install grunt-template-coffee
Once installed, you may wish to move the template to your $HOME directory to make the template available from anywhere:
mv ./node_modules/grunt-template-coffee ~/.grunt-init/node-coffee
Note that while installation by cloning this repository is also possible, NPM contains a pre-compiled version of the template, so you don't have to grunt build
it yourself.
Once the template is installed in your $HOME, all you have to do is create a folder with the name of the project you are about to start and run the grunt-init
command:
mkdir My-Awesome-Project # Create a clean folder for your new project
grunt-init node-coffee
# ... answering questions, Grunt doing its magic...
npm install # Install development dependencies
The node-coffee is the actual name of this template. You can customise its name by renaming the folder where you installed it ( in the ~/.grunt-init folder ).
If you find yourself overriding the automatically-detected default answers each time you bootstrap a new project, you may wish to create a defaults.json file to provide your own defaults. Read more on official Grunt-Init's webpage.
The following tasks are at your disposal in the template:
lint
- Lint your CoffeeScript files using CoffeeLinttest
- Test your CoffeeScript using Mocha and Should.jsbuild
- Lint your code, test it, compile your CoffeeScript files and move everything into place, ready for publishing to NPMdocs
- Generate API documentation from your source code using CodoApplications written in CoffeeScript are awesome, but CS should never be used in production - compilation on-the-fly takes precious CPU cycles away while your app might have been doing something much more useful. It also makes more sense to compile ahead of time as it gives you precise control over the way it is going to be compiled, thus preventing possible future issues when new versions of CoffeeScript are released ( such as when the Coffee-Script-Redux project is eventually merged into the main CS project ).
In addition to providing a means to compile CoffeeScript ahead of time, this template provides several project structure concepts that should keep your folder and file structure clean as much as possible.
Let's discuss how the project is organised.
$ My-Awesome-Project --> root folder of your project
.
├── src/ --> CoffeeScript source files
├── res/ --> Static content - images, text files etc.
├── test/ --> Your test cases
├── lib/ --> The application's staging ground for publishing
│
├── gruntfile.coffee --> Grunt tasks configuration
├── index.coffee --> Your application's entry point
├── package.json --> NPM's package description
├── coffeelint.json --> CoffeeLint's linting rules
├── .travis.yml --> (optional) Travis configuration
├── .gitignore
├── README.md --> Your README file
└── LICENSE --> The license text being used
Your CoffeeScript files should be stored here. You may organise your project inside this folder however you wish; your folder structure will be preserved once you build your app.
Static content like images, text files, or any other non-CoffeeScript files should be placed here. All these files will be simply copied over to the staging area upon build.
Write your test suites here. Mocha is used as testing framework, while Should.js provides the assertions for your tests.
This is the application's staging area - once you run grunt build
, it will:
When finished, you will have a fully working, deployment-ready application in your lib/ folder, ready for publishing to NPM. Just give it a try - create a test project, install dependencies and run grunt build
, then take a look inside the lib/ folder to see what happened.
Once you have everything sorted out and your application built successfully, go to your lib/ folder and publish your application to NPM via: npm publish
. And, you are done!
The template also installs some sample content to show you how to write and organise the code so you get better understanding about your possibilities.
I am not quite happy with the whole package release workflow as it stands now ( bump version, commit to develop, merge develop to master, tag the commit, push to GitHub, push to NPM ) so I will be looking into providing a simple, configurable task to do all this heavy lifting, possibly also generating documentation and pushing it to gh-pages.
Generating the API documentation is optional: grunt docs
will generate the html content in lib/docs/ folder.
This software is licensed under the BSD-3-Clause License. See the LICENSE file for more information.
FAQs
Grunt-init scaffolding template for CoffeeScript applications
The npm package grunt-template-coffee receives a total of 0 weekly downloads. As such, grunt-template-coffee popularity was classified as not popular.
We found that grunt-template-coffee demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.