@shopify/shop-minis-cli 0.0.0-hackathon.20250221160544
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.
- package/.eslintrc.cjs +78 -0
- package/LICENSE +21 -0
- package/README.md +8 -0
- package/README_INTERNAL.md +114 -0
- package/build/commands/app/index.d.ts +2 -0
- package/build/commands/app/index.js +14 -0
- package/build/commands/app/index.js.map +1 -0
- package/build/commands/app/link.d.ts +2 -0
- package/build/commands/app/link.js +65 -0
- package/build/commands/app/link.js.map +1 -0
- package/build/commands/app/list.d.ts +2 -0
- package/build/commands/app/list.js +45 -0
- package/build/commands/app/list.js.map +1 -0
- package/build/commands/app/unlink.d.ts +2 -0
- package/build/commands/app/unlink.js +55 -0
- package/build/commands/app/unlink.js.map +1 -0
- package/build/commands/cancel-submission/cancel-submission.d.ts +1 -0
- package/build/commands/cancel-submission/cancel-submission.js +59 -0
- package/build/commands/cancel-submission/cancel-submission.js.map +1 -0
- package/build/commands/cancel-submission/index.d.ts +2 -0
- package/build/commands/cancel-submission/index.js +18 -0
- package/build/commands/cancel-submission/index.js.map +1 -0
- package/build/commands/cancel-submission/types.d.ts +3 -0
- package/build/commands/cancel-submission/types.js +2 -0
- package/build/commands/cancel-submission/types.js.map +1 -0
- package/build/commands/check-submission/index.d.ts +2 -0
- package/build/commands/check-submission/index.js +55 -0
- package/build/commands/check-submission/index.js.map +1 -0
- package/build/commands/check-submission/types.d.ts +3 -0
- package/build/commands/check-submission/types.js +2 -0
- package/build/commands/check-submission/types.js.map +1 -0
- package/build/commands/codemod/index.d.ts +3 -0
- package/build/commands/codemod/index.js +47 -0
- package/build/commands/codemod/index.js.map +1 -0
- package/build/commands/codemod/releases/index.d.ts +7 -0
- package/build/commands/codemod/releases/index.js +97 -0
- package/build/commands/codemod/releases/index.js.map +1 -0
- package/build/commands/codemod/releases/types.d.ts +9 -0
- package/build/commands/codemod/releases/types.js +2 -0
- package/build/commands/codemod/releases/types.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-100.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-100.js +50 -0
- package/build/commands/codemod/releases/v0-0-100.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-103.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-103.js +43 -0
- package/build/commands/codemod/releases/v0-0-103.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-105.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-105.js +59 -0
- package/build/commands/codemod/releases/v0-0-105.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-106.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-106.js +32 -0
- package/build/commands/codemod/releases/v0-0-106.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-114.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-114.js +48 -0
- package/build/commands/codemod/releases/v0-0-114.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-115.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-115.js +50 -0
- package/build/commands/codemod/releases/v0-0-115.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-121.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-121.js +74 -0
- package/build/commands/codemod/releases/v0-0-121.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-123.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-123.js +33 -0
- package/build/commands/codemod/releases/v0-0-123.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-125.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-125.js +37 -0
- package/build/commands/codemod/releases/v0-0-125.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-130.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-130.js +26 -0
- package/build/commands/codemod/releases/v0-0-130.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-139.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-139.js +26 -0
- package/build/commands/codemod/releases/v0-0-139.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-42/index.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-42/index.js +46 -0
- package/build/commands/codemod/releases/v0-0-42/index.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-42/reset-files.d.ts +7 -0
- package/build/commands/codemod/releases/v0-0-42/reset-files.js +83 -0
- package/build/commands/codemod/releases/v0-0-42/reset-files.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-43.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-43.js +32 -0
- package/build/commands/codemod/releases/v0-0-43.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-44.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-44.js +214 -0
- package/build/commands/codemod/releases/v0-0-44.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-45.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-45.js +23 -0
- package/build/commands/codemod/releases/v0-0-45.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-50.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-50.js +34 -0
- package/build/commands/codemod/releases/v0-0-50.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-54.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-54.js +70 -0
- package/build/commands/codemod/releases/v0-0-54.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-56.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-56.js +48 -0
- package/build/commands/codemod/releases/v0-0-56.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-57.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-57.js +41 -0
- package/build/commands/codemod/releases/v0-0-57.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-58.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-58.js +68 -0
- package/build/commands/codemod/releases/v0-0-58.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-61.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-61.js +30 -0
- package/build/commands/codemod/releases/v0-0-61.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-63.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-63.js +42 -0
- package/build/commands/codemod/releases/v0-0-63.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-64.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-64.js +47 -0
- package/build/commands/codemod/releases/v0-0-64.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-75.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-75.js +30 -0
- package/build/commands/codemod/releases/v0-0-75.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-76.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-76.js +32 -0
- package/build/commands/codemod/releases/v0-0-76.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-77.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-77.js +39 -0
- package/build/commands/codemod/releases/v0-0-77.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-79.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-79.js +35 -0
- package/build/commands/codemod/releases/v0-0-79.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-84.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-84.js +41 -0
- package/build/commands/codemod/releases/v0-0-84.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-85.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-85.js +60 -0
- package/build/commands/codemod/releases/v0-0-85.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-89.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-89.js +60 -0
- package/build/commands/codemod/releases/v0-0-89.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-91/index.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-91/index.js +38 -0
- package/build/commands/codemod/releases/v0-0-91/index.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-91/replace-dev-wrapper.d.ts +5 -0
- package/build/commands/codemod/releases/v0-0-91/replace-dev-wrapper.js +45 -0
- package/build/commands/codemod/releases/v0-0-91/replace-dev-wrapper.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-91/replace-safe-area-imports.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-91/replace-safe-area-imports.js +97 -0
- package/build/commands/codemod/releases/v0-0-91/replace-safe-area-imports.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-92.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-92.js +38 -0
- package/build/commands/codemod/releases/v0-0-92.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-after.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-after.js +15 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-after.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-before.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-before.js +13 -0
- package/build/commands/codemod/releases/v0-0-93/blank/App-before.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/index.d.ts +6 -0
- package/build/commands/codemod/releases/v0-0-93/index.js +7 -0
- package/build/commands/codemod/releases/v0-0-93/index.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.js +53 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-after.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.js +43 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-posts/App-before.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.js +49 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-after.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.js +42 -0
- package/build/commands/codemod/releases/v0-0-93/shoppable-videos/App-before.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-93.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-93.js +48 -0
- package/build/commands/codemod/releases/v0-0-93.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-97/index.d.ts +3 -0
- package/build/commands/codemod/releases/v0-0-97/index.js +20 -0
- package/build/commands/codemod/releases/v0-0-97/index.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-97/migrate-to-new-theme.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-97/migrate-to-new-theme.js +47 -0
- package/build/commands/codemod/releases/v0-0-97/migrate-to-new-theme.js.map +1 -0
- package/build/commands/codemod/releases/v0-0-97/remove-theme-from-config.d.ts +1 -0
- package/build/commands/codemod/releases/v0-0-97/remove-theme-from-config.js +105 -0
- package/build/commands/codemod/releases/v0-0-97/remove-theme-from-config.js.map +1 -0
- package/build/commands/config.d.ts +17 -0
- package/build/commands/config.js +45 -0
- package/build/commands/config.js.map +1 -0
- package/build/commands/create-extension/constants.d.ts +44 -0
- package/build/commands/create-extension/constants.js +111 -0
- package/build/commands/create-extension/constants.js.map +1 -0
- package/build/commands/create-extension/index.d.ts +2 -0
- package/build/commands/create-extension/index.js +68 -0
- package/build/commands/create-extension/index.js.map +1 -0
- package/build/commands/create-extension/types.d.ts +13 -0
- package/build/commands/create-extension/types.js +8 -0
- package/build/commands/create-extension/types.js.map +1 -0
- package/build/commands/create-extension/utils/add-target-to-config.d.ts +2 -0
- package/build/commands/create-extension/utils/add-target-to-config.js +48 -0
- package/build/commands/create-extension/utils/add-target-to-config.js.map +1 -0
- package/build/commands/create-extension/utils/create-extension-files.d.ts +11 -0
- package/build/commands/create-extension/utils/create-extension-files.js +96 -0
- package/build/commands/create-extension/utils/create-extension-files.js.map +1 -0
- package/build/commands/create-extension/utils/create-from-template.d.ts +3 -0
- package/build/commands/create-extension/utils/create-from-template.js +47 -0
- package/build/commands/create-extension/utils/create-from-template.js.map +1 -0
- package/build/commands/create-extension/utils/format-extension-files.d.ts +1 -0
- package/build/commands/create-extension/utils/format-extension-files.js +22 -0
- package/build/commands/create-extension/utils/format-extension-files.js.map +1 -0
- package/build/commands/create-mini/index.d.ts +2 -0
- package/build/commands/create-mini/index.js +182 -0
- package/build/commands/create-mini/index.js.map +1 -0
- package/build/commands/create-mini/utils/examples.d.ts +4 -0
- package/build/commands/create-mini/utils/examples.js +44 -0
- package/build/commands/create-mini/utils/examples.js.map +1 -0
- package/build/commands/create-mini/utils/template-app.d.ts +2 -0
- package/build/commands/create-mini/utils/template-app.js +86 -0
- package/build/commands/create-mini/utils/template-app.js.map +1 -0
- package/build/commands/dev/index.d.ts +13 -0
- package/build/commands/dev/index.js +95 -0
- package/build/commands/dev/index.js.map +1 -0
- package/build/commands/dev/utils/android.d.ts +18 -0
- package/build/commands/dev/utils/android.js +158 -0
- package/build/commands/dev/utils/android.js.map +1 -0
- package/build/commands/dev/utils/app-screens.d.ts +9 -0
- package/build/commands/dev/utils/app-screens.js +170 -0
- package/build/commands/dev/utils/app-screens.js.map +1 -0
- package/build/commands/dev/utils/binaries.d.ts +5 -0
- package/build/commands/dev/utils/binaries.js +17 -0
- package/build/commands/dev/utils/binaries.js.map +1 -0
- package/build/commands/dev/utils/build-type.d.ts +2 -0
- package/build/commands/dev/utils/build-type.js +14 -0
- package/build/commands/dev/utils/build-type.js.map +1 -0
- package/build/commands/dev/utils/cache-cleanup.d.ts +1 -0
- package/build/commands/dev/utils/cache-cleanup.js +45 -0
- package/build/commands/dev/utils/cache-cleanup.js.map +1 -0
- package/build/commands/dev/utils/deeplink.d.ts +22 -0
- package/build/commands/dev/utils/deeplink.js +70 -0
- package/build/commands/dev/utils/deeplink.js.map +1 -0
- package/build/commands/dev/utils/env-config.d.ts +2 -0
- package/build/commands/dev/utils/env-config.js +47 -0
- package/build/commands/dev/utils/env-config.js.map +1 -0
- package/build/commands/dev/utils/interactive-terminal.d.ts +25 -0
- package/build/commands/dev/utils/interactive-terminal.js +244 -0
- package/build/commands/dev/utils/interactive-terminal.js.map +1 -0
- package/build/commands/dev/utils/metro/metro-config.d.ts +2 -0
- package/build/commands/dev/utils/metro/metro-config.js +27 -0
- package/build/commands/dev/utils/metro/metro-config.js.map +1 -0
- package/build/commands/dev/utils/metro/metro-minis-module-resolver.d.ts +6 -0
- package/build/commands/dev/utils/metro/metro-minis-module-resolver.js +11 -0
- package/build/commands/dev/utils/metro/metro-minis-module-resolver.js.map +1 -0
- package/build/commands/dev/utils/metro/metro-reporter.d.ts +21 -0
- package/build/commands/dev/utils/metro/metro-reporter.js +46 -0
- package/build/commands/dev/utils/metro/metro-reporter.js.map +1 -0
- package/build/commands/dev/utils/metro/metro-server-middleware.d.ts +10 -0
- package/build/commands/dev/utils/metro/metro-server-middleware.js +74 -0
- package/build/commands/dev/utils/metro/metro-server-middleware.js.map +1 -0
- package/build/commands/dev/utils/metro/metro-server.d.ts +6 -0
- package/build/commands/dev/utils/metro/metro-server.js +26 -0
- package/build/commands/dev/utils/metro/metro-server.js.map +1 -0
- package/build/commands/dev/utils/network.d.ts +20 -0
- package/build/commands/dev/utils/network.js +129 -0
- package/build/commands/dev/utils/network.js.map +1 -0
- package/build/commands/dev/utils/platform.d.ts +18 -0
- package/build/commands/dev/utils/platform.js +41 -0
- package/build/commands/dev/utils/platform.js.map +1 -0
- package/build/commands/dev/utils/prompt-binary-upgrade.d.ts +1 -0
- package/build/commands/dev/utils/prompt-binary-upgrade.js +12 -0
- package/build/commands/dev/utils/prompt-binary-upgrade.js.map +1 -0
- package/build/commands/dev/utils/react-native-version.d.ts +4 -0
- package/build/commands/dev/utils/react-native-version.js +23 -0
- package/build/commands/dev/utils/react-native-version.js.map +1 -0
- package/build/commands/dev/utils/simulator.d.ts +22 -0
- package/build/commands/dev/utils/simulator.js +113 -0
- package/build/commands/dev/utils/simulator.js.map +1 -0
- package/build/commands/dev/utils/start-app/config.d.ts +5 -0
- package/build/commands/dev/utils/start-app/config.js +24 -0
- package/build/commands/dev/utils/start-app/config.js.map +1 -0
- package/build/commands/dev/utils/start-app/start-app-with-options.d.ts +3 -0
- package/build/commands/dev/utils/start-app/start-app-with-options.js +95 -0
- package/build/commands/dev/utils/start-app/start-app-with-options.js.map +1 -0
- package/build/commands/dev/utils/start-app/start-app.d.ts +3 -0
- package/build/commands/dev/utils/start-app/start-app.js +10 -0
- package/build/commands/dev/utils/start-app/start-app.js.map +1 -0
- package/build/commands/dev/utils/start-app/types.d.ts +14 -0
- package/build/commands/dev/utils/start-app/types.js +2 -0
- package/build/commands/dev/utils/start-app/types.js.map +1 -0
- package/build/commands/dev/utils/types.d.ts +24 -0
- package/build/commands/dev/utils/types.js +7 -0
- package/build/commands/dev/utils/types.js.map +1 -0
- package/build/commands/dev/utils/version.d.ts +64 -0
- package/build/commands/dev/utils/version.js +101 -0
- package/build/commands/dev/utils/version.js.map +1 -0
- package/build/commands/dev/utils/with-retries.d.ts +4 -0
- package/build/commands/dev/utils/with-retries.js +24 -0
- package/build/commands/dev/utils/with-retries.js.map +1 -0
- package/build/commands/doctor/index.d.ts +6 -0
- package/build/commands/doctor/index.js +21 -0
- package/build/commands/doctor/index.js.map +1 -0
- package/build/commands/doctor/utils/diagnose-dependencies.d.ts +7 -0
- package/build/commands/doctor/utils/diagnose-dependencies.js +113 -0
- package/build/commands/doctor/utils/diagnose-dependencies.js.map +1 -0
- package/build/commands/features/index.d.ts +6 -0
- package/build/commands/features/index.js +135 -0
- package/build/commands/features/index.js.map +1 -0
- package/build/commands/generate-graphql-types/index.d.ts +6 -0
- package/build/commands/generate-graphql-types/index.js +33 -0
- package/build/commands/generate-graphql-types/index.js.map +1 -0
- package/build/commands/generate-graphql-types/utils/generate-graphql-types.d.ts +2 -0
- package/build/commands/generate-graphql-types/utils/generate-graphql-types.js +67 -0
- package/build/commands/generate-graphql-types/utils/generate-graphql-types.js.map +1 -0
- package/build/commands/generate-graphql-types/utils/get-graphql-config.d.ts +1 -0
- package/build/commands/generate-graphql-types/utils/get-graphql-config.js +31 -0
- package/build/commands/generate-graphql-types/utils/get-graphql-config.js.map +1 -0
- package/build/commands/generate-graphql-types/utils/get-graphql-config.spec.d.ts +1 -0
- package/build/commands/generate-graphql-types/utils/get-graphql-config.spec.js +57 -0
- package/build/commands/generate-graphql-types/utils/get-graphql-config.spec.js.map +1 -0
- package/build/commands/info/index.d.ts +3 -0
- package/build/commands/info/index.js +42 -0
- package/build/commands/info/index.js.map +1 -0
- package/build/commands/setup/index.d.ts +2 -0
- package/build/commands/setup/index.js +103 -0
- package/build/commands/setup/index.js.map +1 -0
- package/build/commands/submit/config.d.ts +9 -0
- package/build/commands/submit/config.js +18 -0
- package/build/commands/submit/config.js.map +1 -0
- package/build/commands/submit/errors.d.ts +19 -0
- package/build/commands/submit/errors.js +87 -0
- package/build/commands/submit/errors.js.map +1 -0
- package/build/commands/submit/gcs.d.ts +6 -0
- package/build/commands/submit/gcs.js +21 -0
- package/build/commands/submit/gcs.js.map +1 -0
- package/build/commands/submit/index.d.ts +2 -0
- package/build/commands/submit/index.js +25 -0
- package/build/commands/submit/index.js.map +1 -0
- package/build/commands/submit/submit.d.ts +5 -0
- package/build/commands/submit/submit.js +268 -0
- package/build/commands/submit/submit.js.map +1 -0
- package/build/commands/submit/tasks.d.ts +37 -0
- package/build/commands/submit/tasks.js +91 -0
- package/build/commands/submit/tasks.js.map +1 -0
- package/build/commands/submit/types.d.ts +14 -0
- package/build/commands/submit/types.js +2 -0
- package/build/commands/submit/types.js.map +1 -0
- package/build/commands/submit/utils/assert-core-dependencies-version.d.ts +1 -0
- package/build/commands/submit/utils/assert-core-dependencies-version.js +73 -0
- package/build/commands/submit/utils/assert-core-dependencies-version.js.map +1 -0
- package/build/commands/submit/utils/request-entry-point-params.d.ts +1 -0
- package/build/commands/submit/utils/request-entry-point-params.js +43 -0
- package/build/commands/submit/utils/request-entry-point-params.js.map +1 -0
- package/build/commands/submit/validation.d.ts +1 -0
- package/build/commands/submit/validation.js +14 -0
- package/build/commands/submit/validation.js.map +1 -0
- package/build/commands/upgrade/index.d.ts +13 -0
- package/build/commands/upgrade/index.js +70 -0
- package/build/commands/upgrade/index.js.map +1 -0
- package/build/commands/upgrade/utils/clear-metro-cache.d.ts +1 -0
- package/build/commands/upgrade/utils/clear-metro-cache.js +12 -0
- package/build/commands/upgrade/utils/clear-metro-cache.js.map +1 -0
- package/build/commands/upgrade/utils/cli.d.ts +1 -0
- package/build/commands/upgrade/utils/cli.js +15 -0
- package/build/commands/upgrade/utils/cli.js.map +1 -0
- package/build/commands/validate-manifest/index.d.ts +3 -0
- package/build/commands/validate-manifest/index.js +38 -0
- package/build/commands/validate-manifest/index.js.map +1 -0
- package/build/constants/extensions.d.ts +21 -0
- package/build/constants/extensions.js +25 -0
- package/build/constants/extensions.js.map +1 -0
- package/build/data/accept-invitation.d.ts +4 -0
- package/build/data/accept-invitation.js +16 -0
- package/build/data/accept-invitation.js.map +1 -0
- package/build/data/cancel-submission.d.ts +22 -0
- package/build/data/cancel-submission.js +26 -0
- package/build/data/cancel-submission.js.map +1 -0
- package/build/data/create-submission.d.ts +20 -0
- package/build/data/create-submission.js +27 -0
- package/build/data/create-submission.js.map +1 -0
- package/build/data/create-upload.d.ts +21 -0
- package/build/data/create-upload.js +40 -0
- package/build/data/create-upload.js.map +1 -0
- package/build/data/get-linked-apps.d.ts +13 -0
- package/build/data/get-linked-apps.js +21 -0
- package/build/data/get-linked-apps.js.map +1 -0
- package/build/data/get-submissions.d.ts +27 -0
- package/build/data/get-submissions.js +33 -0
- package/build/data/get-submissions.js.map +1 -0
- package/build/data/gql-client.d.ts +8 -0
- package/build/data/gql-client.js +14 -0
- package/build/data/gql-client.js.map +1 -0
- package/build/data/mini-create.d.ts +19 -0
- package/build/data/mini-create.js +34 -0
- package/build/data/mini-create.js.map +1 -0
- package/build/data/mini-link-app.d.ts +20 -0
- package/build/data/mini-link-app.js +35 -0
- package/build/data/mini-link-app.js.map +1 -0
- package/build/data/mini-unlink-app.d.ts +18 -0
- package/build/data/mini-unlink-app.js +25 -0
- package/build/data/mini-unlink-app.js.map +1 -0
- package/build/data/mini.d.ts +7 -0
- package/build/data/mini.js +16 -0
- package/build/data/mini.js.map +1 -0
- package/build/data/partners/query.d.ts +32 -0
- package/build/data/partners/query.js +123 -0
- package/build/data/partners/query.js.map +1 -0
- package/build/data/partners/types.d.ts +55 -0
- package/build/data/partners/types.js +6 -0
- package/build/data/partners/types.js.map +1 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/fragment-masking.d.ts +13 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/fragment-masking.js +7 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/fragment-masking.js.map +1 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.d.ts +107 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.js +28 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/gql.js.map +1 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.d.ts +2177 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js +1474 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/graphql.js.map +1 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/index.d.ts +2 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/index.js +3 -0
- package/build/data/types/autogenerated/shop-minis-admin-api/index.js.map +1 -0
- package/build/dev-panel/asset-manifest.json +13 -0
- package/build/dev-panel/checkmark.svg +3 -0
- package/build/dev-panel/chevron.svg +3 -0
- package/build/dev-panel/copy.svg +4 -0
- package/build/dev-panel/get-started.svg +3 -0
- package/build/dev-panel/how-to.svg +3 -0
- package/build/dev-panel/index.html +1 -0
- package/build/dev-panel/references.svg +3 -0
- package/build/dev-panel/robots.txt +3 -0
- package/build/dev-panel/static/css/main.94b1dbb1.css +2 -0
- package/build/dev-panel/static/css/main.94b1dbb1.css.map +1 -0
- package/build/dev-panel/static/js/main.917a564c.js +3 -0
- package/build/dev-panel/static/js/main.917a564c.js.LICENSE.txt +41 -0
- package/build/dev-panel/static/js/main.917a564c.js.map +1 -0
- package/build/dev-panel/topics.svg +3 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +53 -0
- package/build/index.js.map +1 -0
- package/build/schemas/manifest.schema.json +185 -0
- package/build/templates-index.d.ts +6 -0
- package/build/templates-index.js +24 -0
- package/build/templates-index.js.map +1 -0
- package/build/utils/archive.d.ts +30 -0
- package/build/utils/archive.js +38 -0
- package/build/utils/archive.js.map +1 -0
- package/build/utils/codemod.d.ts +86 -0
- package/build/utils/codemod.js +161 -0
- package/build/utils/codemod.js.map +1 -0
- package/build/utils/common-tasks.d.ts +1 -0
- package/build/utils/common-tasks.js +44 -0
- package/build/utils/common-tasks.js.map +1 -0
- package/build/utils/development-params.d.ts +13 -0
- package/build/utils/development-params.js +44 -0
- package/build/utils/development-params.js.map +1 -0
- package/build/utils/exec-async-child-process.d.ts +18 -0
- package/build/utils/exec-async-child-process.js +41 -0
- package/build/utils/exec-async-child-process.js.map +1 -0
- package/build/utils/extensions.d.ts +13 -0
- package/build/utils/extensions.js +87 -0
- package/build/utils/extensions.js.map +1 -0
- package/build/utils/extract-id-gid.d.ts +1 -0
- package/build/utils/extract-id-gid.js +16 -0
- package/build/utils/extract-id-gid.js.map +1 -0
- package/build/utils/file.d.ts +1 -0
- package/build/utils/file.js +7 -0
- package/build/utils/file.js.map +1 -0
- package/build/utils/loading-state-handlers.d.ts +10 -0
- package/build/utils/loading-state-handlers.js +23 -0
- package/build/utils/loading-state-handlers.js.map +1 -0
- package/build/utils/minis-manifest.d.ts +8 -0
- package/build/utils/minis-manifest.js +90 -0
- package/build/utils/minis-manifest.js.map +1 -0
- package/build/utils/package-manager.d.ts +52 -0
- package/build/utils/package-manager.js +139 -0
- package/build/utils/package-manager.js.map +1 -0
- package/build/utils/patch-package.d.ts +5 -0
- package/build/utils/patch-package.js +76 -0
- package/build/utils/patch-package.js.map +1 -0
- package/build/utils/path.d.ts +1 -0
- package/build/utils/path.js +8 -0
- package/build/utils/path.js.map +1 -0
- package/build/utils/replace-strings-in-template.d.ts +1 -0
- package/build/utils/replace-strings-in-template.js +15 -0
- package/build/utils/replace-strings-in-template.js.map +1 -0
- package/build/utils/semver.d.ts +1 -0
- package/build/utils/semver.js +19 -0
- package/build/utils/semver.js.map +1 -0
- package/build/utils/sync-manifest.d.ts +5 -0
- package/build/utils/sync-manifest.js +26 -0
- package/build/utils/sync-manifest.js.map +1 -0
- package/build/utils/wrap-with-loading-indicator.d.ts +9 -0
- package/build/utils/wrap-with-loading-indicator.js +16 -0
- package/build/utils/wrap-with-loading-indicator.js.map +1 -0
- package/package.json +102 -0
- package/scripts/graphql-codegen.ts +29 -0
- package/scripts/test-template.ts +66 -0
- package/shipit.hackathon-2025.yml +9 -0
- package/shipit.snapshot.yml +9 -0
- package/templates/__template_blank/src/App.tsx +24 -0
- package/templates/__template_blank/src/index.tsx +9 -0
- package/templates/__template_common/.cursorrules +141 -0
- package/templates/__template_common/.eslintignore +1 -0
- package/templates/__template_common/.eslintrc.js +3 -0
- package/templates/__template_common/.graphqlrc.js +1 -0
- package/templates/__template_common/.prettierrc.json +8 -0
- package/templates/__template_common/assets.d.ts +14 -0
- package/templates/__template_common/babel.config.js +5 -0
- package/templates/__template_common/gitignore +5 -0
- package/templates/__template_common/index.tsx +5 -0
- package/templates/__template_common/metro.config.js +5 -0
- package/templates/__template_common/package.json +35 -0
- package/templates/__template_common/src/manifest.json +6 -0
- package/templates/__template_common/tsconfig.json +41 -0
- package/templates/__template_getting_started/src/App.tsx +23 -0
- package/templates/__template_getting_started/src/index.tsx +9 -0
- package/templates/__template_getting_started/src/manifest.json +7 -0
- package/templates/__template_getting_started/src/screens/HomeScreen.tsx +128 -0
- package/templates/__template_getting_started/src/screens/NativeFeaturesScreen.tsx +137 -0
- package/templates/__template_getting_started/src/types/screens.ts +5 -0
- package/templates/__template_shoppable_posts/src/App.tsx +42 -0
- package/templates/__template_shoppable_posts/src/index.tsx +9 -0
- package/templates/__template_shoppable_videos/src/App.tsx +39 -0
- package/templates/__template_shoppable_videos/src/index.tsx +9 -0
- package/templates/extensions/components/__template_blank/render.tsx +9 -0
- package/templates/extensions/components/__template_bundle-collection/render.tsx +31 -0
- package/templates/extensions/components/__template_bundle-collection/seed.ts +26 -0
- package/templates/extensions/components/__template_bundle-selector/render.tsx +51 -0
- package/templates/extensions/components/__template_bundle-selector/seed.ts +72 -0
- package/templates/extensions/components/__template_default-card/render.tsx +24 -0
- package/templates/extensions/components/__template_default-card/seed.ts +10 -0
- package/templates/extensions/components/__template_image-collection/render.tsx +17 -0
- package/templates/extensions/components/__template_image-collection/seed.ts +70 -0
- package/templates/extensions/components/__template_link/render.tsx +17 -0
- package/templates/extensions/components/__template_link/seed.ts +5 -0
- package/templates/extensions/components/__template_product-offer-card/render.tsx +17 -0
- package/templates/extensions/components/__template_product-offer-card/seed.ts +44 -0
- package/templates/extensions/components/__template_survey-single-response/render.tsx +26 -0
- package/templates/extensions/components/__template_survey-single-response/seed.ts +22 -0
- package/templates/extensions/components/__template_video-collection/render.tsx +17 -0
- package/templates/extensions/components/__template_video-collection/seed.ts +37 -0
- package/templates/extensions/queries/__template_order-confirmation-page/input.graphql +5 -0
- package/templates/extensions/queries/__template_order-confirmation-page/input.graphql.d.ts +24 -0
- package/templates/extensions/queries/__template_order-management-page/input.graphql +5 -0
- package/templates/extensions/queries/__template_order-management-page/input.graphql.d.ts +24 -0
- package/templates/extensions/queries/__template_product-page/input.graphql +9 -0
- package/templates/extensions/queries/__template_product-page/input.graphql.d.ts +36 -0
- package/templates/extensions/queries/__template_store-page/input.graphql +5 -0
- package/templates/extensions/queries/__template_store-page/input.graphql.d.ts +24 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.8498 3.56614C3.05315 2.65106 3.86477 2 4.80217 2H18.7399C19.6383 2 20.4265 2.59907 20.667 3.46471L23 11.8637V20C23 21.1046 22.1046 22 21 22H3C1.89543 22 1 21.1046 1 20V11.8902L2.8498 3.56614ZM18.7399 4L4.80217 4L3.02439 12H20.9621L18.7399 4ZM3 20V14H21V20H3ZM14 16H10V18H14V16ZM6 8.70001L18 8.70001V10.5L6 10.5V8.70001ZM17 5.20001L7 5.20001V7.00001L17 7.00001V5.20001Z" fill="black"/>
|
|
3
|
+
</svg>
|
package/build/index.d.ts
ADDED
package/build/index.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --experimental-json-modules --require=suppress-experimental-warnings --no-deprecation
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { loadCommand as loadCancelSubmissionCommand } from './commands/cancel-submission/index.js';
|
|
4
|
+
import { loadCommand as loadCheckSubmissionCommand } from './commands/check-submission/index.js';
|
|
5
|
+
import { loadCommand as loadCodemodCommand } from './commands/codemod/index.js';
|
|
6
|
+
import { CLI_VERSION } from './commands/config.js';
|
|
7
|
+
import { loadCommand as loadCreateExtensionCommand } from './commands/create-extension/index.js';
|
|
8
|
+
import { loadCommand as loadCreateMiniCommand } from './commands/create-mini/index.js';
|
|
9
|
+
import { loadCommand as loadDevCommand } from './commands/dev/index.js';
|
|
10
|
+
import { command as doctorCommand } from './commands/doctor/index.js';
|
|
11
|
+
import { command as featuresCommand } from './commands/features/index.js';
|
|
12
|
+
import { loadCommand as loadGenerateGraphqlTypesCommand } from './commands/generate-graphql-types/index.js';
|
|
13
|
+
import { loadCommand as loadInfoCommand } from './commands/info/index.js';
|
|
14
|
+
import { loadCommand as loadSetupCommand } from './commands/setup/index.js';
|
|
15
|
+
import { loadCommand as loadSubmitCommand } from './commands/submit/index.js';
|
|
16
|
+
import { loadCommand as loadUpgradeCommand } from './commands/upgrade/index.js';
|
|
17
|
+
import { loadCommand as loadValidateManifestCommand } from './commands/validate-manifest/index.js';
|
|
18
|
+
import { loadCommand as loadAppCommand } from './commands/app/index.js';
|
|
19
|
+
const program = new Command();
|
|
20
|
+
async function loadCommands() {
|
|
21
|
+
loadCreateMiniCommand(program);
|
|
22
|
+
await loadDevCommand(program);
|
|
23
|
+
loadGenerateGraphqlTypesCommand(program);
|
|
24
|
+
loadSubmitCommand(program);
|
|
25
|
+
loadCancelSubmissionCommand(program);
|
|
26
|
+
loadCheckSubmissionCommand(program);
|
|
27
|
+
loadUpgradeCommand(program);
|
|
28
|
+
loadValidateManifestCommand(program);
|
|
29
|
+
loadCodemodCommand(program);
|
|
30
|
+
loadInfoCommand(program);
|
|
31
|
+
loadSetupCommand(program);
|
|
32
|
+
loadCreateExtensionCommand(program);
|
|
33
|
+
loadAppCommand(program);
|
|
34
|
+
program.addCommand(doctorCommand);
|
|
35
|
+
program.addCommand(featuresCommand);
|
|
36
|
+
}
|
|
37
|
+
program
|
|
38
|
+
.name('shop-minis')
|
|
39
|
+
.description('CLI for Shop Minis development')
|
|
40
|
+
.version(CLI_VERSION);
|
|
41
|
+
loadCommands()
|
|
42
|
+
.then(() => {
|
|
43
|
+
if (process.argv.length < 3) {
|
|
44
|
+
// Avoid exiting with code 1 even if program.parse() defaults to showing help content.
|
|
45
|
+
program.help();
|
|
46
|
+
}
|
|
47
|
+
program.parse();
|
|
48
|
+
})
|
|
49
|
+
.catch(err => {
|
|
50
|
+
console.log(err);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
});
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAC,WAAW,IAAI,2BAA2B,EAAC,MAAM,uCAAuC,CAAA;AAChG,OAAO,EAAC,WAAW,IAAI,0BAA0B,EAAC,MAAM,sCAAsC,CAAA;AAC9F,OAAO,EAAC,WAAW,IAAI,kB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,CAAC,CAAA;IACpC,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC3B,eAAe,CAAC,OAAO,CAAC,CAAA;IACxB,gBAAgB,CAAC,OAAO,CAAC,CAAA;IACzB,0BAA0B,CAAC,OAAO,CAAC,CAAA;IACnC,cAAc,CAAC,OAAO,CAAC,CAAA;IAEvB,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAA;IACjC,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;AACrC,CAAC;AAED,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,gCAAgC,CAAC;KAC7C,OAAO,CAAC,WAAW,CAAC,CAAA;AAEvB,YAAY,EAAE;KACX,IAAI,CAAC,GAAG,EAAE;IACT,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;QAC3B,sFAAsF;QACtF,OAAO,CAAC,IAAI,EAAE,CAAA;KACf;IACD,OAAO,CAAC,KAAK,EAAE,CAAA;AACjB,CAAC,CAAC;KACD,KAAK,CAAC,GAAG,CAAC,EAAE;IACX,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "/manifest.schema.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"title": "Shop Mini Manifest",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The name of the Mini"
|
|
11
|
+
},
|
|
12
|
+
"handle": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"description": "A unique identifier for the Mini",
|
|
15
|
+
"pattern": "^(?:@[a-z0-9-*~][a-z0-9-*._~]*/)?[a-z0-9-~][a-z0-9-._~]*$"
|
|
16
|
+
},
|
|
17
|
+
"description": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "The description of the Mini"
|
|
20
|
+
},
|
|
21
|
+
"activation_subpath": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "A route on your Mini's Shopify app that will be used to activate (enable entry points) your Mini for the first time. This route path will be appended to the end of the admin URL of the Shopify app. For example, the value 'activate' will correspond to the URL https://admin.shopify.com/store/example-store/apps/my-handle/activate",
|
|
24
|
+
"pattern": "^(?:[a-z0-9~-]+/)*[a-z0-9~-]+$"
|
|
25
|
+
},
|
|
26
|
+
"shopify_apps": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"description": "The Shopify apps associated with the Mini",
|
|
29
|
+
"properties": {
|
|
30
|
+
"production": {
|
|
31
|
+
"type": "integer",
|
|
32
|
+
"minimum": 1,
|
|
33
|
+
"description": "The Shopify app ID for production"
|
|
34
|
+
},
|
|
35
|
+
"development": {
|
|
36
|
+
"type": "array",
|
|
37
|
+
"description": "The Shopify app IDs for development",
|
|
38
|
+
"uniqueItems": true,
|
|
39
|
+
"items": {"type": "integer", "minimum": 1}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"notification_topics": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"description": "Specifies the reason for communication and the scope for messages. An example of a topic could be live streaming related notifications related to a merchant",
|
|
46
|
+
"items": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"required": ["handle", "description", "scope"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"handle": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Text identifier of the topic"
|
|
53
|
+
},
|
|
54
|
+
"description": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"description": "Reason for the communication using the topic"
|
|
57
|
+
},
|
|
58
|
+
"scope": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "The scope in which messages are processed for the topic. SHOP means each message will be processed in the scope of a specific merchant, PRODUCT means each message will be processed in the scope of a specific product",
|
|
61
|
+
"enum": ["SHOP", "PRODUCT"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"notification_templates": {
|
|
67
|
+
"type": "array",
|
|
68
|
+
"description": "Specify the message which will be sent to subscribers when notification is triggered by the mutation",
|
|
69
|
+
"items": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"required": [
|
|
72
|
+
"handle",
|
|
73
|
+
"topic_handle",
|
|
74
|
+
"title",
|
|
75
|
+
"body",
|
|
76
|
+
"cooldown_minutes"
|
|
77
|
+
],
|
|
78
|
+
"properties": {
|
|
79
|
+
"handle": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"description": "Text identifier of the template"
|
|
82
|
+
},
|
|
83
|
+
"topic_handle": {
|
|
84
|
+
"type": "string",
|
|
85
|
+
"description": "Reference to a notification topic"
|
|
86
|
+
},
|
|
87
|
+
"title": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"description": "Template of notification title, supports interpolation using the Liquid template language"
|
|
90
|
+
},
|
|
91
|
+
"body": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"description": "Template of notification body, supports interpolation using the Liquid template language"
|
|
94
|
+
},
|
|
95
|
+
"cooldown_minutes": {
|
|
96
|
+
"type": "number",
|
|
97
|
+
"description": "How often the template allowes to send the exact same message to the same user, in minutes"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"entry_points": {
|
|
103
|
+
"type": "array",
|
|
104
|
+
"description": "A list of entry points that the Mini supports",
|
|
105
|
+
"items": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"properties": {
|
|
108
|
+
"location": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"enum": [
|
|
111
|
+
"PRODUCT_PAGE",
|
|
112
|
+
"STORE_PAGE",
|
|
113
|
+
"PRODUCT_PAGE_CONTEXT_MENU",
|
|
114
|
+
"STORE_PAGE_CONTEXT_MENU",
|
|
115
|
+
"ORDER_CONFIRMATION_PAGE",
|
|
116
|
+
"ORDER_MANAGEMENT_PAGE",
|
|
117
|
+
"HOME_FEED"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"type": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"enum": [
|
|
123
|
+
"LINK",
|
|
124
|
+
"DEFAULT_CARD",
|
|
125
|
+
"IMAGE_COLLECTION",
|
|
126
|
+
"VIDEO_COLLECTION",
|
|
127
|
+
"EVENT_CARD_V2",
|
|
128
|
+
"PRODUCT_OFFER_CARD",
|
|
129
|
+
"IMAGE_COLLECTION_V2",
|
|
130
|
+
"VIDEO_COLLECTION_V2"
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"allOf": [
|
|
135
|
+
{
|
|
136
|
+
"if": {"properties": {"type": {"const": "LINK"}}},
|
|
137
|
+
"then": {"required": ["location"]}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"if": {"properties": {"type": {"const": "DEFAULT_CARD"}}},
|
|
141
|
+
"then": {"required": ["location"]}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"if": {"properties": {"type": {"const": "IMAGE_COLLECTION"}}},
|
|
145
|
+
"then": {"required": ["location"]}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"if": {"properties": {"type": {"const": "IMAGE_COLLECTION_V2"}}},
|
|
149
|
+
"then": {"required": ["location"]}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"if": {"properties": {"type": {"const": "VIDEO_COLLECTION"}}},
|
|
153
|
+
"then": {"required": ["location"]}
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"if": {"properties": {"type": {"const": "VIDEO_COLLECTION_V2"}}},
|
|
157
|
+
"then": {"required": ["location"]}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"if": {"properties": {"type": {"const": "EVENT_CARD_V2"}}},
|
|
161
|
+
"then": {"required": ["location"]}
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"trusted_domains": {
|
|
167
|
+
"type": "array",
|
|
168
|
+
"description": "A list of domains that the minis uses to make requests and fetch information. Requests to domains that are not in this list will fail in production.",
|
|
169
|
+
"uniqueItems": true,
|
|
170
|
+
"items": {
|
|
171
|
+
"type": "string"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"features": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"description": "A list of optional features that your mini app has enabled",
|
|
177
|
+
"uniqueItems": true,
|
|
178
|
+
"items": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"enum": ["FULL_BLEED_VIEWER", "STANDALONE"]
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
"required": ["name", "handle"]
|
|
185
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const TEMPLATES = [
|
|
2
|
+
{
|
|
3
|
+
title: 'Getting Started',
|
|
4
|
+
description: 'A template that generates a fully functioning Shop Mini',
|
|
5
|
+
value: 'getting_started',
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
title: 'Blank',
|
|
9
|
+
description: 'A blank canvas so you can create from scratch',
|
|
10
|
+
value: 'blank',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
title: 'Shoppable Videos',
|
|
14
|
+
description: 'An opinionated starting point for Minis displaying a feed of videos',
|
|
15
|
+
value: 'shoppable_videos',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'Shoppable Posts',
|
|
19
|
+
description: 'An opinionated starting point for Minis displaying a feed of images',
|
|
20
|
+
value: 'shoppable_posts',
|
|
21
|
+
},
|
|
22
|
+
];
|
|
23
|
+
export const TEMPLATE_VALUES = TEMPLATES.map(template => template.value);
|
|
24
|
+
//# sourceMappingURL=templates-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates-index.js","sourceRoot":"","sources":["../src/templates-index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,yDAAyD;QACtE,KAAK,EAAE,iBAAiB;KACzB;IACD;QACE,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,+CAA+C;QAC5D,KAAK,EAAE,OAAO;KACf;IACD;QACE,KAAK,EAAE,kBAAkB;QACzB,WAAW,EACT,qEAAqE;QACvE,KAAK,EAAE,kBAAkB;KAC1B;IACD;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,qEAAqE;QACvE,KAAK,EAAE,iBAAiB;KACzB;CACF,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import archiver from 'archiver';
|
|
2
|
+
interface ZipOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The absolute path to the directory to be zipped.
|
|
5
|
+
*/
|
|
6
|
+
inputDirectory: string;
|
|
7
|
+
/**
|
|
8
|
+
* The absolute path to the output zip file.
|
|
9
|
+
*/
|
|
10
|
+
outputArchivePath: string;
|
|
11
|
+
/**
|
|
12
|
+
* Pattern to match when adding files to archive, uses glob expressions.
|
|
13
|
+
*/
|
|
14
|
+
matchFilePattern?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Patterns to ignore adding files to archive, uses glob expressions.
|
|
17
|
+
*/
|
|
18
|
+
ignore?: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates a tar.gz
|
|
22
|
+
*
|
|
23
|
+
* This is a copy of `zip` [from cli-kit](https://github.com/Shopify/cli/blob/0aa5eb4fe34519e10297977e640dc521f9ab1676/packages/cli-kit/src/public/node/archiver.ts#L31)
|
|
24
|
+
*
|
|
25
|
+
* Our version defaults to tar.gz, theirs is hard-coded to zip
|
|
26
|
+
*
|
|
27
|
+
* @param options - ZipOptions.
|
|
28
|
+
*/
|
|
29
|
+
export declare function zip(options: ZipOptions, format?: archiver.Format): Promise<void>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createWriteStream } from 'node:fs';
|
|
2
|
+
import archiver from 'archiver';
|
|
3
|
+
import { relativePath } from '@shopify/cli-kit/node/path';
|
|
4
|
+
import { glob } from '@shopify/cli-kit/node/fs';
|
|
5
|
+
import { outputDebug, outputContent, outputToken, } from '@shopify/cli-kit/node/output';
|
|
6
|
+
/**
|
|
7
|
+
* Creates a tar.gz
|
|
8
|
+
*
|
|
9
|
+
* This is a copy of `zip` [from cli-kit](https://github.com/Shopify/cli/blob/0aa5eb4fe34519e10297977e640dc521f9ab1676/packages/cli-kit/src/public/node/archiver.ts#L31)
|
|
10
|
+
*
|
|
11
|
+
* Our version defaults to tar.gz, theirs is hard-coded to zip
|
|
12
|
+
*
|
|
13
|
+
* @param options - ZipOptions.
|
|
14
|
+
*/
|
|
15
|
+
export async function zip(options, format = 'tar') {
|
|
16
|
+
const { inputDirectory, outputArchivePath, matchFilePattern = '**/*', ignore, } = options;
|
|
17
|
+
outputDebug(outputContent `${format === 'zip' ? 'Zipping' : 'Creating tar.gz of'} ${outputToken.path(inputDirectory)} into ${outputToken.path(outputArchivePath)}`);
|
|
18
|
+
const pathsToZip = await glob(matchFilePattern, {
|
|
19
|
+
cwd: inputDirectory,
|
|
20
|
+
absolute: true,
|
|
21
|
+
dot: true,
|
|
22
|
+
followSymbolicLinks: false,
|
|
23
|
+
ignore,
|
|
24
|
+
});
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const archive = archiver(format, { gzip: true });
|
|
27
|
+
const output = createWriteStream(outputArchivePath);
|
|
28
|
+
output.on('close', () => resolve());
|
|
29
|
+
archive.on('error', error => reject(error));
|
|
30
|
+
archive.pipe(output);
|
|
31
|
+
for (const filePath of pathsToZip) {
|
|
32
|
+
const fileRelativePath = relativePath(inputDirectory, filePath);
|
|
33
|
+
archive.file(filePath, { name: fileRelativePath });
|
|
34
|
+
}
|
|
35
|
+
archive.finalize();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=archive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive.js","sourceRoot":"","sources":["../../src/utils/archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,SAAS,CAAA;AAEzC,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,0BAA0B,CAAA;AAC7C,OAAO,EACL,WAAW,EACX,aAAa,EACb,WAAW,GACZ,MAAM,8BAA8B,CAAA;AAwBrC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,OAAmB,EACnB,SAA0B,KAAK;IAE/B,MAAM,EACJ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GAAG,MAAM,EACzB,MAAM,GACP,GAAG,OAAO,CAAA;IAEX,WAAW,CACT,aAAa,CAAA,GACX,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBACjC,IAAI,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,WAAW,CAAC,IAAI,CAC3D,iBAAiB,CAClB,EAAE,CACJ,CAAA;IACD,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,gBAAgB,EAAE;QAC9C,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,IAAI;QACT,mBAAmB,EAAE,KAAK;QAC1B,MAAM;KACP,CAAC,CAAA;IAEF,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAC,CAAA;QAE9C,MAAM,MAAM,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAA;QACnD,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;QACnC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;QAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEpB,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;YACjC,MAAM,gBAAgB,GAAG,YAAY,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAA;YAC/D,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;SACjD;QAED,OAAO,CAAC,QAAQ,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import jscodeshift from 'jscodeshift';
|
|
2
|
+
export type Root = ReturnType<typeof jscodeshift>;
|
|
3
|
+
export declare const j: jscodeshift.JSCodeshift;
|
|
4
|
+
/**
|
|
5
|
+
* Find the first import declaration of a module
|
|
6
|
+
*
|
|
7
|
+
* Returns an object containing:
|
|
8
|
+
* - `importDeclaration`: This is the whole import node. This is null if no import is found
|
|
9
|
+
* - `specifier`: This is the specific import specifier node that matches the name/alias. Also null if not found
|
|
10
|
+
*
|
|
11
|
+
* If `importedAsName` is not provided, it will look for an import like:
|
|
12
|
+
* ```
|
|
13
|
+
* import {importedName} from 'importPath'
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* If `importedAsName` is provided, it will look for an import like:
|
|
17
|
+
* ```
|
|
18
|
+
* import {importedName as importedAsName} from 'importPath'
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const findImportOf: (root: import("jscodeshift/src/Collection.js").Collection<any>, importPath: string, importedName: string, importedAsName?: string) => {
|
|
22
|
+
specifier: import("ast-types").namedTypes.ImportSpecifier | import("ast-types").namedTypes.ImportDefaultSpecifier | import("ast-types").namedTypes.ImportNamespaceSpecifier | null;
|
|
23
|
+
importDeclaration: import("ast-types").namedTypes.ImportDeclaration;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Ensure that an import of a module is present in the file
|
|
27
|
+
*
|
|
28
|
+
* If the import is not present, it will be added below other imports or
|
|
29
|
+
* to the top of the file if no other imports are found
|
|
30
|
+
*
|
|
31
|
+
* Returns the specifier and import declaration nodes that were found, edited or created
|
|
32
|
+
*/
|
|
33
|
+
export declare const ensureImportOf: (root: import("jscodeshift/src/Collection.js").Collection<any>, importPath: string, importedName: string, importedAsName?: string) => {
|
|
34
|
+
specifier: import("ast-types").namedTypes.ImportSpecifier | import("ast-types").namedTypes.ImportDefaultSpecifier | import("ast-types").namedTypes.ImportNamespaceSpecifier;
|
|
35
|
+
importDeclaration: import("ast-types").namedTypes.ImportDeclaration;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Find an object expression by its name like
|
|
39
|
+
*
|
|
40
|
+
* ```
|
|
41
|
+
* const objName = {
|
|
42
|
+
* key: 'value',
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Returns the object expression node if found, otherwise null
|
|
47
|
+
*
|
|
48
|
+
* If multiple are found, the first one is returned
|
|
49
|
+
*/
|
|
50
|
+
export declare const findObjectExpression: (root: import("jscodeshift/src/Collection.js").Collection<any>, objName: string) => import("ast-types").namedTypes.ObjectExpression | null;
|
|
51
|
+
/**
|
|
52
|
+
* Find an object's property by it's key
|
|
53
|
+
*
|
|
54
|
+
* Returns the property node that was found or null
|
|
55
|
+
*/
|
|
56
|
+
export declare const findObjectProperty: ({ obj, key, }: {
|
|
57
|
+
obj: jscodeshift.ObjectExpression;
|
|
58
|
+
key: string;
|
|
59
|
+
}) => jscodeshift.Property | null;
|
|
60
|
+
/**
|
|
61
|
+
* Return all the objects keys
|
|
62
|
+
*
|
|
63
|
+
* Only returns keys of types Identifier and StringLiteral eg
|
|
64
|
+
*
|
|
65
|
+
* const foo = { 'cool-key': 'value', otherKey: 'ok' }
|
|
66
|
+
*/
|
|
67
|
+
export declare const objectKeys: ({ obj, }: {
|
|
68
|
+
obj: jscodeshift.ObjectExpression;
|
|
69
|
+
}) => string[];
|
|
70
|
+
/**
|
|
71
|
+
* Ensure that an object has a property with a specific key
|
|
72
|
+
*
|
|
73
|
+
* If the property is not present, it will be added to the object
|
|
74
|
+
*
|
|
75
|
+
* If `defaultValue` is provided, the property will be set to that value if it does not exist
|
|
76
|
+
*
|
|
77
|
+
* If `overwrite` is also true, the property will be replaced with the `defaultValue`
|
|
78
|
+
*
|
|
79
|
+
* Returns the property node that was found or created
|
|
80
|
+
*/
|
|
81
|
+
export declare const ensureObjectProperty: ({ obj, key, defaultValue, overwrite, }: {
|
|
82
|
+
obj: jscodeshift.ObjectExpression;
|
|
83
|
+
key: string;
|
|
84
|
+
defaultValue: jscodeshift.Property['value'];
|
|
85
|
+
overwrite?: boolean | undefined;
|
|
86
|
+
}) => import("ast-types").namedTypes.Property;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import jscodeshift from 'jscodeshift';
|
|
2
|
+
export const j = jscodeshift.withParser('tsx');
|
|
3
|
+
/**
|
|
4
|
+
* Find the first import declaration of a module
|
|
5
|
+
*
|
|
6
|
+
* Returns an object containing:
|
|
7
|
+
* - `importDeclaration`: This is the whole import node. This is null if no import is found
|
|
8
|
+
* - `specifier`: This is the specific import specifier node that matches the name/alias. Also null if not found
|
|
9
|
+
*
|
|
10
|
+
* If `importedAsName` is not provided, it will look for an import like:
|
|
11
|
+
* ```
|
|
12
|
+
* import {importedName} from 'importPath'
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* If `importedAsName` is provided, it will look for an import like:
|
|
16
|
+
* ```
|
|
17
|
+
* import {importedName as importedAsName} from 'importPath'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const findImportOf = (root, importPath, importedName, importedAsName) => {
|
|
21
|
+
const matchedImportDeclaration = root
|
|
22
|
+
.find(j.ImportDeclaration, {
|
|
23
|
+
source: { value: importPath },
|
|
24
|
+
})
|
|
25
|
+
.nodes()[0] ?? null;
|
|
26
|
+
const matchedSpecifier = matchedImportDeclaration?.specifiers?.filter(specifier => {
|
|
27
|
+
if (specifier.type !== 'ImportSpecifier')
|
|
28
|
+
return false;
|
|
29
|
+
return importedAsName
|
|
30
|
+
? specifier.imported.name === importedName &&
|
|
31
|
+
specifier?.local?.name === importedAsName
|
|
32
|
+
: specifier.imported.name === importedName;
|
|
33
|
+
})[0] ?? null;
|
|
34
|
+
return {
|
|
35
|
+
specifier: matchedSpecifier,
|
|
36
|
+
importDeclaration: matchedImportDeclaration,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Ensure that an import of a module is present in the file
|
|
41
|
+
*
|
|
42
|
+
* If the import is not present, it will be added below other imports or
|
|
43
|
+
* to the top of the file if no other imports are found
|
|
44
|
+
*
|
|
45
|
+
* Returns the specifier and import declaration nodes that were found, edited or created
|
|
46
|
+
*/
|
|
47
|
+
export const ensureImportOf = (root, importPath, importedName, importedAsName) => {
|
|
48
|
+
let { importDeclaration, specifier } = findImportOf(root, importPath, importedName, importedAsName);
|
|
49
|
+
if (!specifier) {
|
|
50
|
+
specifier = importedAsName
|
|
51
|
+
? j.importSpecifier(j.identifier(importedName), j.identifier(importedAsName))
|
|
52
|
+
: j.importSpecifier(j.identifier(importedName));
|
|
53
|
+
if (!importDeclaration) {
|
|
54
|
+
importDeclaration = j.importDeclaration([], j.literal(importPath));
|
|
55
|
+
const existingImports = root.find(j.ImportDeclaration);
|
|
56
|
+
// Put it after the existing imports if possible
|
|
57
|
+
if (existingImports.length > 0) {
|
|
58
|
+
existingImports
|
|
59
|
+
.at(existingImports.length - 1)
|
|
60
|
+
.insertAfter(importDeclaration);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
root.get().node.program.body.unshift(importDeclaration);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
importDeclaration?.specifiers?.push(specifier);
|
|
67
|
+
}
|
|
68
|
+
return { specifier, importDeclaration };
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Find an object expression by its name like
|
|
72
|
+
*
|
|
73
|
+
* ```
|
|
74
|
+
* const objName = {
|
|
75
|
+
* key: 'value',
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* Returns the object expression node if found, otherwise null
|
|
80
|
+
*
|
|
81
|
+
* If multiple are found, the first one is returned
|
|
82
|
+
*/
|
|
83
|
+
export const findObjectExpression = (root, objName) => {
|
|
84
|
+
const result = root
|
|
85
|
+
.find(j.VariableDeclarator, {
|
|
86
|
+
id: { type: 'Identifier', name: objName },
|
|
87
|
+
init: { type: 'ObjectExpression' },
|
|
88
|
+
})
|
|
89
|
+
.nodes()[0];
|
|
90
|
+
return result && result?.init?.type === 'ObjectExpression'
|
|
91
|
+
? result.init
|
|
92
|
+
: null;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Find an object's property by it's key
|
|
96
|
+
*
|
|
97
|
+
* Returns the property node that was found or null
|
|
98
|
+
*/
|
|
99
|
+
export const findObjectProperty = ({ obj, key, }) => {
|
|
100
|
+
const properties = obj.properties;
|
|
101
|
+
return (properties.find(prop => {
|
|
102
|
+
if (prop.type !== 'ObjectProperty')
|
|
103
|
+
return false;
|
|
104
|
+
if (prop.key.type === 'Identifier' && prop.key.name === key)
|
|
105
|
+
return true;
|
|
106
|
+
if (prop.key.type === 'StringLiteral' && prop.key.value === key)
|
|
107
|
+
return true;
|
|
108
|
+
return false;
|
|
109
|
+
}) ?? null);
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Return all the objects keys
|
|
113
|
+
*
|
|
114
|
+
* Only returns keys of types Identifier and StringLiteral eg
|
|
115
|
+
*
|
|
116
|
+
* const foo = { 'cool-key': 'value', otherKey: 'ok' }
|
|
117
|
+
*/
|
|
118
|
+
export const objectKeys = ({ obj, }) => {
|
|
119
|
+
const properties = obj.properties;
|
|
120
|
+
return properties
|
|
121
|
+
.map(prop => {
|
|
122
|
+
if (prop.type !== 'ObjectProperty')
|
|
123
|
+
return null;
|
|
124
|
+
if (prop.key.type === 'Identifier')
|
|
125
|
+
return prop.key.name;
|
|
126
|
+
if (prop.key.type === 'StringLiteral')
|
|
127
|
+
return prop.key.value;
|
|
128
|
+
return null;
|
|
129
|
+
})
|
|
130
|
+
.filter(value => typeof value === 'string');
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Ensure that an object has a property with a specific key
|
|
134
|
+
*
|
|
135
|
+
* If the property is not present, it will be added to the object
|
|
136
|
+
*
|
|
137
|
+
* If `defaultValue` is provided, the property will be set to that value if it does not exist
|
|
138
|
+
*
|
|
139
|
+
* If `overwrite` is also true, the property will be replaced with the `defaultValue`
|
|
140
|
+
*
|
|
141
|
+
* Returns the property node that was found or created
|
|
142
|
+
*/
|
|
143
|
+
export const ensureObjectProperty = ({ obj, key, defaultValue, overwrite = false, }) => {
|
|
144
|
+
const properties = obj.properties;
|
|
145
|
+
let targetProperty = findObjectProperty({ obj, key });
|
|
146
|
+
if (targetProperty) {
|
|
147
|
+
if (overwrite) {
|
|
148
|
+
targetProperty.value = defaultValue;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const safeKeyName = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|
|
153
|
+
const identifier = safeKeyName.test(key)
|
|
154
|
+
? j.identifier(key)
|
|
155
|
+
: j.stringLiteral(key);
|
|
156
|
+
targetProperty = j.property('init', identifier, defaultValue);
|
|
157
|
+
properties.push(targetProperty);
|
|
158
|
+
}
|
|
159
|
+
return targetProperty;
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=codemod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codemod.js","sourceRoot":"","sources":["../../src/utils/codemod.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAA;AAGrC,MAAM,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,IAAU,EACV,UAAkB,EAClB,YAAoB,EACpB,cAAuB,EACvB,EAAE;IACF,MAAM,wBAAwB,GAC5B,IAAI;SACD,IAAI,CAAC,CAAC,CAAC,iBAAiB,EAAE;QACzB,MAAM,EAAE,EAAC,KAAK,EAAE,UAAU,EAAC;KAC5B,CAAC;SACD,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAEvB,MAAM,gBAAgB,GACpB,wBAAwB,EAAE,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE;QACvD,IAAI,SAAS,CAAC,IAAI,KAAK,iBAAiB;YAAE,OAAO,KAAK,CAAA;QAEtD,OAAO,cAAc;YACnB,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;gBACtC,SAAS,EAAE,KAAK,EAAE,IAAI,KAAK,cAAc;YAC7C,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,CAAA;IAC9C,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAA;IAEf,OAAO;QACL,SAAS,EAAE,gBAAgB;QAC3B,iBAAiB,EAAE,wBAAwB;KAC5C,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,IAAU,EACV,UAAkB,EAClB,YAAoB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