ember-codemod-pod-to-octane 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/migration/ember-addon/index.js +7 -17
- package/dist/src/migration/ember-addon/steps/create-file-path-maps/addon/index.js +10 -0
- package/dist/src/migration/ember-addon/{addon/component-classes.js → steps/create-file-path-maps/addon/map-component-classes.js} +1 -1
- package/dist/src/migration/{ember-engine/addon/component-stylesheets.js → ember-addon/steps/create-file-path-maps/addon/map-component-stylesheets.js} +1 -1
- package/dist/src/migration/ember-addon/{addon/component-templates.js → steps/create-file-path-maps/addon/map-component-templates.js} +1 -1
- package/dist/src/migration/ember-addon/steps/create-file-path-maps/app/index.js +10 -0
- package/dist/src/migration/ember-addon/{app/component-classes.js → steps/create-file-path-maps/app/map-component-classes.js} +1 -1
- package/dist/src/migration/ember-addon/{app/component-stylesheets.js → steps/create-file-path-maps/app/map-component-stylesheets.js} +1 -1
- package/dist/src/migration/ember-addon/{app/component-templates.js → steps/create-file-path-maps/app/map-component-templates.js} +1 -1
- package/dist/src/migration/ember-addon/steps/create-file-path-maps/tests/index.js +4 -0
- package/dist/src/migration/ember-addon/{tests/components.js → steps/create-file-path-maps/tests/map-components.js} +1 -1
- package/dist/src/migration/ember-addon/steps/create-file-path-maps.js +10 -0
- package/dist/src/migration/ember-addon/steps/index.js +2 -0
- package/dist/src/migration/ember-app/index.js +5 -11
- package/dist/src/migration/ember-app/steps/create-file-path-maps/app/index.js +26 -0
- package/dist/src/migration/ember-app/{app/component-classes.js → steps/create-file-path-maps/app/map-component-classes.js} +1 -1
- package/dist/src/migration/ember-app/{app/component-stylesheets.js → steps/create-file-path-maps/app/map-component-stylesheets.js} +1 -1
- package/dist/src/migration/ember-app/{app/component-templates.js → steps/create-file-path-maps/app/map-component-templates.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-adapters.js → steps/create-file-path-maps/app/map-route-adapters.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-controllers.js → steps/create-file-path-maps/app/map-route-controllers.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-models.js → steps/create-file-path-maps/app/map-route-models.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-routes.js → steps/create-file-path-maps/app/map-route-routes.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-serializers.js → steps/create-file-path-maps/app/map-route-serializers.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-stylesheets.js → steps/create-file-path-maps/app/map-route-stylesheets.js} +1 -1
- package/dist/src/migration/ember-app/{app/route-templates.js → steps/create-file-path-maps/app/map-route-templates.js} +1 -1
- package/dist/src/migration/ember-app/{app/services.js → steps/create-file-path-maps/app/map-services.js} +1 -1
- package/dist/src/migration/ember-app/steps/create-file-path-maps/tests/index.js +12 -0
- package/dist/src/migration/ember-app/{tests/components.js → steps/create-file-path-maps/tests/map-components.js} +1 -1
- package/dist/src/migration/ember-app/{tests/route-controllers.js → steps/create-file-path-maps/tests/map-route-controllers.js} +1 -1
- package/dist/src/migration/ember-app/{tests/route-routes.js → steps/create-file-path-maps/tests/map-route-routes.js} +1 -1
- package/dist/src/migration/ember-app/{tests/services.js → steps/create-file-path-maps/tests/map-services.js} +1 -1
- package/dist/src/migration/ember-app/steps/create-file-path-maps.js +8 -0
- package/dist/src/migration/ember-app/steps/index.js +1 -0
- package/dist/src/migration/ember-engine/index.js +5 -12
- package/dist/src/migration/ember-engine/steps/create-file-path-maps/addon/index.js +18 -0
- package/dist/src/migration/ember-engine/{addon/component-classes.js → steps/create-file-path-maps/addon/map-component-classes.js} +1 -1
- package/dist/src/migration/{ember-addon/addon/component-stylesheets.js → ember-engine/steps/create-file-path-maps/addon/map-component-stylesheets.js} +1 -1
- package/dist/src/migration/ember-engine/{addon/component-templates.js → steps/create-file-path-maps/addon/map-component-templates.js} +1 -1
- package/dist/src/migration/ember-engine/{addon/route-controllers.js → steps/create-file-path-maps/addon/map-route-controllers.js} +1 -1
- package/dist/src/migration/ember-engine/{addon/route-routes.js → steps/create-file-path-maps/addon/map-route-routes.js} +1 -1
- package/dist/src/migration/ember-engine/{addon/route-stylesheets.js → steps/create-file-path-maps/addon/map-route-stylesheets.js} +1 -1
- package/dist/src/migration/ember-engine/{addon/route-templates.js → steps/create-file-path-maps/addon/map-route-templates.js} +1 -1
- package/dist/src/migration/ember-engine/steps/create-file-path-maps/tests/index.js +10 -0
- package/dist/src/migration/ember-engine/{tests/components.js → steps/create-file-path-maps/tests/map-components.js} +1 -1
- package/dist/src/migration/ember-engine/{tests/route-controllers.js → steps/create-file-path-maps/tests/map-route-controllers.js} +1 -1
- package/dist/src/migration/ember-engine/{tests/route-routes.js → steps/create-file-path-maps/tests/map-route-routes.js} +1 -1
- package/dist/src/migration/ember-engine/steps/create-file-path-maps.js +8 -0
- package/dist/src/migration/ember-engine/steps/index.js +1 -0
- package/package.json +11 -11
- package/dist/src/migration/ember-addon/addon/index.js +0 -10
- package/dist/src/migration/ember-addon/app/index.js +0 -10
- package/dist/src/migration/ember-addon/tests/index.js +0 -4
- package/dist/src/migration/ember-app/app/index.js +0 -26
- package/dist/src/migration/ember-app/tests/index.js +0 -12
- package/dist/src/migration/ember-engine/addon/index.js +0 -18
- package/dist/src/migration/ember-engine/tests/index.js +0 -10
- /package/dist/src/{utils/ember-addon/app/components.js → migration/ember-addon/steps/update-paths-in-app-folder.js} +0 -0
package/README.md
CHANGED
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
import { moveFiles } from '@codemod-utils/files';
|
|
2
|
-
import { updatePathsInAppFolder } from '
|
|
3
|
-
import { migrationStrategyForAddonFolder } from './addon/index.js';
|
|
4
|
-
import { migrationStrategyForAppFolder } from './app/index.js';
|
|
5
|
-
import { createOptions } from './steps/index.js';
|
|
6
|
-
import { migrationStrategyForTestsFolder } from './tests/index.js';
|
|
2
|
+
import { createFilePathMaps, createOptions, updatePathsInAppFolder, } from './steps/index.js';
|
|
7
3
|
export function migrateEmberAddon(codemodOptions) {
|
|
8
4
|
const options = createOptions(codemodOptions);
|
|
9
|
-
const
|
|
10
|
-
const migrationStrategyApp = migrationStrategyForAppFolder(options);
|
|
11
|
-
const migrationStrategyTests = migrationStrategyForTestsFolder(options);
|
|
5
|
+
const filePathMaps = createFilePathMaps(options);
|
|
12
6
|
if (options.testRun) {
|
|
13
|
-
console.log(
|
|
14
|
-
migrationStrategyAddon,
|
|
15
|
-
migrationStrategyApp,
|
|
16
|
-
migrationStrategyTests,
|
|
17
|
-
});
|
|
7
|
+
console.log(filePathMaps);
|
|
18
8
|
return;
|
|
19
9
|
}
|
|
20
|
-
moveFiles(
|
|
21
|
-
moveFiles(
|
|
22
|
-
moveFiles(
|
|
23
|
-
updatePathsInAppFolder(
|
|
10
|
+
moveFiles(filePathMaps.addon, options);
|
|
11
|
+
moveFiles(filePathMaps.app, options);
|
|
12
|
+
moveFiles(filePathMaps.tests, options);
|
|
13
|
+
updatePathsInAppFolder(filePathMaps.app, options);
|
|
24
14
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
+
import { mapComponentStylesheets } from './map-component-stylesheets.js';
|
|
3
|
+
import { mapComponentTemplates } from './map-component-templates.js';
|
|
4
|
+
export function mapAddonFolder(options) {
|
|
5
|
+
return new Map([
|
|
6
|
+
...mapComponentClasses(options),
|
|
7
|
+
...mapComponentStylesheets(options),
|
|
8
|
+
...mapComponentTemplates(options),
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentClasses(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/components/**/component.{d.ts,js,ts}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentStylesheets(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/components/**/styles.{css,scss}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentTemplates(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/components/**/template.hbs', {
|
|
5
5
|
projectRoot,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
+
import { mapComponentStylesheets } from './map-component-stylesheets.js';
|
|
3
|
+
import { mapComponentTemplates } from './map-component-templates.js';
|
|
4
|
+
export function mapAppFolder(options) {
|
|
5
|
+
return new Map([
|
|
6
|
+
...mapComponentClasses(options),
|
|
7
|
+
...mapComponentStylesheets(options),
|
|
8
|
+
...mapComponentTemplates(options),
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentClasses(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('app/components/**/component.js', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentStylesheets(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('app/components/**/styles.js', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentTemplates(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('app/components/**/template.js', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponents(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('tests/integration/components/**/component-test.{js,ts}', {
|
|
5
5
|
projectRoot,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapAddonFolder } from './create-file-path-maps/addon/index.js';
|
|
2
|
+
import { mapAppFolder } from './create-file-path-maps/app/index.js';
|
|
3
|
+
import { mapTestsFolder } from './create-file-path-maps/tests/index.js';
|
|
4
|
+
export function createFilePathMaps(options) {
|
|
5
|
+
return {
|
|
6
|
+
addon: mapAddonFolder(options),
|
|
7
|
+
app: mapAppFolder(options),
|
|
8
|
+
tests: mapTestsFolder(options),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import { moveFiles } from '@codemod-utils/files';
|
|
2
|
-
import {
|
|
3
|
-
import { createOptions } from './steps/index.js';
|
|
4
|
-
import { migrationStrategyForTestsFolder } from './tests/index.js';
|
|
2
|
+
import { createFilePathMaps, createOptions } from './steps/index.js';
|
|
5
3
|
export function migrateEmberApp(codemodOptions) {
|
|
6
4
|
const options = createOptions(codemodOptions);
|
|
7
|
-
const
|
|
8
|
-
const migrationStrategyTests = migrationStrategyForTestsFolder(options);
|
|
5
|
+
const filePathMaps = createFilePathMaps(options);
|
|
9
6
|
if (options.testRun) {
|
|
10
|
-
console.log(
|
|
11
|
-
migrationStrategyApp,
|
|
12
|
-
migrationStrategyTests,
|
|
13
|
-
});
|
|
7
|
+
console.log(filePathMaps);
|
|
14
8
|
return;
|
|
15
9
|
}
|
|
16
|
-
moveFiles(
|
|
17
|
-
moveFiles(
|
|
10
|
+
moveFiles(filePathMaps.app, options);
|
|
11
|
+
moveFiles(filePathMaps.tests, options);
|
|
18
12
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
+
import { mapComponentStylesheets } from './map-component-stylesheets.js';
|
|
3
|
+
import { mapComponentTemplates } from './map-component-templates.js';
|
|
4
|
+
import { mapRouteAdapters } from './map-route-adapters.js';
|
|
5
|
+
import { mapRouteControllers } from './map-route-controllers.js';
|
|
6
|
+
import { mapRouteModels } from './map-route-models.js';
|
|
7
|
+
import { mapRouteRoutes } from './map-route-routes.js';
|
|
8
|
+
import { mapRouteSerializers } from './map-route-serializers.js';
|
|
9
|
+
import { mapRouteStylesheets } from './map-route-stylesheets.js';
|
|
10
|
+
import { mapRouteTemplates } from './map-route-templates.js';
|
|
11
|
+
import { mapServices } from './map-services.js';
|
|
12
|
+
export function mapAppFolder(options) {
|
|
13
|
+
return new Map([
|
|
14
|
+
...mapComponentClasses(options),
|
|
15
|
+
...mapComponentStylesheets(options),
|
|
16
|
+
...mapComponentTemplates(options),
|
|
17
|
+
...mapRouteAdapters(options),
|
|
18
|
+
...mapRouteControllers(options),
|
|
19
|
+
...mapRouteModels(options),
|
|
20
|
+
...mapRouteRoutes(options),
|
|
21
|
+
...mapRouteSerializers(options),
|
|
22
|
+
...mapRouteStylesheets(options),
|
|
23
|
+
...mapRouteTemplates(options),
|
|
24
|
+
...mapServices(options),
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapComponentClasses(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, 'components', '**', 'component.{d.ts,js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapComponentStylesheets(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, 'components', '**', 'styles.{css,scss}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapComponentTemplates(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, 'components', '**', 'template.hbs'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteAdapters(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '**', 'adapter.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteControllers(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '**', 'controller.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteModels(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '**', 'model.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteRoutes(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '**', 'route.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteSerializers(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '**', 'serializer.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteStylesheets(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '!(components)', '**', 'styles.{css,scss}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteTemplates(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '!(components)', '**', 'template.hbs'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapServices(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('app', podPath, '**', 'service.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mapComponents } from './map-components.js';
|
|
2
|
+
import { mapRouteControllers } from './map-route-controllers.js';
|
|
3
|
+
import { mapRouteRoutes } from './map-route-routes.js';
|
|
4
|
+
import { mapServices } from './map-services.js';
|
|
5
|
+
export function mapTestsFolder(options) {
|
|
6
|
+
return new Map([
|
|
7
|
+
...mapComponents(options),
|
|
8
|
+
...mapRouteControllers(options),
|
|
9
|
+
...mapRouteRoutes(options),
|
|
10
|
+
...mapServices(options),
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapComponents(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('tests/integration', podPath, 'components', '**', 'component-test.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteControllers(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
/*
|
|
6
6
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapRouteRoutes(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
/*
|
|
6
6
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
2
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
3
|
-
export function
|
|
3
|
+
export function mapServices(options) {
|
|
4
4
|
const { podPath, projectRoot } = options;
|
|
5
5
|
const filePaths = findFiles(join('tests/unit', podPath, '!(services)', '**', 'service-test.{js,ts}'), {
|
|
6
6
|
projectRoot,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mapAppFolder } from './create-file-path-maps/app/index.js';
|
|
2
|
+
import { mapTestsFolder } from './create-file-path-maps/tests/index.js';
|
|
3
|
+
export function createFilePathMaps(options) {
|
|
4
|
+
return {
|
|
5
|
+
app: mapAppFolder(options),
|
|
6
|
+
tests: mapTestsFolder(options),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { moveFiles } from '@codemod-utils/files';
|
|
2
|
-
import {
|
|
3
|
-
import { createOptions } from './steps/index.js';
|
|
4
|
-
import { migrationStrategyForTestsFolder } from './tests/index.js';
|
|
2
|
+
import { createFilePathMaps, createOptions } from './steps/index.js';
|
|
5
3
|
export function migrateEmberEngine(codemodOptions) {
|
|
6
4
|
const options = createOptions(codemodOptions);
|
|
7
|
-
const
|
|
8
|
-
const migrationStrategyTests = migrationStrategyForTestsFolder(options);
|
|
9
|
-
const migrationStrategy = new Map([
|
|
10
|
-
...migrationStrategyAddon,
|
|
11
|
-
...migrationStrategyTests,
|
|
12
|
-
]);
|
|
5
|
+
const filePathMaps = createFilePathMaps(options);
|
|
13
6
|
if (options.testRun) {
|
|
14
|
-
console.log(
|
|
7
|
+
console.log(filePathMaps);
|
|
15
8
|
return;
|
|
16
9
|
}
|
|
17
10
|
// Preserve code
|
|
18
|
-
moveFiles(
|
|
19
|
-
moveFiles(
|
|
11
|
+
moveFiles(filePathMaps.addon, options);
|
|
12
|
+
moveFiles(filePathMaps.tests, options);
|
|
20
13
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { mapComponentClasses } from './map-component-classes.js';
|
|
2
|
+
import { mapComponentStylesheets } from './map-component-stylesheets.js';
|
|
3
|
+
import { mapComponentTemplates } from './map-component-templates.js';
|
|
4
|
+
import { mapRouteControllers } from './map-route-controllers.js';
|
|
5
|
+
import { mapRouteRoutes } from './map-route-routes.js';
|
|
6
|
+
import { mapRouteStylesheets } from './map-route-stylesheets.js';
|
|
7
|
+
import { mapRouteTemplates } from './map-route-templates.js';
|
|
8
|
+
export function mapAddonFolder(options) {
|
|
9
|
+
return new Map([
|
|
10
|
+
...mapComponentClasses(options),
|
|
11
|
+
...mapComponentStylesheets(options),
|
|
12
|
+
...mapComponentTemplates(options),
|
|
13
|
+
...mapRouteControllers(options),
|
|
14
|
+
...mapRouteRoutes(options),
|
|
15
|
+
...mapRouteStylesheets(options),
|
|
16
|
+
...mapRouteTemplates(options),
|
|
17
|
+
]);
|
|
18
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentClasses(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/components/**/component.{d.ts,js,ts}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentStylesheets(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/components/**/styles.{css,scss}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponentTemplates(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/components/**/template.hbs', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapRouteControllers(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/**/controller.{js,ts}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapRouteRoutes(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/**/route.{js,ts}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapRouteStylesheets(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/!(components)/**/styles.{css,scss}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapRouteTemplates(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('addon/!(components)/**/template.hbs', {
|
|
5
5
|
projectRoot,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { mapComponents } from './map-components.js';
|
|
2
|
+
import { mapRouteControllers } from './map-route-controllers.js';
|
|
3
|
+
import { mapRouteRoutes } from './map-route-routes.js';
|
|
4
|
+
export function mapTestsFolder(options) {
|
|
5
|
+
return new Map([
|
|
6
|
+
...mapComponents(options),
|
|
7
|
+
...mapRouteControllers(options),
|
|
8
|
+
...mapRouteRoutes(options),
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapComponents(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
const filePaths = findFiles('tests/integration/components/**/component-test.{js,ts}', {
|
|
5
5
|
projectRoot,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapRouteControllers(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
/*
|
|
5
5
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { findFiles, renamePathByFile } from '@codemod-utils/files';
|
|
2
|
-
export function
|
|
2
|
+
export function mapRouteRoutes(options) {
|
|
3
3
|
const { projectRoot } = options;
|
|
4
4
|
/*
|
|
5
5
|
Case 1: Didn't pass the --pod flag, but configured { usePods: true } in .ember-cli
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { mapAddonFolder } from './create-file-path-maps/addon/index.js';
|
|
2
|
+
import { mapTestsFolder } from './create-file-path-maps/tests/index.js';
|
|
3
|
+
export function createFilePathMaps(options) {
|
|
4
|
+
return {
|
|
5
|
+
addon: mapAddonFolder(options),
|
|
6
|
+
tests: mapTestsFolder(options),
|
|
7
|
+
};
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ember-codemod-pod-to-octane",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "Codemod to un-pod Ember apps, addons, and engines",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemod",
|
|
@@ -24,32 +24,32 @@
|
|
|
24
24
|
"dist"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@codemod-utils/files": "^0.5.
|
|
27
|
+
"@codemod-utils/files": "^0.5.1",
|
|
28
28
|
"yargs": "^17.7.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@babel/core": "^7.22.
|
|
32
|
-
"@codemod-utils/tests": "^0.2.
|
|
31
|
+
"@babel/core": "^7.22.6",
|
|
32
|
+
"@codemod-utils/tests": "^0.2.4",
|
|
33
33
|
"@sondr3/minitest": "^0.1.1",
|
|
34
|
-
"@tsconfig/esm": "^1.0.
|
|
35
|
-
"@tsconfig/node16": "^1.0
|
|
34
|
+
"@tsconfig/esm": "^1.0.4",
|
|
35
|
+
"@tsconfig/node16": "^16.1.0",
|
|
36
36
|
"@tsconfig/strictest": "^2.0.1",
|
|
37
37
|
"@types/node": "^16.11.7",
|
|
38
38
|
"@types/yargs": "^17.0.24",
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
40
|
-
"@typescript-eslint/parser": "^5.
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^5.61.0",
|
|
40
|
+
"@typescript-eslint/parser": "^5.61.0",
|
|
41
41
|
"concurrently": "^8.2.0",
|
|
42
|
-
"eslint": "^8.
|
|
42
|
+
"eslint": "^8.44.0",
|
|
43
43
|
"eslint-config-prettier": "^8.8.0",
|
|
44
44
|
"eslint-import-resolver-typescript": "^3.5.5",
|
|
45
45
|
"eslint-plugin-import": "^2.27.5",
|
|
46
|
-
"eslint-plugin-n": "^16.0.
|
|
46
|
+
"eslint-plugin-n": "^16.0.1",
|
|
47
47
|
"eslint-plugin-prettier": "^4.2.1",
|
|
48
48
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
49
49
|
"eslint-plugin-typescript-sort-keys": "^2.3.0",
|
|
50
50
|
"lerna-changelog": "^2.2.0",
|
|
51
51
|
"prettier": "^2.8.8",
|
|
52
|
-
"typescript": "^5.1.
|
|
52
|
+
"typescript": "^5.1.6"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">= 16"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { migrationStrategyForComponentClasses } from './component-classes.js';
|
|
2
|
-
import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
|
|
3
|
-
import { migrationStrategyForComponentTemplates } from './component-templates.js';
|
|
4
|
-
export function migrationStrategyForAddonFolder(options) {
|
|
5
|
-
return new Map([
|
|
6
|
-
...migrationStrategyForComponentClasses(options),
|
|
7
|
-
...migrationStrategyForComponentStylesheets(options),
|
|
8
|
-
...migrationStrategyForComponentTemplates(options),
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { migrationStrategyForComponentClasses } from './component-classes.js';
|
|
2
|
-
import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
|
|
3
|
-
import { migrationStrategyForComponentTemplates } from './component-templates.js';
|
|
4
|
-
export function migrationStrategyForAppFolder(options) {
|
|
5
|
-
return new Map([
|
|
6
|
-
...migrationStrategyForComponentClasses(options),
|
|
7
|
-
...migrationStrategyForComponentStylesheets(options),
|
|
8
|
-
...migrationStrategyForComponentTemplates(options),
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { migrationStrategyForComponentClasses } from './component-classes.js';
|
|
2
|
-
import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
|
|
3
|
-
import { migrationStrategyForComponentTemplates } from './component-templates.js';
|
|
4
|
-
import { migrationStrategyForRouteAdapters } from './route-adapters.js';
|
|
5
|
-
import { migrationStrategyForRouteControllers } from './route-controllers.js';
|
|
6
|
-
import { migrationStrategyForRouteModels } from './route-models.js';
|
|
7
|
-
import { migrationStrategyForRouteRoutes } from './route-routes.js';
|
|
8
|
-
import { migrationStrategyForRouteSerializers } from './route-serializers.js';
|
|
9
|
-
import { migrationStrategyForRouteStylesheets } from './route-stylesheets.js';
|
|
10
|
-
import { migrationStrategyForRouteTemplates } from './route-templates.js';
|
|
11
|
-
import { migrationStrategyForServices } from './services.js';
|
|
12
|
-
export function migrationStrategyForAppFolder(options) {
|
|
13
|
-
return new Map([
|
|
14
|
-
...migrationStrategyForComponentClasses(options),
|
|
15
|
-
...migrationStrategyForComponentStylesheets(options),
|
|
16
|
-
...migrationStrategyForComponentTemplates(options),
|
|
17
|
-
...migrationStrategyForRouteAdapters(options),
|
|
18
|
-
...migrationStrategyForRouteControllers(options),
|
|
19
|
-
...migrationStrategyForRouteModels(options),
|
|
20
|
-
...migrationStrategyForRouteRoutes(options),
|
|
21
|
-
...migrationStrategyForRouteSerializers(options),
|
|
22
|
-
...migrationStrategyForRouteStylesheets(options),
|
|
23
|
-
...migrationStrategyForRouteTemplates(options),
|
|
24
|
-
...migrationStrategyForServices(options),
|
|
25
|
-
]);
|
|
26
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { migrationStrategyForComponents } from './components.js';
|
|
2
|
-
import { migrationStrategyForRouteControllers } from './route-controllers.js';
|
|
3
|
-
import { migrationStrategyForRouteRoutes } from './route-routes.js';
|
|
4
|
-
import { migrationStrategyForServices } from './services.js';
|
|
5
|
-
export function migrationStrategyForTestsFolder(options) {
|
|
6
|
-
return new Map([
|
|
7
|
-
...migrationStrategyForComponents(options),
|
|
8
|
-
...migrationStrategyForRouteControllers(options),
|
|
9
|
-
...migrationStrategyForRouteRoutes(options),
|
|
10
|
-
...migrationStrategyForServices(options),
|
|
11
|
-
]);
|
|
12
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { migrationStrategyForComponentClasses } from './component-classes.js';
|
|
2
|
-
import { migrationStrategyForComponentStylesheets } from './component-stylesheets.js';
|
|
3
|
-
import { migrationStrategyForComponentTemplates } from './component-templates.js';
|
|
4
|
-
import { migrationStrategyForRouteControllers } from './route-controllers.js';
|
|
5
|
-
import { migrationStrategyForRouteRoutes } from './route-routes.js';
|
|
6
|
-
import { migrationStrategyForRouteStylesheets } from './route-stylesheets.js';
|
|
7
|
-
import { migrationStrategyForRouteTemplates } from './route-templates.js';
|
|
8
|
-
export function migrationStrategyForAddonFolder(options) {
|
|
9
|
-
return new Map([
|
|
10
|
-
...migrationStrategyForComponentClasses(options),
|
|
11
|
-
...migrationStrategyForComponentStylesheets(options),
|
|
12
|
-
...migrationStrategyForComponentTemplates(options),
|
|
13
|
-
...migrationStrategyForRouteControllers(options),
|
|
14
|
-
...migrationStrategyForRouteRoutes(options),
|
|
15
|
-
...migrationStrategyForRouteStylesheets(options),
|
|
16
|
-
...migrationStrategyForRouteTemplates(options),
|
|
17
|
-
]);
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { migrationStrategyForComponents } from './components.js';
|
|
2
|
-
import { migrationStrategyForRouteControllers } from './route-controllers.js';
|
|
3
|
-
import { migrationStrategyForRouteRoutes } from './route-routes.js';
|
|
4
|
-
export function migrationStrategyForTestsFolder(options) {
|
|
5
|
-
return new Map([
|
|
6
|
-
...migrationStrategyForComponents(options),
|
|
7
|
-
...migrationStrategyForRouteControllers(options),
|
|
8
|
-
...migrationStrategyForRouteRoutes(options),
|
|
9
|
-
]);
|
|
10
|
-
}
|
|
File without changes
|