UNPKG

1.01 kBJavaScriptView Raw
1/*
2* @adonisjs/mrm-preset
3*
4* (c) Harminder Virk <virk@adonisjs.com>
5*
6* For the full copyright and license information, please view the LICENSE
7* file that was distributed with this source code.
8*/
9
10const { template } = require('mrm-core')
11const { join } = require('path')
12
13const gh = require('../utils/ghAttributes')
14const mergeConfig = require('../utils/mergeConfig')
15const core = require('./core')
16const standard = require('./standard')
17
18const prTemplate = '.github/PULL_REQUEST_TEMPLATE.md'
19
20/**
21 * Creating required github templates
22 *
23 * @method task
24 *
25 * @param {Object} config
26 *
27 * @return {void}
28 */
29function task (config) {
30 const ghAttributes = gh('creating github templates')
31 mergeConfig(config, { repo: ghAttributes.repo })
32
33 if (config.core) {
34 core.up()
35 standard.down()
36 } else {
37 standard.up()
38 core.down()
39 }
40
41 template(prTemplate, join(__dirname, 'templates', 'pr.md')).apply(ghAttributes).save()
42}
43
44task.description = 'Adds Github related templates'
45module.exports = task