@shopify/shop-minis-cli 0.0.160 → 0.0.162

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/build/commands/create-mini/legacy/index.js +2 -6
  2. package/build/commands/create-mini/legacy/index.js.map +1 -1
  3. package/build/commands/create-mini/standalone/examples/with-camera-access/.eslintignore +1 -0
  4. package/build/commands/create-mini/standalone/examples/with-camera-access/.eslintrc.js +3 -0
  5. package/build/commands/create-mini/standalone/examples/with-camera-access/.graphqlrc.js +1 -0
  6. package/build/commands/create-mini/standalone/examples/with-camera-access/.prettierrc.json +8 -0
  7. package/build/commands/create-mini/standalone/examples/with-camera-access/README.md +30 -0
  8. package/build/commands/create-mini/standalone/examples/with-camera-access/assets.d.ts +14 -0
  9. package/build/commands/create-mini/standalone/examples/with-camera-access/babel.config.js +5 -0
  10. package/build/commands/create-mini/standalone/examples/with-camera-access/index.tsx +5 -0
  11. package/build/commands/create-mini/standalone/examples/with-camera-access/metro.config.js +3 -0
  12. package/build/commands/create-mini/standalone/examples/with-camera-access/package.json +33 -0
  13. package/build/commands/create-mini/standalone/examples/with-camera-access/src/App.tsx +152 -0
  14. package/build/commands/create-mini/standalone/examples/with-camera-access/src/index.tsx +9 -0
  15. package/build/commands/create-mini/standalone/examples/with-camera-access/src/manifest.json +5 -0
  16. package/build/commands/create-mini/standalone/examples/with-camera-access/tsconfig.json +41 -0
  17. package/build/commands/create-mini/standalone/examples/with-fal-ai/.eslintignore +1 -0
  18. package/build/commands/create-mini/standalone/examples/with-fal-ai/.eslintrc.js +3 -0
  19. package/build/commands/create-mini/standalone/examples/with-fal-ai/.graphqlrc.js +1 -0
  20. package/build/commands/create-mini/standalone/examples/with-fal-ai/.prettierrc.json +8 -0
  21. package/build/commands/create-mini/standalone/examples/with-fal-ai/README.md +46 -0
  22. package/build/commands/create-mini/standalone/examples/with-fal-ai/assets.d.ts +14 -0
  23. package/build/commands/create-mini/standalone/examples/with-fal-ai/babel.config.js +5 -0
  24. package/build/commands/create-mini/standalone/examples/with-fal-ai/index.tsx +5 -0
  25. package/build/commands/create-mini/standalone/examples/with-fal-ai/metro.config.js +3 -0
  26. package/build/commands/create-mini/standalone/examples/with-fal-ai/package.json +33 -0
  27. package/build/commands/create-mini/standalone/examples/with-fal-ai/src/App.tsx +5 -0
  28. package/build/commands/create-mini/standalone/examples/with-fal-ai/src/index.tsx +9 -0
  29. package/build/commands/create-mini/standalone/examples/with-fal-ai/src/manifest.json +21 -0
  30. package/build/commands/create-mini/standalone/examples/with-fal-ai/src/screens/HomeScreen.tsx +142 -0
  31. package/build/commands/create-mini/standalone/examples/with-fal-ai/tsconfig.json +41 -0
  32. package/build/commands/create-mini/standalone/examples/with-getting-started/README.md +18 -0
  33. package/build/commands/create-mini/standalone/examples/with-getting-started/package.json +3 -3
  34. package/build/commands/create-mini/standalone/examples/with-search/.eslintignore +1 -0
  35. package/build/commands/create-mini/standalone/examples/with-search/.eslintrc.js +3 -0
  36. package/build/commands/create-mini/standalone/examples/with-search/.graphqlrc.js +1 -0
  37. package/build/commands/create-mini/standalone/examples/with-search/.prettierrc.json +8 -0
  38. package/build/commands/create-mini/standalone/examples/with-search/README.md +25 -0
  39. package/build/commands/create-mini/standalone/examples/with-search/assets.d.ts +14 -0
  40. package/build/commands/create-mini/standalone/examples/with-search/babel.config.js +5 -0
  41. package/build/commands/create-mini/standalone/examples/with-search/index.tsx +5 -0
  42. package/build/commands/create-mini/standalone/examples/with-search/metro.config.js +3 -0
  43. package/build/commands/create-mini/standalone/examples/with-search/package.json +33 -0
  44. package/build/commands/create-mini/standalone/examples/with-search/src/App.tsx +23 -0
  45. package/build/commands/create-mini/standalone/examples/with-search/src/components/HeaderAction.tsx +32 -0
  46. package/build/commands/create-mini/standalone/examples/with-search/src/components/ShopCard.tsx +92 -0
  47. package/build/commands/create-mini/standalone/examples/with-search/src/index.tsx +9 -0
  48. package/build/commands/create-mini/standalone/examples/with-search/src/manifest.json +7 -0
  49. package/build/commands/create-mini/standalone/examples/with-search/src/screens/MerchantSearchScreen.tsx +126 -0
  50. package/build/commands/create-mini/standalone/examples/with-search/src/screens/ProductSearchScreen.tsx +115 -0
  51. package/build/commands/create-mini/standalone/examples/with-search/src/types/screens.ts +6 -0
  52. package/build/commands/create-mini/standalone/examples/with-search/tsconfig.json +41 -0
  53. package/build/commands/create-mini/standalone/examples/with-user-data/.eslintignore +1 -0
  54. package/build/commands/create-mini/standalone/examples/with-user-data/.eslintrc.js +3 -0
  55. package/build/commands/create-mini/standalone/examples/with-user-data/.graphqlrc.js +1 -0
  56. package/build/commands/create-mini/standalone/examples/with-user-data/.prettierrc.json +8 -0
  57. package/build/commands/create-mini/standalone/examples/with-user-data/README.md +26 -0
  58. package/build/commands/create-mini/standalone/examples/with-user-data/assets.d.ts +14 -0
  59. package/build/commands/create-mini/standalone/examples/with-user-data/babel.config.js +5 -0
  60. package/build/commands/create-mini/standalone/examples/with-user-data/index.tsx +5 -0
  61. package/build/commands/create-mini/standalone/examples/with-user-data/metro.config.js +3 -0
  62. package/build/commands/create-mini/standalone/examples/with-user-data/package.json +33 -0
  63. package/build/commands/create-mini/standalone/examples/with-user-data/src/App.tsx +5 -0
  64. package/build/commands/create-mini/standalone/examples/with-user-data/src/components/ProductSection.tsx +39 -0
  65. package/build/commands/create-mini/standalone/examples/with-user-data/src/components/SectionStyles.ts +9 -0
  66. package/build/commands/create-mini/standalone/examples/with-user-data/src/components/ShopCard.tsx +42 -0
  67. package/build/commands/create-mini/standalone/examples/with-user-data/src/components/ShopSection.tsx +40 -0
  68. package/build/commands/create-mini/standalone/examples/with-user-data/src/index.tsx +9 -0
  69. package/build/commands/create-mini/standalone/examples/with-user-data/src/manifest.json +10 -0
  70. package/build/commands/create-mini/standalone/examples/with-user-data/src/screens/HomeScreen.tsx +67 -0
  71. package/build/commands/create-mini/standalone/examples/with-user-data/tsconfig.json +41 -0
  72. package/build/commands/create-mini/standalone/index.js +13 -6
  73. package/build/commands/create-mini/standalone/index.js.map +1 -1
  74. package/build/commands/create-mini/utils/examples.d.ts +3 -3
  75. package/build/commands/create-mini/utils/examples.js +16 -7
  76. package/build/commands/create-mini/utils/examples.js.map +1 -1
  77. package/build/commands/create-mini/utils/index.d.ts +1 -0
  78. package/build/commands/create-mini/utils/index.js +9 -0
  79. package/build/commands/create-mini/utils/index.js.map +1 -1
  80. package/build/utils/package-manager.d.ts +7 -0
  81. package/build/utils/package-manager.js +15 -0
  82. package/build/utils/package-manager.js.map +1 -1
  83. package/package.json +1 -1
  84. package/scripts/test-create-mini-standalone.ts +24 -7
@@ -0,0 +1,115 @@
1
+ import {useMemo, useState} from 'react'
2
+ import {View, Text, TextInput, TouchableOpacity} from 'react-native'
3
+ import {
4
+ useProductSearch,
5
+ SafeAreaView,
6
+ ProductCardGrid,
7
+ TouchableProduct,
8
+ ProductCard,
9
+ } from '@shopify/shop-minis-sdk'
10
+ import debounce from 'lodash/debounce'
11
+
12
+ import {HeaderAction} from '../components/HeaderAction'
13
+
14
+ const LoadMoreButton = ({onPress}: {onPress: () => void}) => (
15
+ <View style={{marginTop: 16}}>
16
+ <TouchableOpacity
17
+ onPress={onPress}
18
+ style={{
19
+ backgroundColor: 'black',
20
+ padding: 12,
21
+ borderRadius: 12,
22
+ alignItems: 'center',
23
+ }}
24
+ >
25
+ <Text style={{color: 'white', fontWeight: '600'}}>Load more</Text>
26
+ </TouchableOpacity>
27
+ </View>
28
+ )
29
+
30
+ export function ProductSearchScreen() {
31
+ const [inputValue, setInputValue] = useState('')
32
+ const [query, setQuery] = useState('')
33
+
34
+ const debouncedSetQuery = useMemo(
35
+ () =>
36
+ debounce((text: string) => {
37
+ setQuery(text)
38
+ }, 300),
39
+ []
40
+ )
41
+
42
+ const {products, loadMore} = useProductSearch({
43
+ query,
44
+ first: 10,
45
+ filters: {
46
+ minimumRating: 4,
47
+ price: {
48
+ min: 150,
49
+ max: 250,
50
+ },
51
+ },
52
+ skip: !query,
53
+ })
54
+
55
+ return (
56
+ <SafeAreaView style={{flex: 1}}>
57
+ <View
58
+ style={{
59
+ flex: 1,
60
+ paddingHorizontal: 16,
61
+ marginBottom: 8,
62
+ backgroundColor: 'white',
63
+ }}
64
+ >
65
+ <View
66
+ style={{
67
+ flexDirection: 'row',
68
+ justifyContent: 'space-between',
69
+ alignItems: 'center',
70
+ marginBottom: 8,
71
+ marginTop: 4,
72
+ }}
73
+ >
74
+ <Text style={{fontSize: 20, fontWeight: 'bold'}}>
75
+ Search Products
76
+ </Text>
77
+
78
+ <HeaderAction />
79
+ </View>
80
+
81
+ <View>
82
+ <TextInput
83
+ placeholder="Search for..."
84
+ value={inputValue}
85
+ onChangeText={text => {
86
+ setInputValue(text)
87
+ debouncedSetQuery(text)
88
+ }}
89
+ style={{
90
+ borderWidth: 1,
91
+ borderColor: 'gray',
92
+ borderRadius: 5,
93
+ padding: 10,
94
+ }}
95
+ />
96
+ </View>
97
+
98
+ {products && products.length > 0 ? (
99
+ <View style={{flex: 1, marginTop: 16}}>
100
+ <ProductCardGrid
101
+ products={products}
102
+ renderItem={({product}) => (
103
+ <TouchableProduct product={product}>
104
+ <ProductCard key={product.id} product={product} />
105
+ </TouchableProduct>
106
+ )}
107
+ initialNumToRender={10}
108
+ ListFooterComponent={<LoadMoreButton onPress={loadMore} />}
109
+ />
110
+ </View>
111
+ ) : null}
112
+ </View>
113
+ </SafeAreaView>
114
+ )
115
+ }
@@ -0,0 +1,6 @@
1
+ import {ParamListBase} from '@react-navigation/native'
2
+
3
+ export interface RootStackParamList extends ParamListBase {
4
+ ProductSearch: undefined
5
+ MerchantSearch: undefined
6
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "*": [
6
+ "*",
7
+ "*.ios",
8
+ "*.android",
9
+ "./node_modules/@shopify/shop-minis-sdk/node_modules/*"
10
+ ]
11
+ },
12
+ "allowJs": true,
13
+ "resolveJsonModule": true,
14
+ "allowSyntheticDefaultImports": true,
15
+ "esModuleInterop": true,
16
+ "isolatedModules": false,
17
+ "jsx": "preserve",
18
+ "lib": ["es2019"],
19
+ "noUnusedParameters": true,
20
+ "noUnusedLocals": true,
21
+ "moduleResolution": "node",
22
+ "noEmit": true,
23
+ "incremental": true,
24
+ "strict": true,
25
+ "target": "esnext",
26
+ "skipLibCheck": true,
27
+ "noImplicitReturns": false,
28
+ "noFallthroughCasesInSwitch": true,
29
+ "allowUnreachableCode": false,
30
+ "allowUnusedLabels": false,
31
+ "noImplicitAny": true,
32
+ "strictNullChecks": true,
33
+ "strictFunctionTypes": true,
34
+ "strictBindCallApply": true,
35
+ "strictPropertyInitialization": true,
36
+ "noImplicitThis": true,
37
+ "alwaysStrict": true,
38
+ "useUnknownInCatchVariables": false
39
+ },
40
+ "exclude": ["node_modules"]
41
+ }
@@ -0,0 +1,3 @@
1
+ const {minisEslintConfig} = require('@shopify/shop-minis-sdk/eslint-config')
2
+
3
+ module.exports = minisEslintConfig
@@ -0,0 +1 @@
1
+ module.exports = require('@shopify/shop-minis-sdk/graphqlrc')
@@ -0,0 +1,8 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "trailingComma": "es5",
5
+ "arrowParens": "avoid",
6
+ "bracketSpacing": false,
7
+ "printWidth": 80
8
+ }
@@ -0,0 +1,26 @@
1
+ # Show Buyers's data
2
+
3
+ A Shop Mini that show user's recently viewed and followed stores and recently viewed and saved products
4
+
5
+ ## Features
6
+
7
+ - Fetches user's data using the Shop Minis Platform SDK
8
+ - Gets user's recently viewed and followed stores and recently viewed and saved products
9
+ - Displays horizontal scrollable lists of products and shops
10
+ - Shows product cards with images and details
11
+ - Shows shop cards with logos and names
12
+
13
+ ## Setup
14
+
15
+ 1. Run the development server:
16
+ ```bash
17
+ npm start
18
+ ```
19
+
20
+ ## Development
21
+
22
+ This mini is built using:
23
+
24
+ - React Native
25
+ - TypeScript
26
+ - Shop Minis SDK
@@ -0,0 +1,14 @@
1
+ declare module '*.svg' {
2
+ const content: import('react').FC<import('react-native-svg').SvgProps>
3
+ export default content
4
+ }
5
+
6
+ declare module '*.png' {
7
+ const content: import('react-native').ImageRequireSource
8
+ export default content
9
+ }
10
+
11
+ declare module '*.jpg' {
12
+ const content: import('react-native').ImageRequireSource
13
+ export default content
14
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ // Changes to babel config are not supported by the mini platform.
3
+ // Custom configuration can introduce unexpected behaviour in your mini and could be a cause of rejection during the submission process.
4
+ presets: ['@shopify/shop-minis-sdk/babel-preset'],
5
+ }
@@ -0,0 +1,5 @@
1
+ import {renderDevelopmentMini} from '@shopify/shop-minis-sdk/src/renderDevelopmentMini'
2
+
3
+ import MiniApp from './src'
4
+
5
+ renderDevelopmentMini(MiniApp)
@@ -0,0 +1,3 @@
1
+ const {getMinisMetroConfig} = require('@shopify/shop-minis-sdk/metro-config')
2
+
3
+ module.exports = getMinisMetroConfig(__dirname)
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "with-user-data",
3
+ "version": "0.0.1",
4
+ "private": true,
5
+ "scripts": {
6
+ "start": "shop-minis dev",
7
+ "test": "jest",
8
+ "lint": "eslint ."
9
+ },
10
+ "dependencies": {
11
+ "@shopify/shop-minis-sdk": "0.0.16"
12
+ },
13
+ "devDependencies": {
14
+ "@shopify/shop-minis-cli": "0.0.161",
15
+ "@types/jest": "^29.2.6",
16
+ "babel-jest": "^26.6.3",
17
+ "eslint": "^8.32.0",
18
+ "jest": "^29.3.1",
19
+ "prettier": "^2.8.2"
20
+ },
21
+ "jest": {
22
+ "preset": "react-native"
23
+ },
24
+ "overrides": {
25
+ "graphql": "15.8.0",
26
+ "react": "18.2.0",
27
+ "react-native": "0.73.2"
28
+ },
29
+ "resolutions": {
30
+ "@apollo/federation": "0.38.1",
31
+ "graphql": "15.8.0"
32
+ }
33
+ }
@@ -0,0 +1,5 @@
1
+ import {HomeScreen} from './screens/HomeScreen'
2
+
3
+ export function App() {
4
+ return <HomeScreen />
5
+ }
@@ -0,0 +1,39 @@
1
+ import {View, Text, FlatList} from 'react-native'
2
+ import {Product, ProductCard} from '@shopify/shop-minis-sdk'
3
+ import {useCallback} from 'react'
4
+
5
+ import {styles} from './SectionStyles'
6
+
7
+ interface ProductSectionProps {
8
+ title: string
9
+ products: Product[]
10
+ }
11
+
12
+ export function ProductSection({title, products}: ProductSectionProps) {
13
+ const renderItem = useCallback(
14
+ ({item}: {item: Product}) => (
15
+ <View style={{width: 160, marginHorizontal: 6}}>
16
+ <ProductCard key={item.id} product={item} />
17
+ </View>
18
+ ),
19
+ []
20
+ )
21
+
22
+ return (
23
+ <>
24
+ <Text style={styles.title}>{title}</Text>
25
+ <View>
26
+ {products === undefined ? (
27
+ <Text>Loading...</Text>
28
+ ) : (
29
+ <FlatList
30
+ data={products}
31
+ renderItem={renderItem}
32
+ horizontal
33
+ showsHorizontalScrollIndicator={false}
34
+ />
35
+ )}
36
+ </View>
37
+ </>
38
+ )
39
+ }
@@ -0,0 +1,9 @@
1
+ import {StyleSheet} from 'react-native'
2
+
3
+ export const styles = StyleSheet.create({
4
+ title: {
5
+ marginVertical: 10,
6
+ fontSize: 24,
7
+ fontWeight: 'bold',
8
+ },
9
+ })
@@ -0,0 +1,42 @@
1
+ import {View, Text, StyleSheet, Pressable} from 'react-native'
2
+ import {Shop, Image} from '@shopify/shop-minis-sdk'
3
+
4
+ export function ShopCard({shop}: {shop: Shop}) {
5
+ return (
6
+ <Pressable style={styles.container}>
7
+ {shop.logoImage ? (
8
+ <Image
9
+ source={{uri: shop.logoImage.url}}
10
+ style={styles.image}
11
+ resizeMode="cover"
12
+ />
13
+ ) : null}
14
+ <View style={styles.details}>
15
+ <Text style={styles.name} numberOfLines={2}>
16
+ {shop.name}
17
+ </Text>
18
+ </View>
19
+ </Pressable>
20
+ )
21
+ }
22
+
23
+ const styles = StyleSheet.create({
24
+ container: {
25
+ flex: 1,
26
+ borderRadius: 8,
27
+ backgroundColor: '#fff',
28
+ overflow: 'hidden',
29
+ },
30
+ image: {
31
+ resizeMode: 'contain',
32
+ height: 120,
33
+ width: 120,
34
+ },
35
+ details: {
36
+ padding: 8,
37
+ },
38
+ name: {
39
+ fontSize: 14,
40
+ fontWeight: '600',
41
+ },
42
+ })
@@ -0,0 +1,40 @@
1
+ import {View, Text, FlatList} from 'react-native'
2
+ import {Shop} from '@shopify/shop-minis-sdk'
3
+ import {useCallback} from 'react'
4
+
5
+ import {ShopCard} from './ShopCard'
6
+ import {styles} from './SectionStyles'
7
+
8
+ interface ShopSectionProps {
9
+ title: string
10
+ shops: Shop[]
11
+ }
12
+
13
+ export function ShopSection({title, shops}: ShopSectionProps) {
14
+ const renderItem = useCallback(
15
+ ({item}: {item: Shop}) => (
16
+ <View style={{marginHorizontal: 6}}>
17
+ <ShopCard key={item.id} shop={item} />
18
+ </View>
19
+ ),
20
+ []
21
+ )
22
+
23
+ return (
24
+ <>
25
+ <Text style={styles.title}>{title}</Text>
26
+ <View>
27
+ {shops === undefined ? (
28
+ <Text>Loading...</Text>
29
+ ) : (
30
+ <FlatList
31
+ data={shops}
32
+ renderItem={renderItem}
33
+ horizontal
34
+ showsHorizontalScrollIndicator={false}
35
+ />
36
+ )}
37
+ </View>
38
+ </>
39
+ )
40
+ }
@@ -0,0 +1,9 @@
1
+ import {MiniAppConfig} from '@shopify/shop-minis-sdk'
2
+
3
+ import {App} from './App'
4
+
5
+ const config: MiniAppConfig = {
6
+ ViewerRoot: App,
7
+ }
8
+
9
+ export default config
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "with-user-data",
3
+ "features": [
4
+ "FULL_BLEED_VIEWER",
5
+ "STANDALONE"
6
+ ],
7
+ "trusted_domains": [
8
+ "proxy.shopify.ai"
9
+ ]
10
+ }
@@ -0,0 +1,67 @@
1
+ import {ScrollView, View, StyleSheet} from 'react-native'
2
+ import {
3
+ SafeAreaView,
4
+ useRecentProducts,
5
+ useSavedProducts,
6
+ useRecentShops,
7
+ useFollowedShops,
8
+ } from '@shopify/shop-minis-sdk'
9
+
10
+ import {ProductSection} from '../components/ProductSection'
11
+ import {ShopSection} from '../components/ShopSection'
12
+
13
+ function RecentProducts() {
14
+ const {products} = useRecentProducts({first: 10})
15
+ return products ? (
16
+ <ProductSection title="Recently Viewed Products" products={products} />
17
+ ) : null
18
+ }
19
+
20
+ function SavedProducts() {
21
+ const {products} = useSavedProducts({first: 10})
22
+ return products ? (
23
+ <ProductSection title="Saved Products" products={products} />
24
+ ) : null
25
+ }
26
+
27
+ function RecentShops() {
28
+ const {shops} = useRecentShops({first: 10})
29
+ return <ShopSection title="Recent Shops" shops={shops} />
30
+ }
31
+
32
+ function FollowedShops() {
33
+ const {shops} = useFollowedShops({first: 10})
34
+ return <ShopSection title="Followed Shops" shops={shops} />
35
+ }
36
+
37
+ export function HomeScreen() {
38
+ return (
39
+ <SafeAreaView>
40
+ <ScrollView>
41
+ <View style={styles.container}>
42
+ <View style={styles.main}>
43
+ <RecentProducts />
44
+ <SavedProducts />
45
+ <RecentShops />
46
+ <FollowedShops />
47
+ </View>
48
+ </View>
49
+ </ScrollView>
50
+ </SafeAreaView>
51
+ )
52
+ }
53
+
54
+ const styles = StyleSheet.create({
55
+ container: {
56
+ flex: 1,
57
+ alignItems: 'stretch',
58
+ justifyContent: 'center',
59
+ marginHorizontal: 'auto',
60
+ },
61
+ main: {
62
+ gap: 8,
63
+ justifyContent: 'center',
64
+ alignItems: 'stretch',
65
+ paddingHorizontal: 12,
66
+ },
67
+ })
@@ -0,0 +1,41 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "*": [
6
+ "*",
7
+ "*.ios",
8
+ "*.android",
9
+ "./node_modules/@shopify/shop-minis-sdk/node_modules/*"
10
+ ]
11
+ },
12
+ "allowJs": true,
13
+ "resolveJsonModule": true,
14
+ "allowSyntheticDefaultImports": true,
15
+ "esModuleInterop": true,
16
+ "isolatedModules": false,
17
+ "jsx": "preserve",
18
+ "lib": ["es2019"],
19
+ "noUnusedParameters": true,
20
+ "noUnusedLocals": true,
21
+ "moduleResolution": "node",
22
+ "noEmit": true,
23
+ "incremental": true,
24
+ "strict": true,
25
+ "target": "esnext",
26
+ "skipLibCheck": true,
27
+ "noImplicitReturns": false,
28
+ "noFallthroughCasesInSwitch": true,
29
+ "allowUnreachableCode": false,
30
+ "allowUnusedLabels": false,
31
+ "noImplicitAny": true,
32
+ "strictNullChecks": true,
33
+ "strictFunctionTypes": true,
34
+ "strictBindCallApply": true,
35
+ "strictPropertyInitialization": true,
36
+ "noImplicitThis": true,
37
+ "alwaysStrict": true,
38
+ "useUnknownInCatchVariables": false
39
+ },
40
+ "exclude": ["node_modules"]
41
+ }
@@ -7,9 +7,10 @@ import chalk from 'chalk';
7
7
  import { copy } from 'fs-extra';
8
8
  import { exec } from '@shopify/cli-kit/node/system';
9
9
  import { packageManagerFromUserAgent } from '@shopify/cli-kit/node/node-package-manager';
10
- import { getHandleFromName, getOutputDirectory } from '../utils/index.js';
10
+ import { outputDebug } from '@shopify/cli-kit/node/output';
11
+ import { getCdCommandPath, getHandleFromName, getOutputDirectory, } from '../utils/index.js';
11
12
  import { generateMiniFromLocalExample } from '../utils/examples.js';
12
- import { getRunBinCommand } from '../../../utils/package-manager.js';
13
+ import { getRunDevModeCommand } from '../../../utils/package-manager.js';
13
14
  export function loadCommand(parentProgram) {
14
15
  const command = new Command()
15
16
  .name('create')
@@ -21,8 +22,10 @@ export function loadCommand(parentProgram) {
21
22
  .option('--legacy', 'Use legacy create command') // TODO: Only used to keep commander happy
22
23
  .action(async (miniNameArg, options = {}) => {
23
24
  try {
25
+ outputDebug(`create mini input: name=${miniNameArg} options=${JSON.stringify(options)}`);
24
26
  let miniName = miniNameArg;
25
27
  const outputDir = getOutputDirectory(options.outputDir);
28
+ outputDebug(`create mini outputDir: ${outputDir}`);
26
29
  if (!existsSync(outputDir)) {
27
30
  renderError({
28
31
  headline: 'Error creating mini',
@@ -41,6 +44,7 @@ export function loadCommand(parentProgram) {
41
44
  miniName = miniNameArg;
42
45
  }
43
46
  else {
47
+ // eslint-disable-next-line require-atomic-updates
44
48
  miniName = await renderTextPrompt({
45
49
  message: `Give your Shop Mini a name. ${chalk.dim('You can change it later.')}`,
46
50
  });
@@ -49,11 +53,14 @@ export function loadCommand(parentProgram) {
49
53
  const miniHandle = getHandleFromName(miniName);
50
54
  const miniDirPath = path.resolve(outputDir, miniHandle);
51
55
  const example = options.example ?? 'with-getting-started';
56
+ outputDebug(`create mini miniHandle: ${miniHandle}`);
57
+ outputDebug(`create mini miniDirPath: ${miniDirPath}`);
58
+ outputDebug(`create mini example: ${example}`);
52
59
  await renderTasks([
53
60
  {
54
61
  title: 'Fetching example',
55
62
  task: async () => {
56
- const miniTmpDirPath = await generateMiniFromLocalExample(miniHandle, example);
63
+ const miniTmpDirPath = await generateMiniFromLocalExample(`${miniName}`, miniHandle, example);
57
64
  await copy(miniTmpDirPath, miniDirPath);
58
65
  },
59
66
  },
@@ -75,7 +82,7 @@ export function loadCommand(parentProgram) {
75
82
  await exec(useYarn ? 'yarn' : 'npx', [
76
83
  'patch-package',
77
84
  '--patch-dir',
78
- 'node_modules/@shopify/shop-minis-runtime/patches',
85
+ 'node_modules/@shopify/shop-minis-sdk/patches',
79
86
  ], { cwd: miniDirPath });
80
87
  },
81
88
  },
@@ -87,13 +94,13 @@ export function loadCommand(parentProgram) {
87
94
  [
88
95
  "Change to your mini's directory",
89
96
  {
90
- command: `cd ${path.relative(process.cwd(), miniDirPath)}`,
97
+ command: `cd ${getCdCommandPath(outputDir, miniHandle)}`,
91
98
  },
92
99
  ],
93
100
  [
94
101
  'Run your Shop Mini',
95
102
  {
96
- command: await getRunBinCommand('start'),
103
+ command: await getRunDevModeCommand(),
97
104
  },
98
105
  ],
99
106
  [
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/create-mini/standalone/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,C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AAC,kBAAkB,CAAC,EAAE,EAAC,GAAG,EAAE,WAAW,EAAC,CAAC,CAAA;yBAC7D;6BAAM;4BACL,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,EAAC,GAAG,EAAE,WAAW,EAAC,CAAC,CAAA;yBACxD;wBAED,MAAM,IAAI,CACR,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EACxB;4BACE,eAAe;4BACf,aAAa;4BACb,kDAAkD;yBACnD,EACD,EAAC,GAAG,EAAE,WAAW,EAAC,CACnB,CAAA;oBACH,CAAC;iBACF;aACF,CAAC,CAAA;YAEF,aAAa,CAAC;gBACZ,QAAQ,EAAE,mBAAmB;gBAC7B,IAAI,EAAE,CAAC,iCAAiC,CAAC;gBACzC,SAAS,EAAE;oBACT;wBACE,iCAAiC;wBACjC;4BACE,OAAO,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,EAAE;yBAC3D;qBACF;oBACD;wBACE,oBAAoB;wBACpB;4BACE,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,CAAC;yBACzC;qBACF;oBACD;wBACE,oBAAoB;wBACpB;4BACE,IAAI,EAAE,8BAA8B;yBACrC;qBACF;iBACF;aACF,CAAC,CAAA;SACH;QAAC,OAAO,KAAU,EAAE;YACnB,WAAW,CAAC,KAAK,CAAC,CAAA;YAElB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;SAChB;IACH,CAAC,CACF,CAAA;IAEH,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/create-mini/standalone/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,IAAI,CAAA;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,EAAC,O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,CAAC,CAAC,CAAA;SAChB;IACH,CAAC,CACF,CAAA;IAEH,aAAa,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
@@ -2,6 +2,6 @@ export declare function cloneShopMinisRepo({ branch, }?: {
2
2
  branch?: string;
3
3
  }): Promise<string>;
4
4
  export declare function getExample(examplesDir: string, exampleName: string): Promise<string>;
5
- export declare function generateMiniFromShopMinisExample(handle: string, exampleName: string): Promise<string>;
6
- export declare function generateMiniFromLocalExample(handle: string, exampleName: string): Promise<string>;
7
- export declare function generateMiniFromExample(handle: string, examplePath: string): Promise<string>;
5
+ export declare function generateMiniFromShopMinisExample(name: string, handle: string, exampleName: string): Promise<string>;
6
+ export declare function generateMiniFromLocalExample(name: string, handle: string, exampleName: string): Promise<string>;
7
+ export declare function generateMiniFromExample(name: string, handle: string, examplePath: string): Promise<string>;