From dd0882693150370917e66a82bbfba940cc1e0e4e Mon Sep 17 00:00:00 2001 From: sarendsen Date: Tue, 7 Jan 2025 12:03:35 +0100 Subject: [PATCH] wip --- package.json | 1 - scripts/reset-project.js | 73 ---------------------------------------- 2 files changed, 74 deletions(-) delete mode 100755 scripts/reset-project.js diff --git a/package.json b/package.json index 69b0e977..b128915c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "scripts": { "submodule-reload": "git submodule update --init --remote --recursive", "start": "bun run submodule-reload && expo start", - "reset-project": "node ./scripts/reset-project.js", "ios": "EXPO_TV=0 expo run:ios", "ios:tv": "EXPO_TV=1 expo run:ios", "android": "EXPO_TV=0 expo run:android", diff --git a/scripts/reset-project.js b/scripts/reset-project.js deleted file mode 100755 index 4512e162..00000000 --- a/scripts/reset-project.js +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env node - -/** - * This script is used to reset the project to a blank state. - * It moves the /app directory to /app-example and creates a new /app directory with an index.tsx and _layout.tsx file. - * You can remove the `reset-project` script from package.json and safely delete this file after running it. - */ - -const fs = require('fs'); -const path = require('path'); - -const root = process.cwd(); -const oldDirPath = path.join(root, 'app'); -const newDirPath = path.join(root, 'app-example'); -const newAppDirPath = path.join(root, 'app'); - -const indexContent = `import { Text, View } from "react-native"; - -export default function Index() { - return ( - - Edit app/index.tsx to edit this screen. - - ); -} -`; - -const layoutContent = `import { Stack } from "expo-router"; - -export default function RootLayout() { - return ( - - - - ); -} -`; - -fs.rename(oldDirPath, newDirPath, (error) => { - if (error) { - return console.error(`Error renaming directory: ${error}`); - } - console.log('/app moved to /app-example.'); - - fs.mkdir(newAppDirPath, { recursive: true }, (error) => { - if (error) { - return console.error(`Error creating new app directory: ${error}`); - } - console.log('New /app directory created.'); - - const indexPath = path.join(newAppDirPath, 'index.tsx'); - fs.writeFile(indexPath, indexContent, (error) => { - if (error) { - return console.error(`Error creating index.tsx: ${error}`); - } - console.log('app/index.tsx created.'); - - const layoutPath = path.join(newAppDirPath, '_layout.tsx'); - fs.writeFile(layoutPath, layoutContent, (error) => { - if (error) { - return console.error(`Error creating _layout.tsx: ${error}`); - } - console.log('app/_layout.tsx created.'); - }); - }); - }); -});