forked from coreui/coreui-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnpm-postinstall.js
59 lines (51 loc) · 1.81 KB
/
npm-postinstall.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
56
57
58
59
#!/usr/bin/env node
const pkg = require(require('path').resolve('./package.json'))
let packageJson = null
try {
packageJson = require(require('path').resolve('../../../package.json'))
} catch (e) {
}
const log = console.log
const VERSIONS = {
'@coreui/coreui': {
url: 'https://coreui.io/pro/',
name: 'CoreUI CSS library'
},
'@coreui/angular': {
url: 'https://coreui.io/pro/angular/',
name: 'CoreUI Angular components library',
docs: 'https://coreui.io/angular/docs/'
},
'@coreui/react': {
url: 'https://coreui.io/pro/react/',
name: 'CoreUI React components library',
docs: 'https://coreui.io/react/docs/introduction'
},
'@coreui/vue': {
url: 'https://coreui.io/pro/vue/',
name: 'CoreUI Vue components library',
docs: 'https://coreui.io/vue/docs/introduction/'
},
}
log('\x1b[32m')
log(`\x1b[1mThank you for using ${VERSIONS[pkg.name].name}! \x1b[22m`)
log(`${VERSIONS[pkg.name].name} is an MIT licensed open source project and ` +
`completely free to use. However, the amount of effort needed to maintain ` +
`and develop new features for the project is not sustainable without proper ` +
`financial backing. You can support development by buying Pro Version: ` +
`\x1b[4m${VERSIONS[pkg.name].url}\x1b[24m]`)
log('\x1b[39m')
const isFramework = VERSIONS[pkg.name].name !== '@coreui/coreui'
const haveStyles = packageJson &&
packageJson.dependencies &&
(
packageJson.dependencies['@coreui/coreui'] ||
packageJson.dependencies['@coreui/coreui-pro']
)
if (isFramework && !haveStyles) {
log(`\x1b[1m\x1b[31mError: You don't have '@coreui/coreui' CSS library installed in ` +
`package.json dependencies section. You need to import it in order to style ` +
`CoreUI components. Installation docs: ${VERSIONS[pkg.name].docs} \n \x1b[0m`
)
// ` \x1b[33m`
}