npx ember-codemods modify-import path/of/files/ or/some**/*glob.js
# or
yarn global add ember-codemods
ember-codemods modify-import path/of/files/ or/some**/*glob.js
Input (basic-imports.input.js):
import { describe, it } from 'mocha';
import setupAcceptance from 'freshdesk/tests/helpers/setup-acceptance';
import {
addFeatures,
addLaunched,
addAbilities,
removeFeatures,
removeAbilities,
convertMirageToModel,
spyFlashMessage
} from 'freshdesk/tests/helpers/util-test-helpers';
describe('Some test', function() {
it('Some test', function() {
// Some test code goes here.
});
});
Output (basic-imports.output.js):
import { describe, it } from 'mocha';
import {
addAbilities,
addFeatures,
addLaunched,
convertMirageToModel,
removeAbilities,
removeFeatures,
spyFlashMessage,
setupAcceptance,
} from '@freshdesk/test-helpers';
describe('Some test', function() {
it('Some test', function() {
// Some test code goes here.
});
});
Input (existing-import.input.js):
import { describe } from 'mocha';
import { addAbilities, addFeatures } from 'freshdesk/tests/helpers/util-test-helpers';
import { spyFlashMessage } from '@freshdesk/test-helpers';
describe('Some test', function () {
it('Some test', function () {
// Some test code goes here.
});
});
Output (existing-import.output.js):
import { describe } from 'mocha';
import {
spyFlashMessage,
addAbilities,
addFeatures
} from '@freshdesk/test-helpers';
describe('Some test', function () {
it('Some test', function () {
// Some test code goes here.
});
});
Input (integration-helpers.input.js):
import { describe, it } from 'mocha';
import {
setupCurrentUser,
setupCurrentAccount
} from 'freshdesk/tests/helpers/integration-test-helpers';
describe('Some test', function() {
it('Some test', function() {
// Some test code goes here.
});
});
Output (integration-helpers.output.js):
import { describe, it } from 'mocha';
import {
setupCurrentAccount,
setupCurrentUser
} from '@freshdesk/test-helpers';
describe('Some test', function() {
it('Some test', function() {
// Some test code goes here.
});
});