Skip to content

Commit d58e149

Browse files
committed
docs: add example app
1 parent 3b9bc09 commit d58e149

File tree

17 files changed

+694
-216
lines changed

17 files changed

+694
-216
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,16 @@ jobs:
4646

4747
- name: Build package
4848
run: yarn prepack
49+
50+
build-web:
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout
54+
uses: actions/checkout@v3
55+
56+
- name: Setup
57+
uses: ./.github/actions/setup
58+
59+
- name: Build example for Web
60+
run: |
61+
yarn example expo export:web

example/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web-build

example/App.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './src/App';

example/app.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"expo": {
3+
"name": "react-native-laravel-sanctum-example",
4+
"slug": "react-native-laravel-sanctum-example",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "light",
9+
"splash": {
10+
"image": "./assets/splash.png",
11+
"resizeMode": "contain",
12+
"backgroundColor": "#ffffff"
13+
},
14+
"assetBundlePatterns": [
15+
"**/*"
16+
],
17+
"ios": {
18+
"supportsTablet": true
19+
},
20+
"android": {
21+
"adaptiveIcon": {
22+
"foregroundImage": "./assets/adaptive-icon.png",
23+
"backgroundColor": "#ffffff"
24+
}
25+
},
26+
"web": {
27+
"favicon": "./assets/favicon.png"
28+
}
29+
}
30+
}

example/assets/adaptive-icon.png

17.1 KB
Loading

example/assets/favicon.png

1.43 KB
Loading

example/assets/icon.png

21.9 KB
Loading

example/assets/splash.png

46.2 KB
Loading

example/babel.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const path = require('path');
2+
const pak = require('../package.json');
3+
4+
module.exports = function (api) {
5+
api.cache(true);
6+
7+
return {
8+
presets: ['babel-preset-expo'],
9+
plugins: [
10+
[
11+
'module-resolver',
12+
{
13+
extensions: ['.tsx', '.ts', '.js', '.json'],
14+
alias: {
15+
// For development, we want to alias the library to the source
16+
[pak.name]: path.join(__dirname, '..', pak.source),
17+
},
18+
},
19+
],
20+
],
21+
};
22+
};

example/metro.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const path = require('path');
2+
const escape = require('escape-string-regexp');
3+
const { getDefaultConfig } = require('@expo/metro-config');
4+
const exclusionList = require('metro-config/src/defaults/exclusionList');
5+
const pak = require('../package.json');
6+
7+
const root = path.resolve(__dirname, '..');
8+
const modules = Object.keys({ ...pak.peerDependencies });
9+
10+
const defaultConfig = getDefaultConfig(__dirname);
11+
12+
/**
13+
* Metro configuration
14+
* https://facebook.github.io/metro/docs/configuration
15+
*
16+
* @type {import('metro-config').MetroConfig}
17+
*/
18+
const config = {
19+
...defaultConfig,
20+
21+
projectRoot: __dirname,
22+
watchFolders: [root],
23+
24+
// We need to make sure that only one version is loaded for peerDependencies
25+
// So we block them at the root, and alias them to the versions in example's node_modules
26+
resolver: {
27+
...defaultConfig.resolver,
28+
29+
blacklistRE: exclusionList(
30+
modules.map(
31+
(m) =>
32+
new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`)
33+
)
34+
),
35+
36+
extraNodeModules: modules.reduce((acc, name) => {
37+
acc[name] = path.join(__dirname, 'node_modules', name);
38+
return acc;
39+
}, {}),
40+
},
41+
};
42+
43+
module.exports = config;

0 commit comments

Comments
 (0)