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

Commit 62bff4d

Browse files
committed
Release 4.0.0
1 parent 5e06cb2 commit 62bff4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+664
-334
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Contributing to generator-oraclejet
2-
3-
*Copyright (c) 2014, 2017 Oracle and/or its affiliates
4-
The Universal Permissive License (UPL), Version 1.0*
5-
6-
**Pull requests are currently not being accepted for the Oracle JET project.**
7-
8-
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)
9-
(OCA).
10-
11-
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)
1+
# Contributing to generator-oraclejet
2+
3+
*Copyright (c) 2014, 2017 Oracle and/or its affiliates
4+
The Universal Permissive License (UPL), Version 1.0*
5+
6+
**Pull requests are currently not being accepted for the Oracle JET project.**
7+
8+
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)
9+
(OCA).
10+
11+
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)

Gruntfile.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
Copyright (c) 2015, 2017, Oracle and/or its affiliates.
3+
The Universal Permissive License (UPL), Version 1.0
4+
*/
5+
module.exports = function (grunt) {
6+
grunt.initConfig({
7+
});
8+
9+
10+
// Load grunt tasks from NPM packages
11+
require("load-grunt-tasks")(grunt);
12+
13+
// Merge sub configs
14+
var options = {
15+
config : {
16+
src : "build/generator.js"
17+
},
18+
pkg: grunt.file.readJSON("package.json")
19+
}
20+
var configs = require('load-grunt-configs')(grunt, options);
21+
grunt.config.merge(configs);
22+
23+
};
24+

README.md

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,18 @@
1-
# generator-oraclejet 3.2.0
2-
3-
## About the generator
4-
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.
5-
6-
This is an open source project maintained by Oracle Corp.
7-
8-
## Installation
9-
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/)
10-
```bash
11-
npm install -g generator-oraclejet
12-
```
13-
14-
## Usage
15-
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.
16-
17-
```bash
18-
# Generate a web application with default blank template
19-
yo oraclejet <app name>
20-
```
21-
```bash
22-
# Generate a web application with default basic template
23-
yo oraclejet <app name> --template=basic
24-
```
25-
```bash
26-
# Generate a hybrid mobile application for Android with default navdrawer template
27-
yo oraclejet:hybrid myApp --appid=com.oracle.samples.myapp --appname=MyApp --template=navdrawer --platform=android
28-
```
29-
30-
## [Contributing](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
31-
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
32-
[CONTRIBUTING](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
33-
for details.
34-
35-
## [License](https://github.com/oracle/generator-oraclejet/tree/master/LICENSE.md)
36-
Copyright (c) 2014, 2017 Oracle and/or its affiliates
37-
The Universal Permissive License (UPL), Version 1.0
1+
# @oracle/generator-oraclejet 4.0.0
2+
3+
## About the generator
4+
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.
5+
6+
This is an open source project maintained by Oracle Corp.
7+
8+
## Installation
9+
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.
10+
11+
## [Contributing](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
12+
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
13+
[CONTRIBUTING](https://github.com/oracle/generator-oraclejet/tree/master/CONTRIBUTING.md)
14+
for details.
15+
16+
## [License](https://github.com/oracle/generator-oraclejet/tree/master/LICENSE.md)
17+
Copyright (c) 2014, 2017 Oracle and/or its affiliates
18+
The Universal Permissive License (UPL), Version 1.0

RELEASENOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Release Notes for generator-oraclejet ##
22

3+
### 4.0.0
4+
* Moved module into @oracle scope, changing the name to @oracle/generator-oraclejet
5+
* This module should no longer be installed directly. Use @oracle/ojet-cli instead for scaffolding JET apps.
6+
37
### 3.2.0
48
* No changes
59

common/component.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
Copyright (c) 2015, 2017, Oracle and/or its affiliates.
3+
The Universal Permissive License (UPL), Version 1.0
4+
*/
5+
'use strict';
6+
7+
const fs = require('fs-extra');
8+
const path = require('path');
9+
const CONSTANTS = require('../util/constants');
10+
const paths = require('../util/paths');
11+
12+
module.exports =
13+
{
14+
writeComponentTemplate: function _writeComponentTemplate(generator) {
15+
return new Promise((resolve) => {
16+
if (generator.options.component) {
17+
const templateSrc = path.join(generator.templatePath(), '../../../template/component');
18+
const isApp = fs.existsSync(path.join(process.cwd(), CONSTANTS.APP_CONFIG_JSON))
19+
|| generator.appDir !== undefined;
20+
21+
if (!isApp) return resolve(generator);
22+
23+
const appDir = generator.appDir === undefined
24+
? process.cwd() : generator.destinationPath(generator.appDir);
25+
26+
const _configPaths = generator.appDir === undefined
27+
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();
28+
29+
const destDirectory = generator.destinationPath(
30+
path.join(appDir, _configPaths.source,
31+
_configPaths.sourceJavascript, CONSTANTS.JET_COMPOSITES, generator.options.component));
32+
33+
// avoid overwrite component
34+
if (fs.existsSync(destDirectory)) {
35+
console.log('Component already exists. ');
36+
return resolve(generator);
37+
}
38+
fs.ensureDirSync(destDirectory);
39+
fs.copySync(templateSrc, destDirectory);
40+
_replaceComponentTemplateToken(generator);
41+
}
42+
43+
return resolve(generator);
44+
});
45+
}
46+
};
47+
48+
function _replaceComponentTemplateToken(generator) {
49+
const componentName = generator.componentName || generator.options.component;
50+
51+
const appDir = generator.appDir === undefined
52+
? process.cwd() : generator.destinationPath(generator.appDir);
53+
54+
const _configPaths = generator.appDir === undefined
55+
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();
56+
57+
const base = path.join(appDir, _configPaths.source,
58+
_configPaths.sourceJavascript, CONSTANTS.JET_COMPOSITES, componentName);
59+
60+
CONSTANTS.COMPONENT_FILES.forEach((file) => {
61+
const fileContent = fs.readFileSync(path.join(base, file), 'utf-8');
62+
fs.outputFileSync(path.join(base, file), fileContent.replace(new RegExp('@component@', 'g'), componentName));
63+
});
64+
}

common/index.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ module.exports =
5050
},
5151

5252
writeCommonTemplates: function _writeCommonTemplates(generator) {
53-
const templateSrc = path.join(generator.templatePath(), '../../../template');
53+
const templateSrc = path.join(generator.templatePath(), '../../../template/common');
5454
const templateDest = generator.destinationPath();
5555

5656
return new Promise((resolve, reject) => {
@@ -89,6 +89,9 @@ module.exports =
8989
if (_fileNotHidden(filename)) {
9090
const error = `path already exists and is not empty: ${path.resolve(appDir)}`;
9191
reject(commonMessages.error(error, 'validateAppDir'));
92+
} else if (filename === '.gitignore') {
93+
const error = 'path already exists and contains a .gitignore file';
94+
reject(commonMessages.error(error, 'validateAppDir'));
9295
}
9396
});
9497
resolve(appDir);
@@ -173,6 +176,11 @@ function _handleAbsoluteOrMissingPath(generator) {
173176

174177
function _updateJSONAppName(generator, jsonPath) {
175178
const json = fs.readJSONSync(generator.destinationPath(jsonPath));
176-
json.name = generator.options.appname;
179+
// space in app name will result in npm install failure
180+
json.name = _removeSpaceInAppName(generator.options.appname);
177181
fs.writeJSONSync(jsonPath, json);
178182
}
183+
184+
function _removeSpaceInAppName(appName) {
185+
return appName.replace(' ', '-');
186+
}

common/messages.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function _getRestoreComplete(invokedByRestore, appDir) {
3535
if (invokedByRestore) {
3636
return _appendSuccessPrefix('Your app restore finished successfully...');
3737
}
38-
return _appendSuccessPrefix(`Your app is ready! Change to your new app directory ${appDir} and try grunt build and serve...`);
38+
return _appendSuccessPrefix(`Your app is ready! Change to your new app directory ${appDir} and try ojet build and serve...`);
3939
}
4040

4141
function _getPrefixError(error) {

common/template/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const urlTemplate = require('./url');
99
const commonTemplate = require('./common');
1010
const npmTemplate = require('./npm');
1111
const localTemplate = require('./local');
12-
const commonMessages = require('../messages');
1312
const path = require('path');
1413
const util = require('../../util');
1514

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

1918
const BLANK_TEMPLATE = blankTemplate.BLANK_TEMPLATE;
2019

21-
const _TEMPLATES_NPM_URL = 'oraclejet-templates@~3.2.0';
20+
const _TEMPLATES_NPM_URL = '@oracle/oraclejet-templates@~4.0.0';
2221

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

@@ -29,11 +28,7 @@ module.exports =
2928
const template = generator.options.template || BLANK_TEMPLATE;
3029
generator.log('Processing template...', template);
3130
const templateHandler = _getHandler(generator, template, templateDestDirectory);
32-
try {
33-
return commonTemplate.handle(templateHandler);
34-
} catch (err) {
35-
return Promise.reject(commonMessages.error(err, 'processing template'));
36-
}
31+
return commonTemplate.handle(templateHandler);
3732
}
3833
};
3934

common/template/npm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module.exports = {
3939
*/
4040
function _copyNpmTemplate(yoGenerator, templateSpec, destination) {
4141
const templateRoot = path.join(yoGenerator.destinationPath(yoGenerator.appDir),
42-
'node_modules', 'oraclejet-templates');
42+
'node_modules', '@oracle/oraclejet-templates');
4343
const src = _getTemplateFromTypeSpecificDirectory(templateRoot, templateSpec) ||
4444
_getTemplateFromGenericDirectory(templateRoot, templateSpec);
4545

common/test.js

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
Copyright (c) 2015, 2017, Oracle and/or its affiliates.
3+
The Universal Permissive License (UPL), Version 1.0
4+
*/
5+
'use strict';
6+
7+
const fs = require('fs-extra');
8+
const path = require('path');
9+
const CONSTANTS = require('../util/constants');
10+
const paths = require('../util/paths');
11+
12+
module.exports =
13+
{
14+
writeTestTemplate: function _writeTestTemplates(generator) {
15+
return new Promise((resolve) => {
16+
if (generator.options.component) {
17+
const isApp = fs.existsSync(path.join(process.cwd(), CONSTANTS.APP_CONFIG_JSON))
18+
|| generator.appDir !== undefined;
19+
20+
if (!isApp) return resolve(generator);
21+
22+
const appDir = generator.appDir === undefined
23+
? process.cwd() : generator.destinationPath(generator.appDir);
24+
25+
const _configPaths = generator.appDir === undefined
26+
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();
27+
28+
const templateSrc = path.join(generator.templatePath(), '../../../template/test');
29+
const destDirectory = generator.destinationPath(
30+
path.join(appDir, _configPaths.source, _configPaths.sourceTests));
31+
32+
// avoid overwrite test
33+
if (fs.existsSync(destDirectory)) resolve(generator);
34+
35+
fs.ensureDirSync(destDirectory);
36+
fs.copySync(templateSrc, destDirectory);
37+
_replaceTestHTMLToken(generator);
38+
}
39+
return resolve(generator);
40+
});
41+
},
42+
};
43+
44+
function _replaceTestHTMLToken(generator) {
45+
const componentName = generator.componentName || generator.options.component;
46+
47+
const appDir = generator.appDir === undefined
48+
? process.cwd() : generator.destinationPath(generator.appDir);
49+
50+
const _configPaths = generator.appDir === undefined
51+
? paths.getConfiguredPaths(appDir) : paths.getDefaultPaths();
52+
53+
const htmlPath = path.join(appDir, _configPaths.source, _configPaths.sourceTests, 'index.html');
54+
const html = fs.readFileSync(htmlPath, 'utf-8');
55+
fs.outputFileSync(htmlPath, html.replace(new RegExp('@component@', 'g'), componentName));
56+
}

config/eslintcustom.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)