Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
generator-demi
Advanced tools
A Demi.js Generator for Yeoman.
Trick question. It's not a thing. It's this guy:
Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.
$ npm install -g yo
Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.
To install generator-demi from npm, run:
$ npm install -g generator-demi
Finally, initiate the generator:
$ yo demi
Available generators:
Note: Generators are to be run from the root directory of your app.
Generates a controller in api/controllers
.
Example:
yo demi:controller tasks index:GET show:GET update:PUT destroy:DELETE
Produces api/controllers/tasks.js
:
/*
* demi
* https://github.com/enytc/demi
*
* Copyright (c) 2014 Christopher EnyTC
* Licensed under the MIT license.
*/
'use strict';
module.exports = {
/*
* GET /tasks
*/
/*
* GET /tasks/index
*/
index: {
method: 'GET',
fn: function (req, res) {
//
}
},
/*
* GET /tasks/show
*/
show: {
method: 'GET',
fn: function (req, res) {
//
}
},
/*
* PUT /tasks/update
*/
update: {
method: 'PUT',
fn: function (req, res) {
//
}
},
/*
* DELETE /tasks/destroy
*/
destroy: {
method: 'DELETE',
fn: function (req, res) {
//
}
},
};
Generates a restful controller in api/controllers
.
Example:
yo demi:restful users
Produces api/controllers/users.js
:
/*
* demi
* https://github.com/enytc/demi
*
* Copyright (c) 2014 Christopher EnyTC
* Licensed under the MIT license.
*/
'use strict';
module.exports = {
/*
* GET /users
*/
index: function (req, res) {
//
},
/*
* GET /users/new
*/
new: function (req, res) {
//
},
/*
* POST /users
*/
create: function (req, res) {
//
},
/*
* GET /users/:task
*/
show: function (req, res) {
//
},
/*
* GET /users/:task/edit
*/
edit: function (req, res) {
//
},
/*
* PUT /users/:task
*/
update: function (req, res) {
//
},
/*
* DELETE /users/:task
*/
destroy: function (req, res) {
//
}
};
Generates a middleware in api/middlewares
.
Example:
yo demi:middleware demi_example
Produces api/middlewares/demi_example.js
:
/*
* demi
* https://github.com/enytc/demi
*
* Copyright (c) 2014 Christopher EnyTC
* Licensed under the MIT license.
*/
'use strict';
/*
* Name: demi_example
*/
module.exports = {
/*
* Set true if you want enable this middleware
*/
enabled: true,
fn: function () {
return function (req, res, next) {
//
next();
};
}
};
Generates a model in api/models
.
Example:
yo demi:model Task name:String slug:String closed:Boolean created:Date
Produces api/models/tasks.js
:
/*
* demi
* https://github.com/enytc/demi
*
* Copyright (c) 2014 Christopher EnyTC
* Licensed under the MIT license.
*/
'use strict';
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
/*
* Task Schema
*/
var TaskSchema = new Schema({
name: {
type: String
},
slug: {
type: String
},
closed: {
type: Boolean
},
created: {
type: Date
},
});
//Exports model
module.exports = mongoose.model('Task', TaskSchema);
Generates a service in api/services
.
Example:
yo demi:service names "name:Chris" "name:Bella"
Produces api/services/names.json
:
{
"name": "Chris",
"name": "Bella",
}
Generates a socket in api/sockets
.
Example:
yo demi:socket test index
Produces api/sockets/test.js
:
/*
* demi
* https://github.com/enytc/demi
*
* Copyright (c) 2014 EnyTC Corporation
* Licensed under the BSD license.
*/
'use strict';
module.exports = {
/*
* SOCKET test/index
*/
index: {
on: function (data) {
console.log(data);
this.emit('test/index', 'testing sockets');
},
emit: 'test this'
},
};
Generates a test in test/
.
Example:
yo demi:make tasks "GET /tasks" "should be return a welcome"
Produces test/tasks_test.js
:
/*
* demi
* https://github.com/enytc/demi
*
* Copyright (c) 2014 Christopher EnyTC
* Licensed under the MIT license.
*/
'use strict';
var supertest = require('supertest');
var demi = require('../lib/demi.js');
var request = supertest(demi());
var chai = require('chai');
chai.expect();
chai.should();
describe('#tasks', function () {
describe('GET /tasks', function () {
it('should be return a welcome', function (done) {
request
.get('/tasks')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, {}, done);
});
});
});
Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.
If you'd like to get to know Yeoman better and meet some of his friends, Grunt and Bower, check out the complete Getting Started Guide.
See the CONTRIBUTING Guidelines
If you have any problem or suggestion please open an issue here.
Copyright (c) 2014 Christopher EnyTC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A Demi.js Generator for Yeoman
We found that generator-demi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.