https://github.com/nostackapp/no-stack-cli
cli for creating no-stack apps
https://github.com/nostackapp/no-stack-cli
Last synced: 9 months ago
JSON representation
cli for creating no-stack apps
- Host: GitHub
- URL: https://github.com/nostackapp/no-stack-cli
- Owner: NoStackApp
- License: mit
- Created: 2019-09-20T06:19:40.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-09-20T07:59:25.000Z (almost 7 years ago)
- Last Synced: 2025-02-24T09:33:56.962Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.nostack.net
- Size: 139 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
@nostack/no-stack-cli
============
Tools for stack generation from templates and an api.
## Getting Started
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'.
But relax--if you are missing one you will be told. :)
The four standard steps for creating an app are the following:
1. create a no-stack-app `nostack newapp -a `
2. create a new moderator and stack `nostack quickstarter -e -w -l -u -s `
3. spin up stack (call from the same directory as step 1): `nostack spinstack -u -t dir/to/template/ -s -e `
4. generate code (call from the same directory as step 1): `nostack makecode -a `
There is also a recommended shortcut command to get started:
`nostack quickStarter -e ${email} -w ${password} -l ${license} -u ${moderator} -s ${stackName} -a${appName} -t ${appTemplate}`
That will give you everything you need for your first app. Note that
you will need to provide a license and a template. You can apply for a license at www.nostack.net. Documentation for
creating templates is in the pipeline right now.
The test directory contains a few sample templates in /test/testData/.
## NoStack Concepts
It is useful to understand two things:
1. NoStack stores types of data and their instances. Instances contain an
autogenerated id and a value. For instance, you might have in your application a type
`restaurant` and it may have 300 instances, each of which has a name and
an autogenerated id.
2. types are declared and used in "sources". A source is fundamentally
a hierarchy of types. For instance, a source might contain at its
root restaurant, with cuisine and rating as children.
Also, every source is assigned to a given user class, and a generated
server has auth built in.
More details are given in the "Creating Templates" section below.
## Creating Templates
The templates are text files which contain series of declarations
using the NoStack Flow Specification language (NFS).
An template file treats each line as a different declaration.
Any line that does not begin with a reserved command word is ignored.
### NFS Commands
The commands are expected to change soon, but currently these are available:
* newUserClass \
* newSource \ \
* newType \ \ \ \[\ ] \[\]
* newSelection \ \
* newConstraint \ \ \ ID|Value
* connectSources \ \ \
## Command Explanations
*newUserClass* A user class is a type of user. A source is an interface unit that
is permitted to a user class. A source contains a hierarchy of
types, starting from some root type. A source also can include
actions that can be performed with data.
Types are loosely data entities and/or properties. A type
declaration contains the name of the type and a parent type.
\[Important note: a user class declaration also results in a
type being created for the user class. In other words, each
user is an instance of their class or classes.] By default,
a type is a string. But optionally a type can be set.
Currently, only booleans and strings are supported, but that
will change soon.
A type declaration can also optionally
contain a association type. Association types can specify whether
a child is required for the parent (always exists) or not,
and the number of children for a type. The default is not
required and multiple. Currently, the only declarable
association type is singleRequired, which is useful for
declaring properties.
A selection means a type in a source that gets returned to
the front end. It is analagous to a field that shows up in
the "SELECT" clause of an SQL query.
A constraint limits the data returned. A source and the type
to be constrained must be specified. Also, a constraint value
is required. That is normally a variable name which can
then be set in front end code. There are two types of
costraints: ID and Value. Constraining by id returns the
instance having the id specified. Constraining by value
will return any instances that satisfy the condition
provided.
There are a few reserved words for constraints. The main
one is __currentUser__, which is the id for the current user.
If you set the constraint value to __currentUser__, then
the code generated will set it as such. Otherwise, it's
just a string used for a variable name that gets set in
the code. \[Note: the name that you give for the constraint
value for an ID contraint is purely for code readability.]
Two sources can be "connected", which will affect frontend
code generated. A connecting type must be shared between the
sources. Usually, a connecting type will be a constrained
type for the child source. When a source A is connected to parent source
B, a component generated for B will contain A as a subcomponent
with an instance for every instance of the connecting type.
[](https://npmjs.org/package/no-stack-cli)
[](https://npmjs.org/package/no-stack-cli)
[](https://github.com/YizYah/no-stack-cli/blob/master/package.json)
* [Usage](#usage)
* [Commands](#commands)
# Usage
```sh-session
$ npm install -g @nostack/no-stack-cli
$ nostack COMMAND
running command...
$ nostack (-v|--version|version)
@nostack/no-stack-cli/0.0.0-semantically-released linux-x64 node-v10.16.3
$ nostack --help [COMMAND]
USAGE
$ nostack COMMAND
...
```
# Commands
* [`nostack callapi`](#nostack-callapi)
* [`nostack createstack`](#nostack-createstack)
* [`nostack help [COMMAND]`](#nostack-help-command)
* [`nostack makecode`](#nostack-makecode)
* [`nostack newapp`](#nostack-newapp)
* [`nostack quickstarter`](#nostack-quickstarter)
* [`nostack spinstack`](#nostack-spinstack)
## `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/sourceData1y.graphql -v
~/projects/no-stack-queries/variables/sourceData1y.json
```
_See code: [src/commands/callapi.ts](https://github.com/NoStackApp/no-stack-cli/blob/v0.0.0-semantically-released/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 franky@gmail.com -w franky12$
```
_See code: [src/commands/createstack.ts](https://github.com/NoStackApp/no-stack-cli/blob/v0.0.0-semantically-released/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](https://github.com/oclif/plugin-help/blob/v2.2.1/src/commands/help.ts)_
## `nostack makecode`
generates a starter app from a json provided by NoStack
```
USAGE
$ nostack makecode
OPTIONS
-a, --appName=appName application name
-f, --force
-h, --help show CLI help
```
_See code: [src/commands/makecode.ts](https://github.com/NoStackApp/no-stack-cli/blob/v0.0.0-semantically-released/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, --appName=appName name of application
-h, --help show CLI help
```
_See code: [src/commands/newapp.ts](https://github.com/NoStackApp/no-stack-cli/blob/v0.0.0-semantically-released/src/commands/newapp.ts)_
## `nostack quickstarter`
Creates a new moderator and stack. Also logs in the moderator locally.
```
USAGE
$ nostack quickstarter
OPTIONS
-a, --appName=appName name of application
-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
-t, --template=template template 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 franky@gmail.com -w franky12$
```
_See code: [src/commands/quickstarter.ts](https://github.com/NoStackApp/no-stack-cli/blob/v0.0.0-semantically-released/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
-a, --appName=appName application name
-e, --email=email email to be used by sample users
-h, --help show CLI help
-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
```
_See code: [src/commands/spinstack.ts](https://github.com/NoStackApp/no-stack-cli/blob/v0.0.0-semantically-released/src/commands/spinstack.ts)_