Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 29 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parser": "babel-eslint",
"env": {
"browser": false,
"node": true,
"es6": false,
"jquery": false
},
"globals": {
"describe": false,
"it": false,
"before": false,
"after": false
},
"extends": "eslint:recommended",
"rules": {
"no-console": "off",
"no-invalid-this": "warn",
"no-undef": "error",
"no-unused-vars": "warn",
"no-var": [
"error"
],
"strict": [
2,
"never"
]
}
}
22 changes: 22 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Npm Publish

on:
release:
types: [released]

jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
73 changes: 73 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# editors
.idea
.DS_Store
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# application
tests/

# idea
.vscode
.idea
.theia

15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
# ide
.idea
.vscode
.theia
.gitpod.yml

# github
.github

# tests
spec

# elsint
.eslintrc
97 changes: 95 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,95 @@
# @themost/cli
CLI Tool for MOST Web Framework
## @themost/cli

![MOST Web Framework Logo](https://github.com/themost-framework/common/raw/master/docs/img/themost_framework_v3_128.png)

A command line utility for [Most Web Framework](https://github.com/themost-framework/) applications.

### Generate a new MOST Web Framework application

themost new project <project name> [--template <api|classic>] [--typescript]

Note: Use --typescript flag if you want to generate a typescript project.

This operation will create a new MOST Web Framework application. Execute:

cd <project name> && npm i

to install dependencies.

### Import data

themost import <data file path> --model <data model name> [--dev]

### Query data

Applies the specified OData query options against the defined data model and prints the result

themost cat --model <data model name> [--dev]
[--filter=<filter option>]
[--select=<select option>]
[--top=<top option>]
[--skip=<skip option>]
[--count=<count option>]
[--order=<order by option>]
[--group=<group by option>]
[--expand=<expand option>]

### User modeler

Use modeler commands to manage data models:

themost modeler <command>

### List data models

themost modeler ls

Enumerates all the available data models

### Get data model details

themost modeler info <model name>

Prints information about the given data model e.g.

themost modeler info UpdateAction

### Extract a data model

themost modeler extract <model name>

e.g.

themost modeler extract Article

Extract a data model definition and its dependencies. There is a large set of data model definitions
as they are defined and documented at [schema.org](https://schema.org)

### Create an new controller

themost generate controller <controller name>

This operation will generate a new controller and it will place it in controllers folder (server/controllers).
### Create an new model

themost generate model <model name>

This operation will generate a new model and it will place it in models definition folder (server/config/models).

### Create an new model class

themost generate class <model name>

This operation will generate a new model class and it will place it in models folder (server/models).

### Create an new model listener

themost generate listener <listener name>

This operation will generate a new model listener and it will place it in listeners folder (server/listeners).

### Create an new application service

themost generate service <service name>

This operation will generate a new application service and it will place it in services folder (server/services).
2 changes: 2 additions & 0 deletions bin/themost
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../cli');
13 changes: 13 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// MOST Web Framework Copyright (c) 2017-2022, THEMOST LP All rights reserved
const path = require('path');

process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
// application specific logging, throwing an error, or other logic here
});

require('yargs')
.commandDir(path.resolve(__dirname, 'commands'))
.demandCommand()
.help()
.argv;
33 changes: 33 additions & 0 deletions commands/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// MOST Web Framework Copyright (c) 2017-2022, THEMOST LP All rights reserved
const getConfiguration = require('../util').getConfiguration;

module.exports = {
command: 'build',
desc: 'Build current @themost/cli project',
builder: function builder(yargs) {
return yargs;
},
handler: function handler(argv) {
let options = getConfiguration();
let buildModule = '@themost-devkit/build';
let build;
if (options.mode === 'typescript') {
// load build module
buildModule = '@themost-devkit/build-typescript';
build = require(buildModule).build;
return build(process.cwd()).then( () => {
console.log('INFO', 'Build operation was completed successfully.');
}).catch(err => {
console.error(err);
});
}
else {
build = require(buildModule).build;
return build(process.cwd()).then( () => {
console.log('INFO', 'Build operation was completed successfully.');
}).catch(err => {
console.error(err);
});
}
}
};
Loading