File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,12 @@ class ReleasePreparation {
3131 this . date = '' ;
3232 this . config = getMergedConfig ( this . dir ) ;
3333
34+ // Ensure the preparer has set an upstream and username.
35+ if ( this . warnForMissing ( ) ) {
36+ cli . error ( 'Failed to begin the release preparation process.' ) ;
37+ return ;
38+ }
39+
3440 // Allow passing optional new version.
3541 if ( argv . newVersion ) {
3642 const newVersion = semver . clean ( argv . newVersion ) ;
@@ -224,6 +230,33 @@ class ReleasePreparation {
224230 return this . config . username ;
225231 }
226232
233+ warnForMissing ( ) {
234+ const { cli, upstream, username } = this ;
235+
236+ const missing = ! username || ! upstream ;
237+ if ( ! upstream ) {
238+ cli . warn ( 'You have not told git-node the remote you want to sync with.' ) ;
239+ cli . separator ( ) ;
240+ cli . info (
241+ 'For example, if your remote pointing to nodejs/node is' +
242+ ' `remote-upstream`, you can run:\n\n' +
243+ ' $ ncu-config set upstream remote-upstream' ) ;
244+ cli . separator ( ) ;
245+ cli . setExitCode ( 1 ) ;
246+ }
247+ if ( ! username ) {
248+ cli . warn ( 'You have not told git-node your username.' ) ;
249+ cli . separator ( ) ;
250+ cli . info (
251+ 'To fix this, you can run: ' +
252+ ' $ ncu-config set username <your_username>' ) ;
253+ cli . separator ( ) ;
254+ cli . setExitCode ( 1 ) ;
255+ }
256+
257+ return missing ;
258+ }
259+
227260 calculateNewVersion ( ) {
228261 let newVersion ;
229262
You can’t perform that action at this time.
0 commit comments