Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor: transform var to let & const
  • Loading branch information
erisu committed Apr 17, 2020
commit 3fda382aa92a19c6e1904cbf4c65d775e62f81d7
24 changes: 12 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@

const fs = require('fs-extra');

var path = require('path');
const path = require('path');

var tmp = require('tmp');
const tmp = require('tmp');
const npa = require('npm-package-arg');
const globby = require('globby');
var isObject = require('isobject');
var pathIsInside = require('path-is-inside');
var requireFresh = require('import-fresh');
var validateIdentifier = require('valid-identifier');
const isObject = require('isobject');
const pathIsInside = require('path-is-inside');
const requireFresh = require('import-fresh');
const validateIdentifier = require('valid-identifier');

var fetch = require('cordova-fetch');
var CordovaError = require('cordova-common').CordovaError;
var ConfigParser = require('cordova-common').ConfigParser;
const fetch = require('cordova-fetch');
const CordovaError = require('cordova-common').CordovaError;
const ConfigParser = require('cordova-common').ConfigParser;

module.exports = cordovaCreate;

Expand Down Expand Up @@ -90,7 +90,7 @@ function cordovaCreate (dest, opts = {}) {

// Use cordova-fetch to obtain npm or git templates
if (needsToBeFetched(opts.template)) {
var target = opts.template;
const target = opts.template;
emit('verbose', 'Using cordova-fetch for ' + target);
return fetch(target, getSelfDestructingTempDir(), {});
} else {
Expand All @@ -99,7 +99,7 @@ function cordovaCreate (dest, opts = {}) {
}
})
.then(function (templatePath) {
var import_from_path;
let import_from_path;

try {
import_from_path = requireFresh(templatePath).dirname;
Expand All @@ -112,7 +112,7 @@ function cordovaCreate (dest, opts = {}) {
import_from_path);
}

var dirAlreadyExisted = fs.existsSync(dir);
const dirAlreadyExisted = fs.existsSync(dir);
if (!dirAlreadyExisted) {
fs.mkdirSync(dir);
}
Expand Down
12 changes: 6 additions & 6 deletions spec/create.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
const fs = require('fs-extra');
const rewire = require('rewire');

var path = require('path');
const path = require('path');

var requireFresh = require('import-fresh');
const requireFresh = require('import-fresh');

var create = require('..');
var CordovaError = require('cordova-common').CordovaError;
var ConfigParser = require('cordova-common').ConfigParser;
const create = require('..');
const CordovaError = require('cordova-common').CordovaError;
const ConfigParser = require('cordova-common').ConfigParser;
const { tmpDir, createWith, createWithMockFetch, expectRejection } = require('./helpers');

const appName = 'TestBase';
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('create end-to-end', function () {
expect(path.join(project, 'www', 'config.xml')).not.toExist();

// Check that config.xml was updated correctly
var configXml = new ConfigParser(path.join(project, 'config.xml'));
const configXml = new ConfigParser(path.join(project, 'config.xml'));
expect(configXml.packageName()).toEqual(appId);
expect(configXml.name()).toEqual(appName);
}
Expand Down
2 changes: 1 addition & 1 deletion spec/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ beforeEach(function () {
toExist: function () {
return {
compare: function (testPath) {
var result = {};
const result = {};
result.pass = fs.existsSync(testPath);

if (result.pass) {
Expand Down
2 changes: 1 addition & 1 deletion spec/templates/withsubdirectory/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
under the License.
*/

var path = require('path');
const path = require('path');
module.exports = {
'dirname': path.join(__dirname, 'template')
};
2 changes: 1 addition & 1 deletion spec/templates/withsubdirectory_package_json/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
under the License.
*/

var path = require('path');
const path = require('path');
module.exports = {
'dirname': path.join(__dirname, 'template')
};