@10play/expo-air 0.7.2 → 0.7.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../commands/init.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAkBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAyHrE"}
|
|
@@ -2,7 +2,6 @@ import chalk from "chalk";
|
|
|
2
2
|
import { spawn } from "child_process";
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import * as fs from "fs";
|
|
5
|
-
import * as readline from "readline";
|
|
6
5
|
const DEFAULT_CONFIG = {
|
|
7
6
|
autoShow: true,
|
|
8
7
|
ui: {
|
|
@@ -10,38 +9,6 @@ const DEFAULT_CONFIG = {
|
|
|
10
9
|
bubbleColor: "#007AFF",
|
|
11
10
|
},
|
|
12
11
|
};
|
|
13
|
-
async function askYesNo(question) {
|
|
14
|
-
const rl = readline.createInterface({
|
|
15
|
-
input: process.stdin,
|
|
16
|
-
output: process.stdout,
|
|
17
|
-
});
|
|
18
|
-
return new Promise((resolve) => {
|
|
19
|
-
rl.question(` ${question} [y/N] `, (answer) => {
|
|
20
|
-
rl.close();
|
|
21
|
-
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
async function runCommand(command, args, cwd) {
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
const proc = spawn(command, args, {
|
|
28
|
-
cwd,
|
|
29
|
-
stdio: "inherit",
|
|
30
|
-
shell: true,
|
|
31
|
-
});
|
|
32
|
-
proc.on("close", (code) => {
|
|
33
|
-
if (code === 0) {
|
|
34
|
-
resolve();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
reject(new Error(`${command} ${args.join(" ")} exited with code ${code}`));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
proc.on("error", (err) => {
|
|
41
|
-
reject(err);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
12
|
export async function initCommand(options) {
|
|
46
13
|
console.log(chalk.blue("\n expo-air init\n"));
|
|
47
14
|
const projectRoot = process.cwd();
|
|
@@ -113,53 +80,7 @@ export async function initCommand(options) {
|
|
|
113
80
|
fs.writeFileSync(gitignorePath, `# expo-air local config (tunnel URLs)\n${gitignoreEntry}\n`);
|
|
114
81
|
console.log(chalk.green(" Created .gitignore with .expo-air.local.json"));
|
|
115
82
|
}
|
|
116
|
-
// Step 5:
|
|
117
|
-
console.log("");
|
|
118
|
-
const enableNotifications = await askYesNo(chalk.white("Enable push notifications?") + chalk.gray(" (requires paid Apple Developer account)"));
|
|
119
|
-
if (enableNotifications) {
|
|
120
|
-
// Update config with notifications enabled
|
|
121
|
-
const configContent = fs.readFileSync(configPath, "utf-8");
|
|
122
|
-
const config = JSON.parse(configContent);
|
|
123
|
-
config.enableNotifications = true;
|
|
124
|
-
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
125
|
-
console.log(chalk.green(" Enabled notifications in .expo-air.json"));
|
|
126
|
-
// Install expo-notifications
|
|
127
|
-
console.log(chalk.gray("\n Installing expo-notifications..."));
|
|
128
|
-
try {
|
|
129
|
-
await runCommand("npx", ["expo", "install", "expo-notifications"], projectRoot);
|
|
130
|
-
console.log(chalk.green(" Installed expo-notifications"));
|
|
131
|
-
}
|
|
132
|
-
catch (err) {
|
|
133
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
134
|
-
console.log(chalk.red(` Failed to install expo-notifications: ${message}`));
|
|
135
|
-
console.log(chalk.gray(" You can install it manually: npx expo install expo-notifications\n"));
|
|
136
|
-
}
|
|
137
|
-
// Add expo-notifications to app.json plugins with background notifications enabled
|
|
138
|
-
if (fs.existsSync(appJsonPath)) {
|
|
139
|
-
try {
|
|
140
|
-
const appJsonContent = fs.readFileSync(appJsonPath, "utf-8");
|
|
141
|
-
const appJson = JSON.parse(appJsonContent);
|
|
142
|
-
// Check if expo-notifications is already in plugins (as string or array config)
|
|
143
|
-
const hasNotificationsPlugin = appJson.expo.plugins.some((p) => p === "expo-notifications" || (Array.isArray(p) && p[0] === "expo-notifications"));
|
|
144
|
-
if (!hasNotificationsPlugin) {
|
|
145
|
-
// Add with enableBackgroundRemoteNotifications for background push support
|
|
146
|
-
appJson.expo.plugins.push([
|
|
147
|
-
"expo-notifications",
|
|
148
|
-
{ enableBackgroundRemoteNotifications: true }
|
|
149
|
-
]);
|
|
150
|
-
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2) + "\n");
|
|
151
|
-
console.log(chalk.green(" Added expo-notifications to app.json plugins"));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
console.log(chalk.yellow(" Could not add expo-notifications to plugins - add it manually"));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
console.log(chalk.gray(" Skipped push notifications setup"));
|
|
161
|
-
}
|
|
162
|
-
// Step 6: Run expo prebuild (unless --skip-prebuild)
|
|
83
|
+
// Step 5: Run expo prebuild (unless --skip-prebuild)
|
|
163
84
|
if (!options.skipPrebuild) {
|
|
164
85
|
console.log(chalk.gray("\n Running expo prebuild --platform ios --clean..."));
|
|
165
86
|
console.log(chalk.gray(" This generates native iOS code with expo-air plugin\n"));
|
|
@@ -201,12 +122,5 @@ export async function initCommand(options) {
|
|
|
201
122
|
console.log(chalk.white(" 1. Connect your iOS device via cable"));
|
|
202
123
|
console.log(chalk.white(" 2. Run: npx expo-air fly"));
|
|
203
124
|
console.log(chalk.white(" 3. The widget will appear on your device\n"));
|
|
204
|
-
if (!enableNotifications) {
|
|
205
|
-
console.log(chalk.gray(" Want push notifications later? Re-run init with --force, or manually:"));
|
|
206
|
-
console.log(chalk.gray(" npx expo install expo-notifications"));
|
|
207
|
-
console.log(chalk.gray(" Add to app.json plugins:"));
|
|
208
|
-
console.log(chalk.gray(' ["expo-notifications", { "enableBackgroundRemoteNotifications": true }]'));
|
|
209
|
-
console.log(chalk.gray(" npx expo prebuild --platform ios --clean\n"));
|
|
210
|
-
}
|
|
211
125
|
}
|
|
212
126
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAczB,MAAM,cAAc,GAAkB;IACpC,QAAQ,EAAE,IAAI;IACd,EAAE,EAAE;QACF,UAAU,EAAE,EAAE;QACd,WAAW,EAAE,SAAS;KACvB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAoB;IACpD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAE/C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAElC,2CAA2C;IAC3C,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