Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mojito-cli-create

Package Overview
Dependencies
Maintainers
6
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mojito-cli-create - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

archetypes/mojit/default/models/model.server.js.hb

6

index.js

@@ -16,3 +16,3 @@ /*

// todo: make user configurable
SRCPATHS = [path.resolve(__dirname, 'archetypes'), './archetypes'];
SRCPATHS = [path.resolve(__dirname, 'archetypes'), '../archetypes'];

@@ -80,3 +80,3 @@

source = pathify(args.shift());
err = 'Custom archtype path is invalid.';
err = 'Custom archetype path is invalid.';
break;

@@ -87,3 +87,3 @@

// (this *should* be the only supported syntax)
source = util.exists(type) && path.resolve(type);
source = pathify(type);
err = type + ' is not a valid archetype or path.';

@@ -90,0 +90,0 @@ }

@@ -36,3 +36,3 @@ /*

var dest = this.saveas(pathname);
log.debug('mkdirp %s', dest);
log.debug('mkdirp', dest);
mkdirp(dest);

@@ -39,0 +39,0 @@ }

@@ -16,3 +16,3 @@ /*

log.headingStyle.fg = 'blue';
log.disp.verbose = 'verbose';
log.disp.verbose = 'verb';
log.disp.error = 'err!';

@@ -19,0 +19,0 @@ log.disp.warn = 'warn';

@@ -28,2 +28,9 @@ /*

/**
* Find the path of some target, looking in one or more directories. Similar to
* $PATH resolution of a POSIX executable in the shell.
* @param {array} paths One or more filesystem paths
* @param {string} target A filesystem name or subpath
* @return {string|false} Resolved pathname of target if exists, false otherwise
*/
function findInPaths(paths, target) {

@@ -43,2 +50,8 @@ var pathname;

/**
* @param {string|null} str Mojito context strings are comma-separated key/value
* pairs like "key1:val1,key2:val2", or "device:iphone,lang:en-US"
* @return {object} An object/hash/dict representing the parsed context string.
* Returns an empty object if `str` is a falsey value.
*/
function parseCsvObj(str) {

@@ -45,0 +58,0 @@ var out = {};

{
"name": "mojito-cli-create",
"version": "0.0.4",
"version": "0.0.5",
"description": "Subcommand for mojito-cli to create mojito scaffolding/boilerplate.",

@@ -17,3 +17,3 @@ "dependencies": {

"lint": "jshint {.,lib}/*.js",
"test": "node tests",
"test": "tap tests/index.js",
"cover": "istanbul cover --dir artifacts/coverage tests",

@@ -20,0 +20,0 @@ "clean": "git clean -dfx {.,tests}/artifacts"

@@ -1,5 +0,5 @@

mojito-create [![Build Status](https://travis-ci.org/yahoo/mojito-create.png)](https://travis-ci.org/yahoo/mojito-create)
=============
mojito-cli-create [![Build Status](https://travis-ci.org/yahoo/mojito-cli-create.png)](https://travis-ci.org/yahoo/mojito-cli-create)
=================
This package provides the `create` command for the [`mojito-cli`](https://github.com/yahoo/mojito-cli) tool.
This package provides the `create` command for the [`mojito-cli`](https://github.com/yahoo/mojito-cli) tool, that you can install with: `npm install -g mojito-cli`

@@ -13,3 +13,3 @@ Creating Code from Archetypes

$ mojito create app [<archetype-name>] <app-name>
mojito create app [<archetype-name>] <app-name>

@@ -20,7 +20,7 @@ This will create an empty application (i.e., one with no mojits) with the name provided. The application is created in a directory named `<app-name>` within the current directory. If no archetype name is provided, the default archetype is used.

$ mojito create mojit [<archetype-name>] <mojit-name>
mojito create mojit [<archetype-name>] <mojit-name>
This will create an empty mojit with the name provided. The command assumes it is being executed within an application directory. Thus, the mojit is created in a directory named `<mojit-name>` within a mojits subdirectory of the application directory. For example, the mojit MyMojit would be created in mojits/MyMojit.
This will create an empty mojit with the name provided. The command assumes it is being executed within an application directory. Thus, the mojit is created in a directory named `<mojit-name>` within the `mojits` subdirectory of the application directory. For example, the mojit `MyMojit` would be created in `mojits/MyMojit`.
As with application creation, if no archetype name is provided, the default archetype is used. Depending upon the archetype, the skeleton may include any or all of the controller, model, view, and binder.
As with application creation, if no archetype name is provided, the default archetype is used. Depending upon the archetype, the skeleton may include any or all of the following: controller, model, view, and binder

@@ -32,5 +32,5 @@ Mojito Archetypes

* simple - The minimal configuration and code needed to run an application.
* default - This archetype is run if no command-line archetype option is specified. It is a happy medium between simple and full.
* full - Provides the most comprehensive configuration and code for applications.
* `simple` - The minimal configuration and code needed to run an application.
* `default` - This archetype is run if no command-line archetype option is specified. It is a happy medium between simple and full.
* `full` - Provides the most comprehensive configuration and code for applications.

@@ -40,17 +40,15 @@ Custom Archetypes

You can copy the [built-in](https://github.com/yahoo/mojito-create/tree/master/archetypes) archetypes and modify them to suit your work-flow, or create your own. Then you can specify the path to specific archetype, like so:
You can copy the [built-in](https://github.com/yahoo/mojito-cli-create/tree/master/archetypes) archetypes and modify them to suit your work-flow, or create your own. Then you can specify the path to specific archetype, like so:
$ mojito create custom <path/to/archtype> <name>
mojito create custom <path/to/archtype> <path/to/name>
If a file in the archetype source ends with ".hb" then the contents of the file will have key/value replacement done for the following:
If a file in the archetype source ends with `.hb` then the contents of the file will have key/value replacement done for the following:
* `{{port}}` -> default port number 8666 or the value passed by option `--port`
* `{{name}}` -> the name passed as the last command line argument that is not a flag or option, like `--port`
* key/value pairs in a string following the `--keyval`, or `-k` option. For example:
* let's say you have an archetype directory at `../menus` containing one file `today.html.hb`.
* the text file `today.html.hb` contains placeholders `{{dish}}` and `{{side}}`
* you do this: `mojito create custom ../menus TodaysMenu -k dish:tilapia,side:macaroni`
* a new directory `TodaysMenu` is created containing the file `today.html` (the ".hb" extension is removed).
* in the file `today.html`, all occurrences of the strings `{{dish}}` and `{{side}}` are replaced with `tilapia` and `macaroni`.
You can also specify the option `--keyval` or `-k` to replace key/value pairs in a string.
For example, suppose you have the archetype directory `../menus` that has the one file `today.html.hb` containing the Handlebars expressions `{{dish}}` and `{{side}}`. Running the command `mojito create custom ../menus TodaysMenu -k dish:tilapia,side:macaroni` would create the new directory `TodaysMenu` containing the file `today.html` (notice that the ".hb" extension is removed). In `today.html`, all occurrences of the strings `{{dish}}` and `{{side}}` would be replaced with `tilapia` and `macaroni`.
Discussion/Forums

@@ -64,5 +62,5 @@ -----------------

`mojito-create` is licensed under a BSD license (see LICENSE.txt). To contribute to the Mojito project, please see [Contributing](https://github.com/yahoo/mojito/wiki/Contributing-Code-to-Mojito).
BSD, see LICENSE.txt. To contribute to the Mojito project, please see [Contributing](https://github.com/yahoo/mojito/wiki/Contributing-Code-to-Mojito).
The Mojito project is a [meritocratic, consensus-based community project](https://github.com/yahoo/mojito/wiki/Governance-Model) which allows anyone to contribute and gain additional responsibilities.
The Mojito project is a [meritocratic, consensus-based community project](https://github.com/yahoo/mojito/wiki/Governance-Model),
which allows anyone to contribute and gain additional responsibilities.

@@ -12,3 +12,3 @@ var path = require('path'),

//log.pause();
log.pause();

@@ -124,9 +124,9 @@ function getEnv(args, opts) {

t.ok(err instanceof Error, 'error was expected');
t.equal(err.errnum, 9);
t.equal(err.errno, 9);
t.equal(err.message, 'Destination directory is invalid.');
}
t.plan(2);
t.plan(3);
fn(env, cb);
});

@@ -86,3 +86,3 @@ var path = require('path'),

t.true(err instanceof Error, 'instance of Error');
t.equal(err.toString(), 'Error: Custom archtype path is invalid.');
t.equal(err.toString(), 'Error: Custom archetype path is invalid.');
t.equal(err.usage.substring(0, 6), 'Usage:');

@@ -229,3 +229,3 @@ t.equal(err.errno, 5);

t.ok(actual instanceof Error);
t.equal(actual.toString(), 'Error: Custom archtype path is invalid.');
t.equal(actual.toString(), 'Error: Custom archetype path is invalid.');
t.equal(actual.errno, 5);

@@ -232,0 +232,0 @@ t.equal(actual.usage.slice(0, 6), 'Usage:');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc