-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apps): react-navigation example
- Loading branch information
Showing
105 changed files
with
3,313 additions
and
10 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
apps/example/package.json → apps/example-app-router/package.json
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
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,4 @@ | ||
module.exports = { | ||
root: true, | ||
extends: '@react-native', | ||
}; |
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,7 @@ | ||
module.exports = { | ||
arrowParens: "avoid", | ||
bracketSameLine: true, | ||
bracketSpacing: false, | ||
singleQuote: true, | ||
trailingComma: "all", | ||
}; |
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 @@ | ||
{} |
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,3 @@ | ||
module.exports = { | ||
presets: ['module:@react-native/babel-preset'], | ||
}; |
Binary file added
BIN
+9 KB
...example-react-navigation/coderc/assets/app-icon/android-adaptive-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+23.4 KB
...example-react-navigation/coderc/assets/app-icon/android-adaptive-foreground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.5 KB
apps/example-react-navigation/coderc/assets/app-icon/android-legacy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
apps/example-react-navigation/coderc/assets/app-icon/android-notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+27.5 KB
apps/example-react-navigation/coderc/assets/app-icon/ios-universal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added
BIN
+170 KB
apps/example-react-navigation/coderc/assets/fonts/Roboto-BlackItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+167 KB
apps/example-react-navigation/coderc/assets/fonts/Roboto-BoldItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+169 KB
apps/example-react-navigation/coderc/assets/fonts/Roboto-LightItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+169 KB
apps/example-react-navigation/coderc/assets/fonts/Roboto-MediumItalic.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+169 KB
apps/example-react-navigation/coderc/assets/fonts/Roboto-ThinItalic.ttf
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions
51
apps/example-react-navigation/coderc/build/build.internal.ts
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,51 @@ | ||
import {defineBuild} from '@brandingbrand/code-cli-kit'; | ||
import type {CodePluginAsset} from '@brandingbrand/code-plugin-asset'; | ||
import type {CodePluginAppIcon} from '@brandingbrand/code-plugin-app-icon'; | ||
import type {CodePluginSplashScreen} from '@brandingbrand/code-plugin-splash-screen'; | ||
|
||
export default defineBuild< | ||
CodePluginAsset & CodePluginAppIcon & CodePluginSplashScreen | ||
>({ | ||
ios: { | ||
bundleId: 'com.brandingbrand', | ||
displayName: 'Branding Brand', | ||
plist: { | ||
urlScheme: { | ||
scheme: 'app', | ||
}, | ||
}, | ||
}, | ||
android: { | ||
packageName: 'com.brandingbrand', | ||
displayName: 'Branding Brand', | ||
}, | ||
codePluginAsset: { | ||
plugin: { | ||
assetPath: ['./coderc/assets/fonts'], | ||
}, | ||
}, | ||
codePluginAppIcon: { | ||
plugin: { | ||
appIconPath: './coderc/assets/app-icon', | ||
iconInsets: 20, | ||
}, | ||
}, | ||
codePluginSplashScreen: { | ||
plugin: { | ||
ios: { | ||
type: 'generated', | ||
generated: { | ||
logoPath: './coderc/assets/splash-screen/logo.png', | ||
backgroundColor: '#fff', | ||
}, | ||
}, | ||
android: { | ||
type: 'generated', | ||
generated: { | ||
logoPath: './coderc/assets/splash-screen/logo.png', | ||
backgroundColor: '#fff', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); |
36 changes: 36 additions & 0 deletions
36
apps/example-react-navigation/coderc/plugins/plugin-monorepo/__tests__/index.ts
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,36 @@ | ||
/** | ||
* @jest-environment-options {"requireTemplate": true} | ||
*/ | ||
|
||
/// <reference types="@brandingbrand/code-jest-config" /> | ||
|
||
import {fs, path} from '@brandingbrand/code-cli-kit'; | ||
import plugin from '../src'; | ||
|
||
describe('plugin', () => { | ||
it('ios', async () => { | ||
await plugin.ios?.({} as any, {} as any); | ||
|
||
const pbxProj = await fs.readFile(path.ios.projectPbxProj, 'utf-8'); | ||
|
||
expect(pbxProj).toContain( | ||
'${REACT_NATIVE_PATH}/scripts/xcode/with-environment.sh', | ||
); | ||
}); | ||
|
||
it('android', async () => { | ||
await plugin.android?.({} as any, {} as any); | ||
|
||
const appBuildGradle = await fs.readFile( | ||
path.android.appBuildGradle, | ||
'utf-8', | ||
); | ||
const settingsGradle = await fs.readFile( | ||
path.project.resolve('android', 'settings.gradle'), | ||
'utf-8', | ||
); | ||
|
||
expect(appBuildGradle).toContain('../../../node_modules'); | ||
expect(settingsGradle).toContain('../../../node_modules'); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
apps/example-react-navigation/coderc/plugins/plugin-monorepo/package.json
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,19 @@ | ||
{ | ||
"name": "plugin-monorepo", | ||
"version": "0.0.0", | ||
"license": "UNLICENSED", | ||
"private": true, | ||
"main": "src/index.ts", | ||
"scripts": { | ||
"lint": "eslint . --max-warnings 0", | ||
"test": "jest" | ||
}, | ||
"jest": { | ||
"preset": "@brandingbrand/code-jest-config" | ||
}, | ||
"types": "src/index.ts", | ||
"devDependencies": { | ||
"eslint": "^8.0.0", | ||
"jest": "^29.0.0" | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
apps/example-react-navigation/coderc/plugins/plugin-monorepo/src/index.ts
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,70 @@ | ||
/** | ||
* Defines a plugin for @brandingbrand/code-cli-kit. | ||
* @module Plugin | ||
*/ | ||
|
||
import { | ||
definePlugin, | ||
path, | ||
string, | ||
withUTF8, | ||
} from '@brandingbrand/code-cli-kit'; | ||
|
||
/** | ||
* Defines a plugin with functions for both iOS and Android platforms. | ||
* @alias module:Plugin | ||
* @param {Object} build - The build configuration object. | ||
* @param {Object} options - The options object. | ||
*/ | ||
export default definePlugin({ | ||
/** | ||
* Function to be executed for iOS platform. | ||
* @param {Object} _build - The build configuration object for iOS. | ||
* @param {Object} _options - The options object for iOS. | ||
* @returns {Promise<void>} A promise that resolves when the process completes. | ||
*/ | ||
ios: async function (_build: object, _options: object): Promise<void> { | ||
await withUTF8(path.ios.projectPbxProj, content => { | ||
return string.replace( | ||
content, | ||
/(..\/)+?node_modules\/react-native/gm, | ||
'${REACT_NATIVE_PATH}', | ||
); | ||
}); | ||
}, | ||
|
||
/** | ||
* Function to be executed for Android platform. | ||
* @param {Object} _build - The build configuration object for Android. | ||
* @param {Object} _options - The options object for Android. | ||
* @returns {Promise<void>} A promise that resolves when the process completes. | ||
*/ | ||
android: async function (_build: object, _options: object): Promise<void> { | ||
await withUTF8( | ||
path.project.resolve('android', 'settings.gradle'), | ||
content => { | ||
return string.replace( | ||
content, | ||
/(..\/)+?(node_modules)/gm, | ||
'../../../$2', | ||
); | ||
}, | ||
); | ||
|
||
await withUTF8(path.android.appBuildGradle, content => { | ||
content = string.replace( | ||
content, | ||
/(react\s+{\n(\s+))/gm, | ||
'$1reactNativeDir = file("../../../../node_modules/react-native")\n$2', | ||
); | ||
|
||
content = string.replace( | ||
content, | ||
/(..\/)+?(node_modules\/@react-native-community)/gm, | ||
'../../../../$2', | ||
); | ||
|
||
return content; | ||
}); | ||
}, | ||
}); |
Oops, something went wrong.