Skip to content

Commit

Permalink
Merge pull request #1035 from bertdeblock/remove-custom-find-by-name-…
Browse files Browse the repository at this point in the history
…util

Remove custom `findByName` util
  • Loading branch information
bertdeblock authored Dec 18, 2024
2 parents bfd124b + 892b1d9 commit d3b56f1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
3 changes: 1 addition & 2 deletions lib/commands/try-one.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const findByName = require('../utils/find-by-name');
const debug = require('debug')('ember-try:commands:try-one');

module.exports = {
Expand Down Expand Up @@ -50,7 +49,7 @@ module.exports = {

debug('Config: %s', JSON.stringify(config));

let scenario = findByName(config.scenarios, scenarioName);
let scenario = config.scenarios.find((s) => s.name === scenarioName);
if (!scenario) {
throw new Error(
'The `ember try:one` command requires a scenario ' + 'specified in the config.',
Expand Down
5 changes: 2 additions & 3 deletions lib/utils/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const path = require('path');
const fs = require('fs');
const { prefix, warn } = require('./console');
const findByName = require('./find-by-name');
const debug = require('debug')('ember-try:utils:config');

function getConfigPath(project) {
Expand Down Expand Up @@ -91,12 +90,12 @@ function mergeAutoConfigAndConfigFileData(autoConfig, configData) {
let conf = Object.assign({}, autoConfig, configData);

let overriddenScenarios = autoConfig.scenarios.map((scenario) => {
let overriddenScenario = findByName(configData.scenarios, scenario.name);
let overriddenScenario = configData.scenarios.find((s) => s.name === scenario.name);
return Object.assign({}, scenario, overriddenScenario);
});

let additionalScenarios = configData.scenarios.filter((scenario) => {
return !findByName(autoConfig.scenarios, scenario.name);
return !autoConfig.scenarios.find((s) => s.name === scenario.name);
});

conf.scenarios = [...overriddenScenarios, ...additionalScenarios];
Expand Down
10 changes: 0 additions & 10 deletions lib/utils/find-by-name.js

This file was deleted.

0 comments on commit d3b56f1

Please sign in to comment.