source: imaps-frontend/node_modules/update-browserslist-db/cli.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100755
File size: 912 bytes
RevLine 
[d565449]1#!/usr/bin/env node
2
3let { readFileSync } = require('fs')
4let { join } = require('path')
5
6require('./check-npm-version')
7let updateDb = require('./')
8
9const ROOT = __dirname
10
11function getPackage() {
12 return JSON.parse(readFileSync(join(ROOT, 'package.json')))
13}
14
15let args = process.argv.slice(2)
16
17let USAGE = 'Usage:\n npx update-browserslist-db\n'
18
19function isArg(arg) {
20 return args.some(i => i === arg)
21}
22
23function error(msg) {
24 process.stderr.write('update-browserslist-db: ' + msg + '\n')
25 process.exit(1)
26}
27
28if (isArg('--help') || isArg('-h')) {
29 process.stdout.write(getPackage().description + '.\n\n' + USAGE + '\n')
30} else if (isArg('--version') || isArg('-v')) {
31 process.stdout.write('browserslist-lint ' + getPackage().version + '\n')
32} else {
33 try {
34 updateDb()
35 } catch (e) {
36 if (e.name === 'BrowserslistUpdateError') {
37 error(e.message)
38 } else {
39 throw e
40 }
41 }
42}
Note: See TracBrowser for help on using the repository browser.