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.

429 lines
10 KiB

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