Skip to content

Commit 4e9d33c

Browse files
committed
refactor: Used Array.from to convert a Set to an array
1 parent ae2a4d7 commit 4e9d33c

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

src/migration/ember-addon/steps/create-files-from-blueprints.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { blueprintsRoot } from '../../../utils/blueprints.js';
1010
function getFilesToSkip(options: Options): string[] {
1111
const { packageManager, packages } = options;
1212

13-
const files = new Set();
13+
const files = new Set<string>();
1414

1515
if (!packages.addon.hasTypeScript) {
1616
files.add('__addonLocation__/unpublished-development-types/index.d.ts');
@@ -21,7 +21,7 @@ function getFilesToSkip(options: Options): string[] {
2121
files.add('pnpm-workspace.yaml');
2222
}
2323

24-
return [...files] as string[];
24+
return Array.from(files);
2525
}
2626

2727
function resolveBlueprintFilePath(

src/migration/ember-addon/steps/create-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function analyzePackageManager(codemodOptions: CodemodOptions): PackageManager {
4545
['yarn.lock', 'yarn'],
4646
]);
4747

48-
const lockFiles = [...mapping.keys()];
48+
const lockFiles = Array.from(mapping.keys());
4949

5050
const filePaths = findFiles(unionize(lockFiles), {
5151
projectRoot,

src/migration/ember-addon/steps/move-project-root-files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function moveToAddonAndTestApp(options: Options): void {
4949
files.add('tsconfig.json');
5050
}
5151

52-
const filePaths = findFiles(unionize([...files]), {
52+
const filePaths = findFiles(unionize(Array.from(files)), {
5353
projectRoot,
5454
});
5555

src/migration/ember-addon/steps/update-addon-package-json.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,13 @@ function updateDevDependencies(
7272
packagesToInstall.delete('@rollup/plugin-babel');
7373
}
7474

75-
[...packagesToInstall].sort().forEach((packageName) => {
76-
const version = getVersion(packageName, options);
75+
Array.from(packagesToInstall)
76+
.sort()
77+
.forEach((packageName) => {
78+
const version = getVersion(packageName, options);
7779

78-
devDependencies.set(packageName, version);
79-
});
80+
devDependencies.set(packageName, version);
81+
});
8082

8183
packageJson['devDependencies'] = convertToObject(devDependencies);
8284
}

src/migration/ember-addon/steps/update-test-app-package-json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function moveDependenciesToDevDependencies(
2929
packagesToMove.add('ember-cli-typescript');
3030
}
3131

32-
[...packagesToMove]
32+
Array.from(packagesToMove)
3333
.filter((packageName) => dependencies.has(packageName))
3434
.sort()
3535
.forEach((packageName) => {

0 commit comments

Comments
 (0)