Skip to content

Commit

Permalink
Optimizing index.html import
Browse files Browse the repository at this point in the history
  • Loading branch information
Bojan Zivkovic committed Dec 9, 2017
1 parent 782bdad commit 0dbf792
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 59 deletions.
18 changes: 9 additions & 9 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ var fs = require('fs');
var path = require('path');
var program = require('commander');

var colorGreen = '\x1b[32m';
var colorReset = '\x1b[0m';

var bootstrapAppJs3 = __dirname + '/resources/App3.js';
var bootstrapAppJs4 = __dirname + '/resources/App4.js';
var bootstrapAppHtml3 = __dirname + '/resources/index-api-3.html';
var bootstrapAppHtml4 = __dirname + '/resources/index-api-4.html';
var bootstrapAppCss3 = __dirname + '/resources/App3.css';

var bootstrapAppJs4 = __dirname + '/resources/App4.js';
var bootstrapAppCss4 = __dirname + '/resources/App4.css';
var colorGreen = '\x1b[32m';
var colorReset = '\x1b[0m';

var bootstrapAppHtml = __dirname + '/resources/index.html';

var currentWorkingDirectory = path.resolve('./');
var bootstrapAppJs;
var bootstrapAppHtml;
var bootstrapAppCss;

program.version('0.1.0').option('-a, --api [number]', 'Add API version ' + colorGreen + '-v 3' + colorReset + ' or ' + colorGreen + '-v 4' + colorReset + '. Default version of ESRI API is v4', 4).parse(process.argv);
Expand All @@ -27,11 +29,9 @@ var appName = program.args[0];

if (program.api === '3') {
bootstrapAppJs = bootstrapAppJs3;
bootstrapAppHtml = bootstrapAppHtml3;
bootstrapAppCss = bootstrapAppCss3;
} else {
bootstrapAppJs = bootstrapAppJs4;
bootstrapAppHtml = bootstrapAppHtml4;
bootstrapAppCss = bootstrapAppCss4;
}

Expand Down Expand Up @@ -96,7 +96,7 @@ if (process.argv.length <= 2) {
console.log(' - ESRI api v%s', program.api);
var createEsriApp = 'create-react-app ' + appName;
exec(createEsriApp, function (error, stdout, stderr) {
var addModule = 'cd ' + appName + ' && npm install esri-loader';
var addModule = 'cd ' + appName + ' && npm install esri-loader --save';
exec(addModule, function (error, stdout, stderr) {
console.log('');
console.log('Success! ESRI React App ' + colorGreen + appName + colorReset + ' is created at ' + colorGreen + currentWorkingDirectory + colorReset + ' ');
Expand Down
40 changes: 0 additions & 40 deletions build/resources/index-api-4.html

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-esri-react-app",
"version": "0.2.1",
"version": "0.2.2",
"description": "Creating ESRI applications with React included",
"main": "./src/index.js",
"bin": {
Expand Down
18 changes: 9 additions & 9 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ var fs = require('fs');
var path = require('path');
var program = require('commander');

var colorGreen = '\x1b[32m';
var colorReset = '\x1b[0m';

var bootstrapAppJs3 = __dirname + '/resources/App3.js';
var bootstrapAppJs4 = __dirname + '/resources/App4.js';
var bootstrapAppHtml3 = __dirname + '/resources/index-api-3.html';
var bootstrapAppHtml4 = __dirname + '/resources/index-api-4.html';
var bootstrapAppCss3 = __dirname + '/resources/App3.css';

var bootstrapAppJs4 = __dirname + '/resources/App4.js';
var bootstrapAppCss4 = __dirname + '/resources/App4.css';
var colorGreen = '\x1b[32m';
var colorReset = '\x1b[0m';

var bootstrapAppHtml = __dirname + '/resources/index.html';

var currentWorkingDirectory = path.resolve('./');
var bootstrapAppJs;
var bootstrapAppHtml;
var bootstrapAppCss;

program
Expand All @@ -29,11 +31,9 @@ var appName = program.args[0];

if (program.api === '3') {
bootstrapAppJs = bootstrapAppJs3;
bootstrapAppHtml = bootstrapAppHtml3;
bootstrapAppCss = bootstrapAppCss3;
} else {
bootstrapAppJs = bootstrapAppJs4;
bootstrapAppHtml = bootstrapAppHtml4;
bootstrapAppCss = bootstrapAppCss4;
}

Expand Down Expand Up @@ -98,7 +98,7 @@ if (process.argv.length <= 2) {
console.log(' - ESRI api v%s', program.api);
var createEsriApp = 'create-react-app ' + appName;
exec(createEsriApp, function (error, stdout, stderr) {
var addModule = 'cd ' + appName + ' && npm install esri-loader';
var addModule = 'cd ' + appName + ' && npm install esri-loader --save';
exec(addModule, function (error, stdout, stderr) {
console.log('');
console.log('Success! ESRI React App ' + colorGreen + appName + colorReset + ' is created at ' + colorGreen + currentWorkingDirectory + colorReset + ' ');
Expand Down

0 comments on commit 0dbf792

Please sign in to comment.