UNPKG

4.55 kBJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
5 * This code may only be used under the BSD style license found at
6 * http://polymer.github.io/LICENSE.txt
7 * The complete set of authors may be found at
8 * http://polymer.github.io/AUTHORS.txt
9 * The complete set of contributors may be found at
10 * http://polymer.github.io/CONTRIBUTORS.txt
11 * Code distributed by Google as part of the polymer project is also
12 * subject to an additional IP rights grant found at
13 * http://polymer.github.io/PATENTS.txt
14 */
15Object.defineProperty(exports, "__esModule", { value: true });
16const environments_1 = require("./environments/environments");
17exports.globalArguments = [
18 {
19 name: 'env',
20 description: 'The environment to use to specialize certain commands, ' +
21 'like build',
22 type: (value) => {
23 return environments_1.buildEnvironment(value);
24 },
25 group: 'global',
26 },
27 {
28 name: 'entrypoint',
29 description: 'The main HTML file that will be requested for all routes.',
30 group: 'global',
31 },
32 {
33 name: 'shell',
34 type: String,
35 description: 'The app shell HTML import',
36 group: 'global',
37 },
38 {
39 name: 'fragment',
40 type: String,
41 multiple: true,
42 description: 'HTML imports that are loaded on-demand.',
43 group: 'global',
44 },
45 {
46 name: 'root',
47 type: String,
48 description: 'The root directory of your project. Defaults to the current' +
49 ' working directory.',
50 group: 'global',
51 },
52 {
53 name: 'sources',
54 type: String,
55 multiple: true,
56 description: 'Glob(s) that match your project source files. ' +
57 'Defaults to `src/**/*`.',
58 group: 'global',
59 },
60 {
61 name: 'extra-dependencies',
62 type: String,
63 multiple: true,
64 description: 'Glob(s) that match any additional dependencies not caught ' +
65 'by the analyzer to include with your build.',
66 group: 'global',
67 },
68 {
69 name: 'npm',
70 type: Boolean,
71 description: 'Sets npm mode: dependencies are installed from npm, ' +
72 'component directory is "node_modules" and the package name is read ' +
73 'from package.json',
74 },
75 {
76 name: 'module-resolution',
77 description: 'Algorithm to use for resolving module specifiers in import ' +
78 'and export statements when rewriting them to be web-compatible. ' +
79 'Valid values are "none" and "node". "none" disables module specifier ' +
80 'rewriting. "node" uses Node.js resolution to find modules.',
81 type: String,
82 // This overrides the default of 'none' in polyserve so that we don't
83 // erroneously override the config file
84 // TODO(justinfagnani): remove the default in polyserve
85 defaultValue: undefined,
86 },
87 {
88 name: 'component-dir',
89 type: String,
90 description: 'The component directory to use. Defaults to reading from ' +
91 'the Bower config (usually bower_components/).',
92 },
93 {
94 name: 'verbose',
95 description: 'turn on debugging output',
96 type: Boolean,
97 alias: 'v',
98 group: 'global',
99 },
100 {
101 name: 'help',
102 description: 'print out helpful usage information',
103 type: Boolean,
104 alias: 'h',
105 group: 'global',
106 },
107 {
108 name: 'quiet',
109 description: 'silence output',
110 type: Boolean,
111 alias: 'q',
112 group: 'global',
113 },
114 {
115 name: 'version',
116 description: 'Print version info.',
117 type: Boolean,
118 group: 'global',
119 },
120];
121/**
122 * Performs a simple merge of multiple arguments lists. Does not mutate given
123 * arguments lists or arguments.
124 *
125 * This doesn't perform any validation of duplicate arguments, multiple
126 * defaults, etc., because by the time this function is run, the user can't do
127 * anything about it. Validation of command and global arguments should be done
128 * in tests, not on users machines.
129 */
130function mergeArguments(argumentLists) {
131 const argsByName = new Map();
132 for (const args of argumentLists) {
133 for (const arg of args) {
134 argsByName.set(arg.name, Object.assign({}, argsByName.get(arg.name), arg));
135 }
136 }
137 return Array.from(argsByName.values());
138}
139exports.mergeArguments = mergeArguments;
140//# sourceMappingURL=args.js.map
\No newline at end of file