-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathoutput-paths.js
27 lines (27 loc) · 984 Bytes
/
output-paths.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const fs_1 = require("fs");
const path_1 = require("path");
function ensureOutputPaths(baseOutputPath, i18n) {
const outputPaths = i18n.shouldInline
? [...i18n.inlineLocales].map(l => [l, i18n.flatOutput ? baseOutputPath : path_1.join(baseOutputPath, l)])
: [
i18n.veCompatLocale
? [i18n.veCompatLocale, path_1.join(baseOutputPath, i18n.veCompatLocale)]
: ['', baseOutputPath],
];
for (const [, outputPath] of outputPaths) {
if (!fs_1.existsSync(outputPath)) {
fs_1.mkdirSync(outputPath, { recursive: true });
}
}
return new Map(outputPaths);
}
exports.ensureOutputPaths = ensureOutputPaths;