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.

424 lines
10 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: "reset", checked: true },
  84. { name: "site", checked: true },
  85. { name: "button", checked: true },
  86. { name: "divider", checked: true },
  87. { name: "flag", checked: true },
  88. { name: "header", checked: true },
  89. { name: "icon", checked: true },
  90. { name: "image", checked: true },
  91. { name: "input", checked: true },
  92. { name: "label", checked: true },
  93. { name: "list", checked: true },
  94. { name: "loader", checked: true },
  95. { name: "rail", checked: true },
  96. { name: "reveal", checked: true },
  97. { name: "segment", checked: true },
  98. { name: "step", checked: true },
  99. { name: "breadcrumb", checked: true },
  100. { name: "form", checked: true },
  101. { name: "grid", checked: true },
  102. { name: "menu", checked: true },
  103. { name: "message", checked: true },
  104. { name: "table", checked: true },
  105. { name: "card", checked: true },
  106. { name: "comment", checked: true },
  107. { name: "feed", checked: true },
  108. { name: "item", checked: true },
  109. { name: "statistic", checked: true },
  110. { name: "accordion", checked: true },
  111. { name: "checkbox", checked: true },
  112. { name: "dimmer", checked: true },
  113. { name: "dropdown", checked: true },
  114. { name: "modal", checked: true },
  115. { name: "nag", checked: true },
  116. { name: "popup", checked: true },
  117. { name: "progress", checked: true },
  118. { name: "rating", checked: true },
  119. { name: "search", checked: true },
  120. { name: "shape", checked: true },
  121. { name: "sidebar", checked: true },
  122. { name: "sticky", checked: true },
  123. { name: "tab", checked: true },
  124. { name: "transition", checked: true },
  125. { name: "video", checked: true },
  126. { name: "api", checked: true },
  127. { name: "form", checked: true }
  128. ],
  129. when: when.notAuto
  130. },
  131. {
  132. type: 'input',
  133. name: 'dist',
  134. message: 'Where should we output Semantic UI?',
  135. default: defaults.paths.output.packaged,
  136. filter: filter.removeTrailingSlash,
  137. when: when.express
  138. },
  139. {
  140. type: 'input',
  141. name: 'site',
  142. message: 'Where should we put your site folder?',
  143. default: defaults.paths.source.site,
  144. filter: filter.removeTrailingSlash,
  145. when: when.custom
  146. },
  147. {
  148. type: 'input',
  149. name: 'packaged',
  150. message: 'Where should we output a packaged version?',
  151. default: defaults.paths.output.packaged,
  152. filter: filter.removeTrailingSlash,
  153. when: when.custom
  154. },
  155. {
  156. type: 'input',
  157. name: 'compressed',
  158. message: 'Where should we output compressed components?',
  159. default: defaults.paths.output.compressed,
  160. filter: filter.removeTrailingSlash,
  161. when: when.custom
  162. },
  163. {
  164. type: 'input',
  165. name: 'uncompressed',
  166. message: 'Where should we output uncompressed components?',
  167. default: defaults.paths.output.uncompressed,
  168. filter: filter.removeTrailingSlash,
  169. when: when.custom
  170. }
  171. ],
  172. cleanup: [
  173. {
  174. type: 'list',
  175. name: 'cleanup',
  176. message: 'Should we remove set-up files?',
  177. choices: [
  178. {
  179. name: 'Yes (re-install will require redownloading semantic).',
  180. value: 'yes'
  181. },
  182. {
  183. name: 'No Thanks',
  184. value: 'no'
  185. }
  186. ]
  187. },
  188. {
  189. type: 'list',
  190. name: 'build',
  191. message: 'Do you want to build Semantic now?',
  192. choices: [
  193. {
  194. name: 'Yes',
  195. value: 'yes'
  196. },
  197. {
  198. name: 'No',
  199. value: 'no'
  200. }
  201. ]
  202. },
  203. ],
  204. site: [
  205. {
  206. type: 'list',
  207. name: 'customize',
  208. message: 'You have not yet customized your site, can we help you do that?',
  209. choices: [
  210. {
  211. name: 'Yes, ask me a few questions',
  212. value: true
  213. },
  214. {
  215. name: 'No I\'ll do it myself',
  216. value: false
  217. }
  218. ]
  219. },
  220. {
  221. type: 'list',
  222. name: 'headerFont',
  223. message: 'Select your header font',
  224. choices: [
  225. {
  226. name: 'Helvetica Neue, Arial, sans-serif',
  227. value: 'Helvetica Neue, Arial, sans-serif;'
  228. },
  229. {
  230. name: 'Lato (Google Fonts)',
  231. value: 'Lato'
  232. },
  233. {
  234. name: 'Open Sans (Google Fonts)',
  235. value: 'Open Sans'
  236. },
  237. {
  238. name: 'Source Sans Pro (Google Fonts)',
  239. value: 'Source Sans Pro'
  240. },
  241. {
  242. name: 'Droid (Google Fonts)',
  243. value: 'Droid'
  244. },
  245. {
  246. name: 'I\'ll choose on my own',
  247. value: false
  248. }
  249. ],
  250. when: when.customize
  251. },
  252. {
  253. type: 'list',
  254. name: 'pageFont',
  255. message: 'Select your page font',
  256. choices: [
  257. {
  258. name: 'Helvetica Neue, Arial, sans-serif',
  259. value: 'Helvetica Neue, Arial, sans-serif;'
  260. },
  261. {
  262. name: 'Lato (Import from Google Fonts)',
  263. value: 'Lato'
  264. },
  265. {
  266. name: 'Open Sans (Import from Google Fonts)',
  267. value: 'Open Sans'
  268. },
  269. {
  270. name: 'Source Sans Pro (Import from Google Fonts)',
  271. value: 'Source Sans Pro'
  272. },
  273. {
  274. name: 'Droid (Google Fonts)',
  275. value: 'Droid'
  276. },
  277. {
  278. name: 'I\'ll choose on my own',
  279. value: false
  280. }
  281. ],
  282. when: when.customize
  283. },
  284. {
  285. type: 'list',
  286. name: 'fontSize',
  287. message: 'Select your base font size',
  288. default: '14px',
  289. choices: [
  290. {
  291. name: '12px',
  292. },
  293. {
  294. name: '13px',
  295. },
  296. {
  297. name: '14px (Recommended)',
  298. value: '14px'
  299. },
  300. {
  301. name: '15px',
  302. },
  303. {
  304. name: '16px',
  305. },
  306. {
  307. name: 'I\'ll choose on my own',
  308. value: false
  309. }
  310. ],
  311. when: when.customize
  312. },
  313. {
  314. type: 'list',
  315. name: 'primaryColor',
  316. message: 'Select the closest name for your primary brand color',
  317. default: '14px',
  318. choices: [
  319. {
  320. name: 'Blue'
  321. },
  322. {
  323. name: 'Green'
  324. },
  325. {
  326. name: 'Orange'
  327. },
  328. {
  329. name: 'Pink'
  330. },
  331. {
  332. name: 'Purple'
  333. },
  334. {
  335. name: 'Red'
  336. },
  337. {
  338. name: 'Teal'
  339. },
  340. {
  341. name: 'Yellow'
  342. },
  343. {
  344. name: 'Black'
  345. },
  346. {
  347. name: 'None really fit',
  348. value: 'custom'
  349. },
  350. {
  351. name: 'I\'ll choose on my own',
  352. value: false
  353. }
  354. ],
  355. when: when.customize
  356. },
  357. {
  358. type: 'input',
  359. name: 'PrimaryHex',
  360. message: 'Enter a hexcode for your primary brand color',
  361. when: when.primaryColor
  362. },
  363. {
  364. type: 'list',
  365. name: 'secondaryColor',
  366. message: 'Select the closest name for your secondary brand color',
  367. default: '14px',
  368. choices: [
  369. {
  370. name: 'Blue'
  371. },
  372. {
  373. name: 'Green'
  374. },
  375. {
  376. name: 'Orange'
  377. },
  378. {
  379. name: 'Pink'
  380. },
  381. {
  382. name: 'Purple'
  383. },
  384. {
  385. name: 'Red'
  386. },
  387. {
  388. name: 'Teal'
  389. },
  390. {
  391. name: 'Yellow'
  392. },
  393. {
  394. name: 'Black'
  395. },
  396. {
  397. name: 'None really fit',
  398. value: 'custom'
  399. },
  400. {
  401. name: 'I\'ll choose on my own',
  402. value: false
  403. }
  404. ],
  405. when: when.customize
  406. },
  407. {
  408. type: 'input',
  409. name: 'secondaryHex',
  410. message: 'Enter a hexcode for your secondary brand color',
  411. when: when.secondaryColor
  412. }
  413. ]
  414. };