Skip to content

Commit

Permalink
refactor: simplify package.js
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Aug 31, 2018
1 parent c20034b commit 783ef46
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions build/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ export default class Package extends EventEmitter {
this.packageObj.version = `${baseVersion}-${date}.${gitCommit}`
}

convertToEdge() {
convertTo(suffix) {
this.logger.info('Converting to edge package')
this.addNameSuffix('-edge')
this.addNameSuffix(`-${suffix}`)
this.generateVersion()
this.writePackage()
}
Expand All @@ -88,7 +88,7 @@ export default class Package extends EventEmitter {
this.emit('build:before')

if (this.edge) {
this.convertToEdge()
this.convertTo('edge')
}

this.logger.info('Cleaning up')
Expand All @@ -112,11 +112,7 @@ export default class Package extends EventEmitter {
}

copyFilesFrom(source, files) {
if (!files) {
files = source.packageObj.files || []
}

for (const file of files) {
for (const file of files || source.packageObj.files || []) {
const src = resolve(source.rootDir, file)
const dst = resolve(this.rootDir, file)
copySync(src, dst)
Expand Down

0 comments on commit 783ef46

Please sign in to comment.