@shoutem/cli
Advanced tools
Comparing version 0.0.14 to 0.0.15
{ | ||
"name": "@shoutem/cli", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Command-line tools for Shoutem applications", | ||
@@ -26,2 +26,3 @@ "repository": { | ||
"mkdirp": "0.5.1", | ||
"mustache": "2.2.1", | ||
"request": "2.72.0", | ||
@@ -28,0 +29,0 @@ "rimraf": "2.5.2", |
@@ -58,3 +58,3 @@ 'use strict'; | ||
}, function (token, done) { | ||
console.log('\nLogged in as ' + credentials.username + '.'); | ||
console.log('\nLogged in as `' + credentials.username + '`.'); | ||
localDataClient.saveApiToken(token, done); | ||
@@ -61,0 +61,0 @@ }], callback); |
@@ -32,11 +32,6 @@ 'use strict'; | ||
var _template = require('../extension/template'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint no-console: 0 */ | ||
function getSchemaTemplate(schemaName) { | ||
return '{\n "title": "' + schemaName + '",\n "properties": {\n "name": {\n "format": "single-line",\n "title": "Name",\n "type": "string"\n }\n },\n "titleProperty": "name",\n "type": "object"\n}'; | ||
} | ||
function saveSchemaToExtJson(schemaName, callback) { | ||
@@ -62,4 +57,5 @@ _get__('async').waterfall([_get__('loadExtensionJson'), function (extension, done) { | ||
}], callback); | ||
} | ||
} /* eslint no-console: 0 */ | ||
function createSchema(schemaName, callback) { | ||
@@ -74,4 +70,5 @@ var root = _get__('ensureInExtensionDir')(); | ||
}, function (done) { | ||
var template = _get__('load')('./schema/schema.json.template', { schemaName: schemaName }); | ||
schemaPath = _get__('path').join(root, 'server', 'data-schemas', schemaName + '.json'); | ||
_get__('fs').writeFile(schemaPath, _get__('getSchemaTemplate')(schemaName), 'utf8', done); | ||
_get__('fs').writeFile(schemaPath, template, 'utf8', done); | ||
}], function (err) { | ||
@@ -132,7 +129,7 @@ return callback(err, schemaPath ? _get__('path').relative(root, schemaPath) : null); | ||
case 'load': | ||
return _template.load; | ||
case 'fs': | ||
return _fs2.default; | ||
case 'getSchemaTemplate': | ||
return getSchemaTemplate; | ||
} | ||
@@ -139,0 +136,0 @@ |
@@ -32,13 +32,6 @@ 'use strict'; | ||
var _template = require('../extension/template'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint no-console: 0 */ | ||
function getScreenTemplate(screenName) { | ||
// Since `screenName` is used as a class name, upper-case the first character: | ||
var name = screenName[0].toUpperCase() + screenName.slice(1); | ||
return 'import React, {\n Component\n} from \'react\';\n\nimport {\n Text,\n} from \'react-native\';\n\nexport default class ' + name + ' extends Component {\n render() {\n return (\n <Text>Hello World!</Text>\n );\n }\n}\n'; | ||
} | ||
function saveScreenToExtJson(screenName, callback) { | ||
@@ -60,4 +53,5 @@ _get__('async').waterfall([_get__('loadExtensionJson'), function (extension, done) { | ||
}], callback); | ||
} | ||
} /* eslint no-console: 0 */ | ||
function createScreen(screenName, callback) { | ||
@@ -72,4 +66,6 @@ var root = _get__('ensureInExtensionDir')(); | ||
}, function (done) { | ||
var screenClassName = screenName[0].toUpperCase() + screenName.slice(1); | ||
var template = _get__('load')('./screen/screen.js.template', { screenClassName: screenClassName }); | ||
screenPath = _get__('path').join(root, 'app', 'screens', screenName + '.js'); | ||
_get__('fs').writeFile(screenPath, _get__('getScreenTemplate')(screenName), 'utf8', done); | ||
_get__('fs').writeFile(screenPath, template, 'utf8', done); | ||
}], function (err) { | ||
@@ -130,7 +126,7 @@ return callback(err, screenPath ? _get__('path').relative(root, screenPath) : null); | ||
case 'load': | ||
return _template.load; | ||
case 'fs': | ||
return _fs2.default; | ||
case 'getScreenTemplate': | ||
return getScreenTemplate; | ||
} | ||
@@ -137,0 +133,0 @@ |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var _index = require('./commands/init/index'); | ||
var _init = require('./commands/init'); | ||
@@ -70,3 +70,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
case 'initExtension': | ||
return _index.initExtension; | ||
return _init.initExtension; | ||
@@ -73,0 +73,0 @@ case 'handleInit': |
@@ -22,3 +22,3 @@ 'use strict'; | ||
_get__('program').description('Manage CMS schemas').arguments('<action> <name>').action(function (verb, name) { | ||
_get__('program').description('Manage CMS schemas').command('add <name>', 'Add a new CMS data schema').action(function (verb, name) { | ||
_assign__('action', verb); | ||
@@ -36,3 +36,3 @@ _assign__('schemaName', name); | ||
default: | ||
// TODO(matej): list all current data schemas | ||
console.log('Unknown command `' + _get__('action') + '`. ' + 'Run `shoutem schema --help` for usage details.'); | ||
} | ||
@@ -39,0 +39,0 @@ var _RewiredData__ = {}; |
@@ -22,3 +22,3 @@ 'use strict'; | ||
_get__('program').description('Manage application screens').arguments('<action> <name>').action(function (verb, name) { | ||
_get__('program').description('Manage application screens').command('add <name>', 'Add a new application screen').action(function (verb, name) { | ||
_assign__('action', verb); | ||
@@ -36,3 +36,3 @@ _assign__('screenName', name); | ||
default: | ||
// TODO(matej): list all current screens | ||
console.log('Unknown command `' + _get__('action') + '`. ' + 'Run `shoutem screen --help` for usage details.'); | ||
} | ||
@@ -39,0 +39,0 @@ var _RewiredData__ = {}; |
@@ -22,3 +22,3 @@ 'use strict'; | ||
_get__('program').description('Manage application shortcuts').arguments('<action> <name>').action(function (verb, name) { | ||
_get__('program').description('Manage application shortcuts').command('add <name>', 'Add a new application shortcut').action(function (verb, name) { | ||
_assign__('action', verb); | ||
@@ -36,3 +36,3 @@ _assign__('shortcutName', name); | ||
default: | ||
// TODO(matej): list all current shortcuts | ||
console.log('Unknown command `' + _get__('action') + '`. ' + 'Run `shoutem shortcut --help` for usage details.'); | ||
} | ||
@@ -39,0 +39,0 @@ var _RewiredData__ = {}; |
@@ -20,2 +20,12 @@ #!/usr/bin/env node | ||
_get__('program').version(_get__('pack').version).command('login', 'Login and register as developer').command('logout', 'Clear local credentials').command('push', 'Upload local extension').command('publish', 'Publish uploaded extension').command('install', 'Install uploaded extension into app').command('init', 'Create extension scaffold in working directory').command('screen', 'Manage application screens').command('shortcut', 'Manage application shortcuts').command('schema', 'Manage CMS schemas').description('Command-line tools for Shoutem applications and extensions.').parse(process.argv); | ||
var commands = ['login', 'logout', 'push', 'publish', 'install', 'init', 'screen', 'shortcut', 'schema']; | ||
/* eslint no-console: 0 */ | ||
if (process.argv.length > 2) { | ||
var subcommand = process.argv[2]; | ||
if (_get__('commands').indexOf(subcommand) === -1) { | ||
console.log('Unknown command `' + subcommand + '`. Run `shoutem --help` for usage details.'); | ||
} | ||
} | ||
var _RewiredData__ = {}; | ||
@@ -53,2 +63,5 @@ var _RewireAPI__ = {}; | ||
return _package2.default; | ||
case 'commands': | ||
return commands; | ||
} | ||
@@ -55,0 +68,0 @@ |
{ | ||
"name": "@shoutem/cli", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "Command-line tools for Shoutem applications", | ||
@@ -26,2 +26,3 @@ "repository": { | ||
"mkdirp": "0.5.1", | ||
"mustache": "2.2.1", | ||
"request": "2.72.0", | ||
@@ -28,0 +29,0 @@ "rimraf": "2.5.2", |
52
214743
11
5601
10
+ Addedmustache@2.2.1
+ Addedmustache@2.2.1(transitive)