-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bundle progress bar to logs #140
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
27357a5
Add bundle progress bar to logs
brentvatne a0755d8
Don't break support for old sdk versions, plus a bit of cleanup
brentvatne 3348855
Update dependencies for new projects so people can try out progress b…
brentvatne c38e4b7
Make loading message not a cliffhanger
brentvatne daa79e7
Default log is bare, must call withTimestamp to get timestamp
brentvatne ecdf6cb
Change console.log calls to log
brentvatne ccd5933
Warn about Expo SDK usage inside eject options.
anp 13c1e5e
Extra details on port accessibility in the section on how to troubles…
richkeenan 4e83841
Apps should not KeepAwake in production.
anp 6a435dd
Version bump.
anp 2f81a8d
Update flow config for RN 0.43.
anp 6b9fd95
Bump versions for RN 0.43 & Expo 16.
anp 3f316a5
Make it work with latest xdl, add timestamps in a couple more places
brentvatne e76536a
Initialize react-native to ^0.43.4
brentvatne 1ccb088
Handle xdl restarting watchman better, don't add newline before 'Stop…
brentvatne 6cd268d
Merge branch 'master' into @brent/add-bundle-progress-bar
anp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -5,18 +5,19 @@ import fsp from 'fs-promise'; | |
import path from 'path'; | ||
import pathExists from 'path-exists'; | ||
import spawn from 'cross-spawn'; | ||
import log from '../util/log'; | ||
|
||
// UPDATE DEPENDENCY VERSIONS HERE | ||
const DEFAULT_DEPENDENCIES = { | ||
expo: '^15.1.0', | ||
react: '~15.4.0', | ||
'react-native': '0.42.3', | ||
expo: '^16.0.0', | ||
react: '16.0.0-alpha.6', | ||
'react-native': '^0.43.4', | ||
}; | ||
|
||
// TODO figure out how this interacts with ejection | ||
const DEFAULT_DEV_DEPENDENCIES = { | ||
'jest-expo': '^0.3.0', | ||
'react-test-renderer': '~15.4.1', | ||
'jest-expo': '^0.4.0', | ||
'react-test-renderer': '16.0.0-alpha.6', | ||
}; | ||
|
||
module.exports = async (appPath: string, appName: string, verbose: boolean, cwd: string = '') => { | ||
|
@@ -94,8 +95,8 @@ module.exports = async (appPath: string, appName: string, verbose: boolean, cwd: | |
} | ||
} | ||
|
||
console.log(`Installing dependencies using ${command}...`); | ||
console.log(); | ||
log(`Installing dependencies using ${command}...`); | ||
log(); // why is this here | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because it's ugly otherwise and i apparently forgot how newlines work |
||
|
||
if (command === 'yarnpkg') { | ||
// it's weird to print a yarn alias that no one uses | ||
|
@@ -118,7 +119,7 @@ module.exports = async (appPath: string, appName: string, verbose: boolean, cwd: | |
cdpath = appPath; | ||
} | ||
|
||
console.log( | ||
log( | ||
` | ||
|
||
Success! Created ${appName} at ${appPath} | ||
|
@@ -151,13 +152,13 @@ We suggest that you begin by typing: | |
); | ||
|
||
if (readmeExists) { | ||
console.log( | ||
log( | ||
` | ||
${chalk.yellow('You had a `README.md` file, we renamed it to `README.old.md`')}` | ||
); | ||
} | ||
|
||
console.log(); | ||
console.log('Happy hacking!'); | ||
log(); | ||
log('Happy hacking!'); | ||
}); | ||
}; |
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,38 @@ | ||
// @flow | ||
|
||
import chalk from 'chalk'; | ||
|
||
function log() { | ||
const args = Array.prototype.slice.call(arguments, 0); | ||
|
||
respectProgressBars(() => { | ||
console.log(...args); | ||
}); | ||
}; | ||
|
||
log.withTimestamp = function() { | ||
const prefix = chalk.dim(new Date().toLocaleTimeString()) + ':'; | ||
const args = [prefix].concat(Array.prototype.slice.call(arguments, 0)); | ||
|
||
respectProgressBars(() => { | ||
console.log(...args); | ||
}); | ||
} | ||
|
||
let _bundleProgressBar; | ||
log.setBundleProgressBar = function(bundleProgressBar) { | ||
_bundleProgressBar = bundleProgressBar; | ||
}; | ||
|
||
function respectProgressBars(commitLogs) { | ||
if (_bundleProgressBar) { | ||
_bundleProgressBar.terminate(); | ||
_bundleProgressBar.lastDraw = ''; | ||
commitLogs(); | ||
_bundleProgressBar.render(); | ||
} else { | ||
commitLogs(); | ||
} | ||
} | ||
|
||
export default log; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue concerns me re: windows support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, I don't have a windows machine to test this :<
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or rather I do but I have no idea how to use windows for anything except oculus and netflix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw we use this same ProgressBar module on exp so this could be a problem we have to address there too if it is indeed true and not user error in that issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok. hm maybe it's broken in exp too then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try out installing exp and init'ing a project? should show progress bar while downloading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wipes tear away while spinning up a VM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so apparently the inquirer package is also irrevocably broken on git bash, so i'm just going to step away slowly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolution: don't support git bash for now if you want a pleasant crna experience. powershell recommended on windows for now. if anyone reading this is interested in fixing git bash support it would be welcome!