sdsetup 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -2
- package/dist/babel.d.ts +25 -0
- package/dist/babel.d.ts.map +1 -0
- package/dist/babel.js +246 -0
- package/dist/babel.js.map +1 -0
- package/dist/config/android.d.ts +15 -0
- package/dist/config/android.d.ts.map +1 -0
- package/dist/config/android.js +133 -0
- package/dist/config/android.js.map +1 -0
- package/dist/config/pods.d.ts +11 -0
- package/dist/config/pods.d.ts.map +1 -0
- package/dist/config/pods.js +28 -0
- package/dist/config/pods.js.map +1 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +27 -0
- package/dist/constants.js.map +1 -0
- package/dist/detect.d.ts +19 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +78 -0
- package/dist/detect.js.map +1 -0
- package/dist/files.d.ts +19 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +48 -0
- package/dist/files.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +189 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +11 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +37 -0
- package/dist/install.js.map +1 -0
- package/dist/pm.d.ts +14 -0
- package/dist/pm.d.ts.map +1 -0
- package/dist/pm.js +52 -0
- package/dist/pm.js.map +1 -0
- package/dist/setup/cli.d.ts +20 -0
- package/dist/setup/cli.d.ts.map +1 -0
- package/dist/setup/cli.js +133 -0
- package/dist/setup/cli.js.map +1 -0
- package/dist/setup/expo.d.ts +20 -0
- package/dist/setup/expo.d.ts.map +1 -0
- package/dist/setup/expo.js +52 -0
- package/dist/setup/expo.js.map +1 -0
- package/package.json +44 -4
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# sdsetup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Set up a React Native project in one command. It installs a ready-made stack for state, navigation, forms and data fetching, then applies the configuration your project needs so you don't have to follow a long checklist by hand.
|
|
4
|
+
|
|
5
|
+
Works with both Expo and bare React Native projects, and with npm, yarn, pnpm or bun.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Run it from the root of your project, the folder that contains your `package.json`:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx sdsetup
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
That's it. It looks at your project first, shows what it plans to do, and asks for confirmation before changing anything.
|
|
16
|
+
|
|
17
|
+
## What it sets up
|
|
18
|
+
|
|
19
|
+
- State management: Redux Toolkit and react-redux
|
|
20
|
+
- Navigation: React Navigation with stack and tab navigators, plus the native dependencies they need
|
|
21
|
+
- Forms and validation: Formik and Yup
|
|
22
|
+
- Data fetching: TanStack Query
|
|
23
|
+
- Animations: Reanimated and Worklets
|
|
24
|
+
|
|
25
|
+
A few things worth knowing:
|
|
26
|
+
|
|
27
|
+
- It picks the right install command for your setup. Expo projects use `expo install`, so every package version matches your SDK. Everything else uses your package manager's normal add command.
|
|
28
|
+
- Your package manager is detected from the lockfile, so you don't need to tell it which one you use.
|
|
29
|
+
- Packages you already have are skipped, and everything missing is installed in one go.
|
|
30
|
+
- It applies the configuration your project actually needs, such as the Babel plugin for Reanimated and the Android change required by React Navigation. This is the step that usually causes confusing build errors when it's missed, so it's handled for you.
|
|
31
|
+
- Expo projects generally need no extra native setup, and none is applied.
|
|
32
|
+
- It's safe to run again. Every file it touches is backed up first as `.sdsetup.bak`, and a second run won't change anything that's already done.
|
|
33
|
+
|
|
34
|
+
## Options
|
|
35
|
+
|
|
36
|
+
| Flag | What it does |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `--dry-run` | Shows the commands and file changes it would make, without touching anything. |
|
|
39
|
+
| `--yes`, `-y` | Skips the confirmation prompts. |
|
|
40
|
+
| `--skip-pods` | Skips the iOS `pod install` step. |
|
|
41
|
+
| `--help`, `-h` | Shows the help text. |
|
|
42
|
+
|
|
43
|
+
A dry run is a good first step if you want to see exactly what will happen:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx sdsetup --dry-run
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## What's left for you
|
|
50
|
+
|
|
51
|
+
The tool prints this at the end of every run, tailored to your project. In short:
|
|
52
|
+
|
|
53
|
+
- Clear the Metro cache after Babel changes, then rebuild the app. The exact commands are printed in the summary.
|
|
54
|
+
- On iOS, run `npx pod-install ios` on a Mac if pods were skipped or you're not on macOS.
|
|
55
|
+
- You still wire up the providers yourself. The packages are installed, but `Provider`, `QueryClientProvider` and `NavigationContainer` are not added to your app entry for you.
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
- Node 18 or newer.
|
|
60
|
+
- A React Native project, Expo or bare, detected by `react-native` or `expo` in `package.json`.
|
|
61
|
+
- Optional files like `app.json`, `app.config.js/ts` and `eas.json` are fine either way. Nothing fails if they're missing.
|
|
62
|
+
|
|
63
|
+
If something goes wrong, the error tells you what to fix, and nothing is rolled back silently. Restoring a `.sdsetup.bak` file puts any edited file back exactly as it was.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
MIT
|
package/dist/babel.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Pick babel plugin based on installed reanimated version. v3.x (or older) -> reanimated plugin, otherwise worklets plugin (v4+). */
|
|
2
|
+
export declare function chooseReanimatedPlugin(reanimatedVersion: string | null | undefined): string;
|
|
3
|
+
/**
|
|
4
|
+
* Pure, idempotent transform: ensure `plugin` is the LAST entry of `plugins` in babel config source.
|
|
5
|
+
* - code === null/'' => creates a minimal config containing just the plugin.
|
|
6
|
+
* - removes any other reanimated/worklets plugin entries, then appends desired plugin last.
|
|
7
|
+
* - never duplicates; running twice yields identical output.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureBabelPlugin(code: string | null, plugin: string, preset?: string): {
|
|
10
|
+
code: string;
|
|
11
|
+
changed: boolean;
|
|
12
|
+
};
|
|
13
|
+
export interface BabelEditResult {
|
|
14
|
+
file: string;
|
|
15
|
+
created: boolean;
|
|
16
|
+
changed: boolean;
|
|
17
|
+
backup: string | null;
|
|
18
|
+
plugin: string;
|
|
19
|
+
unparseable?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function upsertBabelConfig(cwd: string, plugin: string, opts?: {
|
|
22
|
+
dryRun?: boolean;
|
|
23
|
+
preset?: string;
|
|
24
|
+
}): BabelEditResult;
|
|
25
|
+
//# sourceMappingURL=babel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.d.ts","sourceRoot":"","sources":["../src/babel.ts"],"names":[],"mappings":"AASA,sIAAsI;AACtI,wBAAgB,sBAAsB,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAO3F;AAiHD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAA2C,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAuC5J;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,eAAe,CAgChI"}
|
package/dist/babel.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.chooseReanimatedPlugin = chooseReanimatedPlugin;
|
|
37
|
+
exports.ensureBabelPlugin = ensureBabelPlugin;
|
|
38
|
+
exports.upsertBabelConfig = upsertBabelConfig;
|
|
39
|
+
const node_fs_1 = require("node:fs");
|
|
40
|
+
const node_path_1 = require("node:path");
|
|
41
|
+
const parser = __importStar(require("@babel/parser"));
|
|
42
|
+
const recast = __importStar(require("recast"));
|
|
43
|
+
const constants_js_1 = require("./constants.js");
|
|
44
|
+
const files_js_1 = require("./files.js");
|
|
45
|
+
const ALL_REANIMATED_PLUGINS = [constants_js_1.REANIMATED_V3_PLUGIN, constants_js_1.WORKLETS_PLUGIN];
|
|
46
|
+
/** Pick babel plugin based on installed reanimated version. v3.x (or older) -> reanimated plugin, otherwise worklets plugin (v4+). */
|
|
47
|
+
function chooseReanimatedPlugin(reanimatedVersion) {
|
|
48
|
+
if (!reanimatedVersion)
|
|
49
|
+
return constants_js_1.WORKLETS_PLUGIN;
|
|
50
|
+
const m = reanimatedVersion.match(/(\d+)/);
|
|
51
|
+
if (!m)
|
|
52
|
+
return constants_js_1.WORKLETS_PLUGIN;
|
|
53
|
+
const major = Number.parseInt(m[1], 10);
|
|
54
|
+
if (Number.isNaN(major))
|
|
55
|
+
return constants_js_1.WORKLETS_PLUGIN;
|
|
56
|
+
return major <= 3 ? constants_js_1.REANIMATED_V3_PLUGIN : constants_js_1.WORKLETS_PLUGIN;
|
|
57
|
+
}
|
|
58
|
+
function parseWithRecast(code) {
|
|
59
|
+
return recast.parse(code, {
|
|
60
|
+
parser: {
|
|
61
|
+
parse: (src) => parser.parse(src, {
|
|
62
|
+
sourceType: 'unambiguous',
|
|
63
|
+
allowReturnOutsideFunction: true,
|
|
64
|
+
plugins: ['jsx', 'typescript'],
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function isStringLiteral(node, value) {
|
|
70
|
+
return (!!node &&
|
|
71
|
+
((node.type === 'StringLiteral' && node.value === value) ||
|
|
72
|
+
(node.type === 'Literal' && node.value === value)));
|
|
73
|
+
}
|
|
74
|
+
function pluginEntryMatches(entry, plugin) {
|
|
75
|
+
if (!entry)
|
|
76
|
+
return false;
|
|
77
|
+
if (isStringLiteral(entry, plugin))
|
|
78
|
+
return true;
|
|
79
|
+
// ['plugin-name', { ... }] form
|
|
80
|
+
if (entry.type === 'ArrayExpression' && entry.elements.length > 0) {
|
|
81
|
+
return isStringLiteral(entry.elements[0], plugin);
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
function anyReanimatedPluginMatches(entry) {
|
|
86
|
+
return ALL_REANIMATED_PLUGINS.some((p) => pluginEntryMatches(entry, p));
|
|
87
|
+
}
|
|
88
|
+
const b = recast.types.builders;
|
|
89
|
+
function findConfigObject(ast) {
|
|
90
|
+
let found = null;
|
|
91
|
+
recast.types.visit(ast, {
|
|
92
|
+
visitAssignmentExpression(path) {
|
|
93
|
+
const node = path.node;
|
|
94
|
+
// module.exports = ...
|
|
95
|
+
if (node.left &&
|
|
96
|
+
node.left.type === 'MemberExpression' &&
|
|
97
|
+
node.left.object &&
|
|
98
|
+
node.left.object.type === 'Identifier' &&
|
|
99
|
+
node.left.object.name === 'module' &&
|
|
100
|
+
((node.left.property.type === 'Identifier' && node.left.property.name === 'exports') ||
|
|
101
|
+
(node.left.property.type === 'StringLiteral' && node.left.property.value === 'exports') ||
|
|
102
|
+
(node.left.property.type === 'Literal' && node.left.property.value === 'exports'))) {
|
|
103
|
+
const right = node.right;
|
|
104
|
+
if (right.type === 'ObjectExpression') {
|
|
105
|
+
found = right;
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
if (right.type === 'FunctionExpression' || right.type === 'ArrowFunctionExpression') {
|
|
109
|
+
const body = right.body;
|
|
110
|
+
if (body && body.type === 'BlockStatement') {
|
|
111
|
+
for (const stmt of body.body) {
|
|
112
|
+
if (stmt.type === 'ReturnStatement' && stmt.argument && stmt.argument.type === 'ObjectExpression') {
|
|
113
|
+
found = stmt.argument;
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else if (body && body.type === 'ObjectExpression') {
|
|
119
|
+
found = body;
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
this.traverse(path);
|
|
125
|
+
},
|
|
126
|
+
visitExportDefaultDeclaration(path) {
|
|
127
|
+
const decl = path.node.declaration;
|
|
128
|
+
if (decl.type === 'ObjectExpression') {
|
|
129
|
+
found = decl;
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (decl.type === 'FunctionExpression' || decl.type === 'ArrowFunctionExpression') {
|
|
133
|
+
const body = decl.body;
|
|
134
|
+
if (body && body.type === 'BlockStatement') {
|
|
135
|
+
for (const stmt of body.body) {
|
|
136
|
+
if (stmt.type === 'ReturnStatement' && stmt.argument && stmt.argument.type === 'ObjectExpression') {
|
|
137
|
+
found = stmt.argument;
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (body && body.type === 'ObjectExpression') {
|
|
143
|
+
found = body;
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
this.traverse(path);
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
return found;
|
|
151
|
+
}
|
|
152
|
+
function getPluginsArray(configObj) {
|
|
153
|
+
for (const prop of configObj.properties) {
|
|
154
|
+
if (prop.type !== 'ObjectProperty' && prop.type !== 'Property')
|
|
155
|
+
continue;
|
|
156
|
+
const key = prop.key;
|
|
157
|
+
const name = key.type === 'Identifier' ? key.name : key.type === 'StringLiteral' || key.type === 'Literal' ? key.value : null;
|
|
158
|
+
if (name === 'plugins')
|
|
159
|
+
return prop.value;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Pure, idempotent transform: ensure `plugin` is the LAST entry of `plugins` in babel config source.
|
|
165
|
+
* - code === null/'' => creates a minimal config containing just the plugin.
|
|
166
|
+
* - removes any other reanimated/worklets plugin entries, then appends desired plugin last.
|
|
167
|
+
* - never duplicates; running twice yields identical output.
|
|
168
|
+
*/
|
|
169
|
+
function ensureBabelPlugin(code, plugin, preset = 'module:metro-react-native-babel-preset') {
|
|
170
|
+
if (!code || code.trim() === '') {
|
|
171
|
+
const created = `module.exports = {\n presets: ['${preset}'],\n plugins: ['${plugin}'],\n};\n`;
|
|
172
|
+
return { code: created, changed: true };
|
|
173
|
+
}
|
|
174
|
+
let ast;
|
|
175
|
+
try {
|
|
176
|
+
ast = parseWithRecast(code);
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
// Unparseable — do not touch code with regex. Report as unchanged and let caller warn.
|
|
180
|
+
return { code, changed: false };
|
|
181
|
+
}
|
|
182
|
+
const configObj = findConfigObject(ast);
|
|
183
|
+
if (!configObj)
|
|
184
|
+
return { code, changed: false };
|
|
185
|
+
let pluginsArr = getPluginsArray(configObj);
|
|
186
|
+
if (!pluginsArr) {
|
|
187
|
+
// add plugins: [plugin]
|
|
188
|
+
configObj.properties.push(b.objectProperty(b.identifier('plugins'), b.arrayExpression([b.stringLiteral(plugin)])));
|
|
189
|
+
return { code: recast.print(ast).code, changed: true };
|
|
190
|
+
}
|
|
191
|
+
if (pluginsArr.type !== 'ArrayExpression') {
|
|
192
|
+
return { code, changed: false };
|
|
193
|
+
}
|
|
194
|
+
const elements = pluginsArr.elements.filter(Boolean);
|
|
195
|
+
// Check idempotency: already exactly last and no other reanimated plugin entries?
|
|
196
|
+
const last = elements[elements.length - 1];
|
|
197
|
+
const hasDesired = elements.some((e) => pluginEntryMatches(e, plugin));
|
|
198
|
+
const hasOther = elements.some((e) => anyReanimatedPluginMatches(e) && !pluginEntryMatches(e, plugin));
|
|
199
|
+
if (hasDesired && !hasOther && last && pluginEntryMatches(last, plugin)) {
|
|
200
|
+
// Count occurrences of desired plugin — must be exactly 1
|
|
201
|
+
const count = elements.filter((e) => pluginEntryMatches(e, plugin)).length;
|
|
202
|
+
if (count === 1)
|
|
203
|
+
return { code, changed: false };
|
|
204
|
+
}
|
|
205
|
+
// Remove ALL reanimated/worklets entries (both variants), then append desired last.
|
|
206
|
+
pluginsArr.elements = elements.filter((e) => !anyReanimatedPluginMatches(e));
|
|
207
|
+
pluginsArr.elements.push(b.stringLiteral(plugin));
|
|
208
|
+
return { code: recast.print(ast).code, changed: true };
|
|
209
|
+
}
|
|
210
|
+
function upsertBabelConfig(cwd, plugin, opts = {}) {
|
|
211
|
+
const file = (0, node_path_1.join)(cwd, 'babel.config.js');
|
|
212
|
+
const existed = (0, node_fs_1.existsSync)(file);
|
|
213
|
+
const original = existed ? (0, node_fs_1.readFileSync)(file, 'utf8') : null;
|
|
214
|
+
const preset = opts.preset ?? 'module:metro-react-native-babel-preset';
|
|
215
|
+
const { code, changed } = ensureBabelPlugin(original, plugin, preset);
|
|
216
|
+
// Detect unparseable: existed, non-empty, but unchanged and config object missing — caller should warn.
|
|
217
|
+
let unparseable = false;
|
|
218
|
+
if (existed && !changed && original && original.trim() !== '') {
|
|
219
|
+
try {
|
|
220
|
+
const ast = parseWithRecast(original);
|
|
221
|
+
unparseable = findConfigObject(ast) == null;
|
|
222
|
+
if (!unparseable) {
|
|
223
|
+
const cfg = findConfigObject(ast);
|
|
224
|
+
const arr = cfg ? getPluginsArray(cfg) : null;
|
|
225
|
+
if (arr && arr.type !== 'ArrayExpression')
|
|
226
|
+
unparseable = true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
unparseable = true;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (opts.dryRun) {
|
|
234
|
+
return { file, created: !existed, changed, backup: null, plugin, unparseable };
|
|
235
|
+
}
|
|
236
|
+
if (!changed)
|
|
237
|
+
return { file, created: false, changed: false, backup: null, plugin, unparseable };
|
|
238
|
+
let backup = null;
|
|
239
|
+
if (existed && original != null) {
|
|
240
|
+
backup = file + constants_js_1.BACKUP_SUFFIX;
|
|
241
|
+
(0, files_js_1.backupFile)(file, backup);
|
|
242
|
+
}
|
|
243
|
+
(0, node_fs_1.writeFileSync)(file, code, 'utf8');
|
|
244
|
+
return { file, created: !existed, changed: true, backup, plugin, unparseable };
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=babel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"babel.js","sourceRoot":"","sources":["../src/babel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,wDAOC;AAuHD,8CAuCC;AAWD,8CAgCC;AA1ND,qCAAkE;AAClE,yCAAiC;AACjC,sDAAwC;AACxC,+CAAiC;AACjC,iDAAsF;AACtF,yCAAwC;AAExC,MAAM,sBAAsB,GAAG,CAAC,mCAAoB,EAAE,8BAAe,CAAC,CAAC;AAEvE,sIAAsI;AACtI,SAAgB,sBAAsB,CAAC,iBAA4C;IACjF,IAAI,CAAC,iBAAiB;QAAE,OAAO,8BAAe,CAAC;IAC/C,MAAM,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,CAAC;QAAE,OAAO,8BAAe,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACxC,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,8BAAe,CAAC;IAChD,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,mCAAoB,CAAC,CAAC,CAAC,8BAAe,CAAC;AAC7D,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,OAAQ,MAAc,CAAC,KAAK,CAAC,IAAI,EAAE;QACjC,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CACrB,MAAM,CAAC,KAAK,CAAC,GAAG,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AI,EAAE,MAAM,CAAC,CAAC;IAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface MainActivityEdit {
|
|
2
|
+
applied: boolean;
|
|
3
|
+
wouldChange: boolean;
|
|
4
|
+
file: string | null;
|
|
5
|
+
created: boolean;
|
|
6
|
+
backup: string | null;
|
|
7
|
+
reason: string;
|
|
8
|
+
/** An onCreate exists but its signature was not recognized — user must edit it manually. */
|
|
9
|
+
needsManualEdit: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function ensureMainActivityScreens(cwd: string, opts?: {
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
}): MainActivityEdit;
|
|
14
|
+
export declare function checkPredictiveBackOptOut(cwd: string): string | null;
|
|
15
|
+
//# sourceMappingURL=android.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/config/android.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,4FAA4F;IAC5F,eAAe,EAAE,OAAO,CAAC;CAC1B;AAoDD,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,gBAAgB,CA6DxG;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMpE"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureMainActivityScreens = ensureMainActivityScreens;
|
|
4
|
+
exports.checkPredictiveBackOptOut = checkPredictiveBackOptOut;
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const files_js_1 = require("../files.js");
|
|
8
|
+
function findMainActivity(androidDir) {
|
|
9
|
+
const base = (0, node_path_1.join)(androidDir, 'app', 'src', 'main', 'java');
|
|
10
|
+
if (!(0, node_fs_1.existsSync)(base))
|
|
11
|
+
return null;
|
|
12
|
+
const walk = (dir) => {
|
|
13
|
+
for (const e of (0, node_fs_1.readdirSync)(dir, { withFileTypes: true })) {
|
|
14
|
+
const p = (0, node_path_1.join)(dir, e.name);
|
|
15
|
+
if (e.isDirectory()) {
|
|
16
|
+
const hit = walk(p);
|
|
17
|
+
if (hit)
|
|
18
|
+
return hit;
|
|
19
|
+
}
|
|
20
|
+
else if (e.name === 'MainActivity.kt' || e.name === 'MainActivity.java') {
|
|
21
|
+
return p;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
};
|
|
26
|
+
return walk(base);
|
|
27
|
+
}
|
|
28
|
+
const KT_IMPORT = 'import com.swmansion.rnscreens.fragment.restoration.RNScreensFragmentFactory';
|
|
29
|
+
const JAVA_IMPORT = 'import com.swmansion.rnscreens.fragment.restoration.RNScreensFragmentFactory;';
|
|
30
|
+
const KT_ONCREATE = /fun\s+onCreate\s*\([^)]*\)\s*[^{]*\{/;
|
|
31
|
+
const JAVA_ONCREATE = /(?:public|protected|private)\s+void\s+onCreate\s*\(\s*(?:@[\w.]+\s+)*(?:[\w.]+\.)?Bundle\s+\w+\s*\)\s*(?:throws\s+[\w.,\s]+)?\s*\{/;
|
|
32
|
+
/** Insert a statement right after the opening brace of an existing onCreate. Returns null when no onCreate exists. */
|
|
33
|
+
function injectIntoOnCreate(content, re, statement) {
|
|
34
|
+
const m = re.exec(content);
|
|
35
|
+
if (!m)
|
|
36
|
+
return null;
|
|
37
|
+
const afterBrace = m.index + m[0].length;
|
|
38
|
+
const lineStart = content.lastIndexOf('\n', m.index) + 1;
|
|
39
|
+
const indent = (/^[ \t]*/.exec(content.slice(lineStart, m.index)) ?? [''])[0];
|
|
40
|
+
return content.slice(0, afterBrace) + '\n' + indent + ' ' + statement + content.slice(afterBrace);
|
|
41
|
+
}
|
|
42
|
+
/** Append a new onCreate override just before the class's final closing brace. */
|
|
43
|
+
function appendOnCreate(content, snippet) {
|
|
44
|
+
const idx = content.lastIndexOf('}');
|
|
45
|
+
return idx >= 0 ? content.slice(0, idx) + snippet + content.slice(idx) : content + '\n' + snippet;
|
|
46
|
+
}
|
|
47
|
+
function insertImport(content, line) {
|
|
48
|
+
if (content.includes(line))
|
|
49
|
+
return content;
|
|
50
|
+
const lines = content.split('\n');
|
|
51
|
+
let lastImport = -1;
|
|
52
|
+
lines.forEach((l, i) => {
|
|
53
|
+
if (/^\s*import\s+/.test(l))
|
|
54
|
+
lastImport = i;
|
|
55
|
+
});
|
|
56
|
+
lines.splice(lastImport + 1, 0, line);
|
|
57
|
+
return lines.join('\n');
|
|
58
|
+
}
|
|
59
|
+
function ensureMainActivityScreens(cwd, opts = {}) {
|
|
60
|
+
const androidDir = (0, node_path_1.join)(cwd, 'android');
|
|
61
|
+
const found = findMainActivity(androidDir);
|
|
62
|
+
if (!found) {
|
|
63
|
+
return { applied: false, wouldChange: false, file: null, created: false, backup: null, reason: 'No MainActivity.kt/java found under android/app/src/main/java — skipping.', needsManualEdit: false };
|
|
64
|
+
}
|
|
65
|
+
const isKt = found.endsWith('.kt');
|
|
66
|
+
const needle = 'RNScreensFragmentFactory';
|
|
67
|
+
const apply = (content) => {
|
|
68
|
+
let next = content;
|
|
69
|
+
if (isKt) {
|
|
70
|
+
next = insertImport(next, KT_IMPORT);
|
|
71
|
+
// Ignore the import line (it also contains the needle, but not the call form).
|
|
72
|
+
if (!next.includes('RNScreensFragmentFactory()')) {
|
|
73
|
+
const statement = 'supportFragmentManager.fragmentFactory = RNScreensFragmentFactory()';
|
|
74
|
+
const injected = injectIntoOnCreate(next, KT_ONCREATE, statement);
|
|
75
|
+
if (injected != null) {
|
|
76
|
+
next = injected;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
next = insertImport(next, 'import android.os.Bundle');
|
|
80
|
+
const snippet = ' override fun onCreate(savedInstanceState: Bundle?) {\n supportFragmentManager.fragmentFactory = RNScreensFragmentFactory()\n super.onCreate(savedInstanceState)\n }\n';
|
|
81
|
+
next = appendOnCreate(next, snippet);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
next = insertImport(next, JAVA_IMPORT);
|
|
87
|
+
if (!next.includes('RNScreensFragmentFactory(')) {
|
|
88
|
+
const statement = 'getSupportFragmentManager().setFragmentFactory(new RNScreensFragmentFactory());';
|
|
89
|
+
const injected = injectIntoOnCreate(next, JAVA_ONCREATE, statement);
|
|
90
|
+
if (injected != null) {
|
|
91
|
+
next = injected;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
next = insertImport(next, 'import android.os.Bundle;');
|
|
95
|
+
const snippet = ' @Override\n protected void onCreate(Bundle savedInstanceState) {\n getSupportFragmentManager().setFragmentFactory(new RNScreensFragmentFactory());\n super.onCreate(savedInstanceState);\n }\n';
|
|
96
|
+
next = appendOnCreate(next, snippet);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return next;
|
|
101
|
+
};
|
|
102
|
+
const before = (0, node_fs_1.readFileSync)(found, 'utf8');
|
|
103
|
+
if (before.includes(needle)) {
|
|
104
|
+
return { applied: false, wouldChange: false, file: found, created: false, backup: null, reason: 'MainActivity already configures RNScreensFragmentFactory.', needsManualEdit: false };
|
|
105
|
+
}
|
|
106
|
+
// If onCreate exists but we can't find its signature, don't append a duplicate — ask the user to edit it.
|
|
107
|
+
if (/\bonCreate\s*\(/.test(before)) {
|
|
108
|
+
const re = isKt ? KT_ONCREATE : JAVA_ONCREATE;
|
|
109
|
+
if (!re.test(before)) {
|
|
110
|
+
return {
|
|
111
|
+
applied: false,
|
|
112
|
+
wouldChange: false,
|
|
113
|
+
file: found,
|
|
114
|
+
created: false,
|
|
115
|
+
backup: null,
|
|
116
|
+
reason: `Existing onCreate in ${found} was not recognized — add the RNScreensFragmentFactory line from the React Navigation docs manually.`,
|
|
117
|
+
needsManualEdit: true,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const res = (0, files_js_1.editTextFile)(found, needle, apply, { dryRun: opts.dryRun });
|
|
122
|
+
return { applied: res.changed, wouldChange: res.wouldChange, file: found, created: res.created, backup: res.backup, reason: res.changed || res.wouldChange ? 'Added RNScreensFragmentFactory to MainActivity onCreate.' : 'No change.', needsManualEdit: false };
|
|
123
|
+
}
|
|
124
|
+
function checkPredictiveBackOptOut(cwd) {
|
|
125
|
+
const manifest = (0, node_path_1.join)(cwd, 'android', 'app', 'src', 'main', 'AndroidManifest.xml');
|
|
126
|
+
if (!(0, node_fs_1.existsSync)(manifest))
|
|
127
|
+
return null;
|
|
128
|
+
const content = (0, node_fs_1.readFileSync)(manifest, 'utf8');
|
|
129
|
+
if (content.includes('enableOnBackInvokedCallback'))
|
|
130
|
+
return null;
|
|
131
|
+
return 'Android: React Navigation does not yet support predictive back — set android:enableOnBackInvokedCallback="false" in AndroidManifest.xml <application> (see reactnavigation.org/docs/getting-started).';
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/config/android.ts"],"names":[],"mappings":";;AAoEA,8DA6DC;AAED,8DAMC;AAzID,qCAAgE;AAChE,yCAAiC;AACjC,0CAA2C;AAgB3C,SAAS,gBAAgB,CAAC,UAAkB;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PodResult {
|
|
2
|
+
attempted: boolean;
|
|
3
|
+
ok: boolean;
|
|
4
|
+
skippedReason: string | null;
|
|
5
|
+
commandStr: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function runPodInstall(cwd: string, opts?: {
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
skipPods?: boolean;
|
|
10
|
+
}): Promise<PodResult>;
|
|
11
|
+
//# sourceMappingURL=pods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pods.d.ts","sourceRoot":"","sources":["../../src/config/pods.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,OAAO,CAAC;IACZ,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAsB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,SAAS,CAAC,CAexH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.runPodInstall = runPodInstall;
|
|
7
|
+
const execa_1 = require("execa");
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
|
+
async function runPodInstall(cwd, opts = {}) {
|
|
10
|
+
const commandStr = 'npx pod-install ios';
|
|
11
|
+
if (opts.skipPods)
|
|
12
|
+
return { attempted: false, ok: false, skippedReason: 'Skipped via --skip-pods.', commandStr };
|
|
13
|
+
if (process.platform !== 'darwin') {
|
|
14
|
+
return { attempted: false, ok: false, skippedReason: 'Not macOS — run `npx pod-install ios` (or `cd ios && pod install`) on a Mac.', commandStr };
|
|
15
|
+
}
|
|
16
|
+
if (opts.dryRun)
|
|
17
|
+
return { attempted: false, ok: false, skippedReason: null, commandStr };
|
|
18
|
+
console.log(picocolors_1.default.cyan(`\n$ ${commandStr}`));
|
|
19
|
+
try {
|
|
20
|
+
await (0, execa_1.execa)('npx', ['pod-install', 'ios'], { cwd, stdio: 'inherit' });
|
|
21
|
+
return { attempted: true, ok: true, skippedReason: null, commandStr };
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
const msg = err?.shortMessage || err?.message || String(err);
|
|
25
|
+
return { attempted: true, ok: false, skippedReason: `pod install failed: ${msg}. Fix: run \`cd ios && pod install\` manually on macOS.`, commandStr };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=pods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pods.js","sourceRoot":"","sources":["../../src/config/pods.ts"],"names":[],"mappings":";;;;;AAUA,sCAeC;AAzBD,iCAA8B;AAC9B,4DAA4B;AASrB,KAAK,UAAU,aAAa,CAAC,GAAW,EAAE,OAAiD,EAAE;IAClG,MAAM,UAAU,GAAG,qBAAqB,CAAC;IACzC,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,0BAA0B,EAAE,UAAU,EAAE,CAAC;IACjH,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,8EAA8E,EAAE,UAAU,EAAE,CAAC;IACpJ,CAAC;IACD,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACzF,OAAO,CAAC,GAAG,CAAC,oBAAE,CAAC,IAAI,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC;IAC1C,IAAI,CAAC;QACH,MAAM,IAAA,aAAK,EAAC,KAAK,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACtE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IACxE,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,MAAM,GAAG,GAAG,GAAG,EAAE,YAAY,IAAI,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,uBAAuB,GAAG,yDAAyD,EAAE,UAAU,EAAE,CAAC;IACxJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PACKAGES: readonly ["@reduxjs/toolkit", "react-redux", "react-native-reanimated", "react-native-worklets", "formik", "yup", "@tanstack/react-query", "@react-navigation/native", "@react-navigation/native-stack", "@react-navigation/bottom-tabs", "react-native-screens", "react-native-safe-area-context"];
|
|
2
|
+
export type PackageName = (typeof PACKAGES)[number];
|
|
3
|
+
export declare const REANIMATED_V3_PLUGIN = "react-native-reanimated/plugin";
|
|
4
|
+
export declare const WORKLETS_PLUGIN = "react-native-worklets/plugin";
|
|
5
|
+
export declare const BACKUP_SUFFIX = ".sdsetup.bak";
|
|
6
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,qSAaX,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpD,eAAO,MAAM,oBAAoB,mCAAmC,CAAC;AACrE,eAAO,MAAM,eAAe,iCAAiC,CAAC;AAE9D,eAAO,MAAM,aAAa,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BACKUP_SUFFIX = exports.WORKLETS_PLUGIN = exports.REANIMATED_V3_PLUGIN = exports.PACKAGES = void 0;
|
|
4
|
+
exports.PACKAGES = [
|
|
5
|
+
'@reduxjs/toolkit',
|
|
6
|
+
'react-redux',
|
|
7
|
+
'react-native-reanimated',
|
|
8
|
+
'react-native-worklets',
|
|
9
|
+
'formik',
|
|
10
|
+
'yup',
|
|
11
|
+
'@tanstack/react-query',
|
|
12
|
+
'@react-navigation/native',
|
|
13
|
+
'@react-navigation/native-stack',
|
|
14
|
+
'@react-navigation/bottom-tabs',
|
|
15
|
+
'react-native-screens',
|
|
16
|
+
'react-native-safe-area-context',
|
|
17
|
+
];
|
|
18
|
+
exports.REANIMATED_V3_PLUGIN = 'react-native-reanimated/plugin';
|
|
19
|
+
exports.WORKLETS_PLUGIN = 'react-native-worklets/plugin';
|
|
20
|
+
exports.BACKUP_SUFFIX = '.sdsetup.bak';
|
|
21
|
+
// Verified against the live docs on 2026-10-17 (fetch them before changing config logic, steps change between versions):
|
|
22
|
+
// - Reanimated: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started.md
|
|
23
|
+
// Reanimated 4.x requires the New Architecture (Fabric) + react-native-worklets + `react-native-worklets/plugin` (LAST in babel plugins).
|
|
24
|
+
// Reanimated 3.x uses `react-native-reanimated/plugin` (LAST). Expo SDK >= 50 template already includes the worklets plugin via babel-preset-expo.
|
|
25
|
+
// - React Navigation: https://reactnavigation.org/docs/getting-started.md
|
|
26
|
+
// Android: RNScreensFragmentFactory in MainActivity.onCreate + android:enableOnBackInvokedCallback="false"; iOS: npx pod-install ios.
|
|
27
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG;IACtB,kBAAkB;IAClB,aAAa;IACb,yBAAyB;IACzB,uBAAuB;IACvB,QAAQ;IACR,KAAK;IACL,uBAAuB;IACvB,0BAA0B;IAC1B,gCAAgC;IAChC,+BAA+B;IAC/B,sBAAsB;IACtB,gCAAgC;CACxB,CAAC;AAIE,QAAA,oBAAoB,GAAG,gCAAgC,CAAC;AACxD,QAAA,eAAe,GAAG,8BAA8B,CAAC;AAEjD,QAAA,aAAa,GAAG,cAAc,CAAC;AAE5C,yHAAyH;AACzH,wGAAwG;AACxG,4IAA4I;AAC5I,qJAAqJ;AACrJ,0EAA0E;AAC1E,wIAAwI"}
|
package/dist/detect.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PackageManager, ProjectType } from './pm.js';
|
|
2
|
+
export interface ProjectInfo {
|
|
3
|
+
cwd: string;
|
|
4
|
+
projectType: ProjectType;
|
|
5
|
+
packageManager: PackageManager;
|
|
6
|
+
expoSdkMajor: number | null;
|
|
7
|
+
reactNativeVersion: string | null;
|
|
8
|
+
expoVersion: string | null;
|
|
9
|
+
dependencies: Record<string, string>;
|
|
10
|
+
devDependencies: Record<string, string>;
|
|
11
|
+
hasAppJson: boolean;
|
|
12
|
+
hasAppConfig: boolean;
|
|
13
|
+
hasEasJson: boolean;
|
|
14
|
+
hasIosDir: boolean;
|
|
15
|
+
hasAndroidDir: boolean;
|
|
16
|
+
lockfile: string | null;
|
|
17
|
+
}
|
|
18
|
+
export declare function detectProject(cwd: string): ProjectInfo;
|
|
19
|
+
//# sourceMappingURL=detect.d.ts.map
|