Skip to content

Commit f64195e

Browse files
committed
Use the latest patch version when generating function
1 parent b60dff9 commit f64195e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/app/src/cli/services/function/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {runWithTimer} from '@shopify/cli-kit/node/metadata'
1717
import {AbortError} from '@shopify/cli-kit/node/error'
1818
import {Writable} from 'stream'
1919

20-
const SHOPIFY_FUNCTION_NPM_PACKAGE_MAJOR_VERSION = '1'
20+
export const SHOPIFY_FUNCTION_NPM_PACKAGE_MAJOR_VERSION = '1'
2121

2222
class InvalidShopifyFunctionPackageError extends AbortError {
2323
constructor(message: string) {

packages/app/src/cli/services/generate/extension.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {configurationFileNames, versions} from '../../constants.js'
22
import {AppInterface} from '../../models/app/app.js'
3-
import {buildGraphqlTypes} from '../function/build.js'
3+
import {buildGraphqlTypes, SHOPIFY_FUNCTION_NPM_PACKAGE_MAJOR_VERSION} from '../function/build.js'
44
import {GenerateExtensionContentOutput} from '../../prompts/generate/extension.js'
55
import {ExtensionFlavor, ExtensionTemplate} from '../../models/app/template.js'
66
import {ensureDownloadedExtensionFlavorExists, ensureExtensionDirectoryExists} from '../extensions/common.js'
@@ -299,7 +299,10 @@ function getSrcFileExtension(extensionFlavor: ExtensionFlavorValue): SrcFileExte
299299
export function getFunctionRuntimeDependencies(templateLanguage: string): DependencyVersion[] {
300300
const dependencies: DependencyVersion[] = []
301301
if (templateLanguage === 'javascript') {
302-
dependencies.push({name: '@shopify/shopify_function', version: '1.0.0'})
302+
dependencies.push({
303+
name: '@shopify/shopify_function',
304+
version: `~${SHOPIFY_FUNCTION_NPM_PACKAGE_MAJOR_VERSION}.0.0`,
305+
})
303306
}
304307
return dependencies
305308
}

0 commit comments

Comments
 (0)