Skip to content

Commit c0fbfab

Browse files
committed
Move zipName to module
1 parent 795d354 commit c0fbfab

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

lib/build.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import jsYaml from 'js-yaml'
66
import jszip from 'jszip'
77

88
import { loadJson } from './load-json.js'
9+
import { zipName } from './zip-name.js'
910
import { mergeArrayProps, mergeConfig } from './merge.js'
1011

1112
const { load: yamlLoad, dump: yamlDump } = jsYaml
@@ -55,7 +56,7 @@ const createArtifacts = async (
5556
if (!configRoot) throw new Error('Missing configRoot')
5657
if (!distRoot) throw new Error('Missing distRoot')
5758

58-
const srcZipPath = path.resolve(tmpRoot, `${name}_${version}_${platform}.zip`)
59+
const srcZipPath = path.resolve(tmpRoot, zipName({ name, version, platform }))
5960
const srcZipBuffer = await fs.promises.readFile(srcZipPath)
6061
const createArtifact = createArtifactFrom(
6162
srcZipBuffer,

lib/install.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import path from 'path'
55
import download from 'download'
66
import mkdirp from 'mkdirp'
77

8+
import { zipName } from './zip-name.js'
89
import { loadJson } from './load-json.js'
910

1011
export const install = async ({
@@ -36,9 +37,6 @@ const pull = async (benthos) => {
3637
return { data, name }
3738
}
3839

39-
export const zipName = (benthos) =>
40-
`${benthos.name}_${benthos.version}_${benthos.platform}.zip`
41-
4240
const get = async (benthos) => {
4341
const root = `${benthos.src}/v${benthos.version}`
4442
const name = zipName(benthos)

lib/zip-name.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const zipName = (benthos) =>
2+
`${benthos.name}_${benthos.version}_${benthos.platform}.zip`

test/build.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import path from 'path'
33

44
import test from 'ava'
55

6-
import { zipName } from '../lib/install.js'
6+
import { zipName } from '../lib/zip-name.js'
77
import { build, install, loadJson } from '../index.js'
88

99
const tmpRoot = path.join('tmp', 'build-spec')

0 commit comments

Comments
 (0)