Skip to content

Commit 7988e68

Browse files
committed
Refactor build task
1 parent c4ea909 commit 7988e68

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

tasks/build.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function build () {
3737

3838
packager(config.packager)
3939
.then(mapPackageNameAll)
40-
.then(archiveAll)
40+
.then(archivePackageAll)
4141
.then((appPaths) => {
4242
console.log('Build(s) successful!')
4343
console.log(appPaths)
@@ -52,6 +52,10 @@ function mapPackageNameAll (appPaths) {
5252
return Promise.all(appPaths.map(mapPackageName))
5353
}
5454

55+
function archivePackageAll (appPaths) {
56+
return Promise.all(appPaths.map(archivePackage))
57+
}
58+
5559
function mapPackageName (appPath) {
5660
return new Promise((resolve, reject) => {
5761
const originalName = path.basename(appPath)
@@ -73,12 +77,8 @@ function mapPackageName (appPath) {
7377
})
7478
}
7579

76-
function archiveAll (appPaths) {
77-
return Promise.all(appPaths.map(archive))
78-
}
79-
80-
function archive (path) {
81-
const outputPath = `${path}.zip`
80+
function archivePackage (appPath) {
81+
const outputPath = `${appPath}.zip`
8282

8383
return new Promise((resolve, reject) => {
8484
const archive = archiver.create('zip', {})
@@ -97,7 +97,7 @@ function archive (path) {
9797
})
9898

9999
archive.pipe(output)
100-
archive.directory(path, false)
100+
archive.directory(appPath, false)
101101
archive.finalize()
102102
})
103103
}

0 commit comments

Comments
 (0)