UNPKG

3.79 kBJavaScriptView Raw
1/**
2 * @fileoverview Options configuration for optionator.
3 * @author idok
4 */
5'use strict';
6
7//------------------------------------------------------------------------------
8// Requirements
9//------------------------------------------------------------------------------
10
11var optionator = require('optionator');
12var pkg = require('../package.json');
13var reactDOMSupport = require('./reactDOMSupport');
14var reactNativeSupport = require('./reactNativeSupport');
15
16//------------------------------------------------------------------------------
17// Initialization and Public Interface
18//------------------------------------------------------------------------------
19
20// exports 'parse(args)', 'generateHelp()', and 'generateHelpForOption(optionName)'
21module.exports = optionator({
22 prepend: pkg.name + ' v' + pkg.version + '\n' + pkg.description + '\n\nUsage:\n$ rt <filename> [<filename> ...] [<args>]',
23 concatRepeatedArrays: true,
24 mergeRepeatedObjects: true,
25 options: [{
26 heading: 'Options'
27 }, {
28 option: 'help',
29 alias: 'h',
30 type: 'Boolean',
31 description: 'Show help.'
32 }, {
33 option: 'color',
34 alias: 'c',
35 default: 'true',
36 type: 'Boolean',
37 description: 'Use colors in output.'
38 }, {
39 option: 'modules',
40 alias: 'm',
41 default: 'none',
42 type: 'String',
43 description: 'Use output modules. (amd|commonjs|none|es6|typescript|jsrt)'
44 }, {
45 option: 'name',
46 alias: 'n',
47 type: 'String',
48 description: 'When using globals, the name for the variable. The default is the [file name]RT, when using amd, the name of the module'
49 }, {
50 option: 'dry-run',
51 alias: 'd',
52 default: 'false',
53 type: 'Boolean',
54 description: 'Run compilation without creating an output file, used to check if the file is valid'
55 }, {
56 option: 'force',
57 alias: 'r',
58 default: 'false',
59 type: 'Boolean',
60 description: 'Force creation of output. skip file check.'
61 }, {
62 option: 'format',
63 alias: 'f',
64 type: 'String',
65 default: 'stylish',
66 //enum: ['stylish', 'json'],
67 description: 'Use a specific output format. (stylish|json)'
68 }, {
69 option: 'target-version',
70 alias: 't',
71 type: 'String',
72 default: reactDOMSupport.default,
73 description: '\'React version to generate code for (' + Object.keys(reactDOMSupport).join(', ') + ')\''
74 }, {
75 option: 'list-target-version',
76 type: 'Boolean',
77 default: 'false',
78 description: 'Show list of target versions'
79 }, {
80 option: 'version',
81 alias: 'v',
82 type: 'Boolean',
83 description: 'Outputs the version number.'
84 }, {
85 option: 'stack',
86 alias: 'k',
87 type: 'Boolean',
88 description: 'Show stack trace on errors.'
89 }, {
90 option: 'react-import-path',
91 default: 'react/addons',
92 type: 'String',
93 description: 'Dependency path for importing React.'
94 }, {
95 option: 'lodash-import-path',
96 default: 'lodash',
97 type: 'String',
98 description: 'Dependency path for importing lodash.'
99 }, {
100 option: 'native',
101 alias: 'rn',
102 type: 'Boolean',
103 description: 'Renders react native templates.'
104 }, {
105 option: 'flow',
106 type: 'Boolean',
107 description: 'Add /* @flow */ to the top of the generated file'
108 }, {
109 option: 'native-target-version',
110 alias: 'rnv',
111 type: 'String',
112 default: reactNativeSupport.default,
113 description: '\'React native version to generate code for (' + Object.keys(reactNativeSupport).join(', ') + ')\''
114 }]
115});
\No newline at end of file