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

appverse-generator-commons

v0.0.5

Published

Common methods for Appverse Generators

Downloads

12

Readme

Appverse HTML5

Dependency Status devDependency Status Inline docs

appverse-generator-commons

This is a Yeoman Base Generator for Appverse Generators

NPM

NPM

The appverse-generator-commons provides some helper methods to use with Appverse generators.

Usage

The Appverse Generator Commons extends the Yeoman Base generator adding some helpers methods.

Add dependency to your generator package.json

  npm install appverse-generator-commons

Extend your generator from the Appverse Generator Commons, then helper methods will be accessible within the this Yeoman context.

var appverse = require ('appverse-generator-commons');

 module.exports = appverse.extend({ //--> Inheritance
  initializing: function () {
     this.welcome (pkg);  //--> Appverse common helper method.
     this.checkVersion();  // --> Appverse common helper method.
  },
  prompting: function () {
  }
  });

Methods

welcome (pkg) - Outputs the welcome message with package information.

     this.welcome (require('../../package.json'));

The method will add the package information as a new object into the the this context. You can then use this.pkg to get the package.json as object.

checkVersion() - Notifies the user if there is a new published version of the generator.

info (msg) -- Outputs the message the info format (green).

  this.info ("here some information ... ");    

Output:

  [APPVERSE][INFO] :: here some information...

warning (msg) -- Outputs the message the warning format (yellow).

  this.warning ("here some warning information ... ");    

Output:

  [APPVERSE][WARNING] :: here some warning information...

error (msg) -- Outputs the message the error format (red).

  this.error ("error messages ... ");    

Output:

  [APPVERSE][ERROR] :: error messages ...

moveFiles(base,files) -- Move files to target path *base path - Base path where files are located *file list - Array with files path within the base bath

     var files = ['Gruntfile.js', 'bower.json'];
     //generators/app/templates/Gruntfile.js and generators/app/templates/bower.json
     this.moveFiles (this.templatePath(), files);

moveTemplates (base, templates) -- Fill and Move template list to target path. It uses this.templatePath() as base path.

     var templates = ['test/test1,js', 'test/test2.js'];
     //generators/app/templates/test/test1.js and generators/app/templates/test/test2.js
     this.moveTemplates (this.templatePath(), templates);

moveNamedTemplate(base, template,name,target) -- Move Named template. Templates files with $name variable and $target path variable.

     var template = '$target/$name.js';
     var name = 'test1';  
     var target = 'test';
     this.moveNamedTemplate(this.templatePath(),template, name, target);
     //will create /test/test1.js on at the destination folder.

moveNamedTemplates(base, templates, name, target) -- Move Named templates list.

     var templates= ['app/$target/$name-controller.js','app/$target/$name-module.js'];
     var name = 'myComponent';  
     var target = 'myComponent';
     this.moveNamedTemplates(this.templatePath(), template, name, target);
     //will create app/myComponent/myComponent-controller.js and app/myComponent/myComponent-model.js at the destination folder.

addPackage(packages, file, node) -- Add package to dependency manager (package.json or bower.json)

     var packages = [{name: "package", version: "0.0.1"}];
     this.addPackage(packages, "package.json", "devDependencies");

Result:

    ...
    "devDependencies": {
          "package": "0.0.1"
          ...
    }
    ...

addScriptsToPackage(scripts) -- Add scripts to target package.json

     var script = 'test: \'grunt test\'';
     this.addScriptsToPackage(script);

Result:

    ...
    "scripts": {
          "test": 'grunt test'
    }
    ...

addRegistryToPackage(url) -- Add publish configuration to package.json

     var url = 'http://my-internal-registry.local';
     this.addRegistryToPackage(script);

Result:

     ...
     "publishConfig":{
            "registry":"http://my-internal-registry.local"
     }
     ...

API Documentation

License

Copyright (c) 2012 GFT Appverse, S.L., Sociedad Unipersonal.

This Source Code Form is subject to the terms of the Appverse Public License Version 2.0 ("APL v2.0"). If a copy of the APL was not distributed with this file, You can obtain one at http://appverse.org/legal/appverse-license/.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the conditions of the AppVerse Public License v2.0 are met.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. EXCEPT IN CASE OF WILLFUL MISCONDUCT OR GROSS NEGLIGENCE, IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.