Skip to content

Commit

Permalink
馃挕 Update TSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Mar 25, 2020
1 parent 7bcce0e commit a0f62ba
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ import {
} from "fs-extra";
import fg from "fast-glob";

/**
* `console.log` messages if in development environment
* @param params - Messages to log
*/
const log = (...params: any[]) =>
process.env.NODE_ENV === "development" && console.log(...params);

export interface EjectSettings {
sourceDir?: string;
destDir?: string;
Expand All @@ -26,6 +19,7 @@ export interface EjectSettings {

/**
* Eject dependencies
* @param settings - Ejection settings
*/
export const eject = async (settings: EjectSettings = {}) => {
const nodeModulesDir = settings.sourceDir || join(".", "node_modules");
Expand Down Expand Up @@ -63,10 +57,8 @@ export const eject = async (settings: EjectSettings = {}) => {
if (settings.dependenciesFilter)
updatedDependencies = settings.dependenciesFilter(updatedDependencies);

for await (const dependency of updatedDependencies) {
for await (const dependency of updatedDependencies)
await copy(join(nodeModulesDir, dependency), join(destDir, dependency));
log("Copied dependency", dependency);
}

for await (const file of files) {
let contents = await readFile(join(".", file), "utf8");
Expand All @@ -84,7 +76,6 @@ export const eject = async (settings: EjectSettings = {}) => {

if (!updatedFiles.has(file)) continue;
await writeFile(join(".", file), contents);
log("Updated file", file);
}

return { updatedFiles, updatedDependencies };
Expand Down

0 comments on commit a0f62ba

Please sign in to comment.