forked from adonisjs/adonis-websocket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructions.js
42 lines (37 loc) · 1.18 KB
/
instructions.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict'
/**
* adonis-websocket
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const path = require('path')
async function copySocketFile (cli) {
const inFile = path.join(__dirname, 'config', 'socket.js')
const outFile = path.join(cli.helpers.appRoot(), 'start/socket.js')
await cli.copy(inFile, outFile)
cli.command.completed('create', 'start/socket.js')
}
async function copyKernelFile (cli) {
const inFile = path.join(__dirname, 'config', 'wsKernel.js')
const outFile = path.join(cli.helpers.appRoot(), 'start/wsKernel.js')
await cli.copy(inFile, outFile)
cli.command.completed('create', 'start/wsKernel.js')
}
async function copyConfigFile (cli) {
const inFile = path.join(__dirname, 'config', 'index.js')
const outFile = path.join(cli.helpers.configPath(), 'socket.js')
await cli.copy(inFile, outFile)
cli.command.completed('create', 'config/socket.js')
}
module.exports = async (cli) => {
try {
await copySocketFile(cli)
await copyConfigFile(cli)
await copyKernelFile(cli)
} catch (error) {
// ignore error
}
}