UNPKG

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