-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 格式化代码并整理依赖 2. 增加 script
- Loading branch information
Showing
19 changed files
with
384 additions
and
307 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,7 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
'jest/globals': true, | ||
}, | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint', 'jest'], | ||
extends: ['eliassama'], | ||
overrides: [ | ||
{ | ||
files: ['*.ts'], | ||
extends: ['eliassama'], | ||
rules: { | ||
// https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-use-before-define.md | ||
'no-use-before-define': 'off', | ||
'@typescript-eslint/no-use-before-define': ['error'], | ||
'no-unused-vars': 'off', | ||
'@typescript-eslint/no-unused-vars': ['error'], | ||
}, | ||
}, | ||
], | ||
settings: { | ||
'import/resolver': { | ||
node: { | ||
extensions: ['.js', '.jsx', '.ts', '.tsx'], | ||
}, | ||
}, | ||
extends: ['eliassama/typescript'], | ||
rules: { | ||
"@typescript-eslint/no-explicit-any": ["off"] | ||
}, | ||
}; |
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
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 |
---|---|---|
@@ -1,34 +1,45 @@ | ||
import { AnswersType } from './index'; | ||
import * as fs from "fs"; | ||
import * as path from "path"; | ||
import * as filepath from "../../../utils/filepath"; | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import * as filepath from '../../../utils/filepath'; | ||
|
||
export async function create(basicAnswers: AnswersType) { | ||
const CopyFileArray = [ | ||
".editorconfig", | ||
".eslintrc.js", | ||
".prettierrc", | ||
] | ||
const CopyFileArray = ['.editorconfig', '.eslintrc.js', '.prettierrc']; | ||
|
||
const CreateFileArray = [ | ||
path.join(basicAnswers.srcDir, `${basicAnswers.mainName}.ts`) | ||
] | ||
path.join(basicAnswers.srcDir, `${basicAnswers.mainName}.ts`), | ||
]; | ||
|
||
const CreateDirectory = [ | ||
basicAnswers.srcDir, | ||
basicAnswers.outDir, | ||
"__test__", | ||
] | ||
'__test__', | ||
]; | ||
|
||
for (let dirName of CreateDirectory ){ | ||
await filepath.recursionMkdir(path.join(basicAnswers.pkgPath, dirName)) | ||
for (const dirName of CreateDirectory) { | ||
await filepath.recursionMkdir(path.join(basicAnswers.pkgPath, dirName)); | ||
} | ||
|
||
for (let fileName of CreateFileArray ){ | ||
fs.writeFileSync(path.join(basicAnswers.pkgPath, fileName),"","utf-8") | ||
for (const fileName of CreateFileArray) { | ||
fs.writeFileSync(path.join(basicAnswers.pkgPath, fileName), '', 'utf-8'); | ||
} | ||
|
||
for (let fileName of CopyFileArray ){ | ||
fs.writeFileSync(path.join(basicAnswers.pkgPath, fileName), fs.readFileSync(path.resolve( __dirname, "..", "..", "..", "template", "ts-package", fileName), "utf-8"), "utf-8"); | ||
for (const fileName of CopyFileArray) { | ||
fs.writeFileSync( | ||
path.join(basicAnswers.pkgPath, fileName), | ||
fs.readFileSync( | ||
path.resolve( | ||
__dirname, | ||
'..', | ||
'..', | ||
'..', | ||
'template', | ||
'ts-package', | ||
fileName, | ||
), | ||
'utf-8', | ||
), | ||
'utf-8', | ||
); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { AnswersType } from "./index"; | ||
import { AnswersType } from './index'; | ||
import { execSync } from 'child_process'; | ||
|
||
export async function create(basicAnswers: AnswersType) { | ||
const gitCommandArray : string[] = [ | ||
"git init", | ||
"git add .", | ||
const gitCommandArray: string[] = [ | ||
'git init', | ||
'git add .', | ||
'git commit -m "first commit"', | ||
"git branch dev", | ||
`git remote add origin ${basicAnswers.sshRepositoryUrl}` | ||
] | ||
for (let command of gitCommandArray){ | ||
await execSync(command, { cwd: basicAnswers.pkgPath }) | ||
'git branch dev', | ||
`git remote add origin ${basicAnswers.sshRepositoryUrl}`, | ||
]; | ||
for (const command of gitCommandArray) { | ||
await execSync(command, { cwd: basicAnswers.pkgPath }); | ||
} | ||
} |
Oops, something went wrong.