Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pretty-quick #59

Merged
merged 3 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@
{
"taskName": "tsc",
"command": "node",
"args": [
"./node_modules/typescript/lib/tsc.js",
"-w",
"-p",
"."
],
"args": ["./node_modules/typescript/lib/tsc.js", "-w", "-p", "."],
"isBackground": true,
"problemMatcher": "$tsc-watch"
}]
}
}
]
}
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
"scripts": {
"build": "tsc",
"clean": "trash **/*.js **/*.js.map **/*.d.ts **/*.log !**/node_modules/**",
"precommit": "yalc check",
"prepublishOnly": "yarn clean && tsc && yarn test",
"test": "tsc && mocha test && yarn lint",
"watch": "mocha test --watch",
"ci": "tsc && yarn test",
"lint": "tslint -p ."
},
"husky": {
"hooks": {
"pre-commit": "yalc check && pretty-quick --staged"
}
},
"dependencies": {
"del": "^2.2.2",
"fs-extra": "^4.0.2",
Expand All @@ -44,11 +48,11 @@
"@types/npm-packlist": "^1.1.0",
"@types/yargs": "^6.6.0",
"clean-ts-built": "^1.0.0",
"husky": "^0.13.3",
"husky": "^1.3.1",
"mocha": "^5.2.0",
"prettier": "^1.14.2",
"pretty-quick": "^1.8.0",
"trash-cli": "^1.4.0",
"ts-clean-built": "^1.0.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0",
"tslint-plugin-prettier": "^1.3.0",
Expand Down
6 changes: 4 additions & 2 deletions src/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ export const addPackages = async (
}
const addedAction = options.link ? 'linked' : 'added'
console.log(
`Package ${pkg.name}@${pkg.version} ${addedAction} ==> ${destModulesDir}.`
`Package ${pkg.name}@${
pkg.version
} ${addedAction} ==> ${destModulesDir}.`
)
}

Expand Down Expand Up @@ -213,6 +215,6 @@ export const addPackages = async (

if (options.yarn) {
console.log('Running yarn:')
execSync('yarn', {cwd: options.workingDir})
execSync('yarn', { cwd: options.workingDir })
}
}
12 changes: 5 additions & 7 deletions src/installations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ export const readInstallationsFile = (): InstallationsFile => {
export const showInstallations = ({ packages }: { packages: string[] }) => {
const config = readInstallationsFile()
Object.keys(config)
.filter(
packageName =>
packages.length ? packages.indexOf(packageName) >= 0 : true
.filter(packageName =>
packages.length ? packages.indexOf(packageName) >= 0 : true
)
.map((name: PackageName) => ({ name, locations: config[name] }))
.forEach(({ name, locations }) => {
Expand All @@ -55,14 +54,13 @@ export const cleanInstallations = async ({
packages,
dry
}: {
packages: string[],
packages: string[]
dry: boolean
}) => {
const config = readInstallationsFile()
const installsToRemove = Object.keys(config)
.filter(
packageName =>
packages.length ? packages.indexOf(packageName) >= 0 : true
.filter(packageName =>
packages.length ? packages.indexOf(packageName) >= 0 : true
)
.map((name: PackageName) => ({ name, locations: config[name] }))
.reduce(
Expand Down
2 changes: 1 addition & 1 deletion test/fixture/project/nested/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"dependencies": {
"dep-package": "1.0.0"
}
}
}
14 changes: 7 additions & 7 deletions test/fixture/project/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "yalc-test-project",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"dep-package": "1.0.0"
}
"name": "yalc-test-project",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"dep-package": "1.0.0"
}
}
Loading