Skip to content
This repository has been archived by the owner on Jul 2, 2020. It is now read-only.

Commit

Permalink
Release 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benm071 committed Sep 22, 2017
1 parent 5e06cb2 commit 62bff4d
Show file tree
Hide file tree
Showing 59 changed files with 664 additions and 334 deletions.
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Contributing to generator-oraclejet

*Copyright (c) 2014, 2017 Oracle and/or its affiliates
The Universal Permissive License (UPL), Version 1.0*

**Pull requests are currently not being accepted for the Oracle JET project.**

We plan to provide this functionality in the future. At that time, you will need to follow [The Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html)
(OCA).

If you have ideas, comments, or issues related to generator, swing on by the [Oracle JET discussion forum.](https://community.oracle.com/community/development_tools/oracle-jet/generators)
# Contributing to generator-oraclejet

*Copyright (c) 2014, 2017 Oracle and/or its affiliates
The Universal Permissive License (UPL), Version 1.0*

**Pull requests are currently not being accepted for the Oracle JET project.**

We plan to provide this functionality in the future. At that time, you will need to follow [The Oracle Contributor Agreement](https://www.oracle.com/technetwork/community/oca-486395.html)
(OCA).

If you have ideas, comments, or issues to discuss, swing on by the [Oracle JET discussion forum.](https://community.oracle.com/community/development_tools/oracle-jet/generators)
24 changes: 24 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
Copyright (c) 2015, 2017, Oracle and/or its affiliates.
The Universal Permissive License (UPL), Version 1.0
*/
module.exports = function (grunt) {
grunt.initConfig({
});


// Load grunt tasks from NPM packages
require("load-grunt-tasks")(grunt);

// Merge sub configs
var options = {
config : {
src : "build/generator.js"
},
pkg: grunt.file.readJSON("package.json")
}
var configs = require('load-grunt-configs')(grunt, options);
grunt.config.merge(configs);

};

55 changes: 18 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
# generator-oraclejet 3.2.0

## About the generator
This Yeoman generator for Oracle JET lets you quickly set up a project for use as a web application or hybrid mobile application for Android, iOS or Windows 10.

This is an open source project maintained by Oracle Corp.

## Installation
For step-by-step instructions on using Yeoman and this generator to build an Oracle JET application, including possible pre-requisites for installation, please see the [Oracle JET Developers Guide](http://docs.oracle.com/middleware/jet320/jet/)
```bash
npm install -g generator-oraclejet
```

## Usage
Once you have the generator installed, the following commands will scaffold up a JET based application. See the [Oracle JET Developers Guide](http://docs.oracle.com/middleware/jet320/jet/) for information about all of the available command line options as well as details on pre-requisites for installation.

```bash
# Generate a web application with default blank template
yo oraclejet <app name>
```
```bash
# Generate a web application with default basic template
yo oraclejet <app name> --template=basic
```
```bash
# Generate a hybrid mobile application for Android with default navdrawer template
yo oraclejet:hybrid myApp --appid=com.oracle.samples.myapp --appname=MyApp --template=navdrawer --platform=android
```

## [Contributing](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
[CONTRIBUTING](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
for details.

## [License](https://github.com/oracle/generator-oraclejet/tree/master/LICENSE.md)
Copyright (c) 2014, 2017 Oracle and/or its affiliates
The Universal Permissive License (UPL), Version 1.0
# @oracle/generator-oraclejet 4.0.0

## About the generator
This Yeoman generator for Oracle JET lets you quickly set up a project for use as a web application or hybrid mobile application for Android, iOS or Windows 10.

This is an open source project maintained by Oracle Corp.

## Installation
This module will be automatically installed as a dependency of the Oracle JET command-line interface [@oracle/ojet-cli](https://github.com/oracle/ojet-cli), and should not be installed directly.

## [Contributing](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
[CONTRIBUTING](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
for details.

## [License](https://github.com/oracle/generator-oraclejet/tree/master/LICENSE.md)
Copyright (c) 2014, 2017 Oracle and/or its affiliates
The Universal Permissive License (UPL), Version 1.0
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Release Notes for generator-oraclejet ##

### 4.0.0
* Moved module into @oracle scope, changing the name to @oracle/generator-oraclejet
* This module should no longer be installed directly. Use @oracle/ojet-cli instead for scaffolding JET apps.

### 3.2.0
* No changes

Expand Down
64 changes: 64 additions & 0 deletions common/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
Copyright (c) 2015, 2017, Oracle and/or its affiliates.
The Universal Permissive License (UPL), Version 1.0
*/
'use strict';

const fs = require('fs-extra');
const path = require('path');
const CONSTANTS = require('../util/constants');
const paths = require('../util/paths');

module.exports =
{
writeComponentTemplate: function _writeComponentTemplate(generator) {
return new Promise((resolve) => {
if (generator.options.component) {
const templateSrc = path.join(generator.templatePath(), '../../../template/component');
const isApp = fs.existsSync(path.join(process.cwd(), CONSTANTS.APP_CONFIG_JSON))
|| generator.appDir !== undefined;

if (!isApp) return resolve(generator);

const appDir = generator.appDir === undefined
? process.cwd() : generator.destinationPath(generator.appDir);

const _configPaths = generator.appDir === undefined
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();

const destDirectory = generator.destinationPath(
path.join(appDir, _configPaths.source,
_configPaths.sourceJavascript, CONSTANTS.JET_COMPOSITES, generator.options.component));

// avoid overwrite component
if (fs.existsSync(destDirectory)) {
console.log('Component already exists. ');
return resolve(generator);
}
fs.ensureDirSync(destDirectory);
fs.copySync(templateSrc, destDirectory);
_replaceComponentTemplateToken(generator);
}

return resolve(generator);
});
}
};

function _replaceComponentTemplateToken(generator) {
const componentName = generator.componentName || generator.options.component;

const appDir = generator.appDir === undefined
? process.cwd() : generator.destinationPath(generator.appDir);

const _configPaths = generator.appDir === undefined
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();

const base = path.join(appDir, _configPaths.source,
_configPaths.sourceJavascript, CONSTANTS.JET_COMPOSITES, componentName);

CONSTANTS.COMPONENT_FILES.forEach((file) => {
const fileContent = fs.readFileSync(path.join(base, file), 'utf-8');
fs.outputFileSync(path.join(base, file), fileContent.replace(new RegExp('@component@', 'g'), componentName));
});
}
12 changes: 10 additions & 2 deletions common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports =
},

writeCommonTemplates: function _writeCommonTemplates(generator) {
const templateSrc = path.join(generator.templatePath(), '../../../template');
const templateSrc = path.join(generator.templatePath(), '../../../template/common');
const templateDest = generator.destinationPath();

return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -89,6 +89,9 @@ module.exports =
if (_fileNotHidden(filename)) {
const error = `path already exists and is not empty: ${path.resolve(appDir)}`;
reject(commonMessages.error(error, 'validateAppDir'));
} else if (filename === '.gitignore') {
const error = 'path already exists and contains a .gitignore file';
reject(commonMessages.error(error, 'validateAppDir'));
}
});
resolve(appDir);
Expand Down Expand Up @@ -173,6 +176,11 @@ function _handleAbsoluteOrMissingPath(generator) {

function _updateJSONAppName(generator, jsonPath) {
const json = fs.readJSONSync(generator.destinationPath(jsonPath));
json.name = generator.options.appname;
// space in app name will result in npm install failure
json.name = _removeSpaceInAppName(generator.options.appname);
fs.writeJSONSync(jsonPath, json);
}

function _removeSpaceInAppName(appName) {
return appName.replace(' ', '-');
}
2 changes: 1 addition & 1 deletion common/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function _getRestoreComplete(invokedByRestore, appDir) {
if (invokedByRestore) {
return _appendSuccessPrefix('Your app restore finished successfully...');
}
return _appendSuccessPrefix(`Your app is ready! Change to your new app directory ${appDir} and try grunt build and serve...`);
return _appendSuccessPrefix(`Your app is ready! Change to your new app directory ${appDir} and try ojet build and serve...`);
}

function _getPrefixError(error) {
Expand Down
9 changes: 2 additions & 7 deletions common/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const urlTemplate = require('./url');
const commonTemplate = require('./common');
const npmTemplate = require('./npm');
const localTemplate = require('./local');
const commonMessages = require('../messages');
const path = require('path');
const util = require('../../util');

Expand All @@ -18,7 +17,7 @@ const _WEB = 'web';

const BLANK_TEMPLATE = blankTemplate.BLANK_TEMPLATE;

const _TEMPLATES_NPM_URL = 'oraclejet-templates@~3.2.0';
const _TEMPLATES_NPM_URL = '@oracle/oraclejet-templates@~4.0.0';

const _TEMPLATES = [BLANK_TEMPLATE, 'basic', 'navbar', 'navdrawer'];

Expand All @@ -29,11 +28,7 @@ module.exports =
const template = generator.options.template || BLANK_TEMPLATE;
generator.log('Processing template...', template);
const templateHandler = _getHandler(generator, template, templateDestDirectory);
try {
return commonTemplate.handle(templateHandler);
} catch (err) {
return Promise.reject(commonMessages.error(err, 'processing template'));
}
return commonTemplate.handle(templateHandler);
}
};

Expand Down
2 changes: 1 addition & 1 deletion common/template/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = {
*/
function _copyNpmTemplate(yoGenerator, templateSpec, destination) {
const templateRoot = path.join(yoGenerator.destinationPath(yoGenerator.appDir),
'node_modules', 'oraclejet-templates');
'node_modules', '@oracle/oraclejet-templates');
const src = _getTemplateFromTypeSpecificDirectory(templateRoot, templateSpec) ||
_getTemplateFromGenericDirectory(templateRoot, templateSpec);

Expand Down
56 changes: 56 additions & 0 deletions common/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
Copyright (c) 2015, 2017, Oracle and/or its affiliates.
The Universal Permissive License (UPL), Version 1.0
*/
'use strict';

const fs = require('fs-extra');
const path = require('path');
const CONSTANTS = require('../util/constants');
const paths = require('../util/paths');

module.exports =
{
writeTestTemplate: function _writeTestTemplates(generator) {
return new Promise((resolve) => {
if (generator.options.component) {
const isApp = fs.existsSync(path.join(process.cwd(), CONSTANTS.APP_CONFIG_JSON))
|| generator.appDir !== undefined;

if (!isApp) return resolve(generator);

const appDir = generator.appDir === undefined
? process.cwd() : generator.destinationPath(generator.appDir);

const _configPaths = generator.appDir === undefined
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();

const templateSrc = path.join(generator.templatePath(), '../../../template/test');
const destDirectory = generator.destinationPath(
path.join(appDir, _configPaths.source, _configPaths.sourceTests));

// avoid overwrite test
if (fs.existsSync(destDirectory)) resolve(generator);

fs.ensureDirSync(destDirectory);
fs.copySync(templateSrc, destDirectory);
_replaceTestHTMLToken(generator);
}
return resolve(generator);
});
},
};

function _replaceTestHTMLToken(generator) {
const componentName = generator.componentName || generator.options.component;

const appDir = generator.appDir === undefined
? process.cwd() : generator.destinationPath(generator.appDir);

const _configPaths = generator.appDir === undefined
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();

const htmlPath = path.join(appDir, _configPaths.source, _configPaths.sourceTests, 'index.html');
const html = fs.readFileSync(htmlPath, 'utf-8');
fs.outputFileSync(htmlPath, html.replace(new RegExp('@component@', 'g'), componentName));
}
26 changes: 0 additions & 26 deletions config/eslintcustom.js

This file was deleted.

Loading

0 comments on commit 62bff4d

Please sign in to comment.