1
0
Fork 0

🚧 Bumping alpha pre-release

This commit is contained in:
Joost De Cock 2019-05-02 12:40:03 +02:00
parent 6b6f6fd7cd
commit bca5deedb3
62 changed files with 477 additions and 358 deletions

View file

@ -1,54 +1,54 @@
'use strict'
"use strict";
const getGitConfigPath = require('git-config-path')
const githubUsername = require('github-username')
const parseGitConfig = require('parse-git-config')
const which = require('which')
const getGitConfigPath = require("git-config-path");
const githubUsername = require("github-username");
const parseGitConfig = require("parse-git-config");
const which = require("which");
const config = require('./config')
const config = require("./config");
module.exports = async () => {
const defaults = {
name: '',
description: '',
author: config.get('author'),
repo: (info) => `${info.author}/${info.name}`,
license: config.get('license', 'MIT'),
manager: config.get('manager', 'npm'),
template: config.get('template', 'default')
}
name: "",
description: "",
author: config.get("author"),
repo: info => `${info.author}/${info.name}`,
license: config.get("license", "MIT"),
manager: config.get("manager", "npm"),
template: config.get("template", "default")
};
try {
if (!config.get('author')) {
const gitConfigPath = getGitConfigPath('global')
if (!config.get("author")) {
const gitConfigPath = getGitConfigPath("global");
if (gitConfigPath) {
const gitConfig = parseGitConfig.sync({ path: gitConfigPath })
const gitConfig = parseGitConfig.sync({ path: gitConfigPath });
if (gitConfig.github && gitConfig.github.user) {
defaults.author = gitConfig.github.user
defaults.author = gitConfig.github.user;
} else if (gitConfig.user && gitConfig.user.email) {
defaults.author = await githubUsername(gitConfig.user.email)
defaults.author = await githubUsername(gitConfig.user.email);
}
}
if (defaults.author) {
config.set('author', defaults.author)
config.set("author", defaults.author);
}
}
if (!config.get('manager')) {
if (which.sync('yarn', { nothrow: true })) {
defaults.manager = 'yarn'
if (!config.get("manager")) {
if (which.sync("yarn", { nothrow: true })) {
defaults.manager = "yarn";
}
config.set('manager', defaults.manager)
config.set("manager", defaults.manager);
}
if (!config.get('template')) {
config.set('template', defaults.template)
if (!config.get("template")) {
config.set("template", defaults.template);
}
} catch (err) { }
} catch (err) {}
return defaults
}
return defaults;
};