netlify / zip-it-and-ship-it

Intelligently prepare Node.js Lambda functions for deployment

Home Page:https://www.npmjs.com/package/@netlify/zip-it-and-ship-it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove src/utils/shell.ts?

XhmikosR opened this issue · comments

Just going through the source code, I noticed this file is just exporting execa.

Wouldn't it be simpler to remove it and call execa directly in the two places you are using it?

We're using it mostly in order to stub execa in tests. See:

// We must require this file first because we need to stub it before the main
// functions are required.
// eslint-disable-next-line import/order
const shellUtils = require('../dist/utils/shell')
const shellUtilsStub = sinon.stub(shellUtils, 'runCommand')

It's not an ideal solution, but it feels like a harmless abstraction that does the job. I'm happy to look into alternative approaches, though.

I figure out it's only for tests too, but I couldn't make tests works right. I'd definitely remove it because it's unnecessary for production, but I don't have a solution to offer.