committed by
Jason Dreyzehner
parent
56cf111c16
commit
728ae3f879
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
# http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = 0
|
||||
trim_trailing_whitespace = false
|
||||
@@ -12,7 +12,7 @@ export async function checkArgs(): Promise<TypescriptStarterArgsOptions> {
|
||||
|
||||
Non-Interactive Usage
|
||||
$ npx typescript-starter <project-name> [options]
|
||||
|
||||
|
||||
Options
|
||||
--appveyor include Appveyor for Windows CI
|
||||
--description, -d package.json description
|
||||
@@ -22,7 +22,8 @@ export async function checkArgs(): Promise<TypescriptStarterArgsOptions> {
|
||||
--travis include Travis CI configuration
|
||||
--yarn use yarn (default: npm)
|
||||
|
||||
--no-circleci don't include CircleCI
|
||||
--no-circleci don't include CircleCI
|
||||
--no-editorconfig don't include .editorconfig
|
||||
--no-immutable don't enable tslint-immutable
|
||||
--no-install skip yarn/npm install
|
||||
--no-vscode don't include VS Code debugging config
|
||||
@@ -49,6 +50,10 @@ export async function checkArgs(): Promise<TypescriptStarterArgsOptions> {
|
||||
default: false,
|
||||
type: 'boolean'
|
||||
},
|
||||
editorconfig: {
|
||||
default: true,
|
||||
type: 'boolean'
|
||||
},
|
||||
immutable: {
|
||||
default: true,
|
||||
type: 'boolean'
|
||||
@@ -118,6 +123,7 @@ export async function checkArgs(): Promise<TypescriptStarterArgsOptions> {
|
||||
circleci: cli.flags.circleci,
|
||||
description: cli.flags.description,
|
||||
domDefinitions: cli.flags.dom,
|
||||
editorconfig: cli.flags.editorconfig,
|
||||
immutable: cli.flags.immutable,
|
||||
install: cli.flags.install,
|
||||
nodeDefinitions: cli.flags.node,
|
||||
|
||||
@@ -80,6 +80,7 @@ export async function inquire(): Promise<TypescriptStarterCLIOptions> {
|
||||
enum Extras {
|
||||
appveyor = 'appveyor',
|
||||
circleci = 'circleci',
|
||||
editorconfig = 'editorconfig',
|
||||
immutable = 'immutable',
|
||||
strict = 'strict',
|
||||
travis = 'travis',
|
||||
@@ -97,6 +98,11 @@ export async function inquire(): Promise<TypescriptStarterCLIOptions> {
|
||||
name: 'Enable tslint-immutable',
|
||||
value: Extras.immutable
|
||||
},
|
||||
{
|
||||
checked: true,
|
||||
name: 'Include .editorconfig',
|
||||
value: Extras.editorconfig
|
||||
},
|
||||
{
|
||||
checked: true,
|
||||
name: 'Include VS Code debugging config',
|
||||
@@ -155,6 +161,7 @@ export async function inquire(): Promise<TypescriptStarterCLIOptions> {
|
||||
definitions
|
||||
)
|
||||
: false,
|
||||
editorconfig: extras.includes(Extras.editorconfig),
|
||||
immutable: extras.includes(Extras.immutable),
|
||||
install: true,
|
||||
nodeDefinitions: definitions
|
||||
|
||||
@@ -52,7 +52,7 @@ export const cloneRepo = (
|
||||
if (err.code === 'ENOENT') {
|
||||
throw new Error(`
|
||||
Git is not installed on your PATH. Please install Git and try again.
|
||||
|
||||
|
||||
For more information, visit: https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
|
||||
`);
|
||||
} else {
|
||||
@@ -206,6 +206,7 @@ export const addInferredOptions = async (
|
||||
circleci: userOptions.circleci,
|
||||
description: userOptions.description,
|
||||
domDefinitions: userOptions.domDefinitions,
|
||||
editorconfig: userOptions.editorconfig,
|
||||
immutable: userOptions.immutable,
|
||||
install: userOptions.install,
|
||||
nodeDefinitions: userOptions.nodeDefinitions,
|
||||
|
||||
@@ -176,6 +176,7 @@ test(`${
|
||||
const map = await hashAllTheThings(TestDirectories.one);
|
||||
t.deepEqual(map, {
|
||||
'test-1/.circleci/config.yml': '30cc59229facf29bfca712fc6e2ddade',
|
||||
'test-1/.editorconfig': '44a3e6c69d9267b0f756986fd970a8f4',
|
||||
'test-1/.github/CONTRIBUTING.md': '5f0dfa7fdf9bf828e3a3aa8fcaeece08',
|
||||
'test-1/.github/ISSUE_TEMPLATE.md': '82d1b99b29f32d851627b317195e73d2',
|
||||
'test-1/.github/PULL_REQUEST_TEMPLATE.md':
|
||||
@@ -222,6 +223,7 @@ test(`${
|
||||
const map = await hashAllTheThings(TestDirectories.two);
|
||||
t.deepEqual(map, {
|
||||
'test-2/.circleci/config.yml': '30cc59229facf29bfca712fc6e2ddade',
|
||||
'test-2/.editorconfig': '44a3e6c69d9267b0f756986fd970a8f4',
|
||||
'test-2/.github/CONTRIBUTING.md': '5f0dfa7fdf9bf828e3a3aa8fcaeece08',
|
||||
'test-2/.github/ISSUE_TEMPLATE.md': '82d1b99b29f32d851627b317195e73d2',
|
||||
'test-2/.github/PULL_REQUEST_TEMPLATE.md':
|
||||
@@ -336,6 +338,7 @@ test(`${
|
||||
const map = await hashAllTheThings(TestDirectories.three);
|
||||
t.deepEqual(map, {
|
||||
'test-3/.circleci/config.yml': '30cc59229facf29bfca712fc6e2ddade',
|
||||
'test-3/.editorconfig': '44a3e6c69d9267b0f756986fd970a8f4',
|
||||
'test-3/.github/CONTRIBUTING.md': '5f0dfa7fdf9bf828e3a3aa8fcaeece08',
|
||||
'test-3/.github/ISSUE_TEMPLATE.md': '82d1b99b29f32d851627b317195e73d2',
|
||||
'test-3/.github/PULL_REQUEST_TEMPLATE.md':
|
||||
@@ -376,6 +379,7 @@ test(`${
|
||||
const map = await hashAllTheThings(TestDirectories.four);
|
||||
t.deepEqual(map, {
|
||||
'test-4/.circleci/config.yml': '30cc59229facf29bfca712fc6e2ddade',
|
||||
'test-4/.editorconfig': '44a3e6c69d9267b0f756986fd970a8f4',
|
||||
'test-4/.github/CONTRIBUTING.md': '5f0dfa7fdf9bf828e3a3aa8fcaeece08',
|
||||
'test-4/.github/ISSUE_TEMPLATE.md': '82d1b99b29f32d851627b317195e73d2',
|
||||
'test-4/.github/PULL_REQUEST_TEMPLATE.md':
|
||||
@@ -441,6 +445,7 @@ test(`${
|
||||
appveyor: false,
|
||||
circleci: false,
|
||||
domDefinitions: false,
|
||||
editorconfig: false,
|
||||
email: 'email@example.com',
|
||||
fullName: 'Satoshi Nakamoto',
|
||||
immutable: true,
|
||||
@@ -482,6 +487,7 @@ test(`${TestDirectories.six}: Sandboxed: yarn, no initial commit`, async t => {
|
||||
appveyor: true,
|
||||
circleci: true,
|
||||
domDefinitions: true,
|
||||
editorconfig: true,
|
||||
email: Placeholders.email,
|
||||
fullName: Placeholders.name,
|
||||
immutable: true,
|
||||
@@ -498,6 +504,7 @@ test(`${TestDirectories.six}: Sandboxed: yarn, no initial commit`, async t => {
|
||||
const map = await hashAllTheThings(TestDirectories.six, true);
|
||||
t.deepEqual(ignorePackageJson(map), {
|
||||
'test-6/.circleci/config.yml': '30cc59229facf29bfca712fc6e2ddade',
|
||||
'test-6/.editorconfig': '44a3e6c69d9267b0f756986fd970a8f4',
|
||||
'test-6/.github/CONTRIBUTING.md': '5f0dfa7fdf9bf828e3a3aa8fcaeece08',
|
||||
'test-6/.github/ISSUE_TEMPLATE.md': '82d1b99b29f32d851627b317195e73d2',
|
||||
'test-6/.github/PULL_REQUEST_TEMPLATE.md':
|
||||
|
||||
@@ -78,6 +78,7 @@ test('checkArgs returns the right options', async t => {
|
||||
'--travis',
|
||||
'--yarn',
|
||||
'--no-circleci',
|
||||
'--no-editorconfig',
|
||||
'--no-immutable',
|
||||
'--no-install',
|
||||
'--no-vscode'
|
||||
@@ -89,6 +90,7 @@ test('checkArgs returns the right options', async t => {
|
||||
circleci: false,
|
||||
description: '',
|
||||
domDefinitions: true,
|
||||
editorconfig: false,
|
||||
immutable: false,
|
||||
install: false,
|
||||
nodeDefinitions: true,
|
||||
|
||||
@@ -14,6 +14,7 @@ export async function typescriptStarter(
|
||||
circleci,
|
||||
description,
|
||||
domDefinitions,
|
||||
editorconfig,
|
||||
email,
|
||||
fullName,
|
||||
githubUsername,
|
||||
@@ -151,6 +152,9 @@ export async function typescriptStarter(
|
||||
if (!travis) {
|
||||
del([join(projectPath, '.travis.yml')]);
|
||||
}
|
||||
if (!editorconfig) {
|
||||
del([join(projectPath, '.editorconfig')]);
|
||||
}
|
||||
if (!vscode) {
|
||||
del([join(projectPath, '.vscode')]);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface TypescriptStarterCLIOptions {
|
||||
readonly circleci: boolean;
|
||||
readonly description: string;
|
||||
readonly domDefinitions: boolean;
|
||||
readonly editorconfig: boolean;
|
||||
readonly immutable: boolean;
|
||||
readonly install: boolean;
|
||||
readonly nodeDefinitions: boolean;
|
||||
@@ -67,20 +68,20 @@ export function validateName(input: string): true | string {
|
||||
|
||||
export function getIntro(columns: number | undefined): string {
|
||||
const ascii = `
|
||||
_ _ _ _ _
|
||||
| |_ _ _ _ __ ___ ___ ___ _ __(_)_ __ | |_ ___| |_ __ _ _ __| |_ ___ _ __
|
||||
_ _ _ _ _
|
||||
| |_ _ _ _ __ ___ ___ ___ _ __(_)_ __ | |_ ___| |_ __ _ _ __| |_ ___ _ __
|
||||
| __| | | | '_ \\ / _ \\/ __|/ __| '__| | '_ \\| __|____/ __| __/ _\` | '__| __/ _ \\ '__|
|
||||
| |_| |_| | |_) | __/\\__ \\ (__| | | | |_) | ||_____\\__ \\ || (_| | | | || __/ |
|
||||
\\__|\\__, | .__/ \\___||___/\\___|_| |_| .__/ \\__| |___/\\__\\__,_|_| \\__\\___|_|
|
||||
|___/|_| |_|
|
||||
| |_| |_| | |_) | __/\\__ \\ (__| | | | |_) | ||_____\\__ \\ || (_| | | | || __/ |
|
||||
\\__|\\__, | .__/ \\___||___/\\___|_| |_| .__/ \\__| |___/\\__\\__,_|_| \\__\\___|_|
|
||||
|___/|_| |_|
|
||||
`;
|
||||
|
||||
const asciiSmaller = `
|
||||
_ _ _ _ _
|
||||
| |_ _ _ _ __ ___ ___ __ _ _(_)_ __| |_ ___ __| |_ __ _ _ _| |_ ___ _ _
|
||||
_ _ _ _ _
|
||||
| |_ _ _ _ __ ___ ___ __ _ _(_)_ __| |_ ___ __| |_ __ _ _ _| |_ ___ _ _
|
||||
| _| || | '_ \\/ -_|_-</ _| '_| | '_ \\ _|___(_-< _/ _\` | '_| _/ -_) '_|
|
||||
\\__|\\_, | .__/\\___/__/\\__|_| |_| .__/\\__| /__/\\__\\__,_|_| \\__\\___|_|
|
||||
|__/|_| |_|
|
||||
\\__|\\_, | .__/\\___/__/\\__|_| |_| .__/\\__| /__/\\__\\__,_|_| \\__\\___|_|
|
||||
|__/|_| |_|
|
||||
`;
|
||||
|
||||
return columns && columns >= 85
|
||||
|
||||
Reference in New Issue
Block a user