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

csmsc

v0.1.34-a

Published

A node utility for Creating SailsJS Models and Sails Controllers from command line.

Downloads

45

Readme

csmsc

This package is being replaced by DSMC, please switch. This is a node.js command line utility that creates SailsJS base Models and Controllers for API use.

Installation

This utility is available on npm. Globally install it by using the -g flag:

npm install -g csmsc

Usage

To use it, cd into a project directory, and run csmsc with -n and -f args to represent model name and properties respectively.

Examples

Make a model and controller for 'modelName' with properties 'primaryproperty', 'anotherproperty' and 'aThirdproperty':

csmsc -n ModelName -f firstprop,secondprop,thirdprop
csmsc -n ModelName -f title,url,subtitle,text,author -c tags -m company

Notes

SailsJS expects controllers and models to be created using Pascal Case please appropriately name Models with the first character uppercase to ensure compatibility.

csmsc will write the model into the api/models/ folder. csmsc will write the controller into the api/controllers/ folder.

Existing files will be over written.

Model properties are string by default, modify as needed.

MongoDb will add the following

_id as a unique identifier.
createdAt date created.
updatedAt date last updated.

csmsc will add the following

createdBy user that created the record.
updatedBy user that last updated the record.

createdBy and updatedBy values must be passed to the api or will default to 'admin'

Additional Notes

GENERATE model and Sails controller for SailsJS api

-n is the name of the model and controller.
-f is a list of comma separated fields
-c is a list of comma separated collections (one to many)
-m is a list of comma separated models (one to one)

the first field in the field list is considered the primary field.

CREATE Sails model and Sails controller EXAMPLE FROM COMMAND LINE

csmsc -n NewModel -f one,two,three 

MODEL - Returns model definition for frontend Validation Error Checking

http://localhost:1337/newmodel/model/

DISPLAYORDER - Returns list of fields for ordered Dynamic view presentation

http://localhost:1337/newmodel/displayOrder/

GET - Returns ID AND PRIMARY fields for dropdowns / suggestive lists

http://localhost:1337/newmodel/get/

mongodb's auto generated id will be used as the key primaryFild will be the value for that key

SEARCH - Returns results after searching primary or specified field for string

http://localhost:1337/newmodel/search/la?field=ObjectName

Search string follows the slash

Field string is optional and follows ?field=

Using a search string without a field name will search the primary field / node of the object.

Using a search string with a field name specified will search the specified field / node for the string provided.

LIMIT, SKIP

Limit

	&limit=

Skip

	&skip= 

SORT

Implementation is not complete, this is a placeholder.