@siranjeevan/releaseflow 1.1.0 → 1.1.2
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/index.js +45 -15
- package/package.json +1 -1
- package/uploader.js +6 -2
package/index.js
CHANGED
|
@@ -119,6 +119,23 @@ function getProjectPaths() {
|
|
|
119
119
|
throw new Error('Could not find pubspec.yaml. Please run this command inside your Flutter project folder.');
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
async function checkFlutterFireConfig() {
|
|
123
|
+
try {
|
|
124
|
+
const { root } = getProjectPaths();
|
|
125
|
+
const configPath = path.join(root, 'lib', 'firebase_options.dart');
|
|
126
|
+
|
|
127
|
+
if (!fs.existsSync(configPath)) {
|
|
128
|
+
console.log('\x1b[33m\nWarning: Your Flutter project is not yet linked to Firebase.\x1b[0m');
|
|
129
|
+
console.log('To prevent the "Splash Screen Freeze", you must run this command manually:');
|
|
130
|
+
console.log(' \x1b[36mflutterfire configure\x1b[0m\n');
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
134
|
+
} catch (e) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
122
139
|
function getPubspecVersion() {
|
|
123
140
|
try {
|
|
124
141
|
const { pubspec } = getProjectPaths();
|
|
@@ -247,25 +264,37 @@ async function runConfigureFlow() {
|
|
|
247
264
|
fs.writeFileSync(configLocation, JSON.stringify(config, null, 2));
|
|
248
265
|
console.log('\x1b[32mConfiguration saved successfully!\x1b[0m\n');
|
|
249
266
|
console.log(`\x1b[34mSaved to: ${configLocation}\x1b[0m`);
|
|
267
|
+
|
|
268
|
+
await checkFlutterFireConfig();
|
|
250
269
|
}
|
|
251
270
|
|
|
252
271
|
function runPromptFlow() {
|
|
253
|
-
console.log('\n\x1b[36m---
|
|
254
|
-
|
|
255
|
-
console.log('
|
|
256
|
-
console.log('
|
|
257
|
-
|
|
258
|
-
console.log('
|
|
259
|
-
console.log('
|
|
272
|
+
console.log('\n\x1b[36m--- 🚀 MASTER INTEGRATION GUIDE FOR FLUTTER ---\x1b[0m');
|
|
273
|
+
|
|
274
|
+
console.log('\n\x1b[35m[1/3] ADD DEPENDENCIES\x1b[0m');
|
|
275
|
+
console.log('Add these to your pubspec.yaml:');
|
|
276
|
+
console.log(' - package_info_plus (to get local version)');
|
|
277
|
+
console.log(' - cloud_firestore (to read from app_config/version)');
|
|
278
|
+
console.log(' - url_launcher (to open the download link)');
|
|
279
|
+
|
|
280
|
+
console.log('\n\x1b[35m[2/3] THE DART LOGIC (CODE SNIPPET)\x1b[0m');
|
|
281
|
+
console.log('// Inside your button\'s onPressed:');
|
|
282
|
+
console.log('final doc = await FirebaseFirestore.instance.collection("app_config").doc("version").get();');
|
|
283
|
+
console.log('final url = doc["download_url"];');
|
|
284
|
+
console.log('if (await canLaunchUrl(Uri.parse(url))) {');
|
|
285
|
+
console.log(' await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);');
|
|
286
|
+
console.log('}');
|
|
287
|
+
|
|
288
|
+
console.log('\n\x1b[35m[3/3] VERIFICATION CHECKLIST\x1b[0m');
|
|
289
|
+
console.log('To confirm your Force Update is working correctly:');
|
|
260
290
|
console.log(' a. Run "releaseflow release" and set "Force Update" to TRUE.');
|
|
261
|
-
console.log(' b. Open your
|
|
262
|
-
console.log(' c.
|
|
263
|
-
|
|
264
|
-
console.log('\n\x1b[
|
|
265
|
-
console.log('
|
|
266
|
-
console.log(' releaseflow
|
|
267
|
-
console.log(' releaseflow
|
|
268
|
-
console.log(' releaseflow manual : View full Flutter integration guide.\n');
|
|
291
|
+
console.log(' b. Open your app and click the "Update Now" button.');
|
|
292
|
+
console.log(' c. Verify: Does it open Chrome and download your new APK?');
|
|
293
|
+
|
|
294
|
+
console.log('\n\x1b[32m--- 🏁 READY FOR YOUR FIRST RELEASE? ---\x1b[0m');
|
|
295
|
+
console.log(' releaseflow release : Build & Deploy your first version.');
|
|
296
|
+
console.log(' releaseflow config show : Check your project settings.');
|
|
297
|
+
console.log(' releaseflow manual : Open full docs.\n');
|
|
269
298
|
}
|
|
270
299
|
|
|
271
300
|
async function runRemoveConfig() {
|
|
@@ -301,6 +330,7 @@ function runShowConfig() {
|
|
|
301
330
|
}
|
|
302
331
|
|
|
303
332
|
async function runFullReleaseFlow() {
|
|
333
|
+
await checkFlutterFireConfig();
|
|
304
334
|
console.log('\x1b[34mChecking versions and history...\x1b[0m');
|
|
305
335
|
|
|
306
336
|
const liveVersion = await getLiveVersion();
|
package/package.json
CHANGED
package/uploader.js
CHANGED
|
@@ -59,6 +59,8 @@ async function uploadApk(apkPath, version) {
|
|
|
59
59
|
const [url] = await file.getSignedUrl({
|
|
60
60
|
action: 'read',
|
|
61
61
|
expires: '03-01-2099',
|
|
62
|
+
promptSaveAs: true,
|
|
63
|
+
responseDisposition: 'attachment; filename="app-update.apk"'
|
|
62
64
|
});
|
|
63
65
|
|
|
64
66
|
return url;
|
|
@@ -72,7 +74,7 @@ async function updateFirestore(version, url, forceUpdate) {
|
|
|
72
74
|
|
|
73
75
|
await configRef.set({
|
|
74
76
|
latest_version: version,
|
|
75
|
-
|
|
77
|
+
download_url: url,
|
|
76
78
|
force_update: forceUpdate,
|
|
77
79
|
updated_at: new Date().toISOString()
|
|
78
80
|
});
|
|
@@ -110,12 +112,14 @@ async function rollbackToVersion(version, forceUpdate) {
|
|
|
110
112
|
const [url] = await file.getSignedUrl({
|
|
111
113
|
action: 'read',
|
|
112
114
|
expires: '03-01-2099',
|
|
115
|
+
promptSaveAs: true,
|
|
116
|
+
responseDisposition: 'attachment; filename="app-update.apk"'
|
|
113
117
|
});
|
|
114
118
|
|
|
115
119
|
const configRef = db.collection('app_config').doc('version');
|
|
116
120
|
await configRef.set({
|
|
117
121
|
latest_version: version,
|
|
118
|
-
|
|
122
|
+
download_url: url,
|
|
119
123
|
force_update: forceUpdate,
|
|
120
124
|
updated_at: new Date().toISOString()
|
|
121
125
|
});
|