-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Derewith/update
feat: adapted the app to the new be
- Loading branch information
Showing
29 changed files
with
1,043 additions
and
533 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,44 @@ | ||
#!/usr/bin/env node | ||
|
||
const { exec } = require('child_process'); | ||
const yargs = require('yargs'); | ||
const { | ||
REACT_NATIVE_BUNDLE_COMMAND, | ||
BUNDLE_UPDATER_CLI_COMMAND, | ||
} = require('./constants'); | ||
|
||
const options = yargs | ||
.usage('Usage: $0 [options] <apiKey> <branch> <version>') | ||
.option('m', { | ||
alias: 'comment', | ||
describe: 'Add a comment to the bundle', | ||
type: 'string', | ||
default: '', | ||
}) | ||
.demandCommand(3, 'You must provide the apiKey, branch and version') | ||
.help('h') | ||
.alias('h', 'help').argv; | ||
|
||
const apiKey = options._[0]; | ||
const branch = options._[1]; | ||
const version = options._[2]; | ||
const comment = options.comment; | ||
|
||
console.log(`Creating the bundle...`); | ||
exec(REACT_NATIVE_BUNDLE_COMMAND, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`Error during the first script execution: ${stderr}`); | ||
process.exit(1); | ||
} else { | ||
const cliCommand = `${BUNDLE_UPDATER_CLI_COMMAND} ${apiKey} ${branch} ${version} -m "${comment}"`; | ||
exec(cliCommand, (_error, _stdout, _stderr) => { | ||
if (_error) { | ||
console.error(`Error during the second script execution: ${_stderr}`); | ||
process.exit(1); | ||
} else { | ||
console.log(`${_stdout}`); | ||
process.exit(0); | ||
} | ||
}); | ||
} | ||
}); |
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,6 @@ | ||
module.exports = { | ||
REACT_NATIVE_BUNDLE_COMMAND: | ||
'npx react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios --minify true', | ||
BUNDLE_UPDATER_CLI_COMMAND: | ||
'node ./node_modules/react-native-bundle-updater/local-cli/cli.js', | ||
}; |
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
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
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,11 @@ | ||
#import "BundleUpdater.h" | ||
|
||
@interface BundleUpdater (FileManager) | ||
|
||
- (void)copyFilesFromSource:(NSString *)sourceFolder toDestination:(NSString *)destinationFolder; | ||
- (void)clearDocumentsFolder; | ||
- (NSMutableData *)calculateSHA256Hash:(NSData *)script; | ||
- (NSString *)loadHashFromDisk; | ||
- (NSString *)unzipBundleAndAssetsInto: (NSURL *) location withSuccess:(BOOL *)success; | ||
|
||
@end |
Oops, something went wrong.