From b323246c801ee7e49ee679c7b7401f29d0338f0c Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 10:50:59 +0100 Subject: [PATCH 1/6] :white_check_mark: fix flacky tests --- src/tests/add/prettier.spec.ts | 6 +----- src/tests/add/tailwind.spec.ts | 6 +----- src/utls/base-add-command.spec.ts | 14 +++++--------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/tests/add/prettier.spec.ts b/src/tests/add/prettier.spec.ts index 5a58658..d598552 100644 --- a/src/tests/add/prettier.spec.ts +++ b/src/tests/add/prettier.spec.ts @@ -20,10 +20,6 @@ beforeEach(async () => { execPath = filesystem.path('/', 'tmp', tmpDirName); filesystem.dir(execPath); process.chdir(execPath); - try { - await system.run('git config --global user.email "you@example.com"'); - await system.run('git config --global user.name "Your Name"'); - } catch {} }); afterEach(() => { console.log = originalLog; @@ -40,7 +36,7 @@ const initWithConfigAndCommit = async () => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state"'); + await system.run('git commit -m "init state" --author="Dummy '); }; describe('prettier', () => { diff --git a/src/tests/add/tailwind.spec.ts b/src/tests/add/tailwind.spec.ts index 0f9b86c..99a8872 100644 --- a/src/tests/add/tailwind.spec.ts +++ b/src/tests/add/tailwind.spec.ts @@ -20,10 +20,6 @@ beforeEach(async () => { execPath = filesystem.path('/', 'tmp', tmpDirName); filesystem.dir(execPath); process.chdir(execPath); - try { - await system.run('git config --global user.email "you@example.com"'); - await system.run('git config --global user.name "Your Name"'); - } catch {} }); afterEach(() => { console.log = originalLog; @@ -40,7 +36,7 @@ const initWithConfigAndCommit = async (packageJson = {}) => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state"'); + await system.run('git commit -m "init state" --author="Dummy '); }; describe('tailwind', () => { diff --git a/src/utls/base-add-command.spec.ts b/src/utls/base-add-command.spec.ts index ccbfec5..8f548ac 100644 --- a/src/utls/base-add-command.spec.ts +++ b/src/utls/base-add-command.spec.ts @@ -18,10 +18,6 @@ beforeEach(async () => { execPath = filesystem.path('/', 'tmp', tmpDirName); filesystem.dir(execPath); process.chdir(execPath); - try { - await system.run('git config --global user.email "you@example.com"'); - await system.run('git config --global user.name "Your Name"'); - } catch {} }); afterEach(() => { console.log = originalLog; @@ -58,7 +54,7 @@ const initWithConfigAndCommit = async () => { filesystem.write('package.json', {}); await system.run('touch yarn.lock'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "init state"'); + await system.run('git commit -m "init state" --author="Dummy "'); }; describe('BaseAddCommand', () => { @@ -128,7 +124,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit"', + 'git commit -m "test commit" --author="Dummy ', 'echo hello > test.md', ], }, @@ -138,7 +134,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit"', + 'git commit -m "test commit" --author="Dummy ', 'rm -f test.md', ], }, @@ -179,7 +175,7 @@ describe('BaseAddCommand', () => { await system.run('git init'); await system.run('git add .nbxrc'); await system.run('pwd'); - await system.run('git commit -m "initial commit"'); + await system.run('git commit -m "initial commit" --author="Dummy '); await system.run('git status'); await RunCommand.run(['initGit']); const gitConfig = filesystem.read('.git/config'); @@ -252,7 +248,7 @@ describe('BaseAddCommand', () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('touch test.md'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "test"'); + await system.run('git commit -m "test" --author="Dummy '); const before = await system.run('git status -s'); await RunCommand.run(['gitAddUnstaged']); From b90c086890217fc88ee8220d22cd866a7203dfb1 Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 10:52:06 +0100 Subject: [PATCH 2/6] :see_no_evil: ignore readme by prettier --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index b55f23c..a25ccbe 100644 --- a/.prettierignore +++ b/.prettierignore @@ -24,3 +24,4 @@ yarn-error.log* .history CHANGELOG.md +README.md From fe7bb7fbed6f3a4ec6f6b45b320ac68e3dd02ec6 Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 10:59:32 +0100 Subject: [PATCH 3/6] :white_check_mark: fix flacky tests --- src/tests/add/prettier.spec.ts | 2 +- src/tests/add/tailwind.spec.ts | 2 +- src/utls/base-add-command.spec.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tests/add/prettier.spec.ts b/src/tests/add/prettier.spec.ts index d598552..5761534 100644 --- a/src/tests/add/prettier.spec.ts +++ b/src/tests/add/prettier.spec.ts @@ -36,7 +36,7 @@ const initWithConfigAndCommit = async () => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state" --author="Dummy '); + await system.run('git commit -m "init state" --author="Dummy "'); }; describe('prettier', () => { diff --git a/src/tests/add/tailwind.spec.ts b/src/tests/add/tailwind.spec.ts index 99a8872..00dc709 100644 --- a/src/tests/add/tailwind.spec.ts +++ b/src/tests/add/tailwind.spec.ts @@ -36,7 +36,7 @@ const initWithConfigAndCommit = async (packageJson = {}) => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state" --author="Dummy '); + await system.run('git commit -m "init state" --author="Dummy "'); }; describe('tailwind', () => { diff --git a/src/utls/base-add-command.spec.ts b/src/utls/base-add-command.spec.ts index 8f548ac..a7730a2 100644 --- a/src/utls/base-add-command.spec.ts +++ b/src/utls/base-add-command.spec.ts @@ -124,7 +124,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit" --author="Dummy ', + 'git commit -m "test commit" --author="Dummy "', 'echo hello > test.md', ], }, @@ -134,7 +134,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit" --author="Dummy ', + 'git commit -m "test commit" --author="Dummy "', 'rm -f test.md', ], }, @@ -175,7 +175,7 @@ describe('BaseAddCommand', () => { await system.run('git init'); await system.run('git add .nbxrc'); await system.run('pwd'); - await system.run('git commit -m "initial commit" --author="Dummy '); + await system.run('git commit -m "initial commit" --author="Dummy "'); await system.run('git status'); await RunCommand.run(['initGit']); const gitConfig = filesystem.read('.git/config'); @@ -248,7 +248,7 @@ describe('BaseAddCommand', () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('touch test.md'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "test" --author="Dummy '); + await system.run('git commit -m "test" --author="Dummy "'); const before = await system.run('git status -s'); await RunCommand.run(['gitAddUnstaged']); From fb1cace7c8c0f0eab6c3f55ca0c73d141036172f Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 11:06:43 +0100 Subject: [PATCH 4/6] :white_check_mark: fix tests --- src/tests/add/prettier.spec.ts | 8 ++++++-- src/tests/add/tailwind.spec.ts | 8 ++++++-- src/tests/wall.spec.ts | 2 +- src/utls/base-add-command.spec.ts | 27 +++++++++++++++++++++------ 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/tests/add/prettier.spec.ts b/src/tests/add/prettier.spec.ts index 5761534..6d1ac73 100644 --- a/src/tests/add/prettier.spec.ts +++ b/src/tests/add/prettier.spec.ts @@ -4,7 +4,7 @@ import * as prompts from 'prompts'; import * as latestVersion from 'latest-version'; import Prettier from '../../commands/add/prettier'; -jest.setTimeout(30000); +jest.setTimeout(90000); /* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ let consoleLogOutput: string[]; @@ -36,7 +36,11 @@ const initWithConfigAndCommit = async () => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); }; describe('prettier', () => { diff --git a/src/tests/add/tailwind.spec.ts b/src/tests/add/tailwind.spec.ts index 00dc709..37c6068 100644 --- a/src/tests/add/tailwind.spec.ts +++ b/src/tests/add/tailwind.spec.ts @@ -4,7 +4,7 @@ import * as prompts from 'prompts'; import * as latestVersion from 'latest-version'; import Tailwind from '../../commands/add/tailwind'; -jest.setTimeout(60000); +jest.setTimeout(90000); /* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ let consoleLogOutput: string[]; @@ -36,7 +36,11 @@ const initWithConfigAndCommit = async (packageJson = {}) => { await system.run('touch yarn.lock'); await system.run('echo node_modules > .gitignore'); await system.run('git add * .nbxrc .gitignore'); - await system.run('git commit -m "init state" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); }; describe('tailwind', () => { diff --git a/src/tests/wall.spec.ts b/src/tests/wall.spec.ts index fea7f0f..fce8218 100644 --- a/src/tests/wall.spec.ts +++ b/src/tests/wall.spec.ts @@ -2,7 +2,7 @@ import { filesystem } from 'gluegun'; import Wall from '../commands/wall'; const stripANSI = require('strip-ansi'); -jest.setTimeout(30000); +jest.setTimeout(90000); /* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ let consoleLogOutput: string[]; let execPath: string; diff --git a/src/utls/base-add-command.spec.ts b/src/utls/base-add-command.spec.ts index a7730a2..58c27b3 100644 --- a/src/utls/base-add-command.spec.ts +++ b/src/utls/base-add-command.spec.ts @@ -54,7 +54,11 @@ const initWithConfigAndCommit = async () => { filesystem.write('package.json', {}); await system.run('touch yarn.lock'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "init state" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); }; describe('BaseAddCommand', () => { @@ -124,7 +128,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit" --author="Dummy "', + 'git commit -m "test commit"', 'echo hello > test.md', ], }, @@ -134,7 +138,7 @@ describe('BaseAddCommand', () => { 'touch test.md', 'git add test.md', 'git add .nbxrc', - 'git commit -m "test commit" --author="Dummy "', + 'git commit -m "test commit"', 'rm -f test.md', ], }, @@ -144,6 +148,10 @@ describe('BaseAddCommand', () => { it(`should erro when ${action.name}`, async () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('git init'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} for (const step of action.actions) { // eslint-disable-next-line no-await-in-loop await system.run(step); @@ -174,8 +182,11 @@ describe('BaseAddCommand', () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('git init'); await system.run('git add .nbxrc'); - await system.run('pwd'); - await system.run('git commit -m "initial commit" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "initial commit"'); await system.run('git status'); await RunCommand.run(['initGit']); const gitConfig = filesystem.read('.git/config'); @@ -248,7 +259,11 @@ describe('BaseAddCommand', () => { filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); await system.run('touch test.md'); await system.run('git add * .nbxrc'); - await system.run('git commit -m "test" --author="Dummy "'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "test"'); const before = await system.run('git status -s'); await RunCommand.run(['gitAddUnstaged']); From f31dace49098fd0c7199789aac45d0bf183a5ad1 Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 13:04:01 +0100 Subject: [PATCH 5/6] :sparkles: add dep command --- src/commands/add/dep.ts | 44 ++++++ src/tests/add/__snapshots__/dep.spec.ts.snap | 45 ++++++ src/tests/add/dep.spec.ts | 145 +++++++++++++++++++ 3 files changed, 234 insertions(+) create mode 100644 src/commands/add/dep.ts create mode 100644 src/tests/add/__snapshots__/dep.spec.ts.snap create mode 100644 src/tests/add/dep.spec.ts diff --git a/src/commands/add/dep.ts b/src/commands/add/dep.ts new file mode 100644 index 0000000..8bf6b7d --- /dev/null +++ b/src/commands/add/dep.ts @@ -0,0 +1,44 @@ +// import {flags} from '@oclif/command' +import { BaseCommand } from '../../utls/base-command'; +import { BaseAddCommand } from '../../utls/base-add-command'; +import { flags } from '@oclif/command'; + +export default class Dep extends BaseAddCommand { + static description = 'proxy to yarn add, plus gitmoji commit'; + + static examples = [ + `$ nbx add:dep -D eslint`, + `$ nbx add:dep --dev eslint`, + `$ nbx add:dep chalk`, + ]; + + static flags = { + ...BaseCommand.flags, + dev: flags.boolean({ default: false, char: 'D', description: 'install as a dev dependency' }), + }; + + static args = [{ name: 'dep', description: 'The dependency to install', required: true }]; + + async run() { + if (!this.hasDirPackageJson()) { + this.error('There is no package.json not found in the current folder'); + } + const { + args: { dep }, + flags: { dev }, + } = this.parse(Dep); + + if ((dev && this.hasDevDependencyInPackageJson(dep)) || this.hasDependencyInPackageJson(dep)) { + if (this.hasDevDependencyInPackageJson(dep)) { + this.error(`${dep} is already installed in this project.`); + } + } + + await this.initGit(); + if (dev) { + await this.addDevDependency(dep, true); + } else { + await this.addDependency(dep, true); + } + } +} diff --git a/src/tests/add/__snapshots__/dep.spec.ts.snap b/src/tests/add/__snapshots__/dep.spec.ts.snap new file mode 100644 index 0000000..86d4335 --- /dev/null +++ b/src/tests/add/__snapshots__/dep.spec.ts.snap @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`dep should fail if dependancy is already in package.json 1`] = `[Error: Config not found. Tried to look for a .nbxrc, .nbxrc.json, .nbxrc.yaml, .nbxrc.yml, .nbxrc.js]`; + +exports[`dep should fail if dev dependancy is already in package.json 1`] = `[Error: chalk is already installed in this project.]`; + +exports[`dep should fail if no package.json found 1`] = `[Error: There is no package.json not found in the current folder]`; + +exports[`dep should print help correctly 1`] = ` +Array [ + "proxy to yarn add, plus gitmoji commit +", + "USAGE + $ nbx add:dep DEP + +ARGUMENTS + DEP The dependency to install + +OPTIONS + -D, --dev install as a dev dependency + -h, --help show CLI help + -v, --verbose Verbose output + --[no-]spinner Enable spinner in cli output, true by default + +EXAMPLES + $ nbx add:dep -D eslint + $ nbx add:dep --dev eslint + $ nbx add:dep chalk", + "", +] +`; + +exports[`dep should work with a dev dependency 1`] = ` +Array [ + "Adding chalk as a dev dependency", + "The step was done without any error.", +] +`; + +exports[`dep should work with dependency 1`] = ` +Array [ + "Adding chalk as a dependency", + "The step was done without any error.", +] +`; diff --git a/src/tests/add/dep.spec.ts b/src/tests/add/dep.spec.ts new file mode 100644 index 0000000..d3b2244 --- /dev/null +++ b/src/tests/add/dep.spec.ts @@ -0,0 +1,145 @@ +import { filesystem, system } from 'gluegun'; +const stripANSI = require('strip-ansi'); +import * as latestVersion from 'latest-version'; +import Dep from '../../commands/add/dep'; + +jest.setTimeout(90000); + +/* eslint-disable no-console,max-nested-callbacks,@typescript-eslint/ban-ts-ignore */ +let consoleLogOutput: string[]; +let execPath: string; +const originalCwd = process.cwd(); +const originalLog = console.log; + +beforeEach(async () => { + consoleLogOutput = []; + console.log = (x: any) => consoleLogOutput.push(stripANSI(x)); + + const tmpDirName = `${new Date().getTime()}-${Math.random() * 100}-add-nbx-test`; + execPath = filesystem.path('/', 'tmp', tmpDirName); + filesystem.dir(execPath); + process.chdir(execPath); +}); +afterEach(() => { + console.log = originalLog; + process.chdir(originalCwd); + jest.restoreAllMocks(); + filesystem.remove(execPath); +}); + +const initWithConfigAndCommit = async () => { + await system.run('git init'); + filesystem.write('.nbxrc', { git: { user: 'aaa', email: 'bbb' } }); + filesystem.write('package.json', {}); + await system.run('touch yarn.lock'); + await system.run('echo node_modules > .gitignore'); + await system.run('git add * .nbxrc .gitignore'); + try { + await system.run('git config user.email "you@example.com"'); + await system.run('git config user.name "Your Name"'); + } catch {} + await system.run('git commit -m "init state"'); +}; + +describe('dep', () => { + it('should print help correctly', async () => { + try { + await Dep.run(['-h']); + } catch {} + expect(consoleLogOutput).toMatchSnapshot(); + }); + it('should fail if no package.json found', async () => { + expect.assertions(1); + try { + filesystem.remove('package.json'); + await Dep.run(['chalk', '--no-spinner']); + // eslint-disable-next-line unicorn/catch-error-name + } catch (e) { + expect(e).toMatchSnapshot(); + } + }); + it('should fail if dependancy is already in package.json', async () => { + expect.assertions(1); + try { + filesystem.write('package.json', { dependencies: { chalk: '2.3.2' } }); + await Dep.run(['chalk', '--no-spinner']); + // eslint-disable-next-line unicorn/catch-error-name + } catch (e) { + expect(e).toMatchSnapshot(); + } + }); + it('should fail if dev dependancy is already in package.json', async () => { + expect.assertions(1); + try { + filesystem.write('package.json', { devDependencies: { chalk: '2.3.2' } }); + await Dep.run(['chalk', '--dev', '--no-spinner']); + // eslint-disable-next-line unicorn/catch-error-name + } catch (e) { + expect(e).toMatchSnapshot(); + } + }); + + it('should work with dependency', async () => { + await initWithConfigAndCommit(); + const latestChalk = await latestVersion('chalk'); + + await Dep.run(['chalk', '--no-spinner']); + + const packageJson = filesystem.read('package.json', 'json'); + expect(consoleLogOutput).toMatchSnapshot(); + expect(packageJson).toStrictEqual({ + dependencies: { + chalk: latestChalk, + }, + }); + const after = await system.run('git log --name-status --format="%s"'); + const afterSlitted = after + .split('\n') + .map(val => val.trim()) + .map(val => stripANSI(val)) + .filter(val => val !== ''); + + expect(afterSlitted).toStrictEqual([ + `:heavy_plus_sign: add chalk@${latestChalk} as a dependency`, + 'M\tpackage.json', + 'M\tyarn.lock', + 'init state', + 'A\t.gitignore', + 'A\t.nbxrc', + 'A\tpackage.json', + 'A\tyarn.lock', + ]); + }); + + it('should work with a dev dependency', async () => { + await initWithConfigAndCommit(); + const latestChalk = await latestVersion('chalk'); + + await Dep.run(['chalk', '-D', '--no-spinner']); + + const packageJson = filesystem.read('package.json', 'json'); + expect(consoleLogOutput).toMatchSnapshot(); + expect(packageJson).toStrictEqual({ + devDependencies: { + chalk: latestChalk, + }, + }); + const after = await system.run('git log --name-status --format="%s"'); + const afterSlitted = after + .split('\n') + .map(val => val.trim()) + .map(val => stripANSI(val)) + .filter(val => val !== ''); + + expect(afterSlitted).toStrictEqual([ + `:heavy_plus_sign: add chalk@${latestChalk} as a dev dependency`, + 'M\tpackage.json', + 'M\tyarn.lock', + 'init state', + 'A\t.gitignore', + 'A\t.nbxrc', + 'A\tpackage.json', + 'A\tyarn.lock', + ]); + }); +}); From 3b7f67a3bace195a3aaa9971b738aec11342af3a Mon Sep 17 00:00:00 2001 From: Nicolas Beaussart Date: Wed, 19 Feb 2020 13:04:16 +0100 Subject: [PATCH 6/6] :recycle: change plugin declaration for git js --- src/commands/add/prettier.ts | 5 +---- src/commands/add/tailwind.ts | 5 +---- src/utls/base-add-command.ts | 5 ++++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/commands/add/prettier.ts b/src/commands/add/prettier.ts index b46fe36..835ad70 100644 --- a/src/commands/add/prettier.ts +++ b/src/commands/add/prettier.ts @@ -2,12 +2,9 @@ import { BaseCommand } from '../../utls/base-command'; import { system, filesystem } from 'gluegun'; import * as prompts from 'prompts'; -import * as fs from 'fs'; -import { plugins, add, commit } from 'isomorphic-git'; +import { add, commit } from 'isomorphic-git'; import { BaseAddCommand } from '../../utls/base-add-command'; -plugins.set('fs', fs); - export default class Prettier extends BaseAddCommand { static description = 'add prettier to project and format it'; diff --git a/src/commands/add/tailwind.ts b/src/commands/add/tailwind.ts index 922ded7..4429eee 100644 --- a/src/commands/add/tailwind.ts +++ b/src/commands/add/tailwind.ts @@ -1,12 +1,9 @@ import { BaseCommand } from '../../utls/base-command'; import { system, filesystem, patching } from 'gluegun'; import * as prompts from 'prompts'; -import * as fs from 'fs'; -import { plugins, add, commit } from 'isomorphic-git'; +import { add, commit } from 'isomorphic-git'; import { BaseAddCommand } from '../../utls/base-add-command'; -plugins.set('fs', fs); - export default class Tailwind extends BaseAddCommand { static description = 'add tailwindcss to a project'; diff --git a/src/utls/base-add-command.ts b/src/utls/base-add-command.ts index 2dfd6e4..0f3b453 100644 --- a/src/utls/base-add-command.ts +++ b/src/utls/base-add-command.ts @@ -1,7 +1,10 @@ import { BaseCommand } from './base-command'; -import { add, commit, config as gitConfig, statusMatrix } from 'isomorphic-git'; +import { add, plugins, commit, config as gitConfig, statusMatrix } from 'isomorphic-git'; import * as latestVersion from 'latest-version'; import { filesystem, system } from 'gluegun'; +import * as fs from 'fs'; + +plugins.set('fs', fs); export abstract class BaseAddCommand extends BaseCommand { static flags = {