source: trip-planner-front/node_modules/@angular-devkit/build-angular/src/utils/copy-assets.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.9 KB
Line 
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 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28var __importDefault = (this && this.__importDefault) || function (mod) {
29 return (mod && mod.__esModule) ? mod : { "default": mod };
30};
31Object.defineProperty(exports, "__esModule", { value: true });
32exports.copyAssets = void 0;
33const fs = __importStar(require("fs"));
34const glob_1 = __importDefault(require("glob"));
35const path = __importStar(require("path"));
36const copy_file_1 = require("./copy-file");
37function globAsync(pattern, options) {
38 return new Promise((resolve, reject) => glob_1.default(pattern, options, (e, m) => (e ? reject(e) : resolve(m))));
39}
40async function copyAssets(entries, basePaths, root, changed) {
41 const defaultIgnore = ['.gitkeep', '**/.DS_Store', '**/Thumbs.db'];
42 for (const entry of entries) {
43 const cwd = path.resolve(root, entry.input);
44 const files = await globAsync(entry.glob, {
45 cwd,
46 dot: true,
47 nodir: true,
48 ignore: entry.ignore ? defaultIgnore.concat(entry.ignore) : defaultIgnore,
49 follow: entry.followSymlinks,
50 });
51 const directoryExists = new Set();
52 for (const file of files) {
53 const src = path.join(cwd, file);
54 if (changed && !changed.has(src)) {
55 continue;
56 }
57 const filePath = entry.flatten ? path.basename(file) : file;
58 for (const base of basePaths) {
59 const dest = path.join(base, entry.output, filePath);
60 const dir = path.dirname(dest);
61 if (!directoryExists.has(dir)) {
62 if (!fs.existsSync(dir)) {
63 fs.mkdirSync(dir, { recursive: true });
64 }
65 directoryExists.add(dir);
66 }
67 copy_file_1.copyFile(src, dest);
68 }
69 }
70 }
71}
72exports.copyAssets = copyAssets;
Note: See TracBrowser for help on using the repository browser.