-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathcopyWalkthruMedia.ts
More file actions
28 lines (23 loc) · 1.12 KB
/
copyWalkthruMedia.ts
File metadata and controls
28 lines (23 loc) · 1.12 KB
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
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved.
* See 'LICENSE' in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { watch as watchFiles } from 'fs/promises';
import { filepath } from '../src/Utility/Filesystem/filepath';
import { verbose } from '../src/Utility/Text/streams';
import { $root, glob, mkdir, updateFiles } from './common';
export async function main() {
verbose(`Copying walkthrough media to extension/dist folder`);
await updateFiles(await glob('walkthrough/images/**/*'), mkdir('dist'));
}
export async function watch() {
const source = await filepath.isFolder('walkthrough/images', $root);
if (source) {
verbose(`Watching ${source} folder for changes.`);
console.log('Press Ctrl+C to exit.');
// eslint-disable-next-line @typescript-eslint/no-unused-vars
for await (const event of watchFiles(source, { recursive: true })) {
await main();
}
}
}