-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload-single-sample.ts
46 lines (39 loc) · 1.17 KB
/
upload-single-sample.ts
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { parse } from "https://deno.land/std/flags/mod.ts";
import { join } from "https://deno.land/std/path/posix.ts";
import { run } from "https://deno.land/x/run_simple/mod.ts";
const { args } = Deno;
const parsedArgs = parse(args);
const requiredArgs = ["path", "sample"];
if (!requiredArgs.every((arg) => parsedArgs[arg])) {
throw new Error(
"Missing one or more of required arguments: " + requiredArgs.toString(),
);
}
const variants: string[] = parsedArgs.variants
? parsedArgs.variants.split(",")
: ["", "nonav", "embed"];
const { path, sample } = parsedArgs;
const commands = variants.map(async (sampleType) => {
const relativeLocation = (sampleType.length
? `samples/${sampleType}/`
: "samples/") + sample;
console.log(relativeLocation);
const output = join("demos/", relativeLocation);
console.log(output);
const stdout = await run([
"node",
"./bin/cli.js",
"demo-deploy",
"-input",
join(path.replace('samples/', ''), relativeLocation),
"-bucket",
"assets.highcharts.com",
"-output",
output,
"-make-redirects",
"-AWSProfile",
"default"
]);
console.log(stdout);
});
await Promise.all(commands);