mirror of
https://github.com/luxfi/safe-wallet.git
synced 2026-10-30 15:19:21 +00:00
* refactor: repository now follows a Monorepo structure Main project folders are now: - apps - packages Apps such as expo, nextjs live inside of the apps folder. Packages shared between the apps live in packages. I migrated to yarn v4 (from npm) as the general opinion is that yarn has better workspaces support. Also the web app uses it. * fix: enable corepack in CI And also switch to a newer node version in general * fix: collect coverage from right files * fix: make EAS happy * fix: typo
74 lines
1.9 KiB
JavaScript
Executable File
74 lines
1.9 KiB
JavaScript
Executable File
#!/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 SafeFontIcon.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 (
|
|
<View
|
|
style={{
|
|
flex: 1,
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
}}
|
|
>
|
|
<Text>Edit app/index.tsx to edit this screen.</Text>
|
|
</View>
|
|
);
|
|
}
|
|
`
|
|
|
|
const layoutContent = `import { Stack } from "expo-router";
|
|
|
|
export default function RootLayout() {
|
|
return (
|
|
<Stack>
|
|
<Stack.Screen name="index" />
|
|
</Stack>
|
|
);
|
|
}
|
|
`
|
|
|
|
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, 'SafeFontIcon.tsx')
|
|
fs.writeFile(indexPath, indexContent, (error) => {
|
|
if (error) {
|
|
return console.error(`Error creating index.tsx: ${error}`)
|
|
}
|
|
console.log('app/SafeFontIcon.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.')
|
|
})
|
|
})
|
|
})
|
|
})
|