mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-20 02:17:34 +00:00
Adds publish command to register all domains
This commit is contained in:
1 parent
a9ba56908d
commit
e1ea243243
2 files changed
+9
-6
No files matched your search
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Register *.is-a.dev domains for free",
|
"description": "Register *.is-a.dev domains for free",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "jest"
|
"test": "jest",
|
||||||
|
"publish-records": "yarn test && node ./scripts/register-domains.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const R = require('ramda');
|
const R = require('ramda');
|
||||||
const { VALID_RECORD_TYPES, TTL } = require('../utils/constants');
|
const { VALID_RECORD_TYPES, TTL } = require('../utils/constants');
|
||||||
const { domainService: domain } = require('../utils/domain-service');
|
const { domainService: dc } = require('../utils/domain-service');
|
||||||
const { getDomains } = require('../utils/domain');
|
const { getDomains: gd } = require('../utils/domain');
|
||||||
|
|
||||||
const getRecords = R.compose(R.toPairs, R.pick(VALID_RECORD_TYPES));
|
const getRecords = R.compose(R.toPairs, R.pick(VALID_RECORD_TYPES));
|
||||||
|
|
||||||
@@ -21,11 +21,13 @@ const toHostList = R.chain(data => {
|
|||||||
const registerDomains = async ({ domainService, getDomains }) => {
|
const registerDomains = async ({ domainService, getDomains }) => {
|
||||||
const domains = await getDomains().then(toHostList);
|
const domains = await getDomains().then(toHostList);
|
||||||
|
|
||||||
await domainService.updateHosts(domains);
|
return domainService.updateHosts(domains);
|
||||||
};
|
};
|
||||||
|
|
||||||
const main = () => {
|
const main = async () => {
|
||||||
console.log('Running cli');
|
console.log('Registering domains...');
|
||||||
|
const result = await registerDomains({ domainService: dc, getDomains: gd });
|
||||||
|
console.log(result);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
|
|||||||
Reference in new issue
Block a user