Skip to content

Commit

Permalink
refactor: generateKoiConfig only once
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Oct 4, 2022
1 parent 5314648 commit 3f3b4f2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
16 changes: 3 additions & 13 deletions packages/build/tasks/build/generate.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import * as fs from 'fs'
import { parallel } from 'gulp'
import mkdirp from 'mkdirp'
import {
koiConfig,
koiConfigBefore,
koiManifest,
koiVersionInfo,
} from '../../templates'
import { koiConfig, koiManifest, koiVersionInfo } from '../../templates'
import { dir } from '../../utils/path'
import { generateAssets } from './assets'

export const generateKoiConfigBefore = () =>
fs.promises.writeFile(dir('buildPortable', 'koi.yml'), koiConfigBefore)

export const generateKoiConfig = () =>
fs.promises.writeFile(dir('buildPortable', 'koi.yml'), koiConfig)

Expand All @@ -27,11 +19,9 @@ export const generateKoiManifest = async () => {
)
}

export const generateBefore = parallel(
generateKoiConfigBefore,
export const generate = parallel(
generateKoiConfig,
generateKoiVersionInfo,
generateKoiManifest,
generateAssets
)

export const generateAfter = parallel(generateKoiConfig)
12 changes: 3 additions & 9 deletions packages/build/tasks/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,12 @@ import { series } from 'gulp'
import { boil } from './boil'
import { cleanTemp } from './clean'
import { compile } from './compile'
import { generateAfter, generateBefore } from './generate'
import { generate } from './generate'

export * from './assets'
export * from './boil'
export * from './clean'
export * from './compile'
export * from './generate'
export * from './assets'

export const build = series(
generateBefore,
compile,
boil,
generateAfter,
cleanTemp
)
export const build = series(generate, compile, boil, cleanTemp)
6 changes: 0 additions & 6 deletions packages/build/templates/portable/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ import {
koiVersionStringsJson,
} from '../../utils/config'

export const koiConfigBefore = Handlebars.compile(
fs
.readFileSync(path.join(__dirname, 'koi-config-before.yml.hbs'))
.toString('utf-8')
)({})

export const koiConfig = Handlebars.compile(
fs.readFileSync(path.join(__dirname, 'koi-config.yml.hbs')).toString('utf-8')
)({ defaultInstance })
Expand Down

This file was deleted.

0 comments on commit 3f3b4f2

Please sign in to comment.