You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

422 lines
9.9 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. /*******************************
  2. Install Questions
  3. *******************************/
  4. var defaults, fs, filter, when;
  5. fs = require('fs');
  6. defaults = require('./defaults');
  7. filter = {
  8. removeTrailingSlash: function(path) {
  9. return path.replace(/(\/$|\\$)+/mg, '');
  10. }
  11. };
  12. when = {
  13. // set-up
  14. hasConfig: function() {
  15. return( fs.existsSync('./semantic.json') );
  16. },
  17. allowOverwrite: function(questions) {
  18. return (questions.overwrite === undefined || questions.overwrite == 'yes');
  19. },
  20. notAuto: function(questions) {
  21. return (questions.install !== 'auto' && (questions.overwrite === undefined || questions.overwrite == 'yes'));
  22. },
  23. custom: function(questions) {
  24. return (questions.install === 'custom' && (questions.overwrite === undefined || questions.overwrite == 'yes'));
  25. },
  26. express: function(questions) {
  27. return (questions.install === 'express' && (questions.overwrite === undefined || questions.overwrite == 'yes'));
  28. },
  29. // customize
  30. customize: function(questions) {
  31. return (questions.customize === true);
  32. },
  33. primaryColor: function(questions) {
  34. return (questions.primaryColor);
  35. },
  36. secondaryColor: function(questions) {
  37. return (questions.secondaryColor);
  38. }
  39. };
  40. module.exports = {
  41. setup: [
  42. {
  43. type: 'list',
  44. name: 'overwrite',
  45. message: 'It looks like you have a semantic.json file already.',
  46. when: when.hasConfig,
  47. choices: [
  48. {
  49. name: 'Yes, extend my current settings.',
  50. value: 'yes'
  51. },
  52. {
  53. name: 'Skip install',
  54. value: 'no'
  55. }
  56. ]
  57. },
  58. {
  59. type: 'list',
  60. name: 'install',
  61. message: 'Set-up Semantic UI',
  62. when: when.allowOverwrite,
  63. choices: [
  64. {
  65. name: 'Automatic (Use defaults locations and all components)',
  66. value: 'auto'
  67. },
  68. {
  69. name: 'Express (Set components and output folder)',
  70. value: 'express'
  71. },
  72. {
  73. name: 'Custom (Customize all src/dist values)',
  74. value: 'custom'
  75. }
  76. ]
  77. },
  78. {
  79. type: 'checkbox',
  80. name: 'components',
  81. message: 'What components should we include in the package?',
  82. choices: [
  83. { name: "button", checked: true },
  84. { name: "divider", checked: true },
  85. { name: "flag", checked: true },
  86. { name: "header", checked: true },
  87. { name: "icon", checked: true },
  88. { name: "image", checked: true },
  89. { name: "input", checked: true },
  90. { name: "label", checked: true },
  91. { name: "list", checked: true },
  92. { name: "loader", checked: true },
  93. { name: "rail", checked: true },
  94. { name: "reveal", checked: true },
  95. { name: "segment", checked: true },
  96. { name: "step", checked: true },
  97. { name: "breadcrumb", checked: true },
  98. { name: "form", checked: true },
  99. { name: "grid", checked: true },
  100. { name: "menu", checked: true },
  101. { name: "message", checked: true },
  102. { name: "table", checked: true },
  103. { name: "card", checked: true },
  104. { name: "comment", checked: true },
  105. { name: "feed", checked: true },
  106. { name: "item", checked: true },
  107. { name: "statistic", checked: true },
  108. { name: "accordion", checked: true },
  109. { name: "checkbox", checked: true },
  110. { name: "dimmer", checked: true },
  111. { name: "dropdown", checked: true },
  112. { name: "modal", checked: true },
  113. { name: "nag", checked: true },
  114. { name: "popup", checked: true },
  115. { name: "progress", checked: true },
  116. { name: "rating", checked: true },
  117. { name: "search", checked: true },
  118. { name: "shape", checked: true },
  119. { name: "sidebar", checked: true },
  120. { name: "sticky", checked: true },
  121. { name: "tab", checked: true },
  122. { name: "transition", checked: true },
  123. { name: "video", checked: true },
  124. { name: "api", checked: true },
  125. { name: "form", checked: true }
  126. ],
  127. when: when.notAuto
  128. },
  129. {
  130. type: 'input',
  131. name: 'dist',
  132. message: 'Where should we output Semantic UI?',
  133. default: defaults.paths.output.packaged,
  134. filter: filter.removeTrailingSlash,
  135. when: when.express
  136. },
  137. {
  138. type: 'input',
  139. name: 'site',
  140. message: 'Where should we put your site folder?',
  141. default: defaults.paths.source.site,
  142. filter: filter.removeTrailingSlash,
  143. when: when.custom
  144. },
  145. {
  146. type: 'input',
  147. name: 'packaged',
  148. message: 'Where should we output a packaged version?',
  149. default: defaults.paths.output.packaged,
  150. filter: filter.removeTrailingSlash,
  151. when: when.custom
  152. },
  153. {
  154. type: 'input',
  155. name: 'compressed',
  156. message: 'Where should we output compressed components?',
  157. default: defaults.paths.output.compressed,
  158. filter: filter.removeTrailingSlash,
  159. when: when.custom
  160. },
  161. {
  162. type: 'input',
  163. name: 'uncompressed',
  164. message: 'Where should we output uncompressed components?',
  165. default: defaults.paths.output.uncompressed,
  166. filter: filter.removeTrailingSlash,
  167. when: when.custom
  168. }
  169. ],
  170. cleanup: [
  171. {
  172. type: 'list',
  173. name: 'cleanup',
  174. message: 'Should we remove set-up files?',
  175. choices: [
  176. {
  177. name: 'Yes (re-install will require redownloading semantic).',
  178. value: 'yes'
  179. },
  180. {
  181. name: 'No Thanks',
  182. value: 'no'
  183. }
  184. ]
  185. },
  186. {
  187. type: 'list',
  188. name: 'build',
  189. message: 'Do you want to build Semantic now?',
  190. choices: [
  191. {
  192. name: 'Yes',
  193. value: 'yes'
  194. },
  195. {
  196. name: 'No',
  197. value: 'no'
  198. }
  199. ]
  200. },
  201. ],
  202. site: [
  203. {
  204. type: 'list',
  205. name: 'customize',
  206. message: 'You have not yet customized your site, can we help you do that?',
  207. choices: [
  208. {
  209. name: 'Yes, ask me a few questions',
  210. value: true
  211. },
  212. {
  213. name: 'No I\'ll do it myself',
  214. value: false
  215. }
  216. ]
  217. },
  218. {
  219. type: 'list',
  220. name: 'headerFont',
  221. message: 'Select your header font',
  222. choices: [
  223. {
  224. name: 'Helvetica Neue, Arial, sans-serif',
  225. value: 'Helvetica Neue, Arial, sans-serif;'
  226. },
  227. {
  228. name: 'Lato (Google Fonts)',
  229. value: 'Lato'
  230. },
  231. {
  232. name: 'Open Sans (Google Fonts)',
  233. value: 'Open Sans'
  234. },
  235. {
  236. name: 'Source Sans Pro (Google Fonts)',
  237. value: 'Source Sans Pro'
  238. },
  239. {
  240. name: 'Droid (Google Fonts)',
  241. value: 'Droid'
  242. },
  243. {
  244. name: 'I\'ll choose on my own',
  245. value: false
  246. }
  247. ],
  248. when: when.customize
  249. },
  250. {
  251. type: 'list',
  252. name: 'pageFont',
  253. message: 'Select your page font',
  254. choices: [
  255. {
  256. name: 'Helvetica Neue, Arial, sans-serif',
  257. value: 'Helvetica Neue, Arial, sans-serif;'
  258. },
  259. {
  260. name: 'Lato (Import from Google Fonts)',
  261. value: 'Lato'
  262. },
  263. {
  264. name: 'Open Sans (Import from Google Fonts)',
  265. value: 'Open Sans'
  266. },
  267. {
  268. name: 'Source Sans Pro (Import from Google Fonts)',
  269. value: 'Source Sans Pro'
  270. },
  271. {
  272. name: 'Droid (Google Fonts)',
  273. value: 'Droid'
  274. },
  275. {
  276. name: 'I\'ll choose on my own',
  277. value: false
  278. }
  279. ],
  280. when: when.customize
  281. },
  282. {
  283. type: 'list',
  284. name: 'fontSize',
  285. message: 'Select your base font size',
  286. default: '14px',
  287. choices: [
  288. {
  289. name: '12px',
  290. },
  291. {
  292. name: '13px',
  293. },
  294. {
  295. name: '14px (Recommended)',
  296. value: '14px'
  297. },
  298. {
  299. name: '15px',
  300. },
  301. {
  302. name: '16px',
  303. },
  304. {
  305. name: 'I\'ll choose on my own',
  306. value: false
  307. }
  308. ],
  309. when: when.customize
  310. },
  311. {
  312. type: 'list',
  313. name: 'primaryColor',
  314. message: 'Select the closest name for your primary brand color',
  315. default: '14px',
  316. choices: [
  317. {
  318. name: 'Blue'
  319. },
  320. {
  321. name: 'Green'
  322. },
  323. {
  324. name: 'Orange'
  325. },
  326. {
  327. name: 'Pink'
  328. },
  329. {
  330. name: 'Purple'
  331. },
  332. {
  333. name: 'Red'
  334. },
  335. {
  336. name: 'Teal'
  337. },
  338. {
  339. name: 'Yellow'
  340. },
  341. {
  342. name: 'Black'
  343. },
  344. {
  345. name: 'None really fit',
  346. value: 'custom'
  347. },
  348. {
  349. name: 'I\'ll choose on my own',
  350. value: false
  351. }
  352. ],
  353. when: when.customize
  354. },
  355. {
  356. type: 'input',
  357. name: 'PrimaryHex',
  358. message: 'Enter a hexcode for your primary brand color',
  359. when: when.primaryColor
  360. },
  361. {
  362. type: 'list',
  363. name: 'secondaryColor',
  364. message: 'Select the closest name for your secondary brand color',
  365. default: '14px',
  366. choices: [
  367. {
  368. name: 'Blue'
  369. },
  370. {
  371. name: 'Green'
  372. },
  373. {
  374. name: 'Orange'
  375. },
  376. {
  377. name: 'Pink'
  378. },
  379. {
  380. name: 'Purple'
  381. },
  382. {
  383. name: 'Red'
  384. },
  385. {
  386. name: 'Teal'
  387. },
  388. {
  389. name: 'Yellow'
  390. },
  391. {
  392. name: 'Black'
  393. },
  394. {
  395. name: 'None really fit',
  396. value: 'custom'
  397. },
  398. {
  399. name: 'I\'ll choose on my own',
  400. value: false
  401. }
  402. ],
  403. when: when.customize
  404. },
  405. {
  406. type: 'input',
  407. name: 'secondaryHex',
  408. message: 'Enter a hexcode for your secondary brand color',
  409. when: when.secondaryColor
  410. }
  411. ]
  412. };