diff --git a/templates/sample.js b/templates/sample.js new file mode 100644 index 0000000..492a04c --- /dev/null +++ b/templates/sample.js @@ -0,0 +1,56 @@ +var TemplateBase = require("../lib/template-base.js").TemplateBase; +var AppTemplate = require("./app").Template; +var ArgumentError = require("../lib/error.js").ArgumentError; +var path = require('path'); + +var _fromDashesToLowerCamel = function(name) { + var s1 = name.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); + s1 = s1[0].toLowerCase() + s1.slice(1); + return s1; +}; + +var _fromDashesToUpperCamel = function(name) { + var s1 = name.replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); }); + s1 = s1[0].toUpperCase() + s1.slice(1); + return s1; +}; + + +exports.Template = Object.create(AppTemplate, { + + commandDescription: { + value: "sample" + }, + + destination: { + value: "ui" + }, + + didSetOptions: { + value: function (options) { + if (!options.packageName) { + options.packageName = path.basename(options.packageHome); + } + if (!options.relativePackageLocation) { + options.relativePackageLocation = path.relative(options.destination, options.packageHome); + } + if (options.name) { + options.originalName = options.name; + options.componentName = _fromDashesToLowerCamel(options.name); + options.applicationName = _fromDashesToUpperCamel(options.name); + } else { + throw new ArgumentError("Required name option missing"); + } + } + }, + + finish: { + value: function(destination) { + var self = this; + return TemplateBase.finish.call(this).then(function() { + console.log("# "+ self.options.name +".info created and installed with dependency mappings"); + }); + } + }, + +}); diff --git a/templates/sample/__name__.info/sample/.editorconfig b/templates/sample/__name__.info/sample/.editorconfig new file mode 100644 index 0000000..10211c7 --- /dev/null +++ b/templates/sample/__name__.info/sample/.editorconfig @@ -0,0 +1,11 @@ +# http://EditorConfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/templates/sample/__name__.info/sample/.gitignore b/templates/sample/__name__.info/sample/.gitignore new file mode 100644 index 0000000..ea9322c --- /dev/null +++ b/templates/sample/__name__.info/sample/.gitignore @@ -0,0 +1,37 @@ +### General ### +.DS_Store +Thumbs.db +report/ +out/ +temp/ +tmp/ +.tmp +*.tmp +*.tmp.* +log.txt +*.log + +## jsdoc +/doc + +### SublimeText ### +*.sublime-project +*.sublime-workspace + +### Intellij IDE ### +.idea/ +atlassian-ide-plugin.xml + +### VisualStudioCode ### +.vscode/* +.vscode-upload.json + +### TextMate ### +*.tmproj +*.tmproject +tmtags + +### Node ### +npm-debug.log* +.npmignore +node_modules/ \ No newline at end of file diff --git a/templates/sample/__name__.info/sample/LICENSE.md b/templates/sample/__name__.info/sample/LICENSE.md new file mode 100644 index 0000000..e803512 --- /dev/null +++ b/templates/sample/__name__.info/sample/LICENSE.md @@ -0,0 +1,3 @@ +{{#copyright}} +{{{copyright}}} +{{/copyright}} diff --git a/templates/sample/__name__.info/sample/README.md b/templates/sample/__name__.info/sample/README.md new file mode 100644 index 0000000..94f93ac --- /dev/null +++ b/templates/sample/__name__.info/sample/README.md @@ -0,0 +1,101 @@ + +This readme file provides a brief overview of the file and folder structure +included in the default MontageJS project directory. + +>IMPORTANT: Be sure to replace the contents of this readme file with information +about the final application before deploying the application or passing it on to +a client. + +Project Directory +============ + +The default project directory includes the following files and folders: + +* assets/ - Contains global stylesheets and images for the application. +* index.html - Is the entry-point document for the application. +* node_modules/ - Contains the code dependencies required in development. + + Includes Montage, the core framework, and Digit, a mobile-optimized user + interface widget set by default. Since MontageJS uses the CommonJS module + system, you can leverage the npm ecosystem for additional modules. To add + dependencies (e.g., foo), use `npm install foo` in the project directory. + + NOTE: All packages in this directory must be included as dependencies + in package.json. + +* package.json - Describes the application and the dependencies included in + the node_modules directory. +* README.md - The default readme file. +* run-tests.html - Is a page to run Jasmine tests manually in the browser. +* test/ - Contains tests for the application. + + By default, this directory includes all.js, a module that points the test runner + to all jasmine specs. + +* ui/ - Contains the application user interface components. + + By default, this directory contains two components: main.reel (the Main + user interface component) and version.reel (which displays the current + MontageJS version). + +* core/ - Contains the core modules of the application logic. + +In development, you can expand this project directory as necessary; for example, +depending on the project you may want to add the following folders: + +* locale/ - For localized content. +* scripts/ - For JS libraries that do not support the CommonJS exports object + and, therefore, have to be loaded using a ` + + +
+ + +