1 | 'use strict'
|
2 |
|
3 | const { resolvePath } = require('./files')
|
4 |
|
5 |
|
6 | const getInitialBase = function ({
|
7 | repositoryRoot,
|
8 | defaultConfig: { build: { base: defaultBase } = {} },
|
9 | inlineConfig: { build: { base: initialBase = defaultBase } = {} },
|
10 | }) {
|
11 | return resolveBase(repositoryRoot, initialBase)
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | const getBase = function (base, repositoryRoot, config) {
|
26 | return base === undefined ? resolveBase(repositoryRoot, config.build.base) : base
|
27 | }
|
28 |
|
29 | const resolveBase = function (repositoryRoot, base) {
|
30 | return resolvePath(repositoryRoot, repositoryRoot, base, 'build.base')
|
31 | }
|
32 |
|
33 |
|
34 | const addBase = function (config, base) {
|
35 | return { ...config, build: { ...config.build, base } }
|
36 | }
|
37 |
|
38 | module.exports = { getInitialBase, getBase, addBase }
|