1 | const path = require('path')
|
2 | const shelljs = require('shelljs')
|
3 |
|
4 | const { version } = require('../package.json')
|
5 | const { shouldUseYarn } = require('../dist/util')
|
6 | const Project = require('../dist/create/project').default
|
7 |
|
8 | class GenerateLockfile extends Project {
|
9 | constructor() {
|
10 | super()
|
11 | this.conf = Object.assign(this.conf, {
|
12 | projectName: 'temp',
|
13 | template: 'default'
|
14 | })
|
15 | }
|
16 |
|
17 | copy () {
|
18 | const cwd = process.cwd()
|
19 | const { projectName, template } = this.conf
|
20 | const lockfileDir = path.join(
|
21 | this.templatePath(),
|
22 | template,
|
23 | 'yarn-lockfiles'
|
24 | )
|
25 | shelljs.cd(cwd)
|
26 | shelljs.rm('-rf', lockfileDir)
|
27 | shelljs.mkdir('-p', lockfileDir)
|
28 | shelljs.rm('-rf', projectName)
|
29 | }
|
30 |
|
31 | start () {
|
32 |
|
33 | }
|
34 | }
|
35 |
|
36 | if (shouldUseYarn) {
|
37 | const generateLockfile = new GenerateLockfile()
|
38 | generateLockfile.start()
|
39 | }
|