build-strap 6.1.0-main.159 → 6.1.0-main.167

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/git.js +8 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-strap",
3
- "version": "6.1.0-main.159",
3
+ "version": "6.1.0-main.167",
4
4
  "description": "Node scripts for building things",
5
5
  "license": "MIT",
6
6
  "author": "Justin Murray <justin@murrayju.com>",
package/src/git.js CHANGED
@@ -61,7 +61,10 @@ export async function gitInfo(noCache = false) {
61
61
  export const ensureGitLfsInstalled = async () => {
62
62
  await git(['lfs', 'install']);
63
63
  };
64
- export const gitConfigRead = async (key, global = true) => gitOutput(['config', ...(global ? ['--global'] : []), key], {
64
+ // Git ignores include directives when you name a config file (for example with
65
+ // --global). The --includes flag makes git follow them, so that values from
66
+ // included files (for example ~/.gitconfig.local) are found.
67
+ export const gitConfigRead = async (key, global = true) => gitOutput(['config', '--includes', ...(global ? ['--global'] : []), key], {
65
68
  rejectOnErrorCode: false,
66
69
  });
67
70
  export const gitConfigWrite = async (key, value, global = true) => {
@@ -73,8 +76,10 @@ export const ensureGitConfigUserEmail = async (emailRegex = /.+@.+/, emailPrompt
73
76
  return;
74
77
  }
75
78
  buildLog('Setting up git user config...');
76
- const name = await userQuestion('Enter your full name: ');
77
- await gitConfigWrite('user.name', name, global);
79
+ if (!(await gitConfigRead('user.name', global))) {
80
+ const name = await userQuestion('Enter your full name: ');
81
+ await gitConfigWrite('user.name', name, global);
82
+ }
78
83
  const email = await userQuestion(emailPrompt, (input) => emailRegex.test(input));
79
84
  await gitConfigWrite('user.email', email, global);
80
85
  };