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

no-stack-cli

v0.3.4

Published

tools for stack generation from templates and an api

Downloads

28

Readme

no-stack-cli

Version Downloads/week License

Table of Contents

Intro

NoStack lets you generate a secure and stable back end easily from a high level app flow specification, and even generates starter React code for your front end.

This CLI lets you take advantage of these capabilities. The CLI, as well as NoStack, are only being released in alpha at this point. But we are actively building the project.

NoStack lets you break down your app flow into units, which are essentially hierarchies (trees) of data types. NoStack then spins up a back end that combines the data needs of all of the units, and creates for you starter front end code. The starter code implements the full user flow. [But styling is left up to you.] Unlike templating tools, NoStack does not limit your application to particular types of data, screens, etc.

Features include:

  • A simple language NoStack Flow Specification (NFS) language for specifying the units of a user interface
  • Spinning up virtual stacks from flow specs within seconds
  • Support for unlimited types of users and apps sharing the same data
  • Built in auth flow and strict access control
  • Hosting of virtual stacks (licence required)
  • Ability to pivot a flow quickly (some features pending)
  • Planned export capability to let you run the app from your own server
  • Generation of starter code on the front end
  • Sample data for testing purposes, marked clearly in the database as sample.

Getting Started

To install the CLI, run the following:

npm install -g no-stack-cli

You can then run any of the commands as an argument to nostack. For instance:

nostack callapi ...

The CLI is only useful if you have a NoStack licence. You can apply for one on the NoStack Website, but currently they are only being awarded to alpha testers.

Using the CLI

The CLI tool is created with the two goals of flexibility and simplicity. You can use the CLI to perform any action possible with the NoStack API, so it is flexible. But, most users will be able to get by with a few key commands.

Fundamentally, the CLI can do the following:

  1. create a back end, called a "stack", using the spinstack command
  2. create front end code, called an "app", in a specified directory that uses a stack, using the makecode command
  3. make general NoStack api calls, using the callapi command. (Most people probably won't need that.)

In addition to being straightforward, the CLI seamlessly handles token refreshing once a "user" has logged in.

WARNING: in the alpha version, the CLI currently stores passwords in the directory ~/secure, which (despite the name) is accessible by anyone who has access to your computer. So it is your responsibility to protect the computer where the CLI is used from anyone who might maliciously use that information. A future version might come up with a better approach, or at least allow you the option not to save a password.

The quickstarter Command

There is a shortcut command to get started:

? nostack quickStarter -e ${email} -w ${password} -l ${license}  -u ${moderator} -s ${stackName} -a ${appDir} -t ${appFlow} -c ${userClass} -b ${appBase} -j jsonPath

That will give you everything you need for your first app. Note that you will need to provide a licence.

Actually, quickstarter combines the Separate Steps for generating an App shown below. If you want to see what's happening, check those out.

The following parameters appear in quickstarter, and are used consistently in other CLI commands:

  • -u : the user name for the stack moderator
  • -w : the password for the stack moderator
  • -e : the email that you want for the stack moderator
  • -l : the licence string entitling you to a new stack
  • -s : the name of the stack (note that it needs to be unique)
  • -c : the type of user in the appFlow file for which the front end app will be created.
  • -a : the path and directory of the front end app for the userClass. (The last directory in the path becomes the name of the app. Note that it must be all lowercase letters without spaces, but does not need to be unique within nostack, and in fact is only relevant to you running locally.)
  • -t : a path to a valid app flow specification file
  • -b [OPTIONAL]: a directory containing an empty NoStack application. See Creating an App Base below for instructions to create one.

Separate Steps for generating an App

The quickstarter is a way to use the CLI for the first time, but you will probably need to know the commands for the separate steps that it uses. The reason is that you'll probably want to reset and reuse the stack with a different app flow.

There are the four standard steps for creating an app, covered below.

Create a NoStack App Placeholder

Generation of an "empty" NoStack application:

nostack newapp -a <appDir> [-b <baseApp> ]

The application is created using create-react-app, with several added packages. Included in the packages are:

  • no-stack, a package that enables a React application to work with NoStack
  • a lot of Apollo client packages.

This step takes a long time unless you use an baseApp. See Creating an App Base below.

The folder for the app will be created.

Create an Empty Stack

Create a new moderator and stack.

nostack createstack -e <moderatorEmail> -w <password> -l <licenceId>  -u <moderatorName> -s <stackName>

Build the Stack

Spin up the stack from an NFS file.

nostack spinstack -u <moderatorName> -t dir/to/appFlow/<appFlow> -s <stackName> -e <emailFor Moderator> -a appDir -j <jsonPath>

Calling spinstack will generate a stack json file in the path that you specify in . The conventional suffix used is .json. That file contains a wealth of information about your stack, including every element generated and their ids. Also included are ids for sample data.

Generate a Front End App

Generate front end code for an app for a given userClass.

nostack makecode -a <appDir> -c <userClass> -j <jsonPath>

The makecode command uses the jsonPath file specified. Only the units owned by the specified userClass get used.

You can build as many apps as you like using your stack. The tool only generates one app for a user from a given userClass. But you can modify the stack.json file that you use to generate more than one for a userClass by removing unwanted units from your stack json file.

Note: for your convenience, every time you call makecode, a copy of the stack json that you used appears in your app directory as docs/stack.json.

Creating an App Base

The first step, newApp, takes by far the most time to execute. Not only does it call create-react-app, but it installs every dependency, which can take 10 minutes.

Therefore, it pays to perform newapp one time to create an appBase. Once you have an appBase, you can create a new app almost immediately by using the new appBase with the -b flag:

? nostack newapp -a app${currentNumber} -b ${appBase}`.

The best practice is usually to create one initially by calling this:

nostack newapp -a /path/to/appbase

Then you can use the appBase whenever you like. The drawback of using an appBase is that if any of the dependencies change you will not benefit from the changes.

The resources/appFlows directory contains a few sample appFlows. Currently, there is no repository, but one is planned.

Getting Help

If you are ever confused about the commands, run

$ nostack --help

If you want to know the parameters for any command, just run the command with '--help', e.g.

$ nostack spinstack --help

But relax--if you are missing a parameter you will be prompted :)

Further Information

Check out the Introduction to NoStack for an explanation of how data is organized in the stack.

Then check out:

Usage

$ npm install -g no-stack-cli
$ nostack COMMAND
running command...
$ nostack (-v|--version|version)
no-stack-cli/0.3.4 linux-x64 node-v12.11.1
$ nostack --help [COMMAND]
USAGE
  $ nostack COMMAND
...

Commands

nostack callapi

Make a call to the nostack api. Takes care of auth for the user. You need to specify a file with the graphql query and another one with a json of the variables, if anyare used.

USAGE
  $ nostack callapi

OPTIONS
  -h, --help                         show CLI help
  -q, --queryFile=queryFile          graphql file containing a single query
  -s, --stack=stack                  stack
  -u, --user=user                    moderator for stack
  -v, --variablesFile=variablesFile  json file with query variables

EXAMPLE
  $ nostack callapi -u irnold1y -s TestStack1y -q ~/projects/no-stack-queries/queries/unitData1y.graphql -v 
  ~/projects/no-stack-queries/variables/unitData1y.json

See code: src/commands/callapi.ts

nostack createstack

Creates a new moderator and stack. Also logs in the moderator locally.

USAGE
  $ nostack createstack

OPTIONS
  -e, --email=email          moderator email
  -f, --force
  -h, --help                 show CLI help
  -l, --licenseId=licenseId  license id for the organization of the user
  -s, --stack=stack          stack
  -u, --user=user            moderator to create
  -w, --password=password    moderator password

EXAMPLE
  $ nostack createStack -u franky -s tempstack, -e [email protected] -w franky12$

See code: src/commands/createstack.ts

nostack help [COMMAND]

display help for nostack

USAGE
  $ nostack help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

nostack makecode

generates a starter app from a json provided by NoStack

USAGE
  $ nostack makecode

OPTIONS
  -a, --appDir=appDir        application directory
  -c, --userClass=userClass  user class for which to generate an app
  -h, --help                 show CLI help

  -j, --jsonPath=jsonPath    path and filename for the stack json file.  The file tells you about your server and gets
                             used to generate code for front end apps.

EXAMPLE
  $ nostack makecode -a ~/temp/myapp -j ~/temp/stack.json -c buyer

See code: src/commands/makecode.ts

nostack newapp

create an empty new no-stack app. Effectively combines create-react-app with apollo stuff and the no stack package.

USAGE
  $ nostack newapp

OPTIONS
  -a, --appDir=appDir    application directory
  -b, --baseApp=baseApp  directory of the base app to copy. If it does not exist, it is created.
  -h, --help             show CLI help

EXAMPLE
  $ nostack newapp -a ~/temp/myapp -b ~/temp/baseapp

See code: src/commands/newapp.ts

nostack quickstarter

Creates a new moderator and stack. Also logs in the moderator locally.

USAGE
  $ nostack quickstarter

OPTIONS
  -a, --appDir=appDir        path and directory of application
  -b, --baseApp=baseApp      path and directory of the base app to copy.
  -c, --userClass=userClass  userClass for which to generate an app
  -e, --email=email          moderator email
  -h, --help                 show CLI help

  -j, --jsonPath=jsonPath    path and filename for the stack json file.  The file tells you about your server and gets
                             used to generate code for front end apps.

  -l, --licenseId=licenseId  license id for the organization of the user

  -s, --stack=stack          stack

  -t, --template=template    app flow spec from which to spin up a stack

  -u, --user=user            moderator to create

  -w, --password=password    moderator password

EXAMPLE
  $ nostack quickstarter -u franky -s tempstack, -e [email protected] -w franky12$ -a ~/temp/myapp -b ~/temp/baseApp -j 
  ~/temp/stack.json -t appFlow.txt -l ABC$123 -c buyer

See code: src/commands/quickstarter.ts

nostack spinstack

Spins up a fully functional backend from a provided template. The same template can then be used to generate front end code using the command 'makeCode'.

USAGE
  $ nostack spinstack

OPTIONS
  -e, --email=email              email to be used by sample users
  -h, --help                     show CLI help

  -j, --jsonPath=jsonPath        path and filename for the stack json file.  The file tells you about your server and
                                 gets used to generate code for front end apps.

  -s, --stack=stack              stack

  -t, --template=template        template from which to spin up a stack

  -u, --user=user                moderator for stack

  -x, --addedSuffix=addedSuffix  added suffix for sample instances generated

EXAMPLE
  $ nostack spinstack -u franky -s tempstack, -e [email protected] -j ~/temp/stack.json -t appFlow.txt

See code: src/commands/spinstack.ts