UNPKG

889 BJavaScriptView Raw
1const path = require('path')
2const shelljs = require('shelljs')
3
4const { version } = require('../package.json')
5const { shouldUseYarn } = require('../dist/util')
6const Project = require('../dist/create/project').default
7
8class 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 // this.write(this.copy.bind(this))
33 }
34}
35
36if (shouldUseYarn) {
37 const generateLockfile = new GenerateLockfile()
38 generateLockfile.start()
39}