Skip to content

Commit

Permalink
use node 6 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Selden committed Aug 16, 2018
1 parent e62c4af commit 4aafecb
Show file tree
Hide file tree
Showing 25 changed files with 166 additions and 167 deletions.
5 changes: 2 additions & 3 deletions bin/ember-cli-update.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
const emberCliUpdate = require('../src');
const args = require('../src/args');

const argv = require('yargs')
.options(args)
.argv;
const { argv } = require('yargs')
.options(args);

const from = argv['from'];
const to = argv['to'];
Expand Down
10 changes: 5 additions & 5 deletions src/compare-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

const utils = require('./utils');

module.exports = function compareVersions(options) {
let remoteUrl = options.remoteUrl;
let startTag = options.startTag;
let endTag = options.endTag;

module.exports = function compareVersions({
remoteUrl,
startTag,
endTag
}) {
let compareUrl = `${remoteUrl}/compare/${startTag}...${endTag}`;

// even though this returns a promise, we don't want to use
Expand Down
8 changes: 4 additions & 4 deletions src/get-applicable-codemods.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
const utils = require('./utils');
const semver = require('semver');

module.exports = function getApplicableCodemods(options) {
let projectType = options.projectType;
let startVersion = options.startVersion;

module.exports = function getApplicableCodemods({
projectType,
startVersion
}) {
let nodeVersion = utils.getNodeVersion();

return utils.getCodemods().then(codemods => {
Expand Down
8 changes: 4 additions & 4 deletions src/get-dry-run-stats.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

module.exports = function getDryRunStats(options) {
let startVersion = options.startVersion;
let endVersion = options.endVersion;

module.exports = function getDryRunStats({
startVersion,
endVersion
}) {
return Promise.resolve(
`Would update from ${startVersion} to ${endVersion}.`
);
Expand Down
2 changes: 1 addition & 1 deletion src/get-package-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function getPackageVersion(projectPath, projectType) {

let packageVersion;

let devDependencies = packageJson.devDependencies;
let { devDependencies } = packageJson;

if (devDependencies) {
switch (projectType) {
Expand Down
4 changes: 2 additions & 2 deletions src/get-project-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ module.exports = function getProjectType(projectPath) {
throw 'The package.json is malformed';
}

let keywords = packageJson.keywords;
let { keywords } = packageJson;

let isAddon = keywords && keywords.indexOf('ember-addon') !== -1;

if (isAddon) {
return 'addon';
}

let devDependencies = packageJson.devDependencies;
let { devDependencies } = packageJson;

if (devDependencies) {
let isGlimmer = devDependencies['@glimmer/blueprint'];
Expand Down
20 changes: 10 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ const gitDiffApply = require('git-diff-apply');
const run = require('./run');
const utils = require('./utils');

module.exports = function emberCliUpdate(options) {
let from = options.from;
let to = options.to;
let resolveConflicts = options.resolveConflicts;
let _runCodemods = options.runCodemods;
let reset = options.reset;
let compareOnly = options.compareOnly;
let dryRun = options.dryRun;
let listCodemods = options.listCodemods;

module.exports = function emberCliUpdate({
from,
to,
resolveConflicts,
runCodemods: _runCodemods,
reset,
compareOnly,
dryRun,
listCodemods
}) {
return Promise.resolve().then(() => {
if (listCodemods) {
return utils.getCodemods().then(codemods => {
Expand Down
38 changes: 19 additions & 19 deletions test/acceptance/ember-addon-test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict';

const expect = require('chai').expect;
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
const gitFixtures = require('git-fixtures');
const { expect } = require('chai');
const { AddonTestApp } = require('ember-cli-addon-tests');
const {
gitInit,
commit: _commit,
postCommit,
processIo,
fixtureCompare: _fixtureCompare
} = require('git-fixtures');
const run = require('../../src/run');
const assertions = require('../helpers/assertions');

const gitInit = gitFixtures.gitInit;
const _commit = gitFixtures.commit;
const postCommit = gitFixtures.postCommit;
const processIo = gitFixtures.processIo;
const _fixtureCompare = gitFixtures.fixtureCompare;

const assertNormalUpdate = assertions.assertNormalUpdate;
const assertNoUnstaged = assertions.assertNoUnstaged;
const {
assertNormalUpdate,
assertNoUnstaged
} = require('../helpers/assertions');

const commitMessage = 'add files';

Expand Down Expand Up @@ -75,9 +75,9 @@ describe('Acceptance | ember-addon', function() {
});
});

function fixtureCompare(options) {
let mergeFixtures = options.mergeFixtures;

function fixtureCompare({
mergeFixtures
}) {
let actual = app.path;
let expected = mergeFixtures;

Expand All @@ -98,9 +98,9 @@ describe('Acceptance | ember-addon', function() {
}

it('works', function() {
return merge().then(result => {
let status = result.status;

return merge().then(({
status
}) => {
// remove addon because it's not in the fixtures
app.editPackageJSON(pkg => {
delete pkg.devDependencies['ember-cli-update'];
Expand Down
60 changes: 30 additions & 30 deletions test/acceptance/ember-cli-update-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

const fs = require('fs-extra');
const path = require('path');
const expect = require('chai').expect;
const { expect } = require('chai');
const tmp = require('tmp');
const gitFixtures = require('git-fixtures');
const {
processBin,
fixtureCompare: _fixtureCompare
} = require('git-fixtures');
const buildTmp = require('../helpers/build-tmp');
const assertions = require('../helpers/assertions');

const processBin = gitFixtures.processBin;
const _fixtureCompare = gitFixtures.fixtureCompare;

const assertNormalUpdate = assertions.assertNormalUpdate;
const assertNoUnstaged = assertions.assertNoUnstaged;
const assertCodemodRan = assertions.assertCodemodRan;
const {
assertNormalUpdate,
assertNoUnstaged,
assertCodemodRan
} = require('../helpers/assertions');

const commitMessage = 'add files';

Expand All @@ -26,11 +26,11 @@ describe('Acceptance - ember-cli-update', function() {
tmpPath = tmp.dirSync().name;
});

function merge(options) {
let fixturesPath = options.fixturesPath;
let runCodemods = options.runCodemods;
let subDir = options.subDir || '';

function merge({
fixturesPath,
runCodemods,
subDir = ''
}) {
buildTmp({
fixturesPath,
tmpPath,
Expand Down Expand Up @@ -60,9 +60,9 @@ describe('Acceptance - ember-cli-update', function() {
}).promise;
}

function fixtureCompare(options) {
let mergeFixtures = options.mergeFixtures;

function fixtureCompare({
mergeFixtures
}) {
let actual = tmpPath;
let expected = mergeFixtures;

Expand All @@ -79,9 +79,9 @@ describe('Acceptance - ember-cli-update', function() {
it('updates app', function() {
return merge({
fixturesPath: 'test/fixtures/local/my-app'
}).then(result => {
let status = result.status;

}).then(({
status
}) => {
fixtureCompare({
mergeFixtures: 'test/fixtures/merge/my-app'
});
Expand All @@ -94,9 +94,9 @@ describe('Acceptance - ember-cli-update', function() {
it('updates addon', function() {
return merge({
fixturesPath: 'test/fixtures/local/my-addon'
}).then(result => {
let status = result.status;

}).then(({
status
}) => {
fixtureCompare({
mergeFixtures: 'test/fixtures/merge/my-addon'
});
Expand All @@ -112,9 +112,9 @@ describe('Acceptance - ember-cli-update', function() {
return merge({
fixturesPath: 'test/fixtures/merge/my-app',
runCodemods: true
}).then(result => {
let status = result.status;

}).then(({
status
}) => {
let mergeFixtures = 'test/fixtures/codemod/latest-node/my-app';
if (process.env.NODE_LTS) {
mergeFixtures = 'test/fixtures/codemod/min-node/my-app';
Expand All @@ -133,9 +133,9 @@ describe('Acceptance - ember-cli-update', function() {
return merge({
fixturesPath: 'test/fixtures/local/my-app',
subDir: 'foo/bar'
}).then(result => {
let status = result.status;

}).then(({
status
}) => {
fixtureCompare({
mergeFixtures: 'test/fixtures/merge/my-app'
});
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/assertions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const expect = require('chai').expect;
const { expect } = require('chai');

module.exports.assertNormalUpdate = function(status) {
// changed locally, no change upstream
Expand Down
26 changes: 13 additions & 13 deletions test/helpers/build-tmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

const path = require('path');
const fs = require('fs-extra');
const gitFixtures = require('git-fixtures');

const gitInit = gitFixtures.gitInit;
const commit = gitFixtures.commit;
const postCommit = gitFixtures.postCommit;

module.exports = function(options) {
let fixturesPath = options.fixturesPath;
let tmpPath = options.tmpPath;
let commitMessage = options.commitMessage;
let dirty = options.dirty;
let subDir = options.subDir || '';

const {
gitInit,
commit,
postCommit
} = require('git-fixtures');

module.exports = function({
fixturesPath,
tmpPath,
commitMessage,
dirty,
subDir = ''
}) {
gitInit({
cwd: tmpPath
});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/get-codemods-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const expect = require('chai').expect;
const { expect } = require('chai');
const getCodemods = require('../../src/get-codemods');

describe('Integration - getCodemods', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/get-package-version-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const expect = require('chai').expect;
const { expect } = require('chai');
const getPackageVersion = require('../../src/get-package-version');

describe('Integration - getPackageVersion', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/get-project-type-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const expect = require('chai').expect;
const { expect } = require('chai');
const getProjectType = require('../../src/get-project-type');

describe('Integration - getProjectType', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/get-tag-version-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const expect = require('chai').expect;
const { expect } = require('chai');
const getTagVersion = require('../../src/get-tag-version');
const semver = require('semver');
const sinon = require('sinon');
Expand Down
Loading

0 comments on commit 4aafecb

Please sign in to comment.