fastly-domains
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -5,32 +5,23 @@ #!/usr/bin/env node | ||
const yargs = require('yargs'); | ||
const ora = require('ora'); | ||
const chalk = require('chalk'); | ||
const fastly = require('../src/index'); | ||
const token = require('./fastly-token'); | ||
const response = require('../test/response/domains.response'); | ||
const argv = yargs | ||
.options({ | ||
'token': { | ||
alias: 't', | ||
describe: 'Fastly API token with read access', | ||
demandOption: true, | ||
} | ||
}) | ||
.check(argv => { | ||
if (argv.token.length === 32) { | ||
return true; | ||
} else { | ||
throw new Error('Your token is not a valid Fastly API token! Please try again.'); | ||
} | ||
}) | ||
.help() | ||
.alias('help', 'h') | ||
.version() | ||
.alias('version', 'v') | ||
.argv; | ||
const spinner = ora(chalk.yellow('Fetching domains')).start(); | ||
fastly(argv.token) | ||
fastly(token) | ||
.then(domains => { | ||
console.log(JSON.stringify(domains, null, 2)); | ||
spinner.succeed(chalk.green('Fetching domains')); | ||
console.log(chalk.dim(JSON.stringify(domains, null, 2))); | ||
}) | ||
.catch(err => { | ||
console.error(err.message); | ||
spinner.fail(chalk.red('Fetching domains')); | ||
if (err.message === response.domainList.error[401] || err.message === response.domainList.error[404]) { | ||
spinner.info(chalk.blue(err.message)); | ||
} else { | ||
spinner.info(chalk.blue('Something went wrong! Please check your internet connection and try it again.')); | ||
} | ||
}); |
{ | ||
"name": "fastly-domains", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Client to list all the domains for a particular Fastly account", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"test": "mocha test" | ||
"commit": "git-cz", | ||
"check-coverage": "istanbul check-coverage --statements 100 --branches 100 --functions 100 --lines 100", | ||
"report-coverage": "cat ./coverage/lcov.info | codecov", | ||
"test": "istanbul cover -x *.test.js _mocha -- -R spec test", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
}, | ||
@@ -32,13 +36,32 @@ "repository": { | ||
"homepage": "https://github.com/philippschulte/fastly-domains#readme", | ||
"engines": { | ||
"node": ">=7.6.0" | ||
}, | ||
"dependencies": { | ||
"chalk": "2.1.0", | ||
"fastly-promises": "0.4.0", | ||
"lodash": "4.17.4", | ||
"ora": "1.3.0", | ||
"yargs": "8.0.2" | ||
}, | ||
"devDependencies": { | ||
"codecov.io": "0.1.6", | ||
"commitizen": "2.9.6", | ||
"cz-conventional-changelog": "2.0.0", | ||
"expect": "1.20.2", | ||
"ghooks": "2.0.0", | ||
"istanbul": "1.1.0-alpha.1", | ||
"mocha": "3.4.2", | ||
"nock": "9.0.14", | ||
"rewire": "2.5.2" | ||
"rewire": "2.5.2", | ||
"semantic-release": "^7.0.2" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "node_modules/cz-conventional-changelog" | ||
}, | ||
"ghooks": { | ||
"pre-commit": "npm run test && npm run check-coverage" | ||
} | ||
} | ||
} | ||
} |
@@ -35,2 +35,4 @@ # fastly-domains | ||
The library doesn't provide an option to specify a particular version of a service since it fetches the domains of all serivces. Instead it uses the active version for each request to [GET /service/service_id/version/version/domain](https://docs.fastly.com/api/config#domain_6d340186666771f022ca20f81609d03d). | ||
## Security | ||
@@ -37,0 +39,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18585
15
329
160
5
10
1
+ Addedchalk@2.1.0
+ Addedora@1.3.0
+ Addedansi-styles@2.2.13.2.1(transitive)
+ Addedchalk@1.1.32.1.0(transitive)
+ Addedcli-cursor@2.1.0(transitive)
+ Addedcli-spinners@1.3.1(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedhas-ansi@2.0.0(transitive)
+ Addedhas-flag@2.0.0(transitive)
+ Addedlog-symbols@1.0.2(transitive)
+ Addedonetime@2.0.1(transitive)
+ Addedora@1.3.0(transitive)
+ Addedrestore-cursor@2.0.0(transitive)
+ Addedsupports-color@2.0.04.5.0(transitive)