-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathinit.ts
79 lines (72 loc) · 2.18 KB
/
init.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright 2020 Google Inc. Use of this source code is governed by an
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.
import yargs from 'yargs';
import {getDeprecations} from './get-deprecations';
import {getEmbeddedCompiler} from './get-embedded-compiler';
import {getLanguageRepo} from './get-language-repo';
const argv = yargs(process.argv.slice(2))
.option('compiler-path', {
type: 'string',
description:
'Build the Embedded Dart Sass binary from the source at this path.',
})
.option('compiler-ref', {
type: 'string',
description: 'Build the Embedded Dart Sass binary from this Git ref.',
})
.option('compiler-js', {
type: 'boolean',
description: 'Build the Embedded Dart Sass with dart2js.',
})
.option('skip-compiler', {
type: 'boolean',
description: "Don't Embedded Dart Sass at all.",
})
.option('language-path', {
type: 'string',
description: 'Use the Sass language repo from the source at this path.',
})
.option('language-ref', {
type: 'string',
description: 'Use the Sass language repo from this Git ref.',
})
.conflicts({
'compiler-path': ['compiler-ref', 'skip-compiler'],
'compiler-ref': ['skip-compiler'],
'language-path': ['language-ref'],
})
.parseSync();
void (async () => {
try {
const outPath = 'lib/src/vendor';
if (argv['language-ref']) {
await getLanguageRepo(outPath, {
ref: argv['language-ref'],
});
} else if (argv['language-path']) {
await getLanguageRepo(outPath, {
path: argv['language-path'],
});
} else {
await getLanguageRepo(outPath);
}
if (!argv['skip-compiler']) {
if (argv['compiler-ref']) {
await getEmbeddedCompiler(argv['compiler-js'], {
ref: argv['compiler-ref'],
});
} else if (argv['compiler-path']) {
await getEmbeddedCompiler(argv['compiler-js'], {
path: argv['compiler-path'],
});
} else {
await getEmbeddedCompiler(argv['compiler-js']);
}
}
await getDeprecations(outPath);
} catch (error) {
console.error(error);
process.exitCode = 1;
}
})();