1 | import bash from 'vamtiger-bash';
|
2 | import Args from 'vamtiger-argv/build/main';
|
3 | import { CommandlineArgument, ShortCommandlineArgument } from './types';
|
4 |
|
5 | const args = new Args();
|
6 | const webComponent = args.has(CommandlineArgument.webComponent)
|
7 | || args.has(ShortCommandlineArgument.webComponent);
|
8 | const jsonLd = args.has(CommandlineArgument.jsonLd)
|
9 | || args.has(ShortCommandlineArgument.jsonLd);
|
10 | const bundle = args.has(CommandlineArgument.bundle)
|
11 | || args.has(ShortCommandlineArgument.bundle);
|
12 | const devDependencies = [
|
13 | '@types/node',
|
14 | 'mocha',
|
15 | '@types/mocha',
|
16 | 'chai',
|
17 | '@types/chai',
|
18 | 'typescript',
|
19 | 'vamtiger-node-typescript-commit'
|
20 | ];
|
21 | const bundleDevDependencies = [
|
22 | 'vamtiger-bundle-typescript',
|
23 | 'vamtiger-bundle-css-next',
|
24 | 'vamtiger-bundle-html',
|
25 | 'vamtiger-remove',
|
26 | 'vamtiger-get-directory-content',
|
27 | 'vamtiger-bash'
|
28 | ];
|
29 | const webComponentsDevDependecies = [
|
30 | 'vamtiger-browser-method',
|
31 | 'vamtiger-copy-file',
|
32 | 'vamtiger-get-directory-content',
|
33 | 'vamtiger-watch'
|
34 | ]
|
35 |
|
36 | export default async (params: Params) => {
|
37 | const { workingDirectory } = params;
|
38 | const bashOptions = {
|
39 | cwd: workingDirectory
|
40 | };
|
41 | const dependencies = devDependencies;
|
42 |
|
43 | let installDependencies: string;
|
44 |
|
45 | if (bundle || webComponent || jsonLd) {
|
46 | dependencies.push(...bundleDevDependencies);
|
47 | }
|
48 |
|
49 | if (webComponent || jsonLd) {
|
50 | dependencies.push(...webComponentsDevDependecies);
|
51 | }
|
52 |
|
53 | installDependencies = `npm install --save-dev ${dependencies.join(' ')}`;
|
54 |
|
55 | console.log(installDependencies);
|
56 |
|
57 | return bash(installDependencies, bashOptions)
|
58 | .then(console.log)
|
59 | .catch(error => console.warn(error));
|
60 | }
|
61 |
|
62 | export interface Params {
|
63 | workingDirectory: string;
|
64 | } |
\ | No newline at end of file |