@mikeyt23/node-cli-utils 1.2.0 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -160,7 +160,7 @@ exports.defaultSpawnOptions = {
|
|
|
160
160
|
stdio: ['ignore', 'inherit', 'inherit']
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
async function createTarball(directoryToTarball, outputDirectory, tarballName) {
|
|
163
|
+
async function createTarball(directoryToTarball, outputDirectory, tarballName, strip = 0) {
|
|
164
164
|
if (!directoryToTarball || directoryToTarball.length === 0) {
|
|
165
165
|
throw new Error('directoryToTarball is required')
|
|
166
166
|
}
|
|
@@ -183,10 +183,14 @@ async function createTarball(directoryToTarball, outputDirectory, tarballName) {
|
|
|
183
183
|
if (!fs.existsSync(outputDirectory)) {
|
|
184
184
|
fs.mkdirSync(outputDirectory)
|
|
185
185
|
} else {
|
|
186
|
-
|
|
186
|
+
if (fs.existsSync(tarballPath)) {
|
|
187
|
+
fs.unlinkSync(tarballPath)
|
|
188
|
+
}
|
|
187
189
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
+
|
|
191
|
+
let options = { gzip: true, file: tarballPath, strip: strip }
|
|
192
|
+
|
|
193
|
+
await tar.c(options, [directoryToTarball])
|
|
190
194
|
}
|
|
191
195
|
|
|
192
196
|
async function dockerCompose(command, projectName, dockerRelativeDirectory, detached = false) {
|