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.

452 lines
11 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: 'permission',
  138. message: 'What octal file permission should outputted files receive?',
  139. default: defaults.permission,
  140. when: when.notAuto
  141. },
  142. {
  143. type: 'list',
  144. name: 'rtl',
  145. message: 'Do you use a RTL (Right-To-Left) language?',
  146. when: when.notAuto,
  147. choices: [
  148. {
  149. name: 'No',
  150. value: 'no'
  151. },
  152. {
  153. name: 'Yes',
  154. value: 'yes'
  155. },
  156. ]
  157. },
  158. {
  159. type: 'input',
  160. name: 'dist',
  161. message: 'Where should we output Semantic UI?',
  162. default: defaults.paths.output.packaged,
  163. filter: filter.removeTrailingSlash,
  164. when: when.express
  165. },
  166. {
  167. type: 'input',
  168. name: 'site',
  169. message: 'Where should we put your site folder?',
  170. default: defaults.paths.source.site,
  171. filter: filter.removeTrailingSlash,
  172. when: when.custom
  173. },
  174. {
  175. type: 'input',
  176. name: 'packaged',
  177. message: 'Where should we output a packaged version?',
  178. default: defaults.paths.output.packaged,
  179. filter: filter.removeTrailingSlash,
  180. when: when.custom
  181. },
  182. {
  183. type: 'input',
  184. name: 'compressed',
  185. message: 'Where should we output compressed components?',
  186. default: defaults.paths.output.compressed,
  187. filter: filter.removeTrailingSlash,
  188. when: when.custom
  189. },
  190. {
  191. type: 'input',
  192. name: 'uncompressed',
  193. message: 'Where should we output uncompressed components?',
  194. default: defaults.paths.output.uncompressed,
  195. filter: filter.removeTrailingSlash,
  196. when: when.custom
  197. }
  198. ],
  199. cleanup: [
  200. {
  201. type: 'list',
  202. name: 'cleanup',
  203. message: 'Should we remove set-up files?',
  204. choices: [
  205. {
  206. name: 'Yes (re-install will require redownloading semantic).',
  207. value: 'yes'
  208. },
  209. {
  210. name: 'No Thanks',
  211. value: 'no'
  212. }
  213. ]
  214. },
  215. {
  216. type: 'list',
  217. name: 'build',
  218. message: 'Do you want to build Semantic now?',
  219. choices: [
  220. {
  221. name: 'Yes',
  222. value: 'yes'
  223. },
  224. {
  225. name: 'No',
  226. value: 'no'
  227. }
  228. ]
  229. },
  230. ],
  231. site: [
  232. {
  233. type: 'list',
  234. name: 'customize',
  235. message: 'You have not yet customized your site, can we help you do that?',
  236. choices: [
  237. {
  238. name: 'Yes, ask me a few questions',
  239. value: true
  240. },
  241. {
  242. name: 'No I\'ll do it myself',
  243. value: false
  244. }
  245. ]
  246. },
  247. {
  248. type: 'list',
  249. name: 'headerFont',
  250. message: 'Select your header font',
  251. choices: [
  252. {
  253. name: 'Helvetica Neue, Arial, sans-serif',
  254. value: 'Helvetica Neue, Arial, sans-serif;'
  255. },
  256. {
  257. name: 'Lato (Google Fonts)',
  258. value: 'Lato'
  259. },
  260. {
  261. name: 'Open Sans (Google Fonts)',
  262. value: 'Open Sans'
  263. },
  264. {
  265. name: 'Source Sans Pro (Google Fonts)',
  266. value: 'Source Sans Pro'
  267. },
  268. {
  269. name: 'Droid (Google Fonts)',
  270. value: 'Droid'
  271. },
  272. {
  273. name: 'I\'ll choose on my own',
  274. value: false
  275. }
  276. ],
  277. when: when.customize
  278. },
  279. {
  280. type: 'list',
  281. name: 'pageFont',
  282. message: 'Select your page font',
  283. choices: [
  284. {
  285. name: 'Helvetica Neue, Arial, sans-serif',
  286. value: 'Helvetica Neue, Arial, sans-serif;'
  287. },
  288. {
  289. name: 'Lato (Import from Google Fonts)',
  290. value: 'Lato'
  291. },
  292. {
  293. name: 'Open Sans (Import from Google Fonts)',
  294. value: 'Open Sans'
  295. },
  296. {
  297. name: 'Source Sans Pro (Import from Google Fonts)',
  298. value: 'Source Sans Pro'
  299. },
  300. {
  301. name: 'Droid (Google Fonts)',
  302. value: 'Droid'
  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: 'fontSize',
  314. message: 'Select your base font size',
  315. default: '14px',
  316. choices: [
  317. {
  318. name: '12px',
  319. },
  320. {
  321. name: '13px',
  322. },
  323. {
  324. name: '14px (Recommended)',
  325. value: '14px'
  326. },
  327. {
  328. name: '15px',
  329. },
  330. {
  331. name: '16px',
  332. },
  333. {
  334. name: 'I\'ll choose on my own',
  335. value: false
  336. }
  337. ],
  338. when: when.customize
  339. },
  340. {
  341. type: 'list',
  342. name: 'primaryColor',
  343. message: 'Select the closest name for your primary brand color',
  344. default: '14px',
  345. choices: [
  346. {
  347. name: 'Blue'
  348. },
  349. {
  350. name: 'Green'
  351. },
  352. {
  353. name: 'Orange'
  354. },
  355. {
  356. name: 'Pink'
  357. },
  358. {
  359. name: 'Purple'
  360. },
  361. {
  362. name: 'Red'
  363. },
  364. {
  365. name: 'Teal'
  366. },
  367. {
  368. name: 'Yellow'
  369. },
  370. {
  371. name: 'Black'
  372. },
  373. {
  374. name: 'None really fit',
  375. value: 'custom'
  376. },
  377. {
  378. name: 'I\'ll choose on my own',
  379. value: false
  380. }
  381. ],
  382. when: when.customize
  383. },
  384. {
  385. type: 'input',
  386. name: 'PrimaryHex',
  387. message: 'Enter a hexcode for your primary brand color',
  388. when: when.primaryColor
  389. },
  390. {
  391. type: 'list',
  392. name: 'secondaryColor',
  393. message: 'Select the closest name for your secondary brand color',
  394. default: '14px',
  395. choices: [
  396. {
  397. name: 'Blue'
  398. },
  399. {
  400. name: 'Green'
  401. },
  402. {
  403. name: 'Orange'
  404. },
  405. {
  406. name: 'Pink'
  407. },
  408. {
  409. name: 'Purple'
  410. },
  411. {
  412. name: 'Red'
  413. },
  414. {
  415. name: 'Teal'
  416. },
  417. {
  418. name: 'Yellow'
  419. },
  420. {
  421. name: 'Black'
  422. },
  423. {
  424. name: 'None really fit',
  425. value: 'custom'
  426. },
  427. {
  428. name: 'I\'ll choose on my own',
  429. value: false
  430. }
  431. ],
  432. when: when.customize
  433. },
  434. {
  435. type: 'input',
  436. name: 'secondaryHex',
  437. message: 'Enter a hexcode for your secondary brand color',
  438. when: when.secondaryColor
  439. }
  440. ]
  441. };