npm package and path refactoring

moved around paths to facilitate node project development and npm package
This commit is contained in:
Doug Bird 2017-12-13 12:01:28 -08:00
parent 82402eb352
commit 2fb8666e0e
15 changed files with 329 additions and 396 deletions

1
.gitignore vendored
View File

@ -1,7 +1,6 @@
.*
!/.gitignore
/vendor/
/web/alive.html
composer.lock
*.log
!**.gitkeep

View File

@ -1,96 +0,0 @@
#!/bin/bash
################################################################################
## "generate-all.sh"
## (Re)generates all TLD Enumeration format files using the current
## contents of the 'tlds.csv' file.
################################################################################
################################################################################
## this script does not have any configuration variables
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
## convenience variable for referring to this script
################################################################################
ME_NAME='generate-all.sh'
################################################################################
##
## introduction
##
################################################################################
echo "$ME_NAME"
echo -e " (re)generates all TLD format files using the current contents of the 'tlds.csv' file\n"
################################################################################
##
## generate PHP format
##
################################################################################
echo "generating PHP format..."
generate-php-tld-enum.php
GEN_STATUS=$?
################################################################################
##
## enforce that PHP format generation was a reported success before proceeding
##
################################################################################
if [ "$GEN_STATUS" -ne "0" ]; then
>&2 echo -e "$ME_NAME: cannot continue; PHP generator script failed (exit status $GEN_STATUS)"
exit $GEN_STATUS
fi
################################################################################
##
## generate JSON format
##
################################################################################
echo "generating JSON format..."
generate-json-tld-enum.js
GEN_STATUS=$?
################################################################################
##
## enforce that JSON format generation was a reported success before proceeding
##
################################################################################
if [ "$GEN_STATUS" -ne "0" ]; then
>&2 echo -e "$ME_NAME: cannot continue; JSON generator script failed (exit status $GEN_STATUS)"
exit $GEN_STATUS
fi
################################################################################
##
## generate CSV (text) format
##
################################################################################
echo "generating CSV (text) format..."
generate-csv-tld-enum.js
GEN_STATUS=$?
################################################################################
##
## enforce that CSV format generation was a reported success before proceeding
##
################################################################################
if [ "$GEN_STATUS" -ne "0" ]; then
>&2 echo -e "$ME_NAME: cannot continue; CSV (text) generator script failed (exit status $GEN_STATUS)"
exit $GEN_STATUS
fi
################################################################################
##
## indicate success with message
##
################################################################################
echo "successfully (re)generated all TLS format files"

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
console.log("generates the 'tlds-name-only.csv' CSV text file from the 'tlds.csv' csv file");
console.log("---this script is currently a 'to-do' placeholder!---");
console.error("terminating... the development for the 'CSV' (text) format generator has not yet been completed");

4
bin/update-tlds Normal file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env node
console.log("updates the 'tlds.csv' file from iana.org and re-generates the native format files in the 'format/' directory");
console.log("---this script is currently a 'to-do' placeholder!---");

View File

@ -4,7 +4,7 @@
"homepage": "https://github.com/katmore/tld-enum",
"autoload": {
"psr-4": {
"TldEnum\\": "src/formats/php/TldEnum/"
"TldEnum\\": "formats/php/TldEnum/"
}
},
"license": [

0
formats/.gitkeep Normal file
View File

288
formats/js/tld-enum.js Normal file
View File

@ -0,0 +1,288 @@
exports.tldList = () => {
return [
"ac",
"ad",
"ae",
"aero",
"af",
"ag",
"ai",
"al",
"am",
"an",
"ao",
"aq",
"ar",
"arpa",
"as",
"asia",
"at",
"au",
"aw",
"ax",
"az",
"ba",
"bb",
"bd",
"be",
"bf",
"bg",
"bh",
"bi",
"biz",
"bj",
"bl",
"bm",
"bn",
"bo",
"bq",
"br",
"bs",
"bt",
"bv",
"bw",
"by",
"bz",
"ca",
"cat",
"cc",
"cd",
"cf",
"cg",
"ch",
"ci",
"ck",
"cl",
"cm",
"cn",
"co",
"com",
"coop",
"cr",
"cs",
"cu",
"cv",
"cw",
"cx",
"cy",
"cz",
"dd",
"de",
"dj",
"dk",
"dm",
"do",
"dz",
"ec",
"edu",
"ee",
"eg",
"eh",
"er",
"es",
"et",
"eu",
"fi",
"fj",
"fk",
"fm",
"fo",
"fr",
"ga",
"gb",
"gd",
"ge",
"gf",
"gg",
"gh",
"gi",
"gl",
"gm",
"gn",
"gov",
"gp",
"gq",
"gr",
"gs",
"gt",
"gu",
"gw",
"gy",
"hk",
"hm",
"hn",
"hr",
"ht",
"hu",
"id",
"ie",
"il",
"im",
"in",
"info",
"int",
"io",
"iq",
"ir",
"is",
"it",
"je",
"jm",
"jo",
"jobs",
"jp",
"ke",
"kg",
"kh",
"ki",
"km",
"kn",
"kp",
"kr",
"kw",
"ky",
"kz",
"la",
"lb",
"lc",
"li",
"lk",
"local",
"lr",
"ls",
"lt",
"lu",
"lv",
"ly",
"ma",
"mc",
"md",
"me",
"mf",
"mg",
"mh",
"mil",
"mk",
"ml",
"mm",
"mn",
"mo",
"mobi",
"mp",
"mq",
"mr",
"ms",
"mt",
"mu",
"museum",
"mv",
"mw",
"mx",
"my",
"mz",
"na",
"name",
"nato",
"nc",
"ne",
"net",
"nf",
"ng",
"ni",
"nl",
"no",
"np",
"nr",
"nu",
"nz",
"om",
"onion",
"org",
"pa",
"pe",
"pf",
"pg",
"ph",
"pk",
"pl",
"pm",
"pn",
"pr",
"pro",
"ps",
"pt",
"pw",
"py",
"qa",
"re",
"ro",
"rs",
"ru",
"rw",
"sa",
"sb",
"sc",
"sd",
"se",
"sg",
"sh",
"si",
"sj",
"sk",
"sl",
"sm",
"sn",
"so",
"sr",
"ss",
"st",
"su",
"sv",
"sx",
"sy",
"sz",
"tc",
"td",
"tel",
"tf",
"tg",
"th",
"tj",
"tk",
"tl",
"tm",
"tn",
"to",
"tp",
"tr",
"travel",
"tt",
"tv",
"tw",
"tz",
"ua",
"ug",
"uk",
"um",
"us",
"uy",
"uz",
"va",
"vc",
"ve",
"vg",
"vi",
"vn",
"vu",
"wf",
"ws",
"xxx",
"ye",
"yt",
"yu",
"za",
"zm",
"zr",
"zw"
];
}

22
package.json Normal file
View File

@ -0,0 +1,22 @@
{
"name": "tld-enum",
"version": "1.0.0",
"description": "Lists of every ICANN TLD in formats that can be natively compiled in various language targets",
"main": "formats/js/tld-enum.js",
"bin": {
"tld-enum": "generate-json-tld-enum.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/katmore/tld-enum.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/katmore/tld-enum/issues"
},
"homepage": "https://github.com/katmore/tld-enum#readme"
}

0
src/.gitkeep Normal file
View File

View File

@ -1,285 +0,0 @@
ac
ad
ae
aero
af
ag
ai
al
am
an
ao
aq
ar
arpa
as
asia
at
au
aw
ax
az
ba
bb
bd
be
bf
bg
bh
bi
biz
bj
bl
bm
bn
bo
bq
br
bs
bt
bv
bw
by
bz
ca
cat
cc
cd
cf
cg
ch
ci
ck
cl
cm
cn
co
com
coop
cr
cs
cu
cv
cw
cx
cy
cz
dd
de
dj
dk
dm
do
dz
ec
edu
ee
eg
eh
er
es
et
eu
fi
fj
fk
fm
fo
fr
ga
gb
gd
ge
gf
gg
gh
gi
gl
gm
gn
gov
gp
gq
gr
gs
gt
gu
gw
gy
hk
hm
hn
hr
ht
hu
id
ie
il
im
in
info
int
io
iq
ir
is
it
je
jm
jo
jobs
jp
ke
kg
kh
ki
km
kn
kp
kr
kw
ky
kz
la
lb
lc
li
lk
local
lr
ls
lt
lu
lv
ly
ma
mc
md
me
mf
mg
mh
mil
mk
ml
mm
mn
mo
mobi
mp
mq
mr
ms
mt
mu
museum
mv
mw
mx
my
mz
na
name
nato
nc
ne
net
nf
ng
ni
nl
no
np
nr
nu
nz
om
onion
org
pa
pe
pf
pg
ph
pk
pl
pm
pn
pr
pro
ps
pt
pw
py
qa
re
ro
rs
ru
rw
sa
sb
sc
sd
se
sg
sh
si
sj
sk
sl
sm
sn
so
sr
ss
st
su
sv
sx
sy
sz
tc
td
tel
tf
tg
th
tj
tk
tl
tm
tn
to
tp
tr
travel
tt
tv
tw
tz
ua
ug
uk
um
us
uy
uz
va
vc
ve
vg
vi
vn
vu
wf
ws
xxx
ye
yt
yu
za
zm
zr
zw
1 ac
2 ad
3 ae
4 aero
5 af
6 ag
7 ai
8 al
9 am
10 an
11 ao
12 aq
13 ar
14 arpa
15 as
16 asia
17 at
18 au
19 aw
20 ax
21 az
22 ba
23 bb
24 bd
25 be
26 bf
27 bg
28 bh
29 bi
30 biz
31 bj
32 bl
33 bm
34 bn
35 bo
36 bq
37 br
38 bs
39 bt
40 bv
41 bw
42 by
43 bz
44 ca
45 cat
46 cc
47 cd
48 cf
49 cg
50 ch
51 ci
52 ck
53 cl
54 cm
55 cn
56 co
57 com
58 coop
59 cr
60 cs
61 cu
62 cv
63 cw
64 cx
65 cy
66 cz
67 dd
68 de
69 dj
70 dk
71 dm
72 do
73 dz
74 ec
75 edu
76 ee
77 eg
78 eh
79 er
80 es
81 et
82 eu
83 fi
84 fj
85 fk
86 fm
87 fo
88 fr
89 ga
90 gb
91 gd
92 ge
93 gf
94 gg
95 gh
96 gi
97 gl
98 gm
99 gn
100 gov
101 gp
102 gq
103 gr
104 gs
105 gt
106 gu
107 gw
108 gy
109 hk
110 hm
111 hn
112 hr
113 ht
114 hu
115 id
116 ie
117 il
118 im
119 in
120 info
121 int
122 io
123 iq
124 ir
125 is
126 it
127 je
128 jm
129 jo
130 jobs
131 jp
132 ke
133 kg
134 kh
135 ki
136 km
137 kn
138 kp
139 kr
140 kw
141 ky
142 kz
143 la
144 lb
145 lc
146 li
147 lk
148 local
149 lr
150 ls
151 lt
152 lu
153 lv
154 ly
155 ma
156 mc
157 md
158 me
159 mf
160 mg
161 mh
162 mil
163 mk
164 ml
165 mm
166 mn
167 mo
168 mobi
169 mp
170 mq
171 mr
172 ms
173 mt
174 mu
175 museum
176 mv
177 mw
178 mx
179 my
180 mz
181 na
182 name
183 nato
184 nc
185 ne
186 net
187 nf
188 ng
189 ni
190 nl
191 no
192 np
193 nr
194 nu
195 nz
196 om
197 onion
198 org
199 pa
200 pe
201 pf
202 pg
203 ph
204 pk
205 pl
206 pm
207 pn
208 pr
209 pro
210 ps
211 pt
212 pw
213 py
214 qa
215 re
216 ro
217 rs
218 ru
219 rw
220 sa
221 sb
222 sc
223 sd
224 se
225 sg
226 sh
227 si
228 sj
229 sk
230 sl
231 sm
232 sn
233 so
234 sr
235 ss
236 st
237 su
238 sv
239 sx
240 sy
241 sz
242 tc
243 td
244 tel
245 tf
246 tg
247 th
248 tj
249 tk
250 tl
251 tm
252 tn
253 to
254 tp
255 tr
256 travel
257 tt
258 tv
259 tw
260 tz
261 ua
262 ug
263 uk
264 um
265 us
266 uy
267 uz
268 va
269 vc
270 ve
271 vg
272 vi
273 vn
274 vu
275 wf
276 ws
277 xxx
278 ye
279 yt
280 yu
281 za
282 zm
283 zr
284 zw

View File

@ -0,0 +1,5 @@
#!/usr/bin/env node
console.log("generates the 'tld-enum.js' node source file from the 'tlds.csv' csv file");
console.log("---this script is currently a 'to-do' placeholder!---");
console.error("terminating... the development for the 'JSON' format generator has not yet been completed");