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

modifying index.js file #4358

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions packages/create-pwa/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ const defaultSampleBackends = require('@magento/pwa-buildpack/sampleBackends.jso

const uniqBy = (array, property) => {
const map = new Map();

for (const element of array) {
if (element && element.hasOwnProperty(property)) {
map.set(element[property], element);
}
}

return Array.from(map.values());
};

Expand All @@ -32,7 +30,6 @@ const fetchSampleBackends = async () => {
'https://fvp0esmt8f.execute-api.us-east-1.amazonaws.com/default/getSampleBackends'
);
const { sampleBackends } = await res.json();

return sampleBackends.environments;
} catch {
return [];
Expand Down Expand Up @@ -129,14 +126,7 @@ module.exports = async () => {
default: 'https://magento2.localhost',
when: ({ backendUrl }) => !backendUrl
},
{
name: 'backendEdition',
type: 'list',
message:
'Edition of the magento store (Adobe Commerce or Magento Open Source)',
choices: ['AC', 'EE', 'MOS', 'CE'],
default: 'AC'
},
// Removed the question for backendEdition and set it directly
{
name: 'braintreeToken',
message:
Expand All @@ -163,6 +153,7 @@ module.exports = async () => {
answers = await inquirer.prompt(questions);

answers.backendUrl = answers.backendUrl || answers.customBackendUrl;

const args = questions.reduce(
(args, q) => {
if (q.name === 'customBackendUrl' || q.name === 'directory') {
Expand All @@ -184,6 +175,9 @@ module.exports = async () => {
['create-project', answers.directory]
);

// Set backendEdition directly without asking
args.push('--backend-edition', `"AC"`);

const argsString = args.join(' ');

console.log(
Expand Down
Loading