|
| 1 | +#!/usr/bin/env node |
| 2 | + |
| 3 | +const pkg = require(require('path').resolve('./package.json')) |
| 4 | + |
| 5 | +let packageJson = null |
| 6 | +try { |
| 7 | + packageJson = require(require('path').resolve('../../../package.json')) |
| 8 | +} catch (e) { |
| 9 | + |
| 10 | +} |
| 11 | + |
| 12 | +const log = console.log |
| 13 | + |
| 14 | +const VERSIONS = { |
| 15 | + '@coreui/coreui': { |
| 16 | + url: 'https://coreui.io/pro/', |
| 17 | + name: 'CoreUI CSS library' |
| 18 | + }, |
| 19 | + '@coreui/angular': { |
| 20 | + url: 'https://coreui.io/pro/angular/', |
| 21 | + name: 'CoreUI Angular components library', |
| 22 | + docs: 'https://coreui.io/angular/docs/' |
| 23 | + }, |
| 24 | + '@coreui/react': { |
| 25 | + url: 'https://coreui.io/pro/react/', |
| 26 | + name: 'CoreUI React components library', |
| 27 | + docs: 'https://coreui.io/react/docs/introduction' |
| 28 | + }, |
| 29 | + '@coreui/vue': { |
| 30 | + url: 'https://coreui.io/pro/vue/', |
| 31 | + name: 'CoreUI Vue components library', |
| 32 | + docs: 'https://coreui.io/vue/docs/introduction/' |
| 33 | + }, |
| 34 | +} |
| 35 | + |
| 36 | +log('\x1b[32m') |
| 37 | +log(`\x1b[1mThank you for using ${VERSIONS[pkg.name].name}! \x1b[22m`) |
| 38 | +log(`${VERSIONS[pkg.name].name} is an MIT licensed open source project and ` + |
| 39 | +`completely free to use. However, the amount of effort needed to maintain ` + |
| 40 | +`and develop new features for the project is not sustainable without proper ` + |
| 41 | +`financial backing. You can support development by buying Pro Version: ` + |
| 42 | +`\x1b[4m${VERSIONS[pkg.name].url}\x1b[24m]`) |
| 43 | +log('\x1b[39m') |
| 44 | + |
| 45 | +const isFramework = VERSIONS[pkg.name].name !== '@coreui/coreui' |
| 46 | +const haveStyles = packageJson && |
| 47 | + packageJson.dependencies && |
| 48 | + ( |
| 49 | + packageJson.dependencies['@coreui/coreui'] || |
| 50 | + packageJson.dependencies['@coreui/coreui-pro'] |
| 51 | + ) |
| 52 | + |
| 53 | +if (isFramework && !haveStyles) { |
| 54 | + log(`\x1b[1m\x1b[31mError: You don't have '@coreui/coreui' CSS library installed in ` + |
| 55 | + `package.json dependencies section. You need to import it in order to style ` + |
| 56 | + `CoreUI components. Installation docs: ${VERSIONS[pkg.name].docs} \n \x1b[0m` |
| 57 | + ) |
| 58 | + // ` \x1b[33m` |
| 59 | +} |
0 commit comments