Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed possible values for --type #63

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
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
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
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