Skip to content

Latest commit

 

History

History
138 lines (111 loc) · 3.13 KB

File metadata and controls

138 lines (111 loc) · 3.13 KB

modify-import

Usage

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 / Output


basic-imports

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.
  });
});

existing-import

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.
  });
});

integration-helpers

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.
  });
});