Skip to content

Commit

Permalink
Merge pull request #3 from vmadman/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vmadman authored Sep 1, 2017
2 parents 0de692f + 88deeb2 commit 921828a
Show file tree
Hide file tree
Showing 36 changed files with 3,203 additions and 67 deletions.
33 changes: 33 additions & 0 deletions docs/project-scaffolds/sls-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Project Scaffold: "luke:sls-service" ([source](../../generators/sls-service/index.js))

A [project scaffold](../project-scaffolds.md) that can be used to create or
recreate a basic Serverless service project (C2C Style).

This scaffold includes everything that the [module scaffold](module.md) includes
as well as many additional [partials](../partials.md) for Serverless development.

## Usage Example

```
$ yo luke:sls-service
```

## Included Partials

The following [partials](../partials.md) are included when this
[project scaffold](../project-scaffolds.md) is used/specified:

* .. todo ..
* [luke:readme](../partials/readme.md)

_Note: Additional, unlisted, [partials](../partials.md) may be automatically
included as [partial dependencies](../partials.md#partial-dependency)._

# Further Reading

* [Source](../../generators/sls-service/index.js) - The source code for this [project scaffold](../project-scaffolds.md)
* [Project Scaffold Listing](./) - Individual docs for each [project scaffold](../project-scaffolds.md)
* [About Project Scaffolds](../project-scaffolds.md) - Basic information about project scaffolds
* [About Partials](../partials.md) - Information about partials
* [About Sub-Generators](../generators.md) - General information about generators and sub-generators
* [Project README](../README.md) - Basic project information
14 changes: 14 additions & 0 deletions generators/_BaseGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ module.exports = yeoman.Base.extend(
default : "",
cacheMode : "prefer-cache",
askAgain : false
}, {
type : "input",
name : "projectVersion",
message : "What is the starting version for this project?",
default : "0.1.0",
cacheMode : "prefer-cache",
askAgain : false
}, {
type : "input",
name : "fullName",
Expand Down Expand Up @@ -102,6 +109,13 @@ module.exports = yeoman.Base.extend(
default : me.appname,
cacheMode : "prefer-cache",
askAgain : false
}, {
type : "input",
name : "copyrightHolder",
message : "Who is the intellectual property rights holder for this project?",
default : "",
cacheMode : "prefer-cache",
askAgain : false
}
];

Expand Down
33 changes: 32 additions & 1 deletion generators/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,32 @@ module.exports = baseGenerator.extend(

},

default : {

createSharedMetaObjects: function() {

var me = this;

// You can't trust a man that doesn't lodash..
me._createSharedObject(
"npm-dependency", "lodash", {
module : "lodash",
version : "^4.17.4"
}
);

// .. and everyone needs a BlueBird.
me._createSharedObject(
"npm-dependency", "bluebird", {
module : "bluebird",
version : "^3.3.5"
}
);

}

},

writing : {

createPartialFiles : function() {
Expand All @@ -33,7 +59,12 @@ module.exports = baseGenerator.extend(
me.fs.copy(
me.templatePath( "core/_eslintrc" ), me.destinationPath( ".eslintrc" )
);


// typedefs.js
me.fs.copy(
me.templatePath( "core/_typedefs.js" ), me.destinationPath( "typedefs.js" )
);

}
}

Expand Down
39 changes: 37 additions & 2 deletions generators/mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,32 @@ module.exports = baseGenerator.extend(
me._createSharedObject(
"script", "test.sh", {
name : "test",
src : "core/scripts/_mocha-exec-tests.sh",
dest : "scripts/test.sh"
src : "core/scripts/test/_run-unit-tests.sh",
dest : "scripts/test/run-unit-tests.sh"
}
);

// Add Mocha as a devDependency
me._createSharedObject(
"npm-dev-dependency", "mocha", {
module : "mocha",
version : "^2.4.5"
}
);

// Chai is also a given ..
me._createSharedObject(
"npm-dev-dependency", "chai", {
module : "chai",
version : "^3.5.0"
}
);

// Tipe is also useful in unit tests ..
me._createSharedObject(
"npm-dev-dependency", "tipe", {
module : "tipe",
version : "^0.1.12"
}
);

Expand All @@ -61,6 +85,16 @@ module.exports = baseGenerator.extend(

var me = this;

// scripts/test/_test-and-wait.sh
me.fs.copy(
me.templatePath( "core/scripts/test/_test-and-wait.sh" ), me.destinationPath( "scripts/test/_test-and-wait.sh" )
);

// Since the unit testing setup for various projects
// can be radically different, I am disabling the testing
// scaffold, below, in favor of project-type-specific scaffolds.

/*
// test/index.js
me.fs.copy(
me.templatePath( "core/test/_mocha-index.js" ), me.destinationPath( "test/index.js" )
Expand All @@ -70,6 +104,7 @@ module.exports = baseGenerator.extend(
me.fs.copy(
me.templatePath( "core/test/lib/_util.js" ), me.destinationPath( "test/lib/util.js" )
);
*/

}

Expand Down
14 changes: 9 additions & 5 deletions generators/package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = baseGenerator.extend(
me._showPrompts(

// Prompts from the base generator
[ "projectName", "projectDesc", "fullName", "emailAddress", "githubOwner", "gitRepoName" ],
[ "projectName", "projectDesc", "projectVersion", "fullName", "emailAddress", "githubOwner", "gitRepoName" ],

// Additional, custom, prompts
[],
Expand Down Expand Up @@ -70,12 +70,17 @@ module.exports = baseGenerator.extend(
// Build package.json
var pkg = {
name : me.props.parsedProject,
version : "0.1.0",
version : me.props.projectVersion,
description : me.props.projectDesc,
main : "lib/index.js",
license : licenseString,
repository : "https://github.com/" + me.props.parsedGitHubOwner + "/" + me.props.parsedRepoName,
author : [
author : {
name : me.props.fullName,
email : me.props.emailAddress,
url : ""
},
contributors : [
{
name : me.props.fullName,
email : me.props.emailAddress,
Expand All @@ -85,8 +90,7 @@ module.exports = baseGenerator.extend(
publishConfig : {
registry : "https://registry.npmjs.org/"
},
keywords : [
]
keywords : []
};

// Check to see if this composition includes "scripts"
Expand Down
59 changes: 59 additions & 0 deletions generators/proprietary-license/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* This is a "partial" sub-generator that attaches a proprietary license.
*
* @example
* shell> yo luke:proprietary-license
*
* @author Luke Chavers <[email protected]>
* @created 2017-08-31
*/

var yeoman = require( "yeoman-generator" );
var baseGenerator = require("../_BaseGenerator");

module.exports = baseGenerator.extend(
{

prompting : function() {

// Locals
var me = this;

// Initialize the base generator
me._initBase();

// Show user prompts
me._showPrompts(

// Prompts from the base generator
["copyrightHolder"],

// Additional, custom, prompts
[],

// Callback function
me.async()

);

},

writing : {

createPartialFiles : function() {

var me = this;

// LICENSE.MD
me.fs.copyTpl(
me.templatePath( "core/_PROPRIETARY-LICENSE.md" ), me.destinationPath( "LICENSE.md" ), {
year : new Date().getFullYear(),
owner : me.props.copyrightHolder
}
);

}
}

}
);
5 changes: 3 additions & 2 deletions generators/readme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = baseGenerator.extend(
me._showPrompts(

// Prompts from the base generator
[ "projectName" ],
[ "projectName", "projectDesc" ],

// Additional, custom, prompts
[],
Expand All @@ -46,7 +46,8 @@ module.exports = baseGenerator.extend(
// README.md
me.fs.copyTpl(
me.templatePath( "core/_README.md" ), me.destinationPath( "README.md" ), {
name : me.props.projectName
name : me.props.projectName,
desc : me.props.projectDesc
}
);

Expand Down
Loading

0 comments on commit 921828a

Please sign in to comment.