Skip to content

Commit

Permalink
Changed possible values for --type (#63)
Browse files Browse the repository at this point in the history
* breaking: Renamed codemod option

* refactor: Renamed function (app)

* refactor: Renamed function (engine)

* refactor: Renamed function (v1-addon)

* refactor: Renamed folders (fixtures)

---------

Co-authored-by: ijlee2 <[email protected]>
  • Loading branch information
ijlee2 and ijlee2 authored Oct 11, 2024
1 parent 7e99adc commit 1a46b66
Show file tree
Hide file tree
Showing 1,449 changed files with 556 additions and 556 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ You must pass `--type` to indicate what type of project you have.

```sh
npx ember-codemod-pod-to-octane --type app
npx ember-codemod-pod-to-octane --type addon
npx ember-codemod-pod-to-octane --type v1-addon
npx ember-codemod-pod-to-octane --type engine
```

Expand Down
2 changes: 1 addition & 1 deletion bin/ember-codemod-pod-to-octane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const argv = yargs(hideBin(process.argv))
type: 'boolean',
})
.option('type', {
choices: ['addon', 'app', 'engine'] as const,
choices: ['app', 'engine', 'v1-addon'] as const,
demandOption: true,
describe: 'Type of your Ember project',
type: 'string',
Expand Down
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import {
migrateEmberAddon,
migrateEmberApp,
migrateEmberEngine,
migrateApp,
migrateEngine,
migrateV1Addon,
} from './migration/index.js';
import type { CodemodOptions } from './types/index.js';

export function runCodemod(codemodOptions: CodemodOptions): void {
switch (codemodOptions.projectType) {
case 'addon': {
migrateEmberAddon(codemodOptions);
case 'app': {
migrateApp(codemodOptions);
break;
}

case 'app': {
migrateEmberApp(codemodOptions);
case 'engine': {
migrateEngine(codemodOptions);
break;
}

case 'engine': {
migrateEmberEngine(codemodOptions);
case 'v1-addon': {
migrateV1Addon(codemodOptions);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { moveFiles } from '@codemod-utils/files';
import type { CodemodOptions } from '../../types/index.js';
import { createFilePathMaps, createOptions } from './steps/index.js';

export function migrateEmberApp(codemodOptions: CodemodOptions): void {
export function migrateApp(codemodOptions: CodemodOptions): void {
const options = createOptions(codemodOptions);

const filePathMaps = createFilePathMaps(options);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { moveFiles } from '@codemod-utils/files';
import type { CodemodOptions } from '../../types/index.js';
import { createFilePathMaps, createOptions } from './steps/index.js';

export function migrateEmberEngine(codemodOptions: CodemodOptions): void {
export function migrateEngine(codemodOptions: CodemodOptions): void {
const options = createOptions(codemodOptions);

const filePathMaps = createFilePathMaps(options);
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/migration/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './ember-addon/index.js';
export * from './ember-app/index.js';
export * from './ember-engine/index.js';
export * from './app/index.js';
export * from './engine/index.js';
export * from './v1-addon/index.js';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
updatePathsInAppFolder,
} from './steps/index.js';

export function migrateEmberAddon(codemodOptions: CodemodOptions): void {
export function migrateV1Addon(codemodOptions: CodemodOptions): void {
const options = createOptions(codemodOptions);

const filePathMaps = createFilePathMaps(options);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { FilePath, FilePathMap } from '@codemod-utils/files';
type CodemodOptions = {
podPath: string;
projectRoot: string;
projectType: 'addon' | 'app' | 'engine';
projectType: 'app' | 'engine' | 'v1-addon';
testRun: boolean;
};

Expand All @@ -12,7 +12,7 @@ type FilePathMapEntries = [FilePath, FilePath][];
type Options = {
podPath: string;
projectRoot: string;
projectType: 'addon' | 'app' | 'engine';
projectType: 'app' | 'engine' | 'v1-addon';
testRun: boolean;
};

Expand Down
6 changes: 6 additions & 0 deletions tests/fixtures/app/javascript/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { convertFixtureToJson } from '@codemod-utils/tests';

const inputProject = convertFixtureToJson('app/javascript/input');
const outputProject = convertFixtureToJson('app/javascript/output');

export { inputProject, outputProject };
6 changes: 6 additions & 0 deletions tests/fixtures/app/pod-path/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { convertFixtureToJson } from '@codemod-utils/tests';

const inputProject = convertFixtureToJson('app/pod-path/input');
const outputProject = convertFixtureToJson('app/pod-path/output');

export { inputProject, outputProject };
Loading

0 comments on commit 1a46b66

Please sign in to comment.