-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
Copy pathbootstrap.js
55 lines (48 loc) · 1.6 KB
/
bootstrap.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
43
44
45
46
47
48
49
50
51
52
53
54
55
// create package.json and README for packages that don't have one yet
const fs = require('fs')
const path = require('path')
const baseVersion = require('../packages/@vue/cli-service/package.json').version
const packagesDir = path.resolve(__dirname, '../packages/@vue')
const files = fs.readdirSync(packagesDir)
files.forEach(pkg => {
if (pkg.charAt(0) === '.') return
const isPlugin = /^cli-plugin-/.test(pkg)
const desc = isPlugin
? `${pkg.replace('cli-plugin-', '')} plugin for vue-cli`
: `${pkg.replace('cli-', '')} for vue-cli`
const pkgPath = path.join(packagesDir, pkg, `package.json`)
if (!fs.existsSync(pkgPath)) {
const json = {
'name': `@vue/${pkg}`,
'version': baseVersion,
'description': desc,
'main': 'index.js',
'publishConfig': {
'access': 'public'
},
'repository': {
'type': 'git',
'url': 'git+https://github.com/vuejs/vue-cli.git'
},
'keywords': [
'vue',
'cli'
],
'author': 'Evan You',
'license': 'MIT',
'bugs': {
'url': 'https://github.com/vuejs/vue-cli/issues'
},
'homepage': `https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/${pkg}#readme`
}
fs.writeFileSync(pkgPath, JSON.stringify(json, null, 2))
}
const readmePath = path.join(packagesDir, pkg, `README.md`)
if (!fs.existsSync(readmePath)) {
fs.writeFileSync(readmePath, `# @vue/${pkg}\n\n> ${desc}`)
}
const npmIgnorePath = path.join(packagesDir, pkg, `.npmignore`)
if (!fs.existsSync(npmIgnorePath)) {
fs.writeFileSync(npmIgnorePath, `__tests__\n__mocks__`)
}
})