-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR rewrites `copy.sh` script that was used to copy shared components to test-apps. The rewrite is necessary to work on windows without resulting to using tools that might not be present on user machine.
- Loading branch information
1 parent
7225cf4
commit f9fcdac
Showing
11 changed files
with
44 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
|
||
function showUsage() { | ||
console.log("Copies shared code to a destination directory. Shared code has navigation directory, integrating with expo-router. To copy it, use 'expo-router' as the first argument. Otherwise, use 'bare'."); | ||
console.log("Example: ./copy.js expo-router /src/shared"); | ||
console.log(""); | ||
console.log(`Usage: ${path.basename(process.argv[1])} {bare | expo-router} <destination>`); | ||
process.exit(1); | ||
} | ||
|
||
if (process.argv.length !== 4 || !["bare", "expo-router"].includes(process.argv[2])) { | ||
showUsage(); | ||
} | ||
|
||
const mode = process.argv[2]; | ||
const destination = process.argv[3]; | ||
const scriptDir = path.dirname(__filename); | ||
|
||
if (fs.existsSync(destination)) { | ||
fs.rmSync(destination, { recursive: true, force: true }); | ||
} | ||
fs.mkdirSync(destination, { recursive: true }); | ||
|
||
const sourceDir = path.join(scriptDir, 'src'); | ||
execSync(`cp -R ${sourceDir}/ ${destination}`); | ||
|
||
// Remove the "navigation" directory is only testable in expo-router setups so we need to remove it | ||
if (mode === "bare") { | ||
const navigationDir = path.join(destination, 'navigation'); | ||
if (fs.existsSync(navigationDir)) { | ||
fs.rmSync(navigationDir, { recursive: true, force: true }); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.