From 09671e847ffe6fe46686a4085263b797f9603876 Mon Sep 17 00:00:00 2001 From: Frank Calise Date: Mon, 9 Sep 2024 07:18:02 -0400 Subject: [PATCH] fix: remove snackify command and references (#2763 by @frankcalise) --- docs/cli/Ignite-CLI.md | 7 --- docs/expo/Expo-and-Ignite.md | 10 ---- src/commands/help.ts | 4 -- src/commands/snackify.ts | 93 ------------------------------------ 4 files changed, 114 deletions(-) delete mode 100644 src/commands/snackify.ts diff --git a/docs/cli/Ignite-CLI.md b/docs/cli/Ignite-CLI.md index c381d9e67..1564678f7 100644 --- a/docs/cli/Ignite-CLI.md +++ b/docs/cli/Ignite-CLI.md @@ -146,13 +146,6 @@ Removes all demo code (files, marked code blocks and lines) from the generated b Renames your current project to the desired new name. It'll also help switch the bundle identifier. -### Snackify - -- `npx ignite-cli snackify` -- Alias: `npx ignite-cli s` - -Turns an Ignite app into a project compatible with uploading directly to [Expo's Snack platform](https://snack.expo.dev/). This will create a separate branch to do so without worrying about modifying your current project structure. - ### Update - `npx ignite-cli update` diff --git a/docs/expo/Expo-and-Ignite.md b/docs/expo/Expo-and-Ignite.md index 1fd557cc2..79afac23e 100644 --- a/docs/expo/Expo-and-Ignite.md +++ b/docs/expo/Expo-and-Ignite.md @@ -47,13 +47,3 @@ As a general rule of thumb, it's not a bad idea to start with Expo CLI. You'll a Where you generally will need to start considering diverging from standard Expo is when you need custom native functionality. Note that you can do a lot of custom native code with Expo's new [Config Plugins](https://docs.expo.dev/guides/config-plugins/) feature, too, so even native code is no longer much of a barrier. If you still would rather not use Expo Go / CLI, then Ignite is already ready for you -- no "ejecting" necessary. Expo refers to this as the "bare workflow." Just run `yarn ios` / `yarn android` and it'll build using the React Native CLI. - -## Expo Snacks - -You can't run an Ignite app directly in [Expo Snack](https://snack.expo.dev/), but we have a new command in Ignite that will set up your project so it can load in a Snack! - -This is one of the coolest ways to demo an app to someone else without having to send them a build. They can try your app out right in their browser! - -Note there are some limitations to Expo Snacks, and making those work (other than out of the box for Ignite) is beyond the scope of this documentation. You can learn more in [the Snack docs](https://docs.expo.dev/workflow/snack/). - -TODO: add documentation for `npx ignite-cli snackify` here. diff --git a/src/commands/help.ts b/src/commands/help.ts index cc8f49acd..55e967c11 100644 --- a/src/commands/help.ts +++ b/src/commands/help.ts @@ -61,10 +61,6 @@ module.exports = { ["npx ignite-cli remove-demo-markup", "npx ignite-cli remove-demo-markup --dry-run"], ) p() - command("snackify ", "Creates a new branch which can be imported as an Expo snack", [ - "npx ignite-cli snackify", - ]) - p() direction( `See the documentation: ${link("https://github.com/infinitered/ignite/tree/master/docs")}`, ) diff --git a/src/commands/snackify.ts b/src/commands/snackify.ts deleted file mode 100644 index 886dec0e3..000000000 --- a/src/commands/snackify.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { filesystem, GluegunToolbox } from "gluegun" -import { packager } from "../tools/packager" - -module.exports = { - alias: ["s"], - description: "Snackify Ignite app", - run: async (toolbox: GluegunToolbox) => { - const { print, prompt, system, patching } = toolbox - const { remove, exists } = filesystem - const { info } = print - - // check if git is enabled in the project - const gitExists = exists("./.git") - if (gitExists === "dir") { - // getStatus checks if there are any uncommitted changes inside the branch - const getStatus = await system.run(`git status -s`) - if (getStatus === "") { - // test if the branch name has substring snack - const branchName = await system.run(`git branch --show-current`) - if (!branchName.includes("snack")) { - info("Creating a new branch for your snack") - system.run(`git checkout -b snack-$(date +'%m%d%y')`) - } - } else { - info( - "There are uncommitted changes in your current branch, please commit changes before running this", - ) - return - } - } - - info("This command will create an Expo snack project for you. ") - info("This can be exported to an Expo snack for you to test and play with your app.") - info("In order to snackify (create an Expo snack) this project, we must delete:") - info( - "- /ios\n- /android\n- /e2e\n- /test\n- /app/services/reactotron\n- jest.config.js\n- metro.config.js\n- webpack.config.js", - ) - - const confirm = await prompt.confirm("Do you wish to continue", true) - // the following array contains folders and files that are deleted to make project ready for some snacking - const removeArray = [ - "./ios", - "./android", - "./e2e", - "./test", - "./jest.config.js", - "./metro.config.js", - "./webpack.config.js", - "./app/services/reactotron", - ] - - if (confirm) { - // 1. delete all folders and files that are not required - removeArray.map((val) => remove(val)) - // 2. Create a new file to handle reactotron - filesystem.file("./app/services/reactotron/index.ts") - patching.replace( - "./app/services/reactotron/index.ts", - "", - "/*** This file is loaded for snack to resolve Reactotron for expo snack**/ \n export const setupReactotron = (arg1:any) => null \nexport const setReactotronRootStore=(arg1:any, arg2:any)=>null", - ) - - // 3. Update/Add packages as per expo snack's requirements - const addPackages = [ - "expo-constants@~13.2.4", - "expo-localization@~13.1.0", - "expo-modules-core@~0.11.4", - "expo-splash-screen@~0.16.2", - "react-native-screens@~3.15.0", - "@react-native-async-storage/async-storage@~1.17.3", - ] - - // 4. Remove packages that are not required - const removePackages = [ - "@expo/webpack-config", - "reactotron-react-native", - "ts-jest", - "jest", - "metro-config", - "@rnx-kit/metro-config", - "reactotron-mst", - "reactotron-react-js", - "reactotron-core-client", - ] - await packager.add(addPackages.join(" ")) - await packager.remove(removePackages.join(" ")) - } - info("All done, your app is ready to be imported into Expo snack") - info( - "The best way to import this project into an Expo snack is via publishing this project into a public repository on github and then adding your repo's URL to an expo snack - https://snack.expo.dev/", - ) - }, -}