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

mold-js

v0.2.47

Published

MoldJS structure and pattern framework commandline interface

Downloads

193

Readme

#Mold.Core.CLI (alpha) This repository includes the moldjs command line interface and a bunch of commands. Including all commands are needed to manage mold packages.

##requirements You need nodejs and npm to install the mold clis.

##installation To install the mold cli use npm and install it global:

	npm install mold-js -g

##use mold cli After installation you can use the command mold on the command line. For example if you will create a new project/package you can do it with:

	mold init

if you want to add a package to your current project use:

	mold install -path http://path-to-your-mold-package

Use --help to get info about a command.

##commands Currently implemented (most important) commands are:

  • init - intitalise a new mold app/package creates a mold.json file

  • install - installs a mold package into the current package possible arguments are:

    • -path - path to the package you wish to install
    • -name - namen of the package you wish to install (currently not implemented cause registry is missing)
    • --without-sub-packages - if set dependent packages will be ignored
    • --without-git-ignore - if set package dependecies will not added to the git ignore file
    • --without-npm - skips installing npm packages
    • --without-sources - ingore all sources, only seeds(mold modules) will be copied
    • --without-adding-dependencies - if set dependent packages will not added to the mold.json file
  • unistall - uninstalls a package by path or name

    • -path - the path of the package you wish to uninstall
    • -name - name of the package
  • update - updates all or a specific package, if no argument is given all packages will be updated

    • -path - if set the package with this path will be updated
    • -name - if name is set only the package with this name will be updated
    • --force - updates the packages even if the version has not changed
  • version - get/set the version number of your package, if no parameter is set the current version will be displayed

    • --up - set the version to the next possible number, 0.0.1 becomes 0.0.2
    • -set - set the version to a specific number.
  • test - executes a test for a specific seed (if a test is defined)

    • -name - the seed name
  • update-mold-json updates the mold.json file

    • -property - the property to update

    • -value - the value

##using commands programmatically To use a command in your application import { Command : "Mold.Core.Command"} in your seed. Now you can execute all commands using Command.myCommandName( options ). The command name will be translated to camelcase. Command arguments can be set via a option object. All commands will return a promise.

Example:


Command
	.install({ '-path' : 'https://raw.githubusercontent.com/jailkey/MoldJS/master/'})
	.then(function(){
		//do something if the package is successfully installed
	))
	.catch(function(err){
		//something went wrong
	})
	

##create your own command If you wish to create you own command, add a directory called CMD to your Mold repository and create a seed inside. For example Mold/CMD/MyCommand.js . When the mold cli is called, this directory will be scanned and all seeds in it will be loaded. The seed content should look like this:

	Seed({
			type : 'module',
			include : [
				{ Command : 'Mold.Core.Command' },
				{ Promise : 'Mold.Core.Promise' },
				{ Helper : 'Mold.Core.CLIHelper' }
			]
		},
		function(){
			Command.register({
				name : 'my-command',
				description : 'description of the command, it will be shown in the command help',
				parameter : {
					'--switch' : {
						'description' : 'description of the switch',
					},
					'-argument' : {
						'description' : 'description of your argument',
						'required' : true
					}
				},
				code : function(args){
					return new Promise(function(resolve, reject){
						var valueOfTheArgument = args.parameter['-argument'].value;
						
						if(args.parameter['--switch']){
							//do something
						}
						
						
						//resolve with args if command is successfull
						Helper.ok("Everything works fine!");
						resolve(args);
						
					})
				}
			})
		}
	)

This are the important parts for registering a command. Don't forget to return a promise in the command code.

Realted seeds are: Mold.Core.CLIHelper - Helps you to manage the cli output, input, colors, errors etc. Mold.Core.CLIForm - Create easily a cli form to manage user input Mold.Core.CLILoadingBar

For detailed information see api docs (when they are ready :) )