-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {renderConfirmationPrompt} from '@shopify/cli-kit/node/ui' | ||
Check failure on line 1 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L1
|
||
import {Workflow} from './registry.js' | ||
import {generateExtensionTemplate} from '../extension.js' | ||
import {generateExtensionPrompts} from '../../../prompts/generate/extension.js' | ||
Check failure on line 4 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L4
|
||
import {buildGenerateOptions, renderSuccessMessage, buildPromptOptions} from '../../generate.js' | ||
import {GenerateExtensionPromptOutput} from '../../../prompts/generate/extension.js' | ||
Check failure on line 6 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L6
Check failure on line 6 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L6
Check failure on line 6 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L6
|
||
|
||
export const discountDetailsFunctionSettingsCollection: Workflow = { | ||
afterGenerate: async (options) => { | ||
console.log('OPTIONS', options) | ||
Check failure on line 10 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L10
|
||
const {app, developerPlatformClient, remoteApp, specifications, template} = options.generateOptions | ||
Check failure on line 11 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L11
Check failure on line 11 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L11
|
||
|
||
const shouldCreateFunction = await renderConfirmationPrompt({ | ||
message: 'Would you like to create a function for this extension?', | ||
defaultValue: true, | ||
}) | ||
|
||
if (shouldCreateFunction) { | ||
// create a function extension | ||
const extensionTemplates = options.extensionTemplates.filter( | ||
(template) => | ||
template.identifier === 'shipping_discounts' || | ||
template.identifier === 'product_discounts' || | ||
template.identifier === 'order_discounts' || | ||
template.identifier == 'discounts_allocator', | ||
Check failure on line 25 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L25
|
||
) | ||
console.log('FUNCTION specs', specifications) | ||
Check failure on line 27 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L27
|
||
console.log('FUNCTION TEMPLATES', extensionTemplates) | ||
Check failure on line 28 in packages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts GitHub Actions / ESLint Report Analysispackages/app/src/cli/services/generate/workflows/discount-details-function-settings-collection.ts#L28
|
||
|
||
const promptOptions = await buildPromptOptions(extensionTemplates, specifications, app, options.generateOptions) | ||
const promptAnswers = await generateExtensionPrompts(promptOptions) | ||
|
||
const generateExtensionOptions = buildGenerateOptions( | ||
promptAnswers, | ||
app, | ||
options.generateOptions, | ||
developerPlatformClient, | ||
) | ||
const generatedExtension = await generateExtensionTemplate(generateExtensionOptions) | ||
renderSuccessMessage(generatedExtension, app.packageManager) | ||
} | ||
}, | ||
} |