-
Notifications
You must be signed in to change notification settings - Fork 2
/
instructions.ts
28 lines (25 loc) · 882 Bytes
/
instructions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
* adonis-mix-asset
*
* (c) Wahyu Budi Saputra <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import * as sinkStatic from '@adonisjs/sink'
import { ApplicationContract } from '@ioc:Adonis/Core/Application'
import { join } from 'path'
const MIX_CONFIG_TEMPLATE_STUB = join(__dirname, './templates', 'webpack.mix.txt')
export default async function instructions(
projectRoot: string,
_: ApplicationContract,
{ logger, files }: typeof sinkStatic
) {
const mixConfig = new files.MustacheFile(projectRoot, 'webpack.mix.js', MIX_CONFIG_TEMPLATE_STUB)
if (mixConfig.exists()) {
logger.action('create').skipped('webpack.mix.js', 'File already exists')
} else {
mixConfig.apply({}).commit()
logger.action('create').succeeded('webpack.mix.js')
}
}