-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
44 additions
and
64 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
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,14 +1,14 @@ | ||
import { exec } from "child_process"; | ||
import * as fs from "fs-extra"; | ||
import * as path from "path"; | ||
import getProjectDir from "./getProjectDir"; | ||
import { exec } from 'child_process'; | ||
import * as path from 'path'; | ||
import * as fs from 'fs-extra'; | ||
import getProjectDir from './getProjectDir'; | ||
|
||
export default async function addDependency(deps: string, { dev = false }) { | ||
const isYarn = await fs.exists(path.join(await getProjectDir(), "yarn.lock")); | ||
const isYarn = await fs.exists(path.join(await getProjectDir(), 'yarn.lock')); | ||
|
||
if (isYarn) { | ||
exec(`yarn add ${dev ? "--dev" : ""} ${deps}`); | ||
exec(`yarn add ${dev ? '--dev' : ''} ${deps}`); | ||
} else { | ||
exec(`npm install ${dev ? "--save-dev" : "--save"} ${deps}`); | ||
exec(`npm install ${dev ? '--save-dev' : '--save'} ${deps}`); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,10 +1,10 @@ | ||
import fs from "fs-extra"; | ||
import path from "path"; | ||
import { PackageJson } from "../types"; | ||
import getProjectDir from "./getProjectDir"; | ||
import path from 'path'; | ||
import fs from 'fs-extra'; | ||
import { PackageJson } from '../types'; | ||
import getProjectDir from './getProjectDir'; | ||
|
||
export default async function readPackageJson() { | ||
const rootDir = await getProjectDir(); | ||
const pkg = await fs.readFile(path.join(rootDir, "package.json")); | ||
const pkg = await fs.readFile(path.join(rootDir, 'package.json')); | ||
return JSON.parse(pkg.toString()) as PackageJson; | ||
} |