pake-cli 0.0.1-beta.8 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/.ecrc.json +3 -0
  2. package/.editorconfig +24 -0
  3. package/.github/FUNDING.yml +2 -2
  4. package/.github/ISSUE_TEMPLATE/bug.md +13 -0
  5. package/.github/workflows/editorconfig-check.yml +23 -0
  6. package/.github/workflows/main.yml +17 -0
  7. package/.github/workflows/rust-code-quality-check.yml +89 -0
  8. package/.prettierignore +4 -0
  9. package/.vscode/settings.json +1 -0
  10. package/CODE_OF_CONDUCT.md +128 -0
  11. package/CONTRIBUTING.md +26 -0
  12. package/LICENSE +21 -0
  13. package/README.md +175 -54
  14. package/README_EN.md +91 -53
  15. package/app.csv +9 -0
  16. package/bin/README.md +72 -0
  17. package/bin/builders/MacBuilder.ts +13 -14
  18. package/bin/builders/base.ts +10 -1
  19. package/bin/builders/common.ts +7 -25
  20. package/bin/cli.ts +12 -5
  21. package/bin/defaults.ts +1 -0
  22. package/bin/options/icon.ts +51 -53
  23. package/bin/options/index.ts +3 -5
  24. package/bin/types.ts +3 -3
  25. package/bin/utils/shell.ts +1 -0
  26. package/bin/utils/tlds.ts +1489 -0
  27. package/bin/utils/url.ts +26 -0
  28. package/dist/cli.js +1620 -101
  29. package/dist/twitter.css +176 -0
  30. package/icns2png.py +38 -0
  31. package/package.json +8 -7
  32. package/pake-default.icns +0 -0
  33. package/rollup.config.js +1 -1
  34. package/script/build.bat +80 -0
  35. package/script/build.sh +122 -0
  36. package/script/sd-apple-x64 +0 -0
  37. package/script/sd-linux-x64 +0 -0
  38. package/script/sd.exe +0 -0
  39. package/src-tauri/Cargo.lock +344 -65
  40. package/src-tauri/Cargo.toml +14 -6
  41. package/src-tauri/assets/com-tw93-weread.desktop +10 -0
  42. package/src-tauri/build.rs +1 -1
  43. package/src-tauri/icons/icon.icns +0 -0
  44. package/src-tauri/icons/reference.icns +0 -0
  45. package/src-tauri/icons/translate.icns +0 -0
  46. package/src-tauri/icons/twitter.icns +0 -0
  47. package/src-tauri/icons/{weRead.icns → weread.icns} +0 -0
  48. package/src-tauri/icons/youtube.icns +0 -0
  49. package/src-tauri/png/code_256.ico +0 -0
  50. package/src-tauri/png/code_32.ico +0 -0
  51. package/src-tauri/png/code_512.png +0 -0
  52. package/src-tauri/png/flomo_256.ico +0 -0
  53. package/src-tauri/png/flomo_32.ico +0 -0
  54. package/src-tauri/png/flomo_512.png +0 -0
  55. package/src-tauri/png/reference_256.ico +0 -0
  56. package/src-tauri/png/reference_32.ico +0 -0
  57. package/src-tauri/png/reference_512.png +0 -0
  58. package/src-tauri/png/tool_256.ico +0 -0
  59. package/src-tauri/png/tool_32.ico +0 -0
  60. package/src-tauri/png/tool_512.png +0 -0
  61. package/src-tauri/png/translate_256.ico +0 -0
  62. package/src-tauri/png/translate_32.ico +0 -0
  63. package/src-tauri/png/translate_512.png +0 -0
  64. package/src-tauri/png/twitter_256.ico +0 -0
  65. package/src-tauri/png/twitter_32.ico +0 -0
  66. package/src-tauri/png/twitter_512.png +0 -0
  67. package/src-tauri/png/weread_256.ico +0 -0
  68. package/src-tauri/png/weread_32.ico +0 -0
  69. package/src-tauri/png/weread_512.png +0 -0
  70. package/src-tauri/png/witeboard_256.ico +0 -0
  71. package/src-tauri/png/witeboard_32.ico +0 -0
  72. package/src-tauri/png/witeboard_512.png +0 -0
  73. package/src-tauri/png/youtube_256.ico +0 -0
  74. package/src-tauri/png/youtube_32.ico +0 -0
  75. package/src-tauri/png/youtube_512.png +0 -0
  76. package/src-tauri/png/yuque_256.ico +0 -0
  77. package/src-tauri/png/yuque_32.ico +0 -0
  78. package/src-tauri/png/yuque_512.png +0 -0
  79. package/src-tauri/src/main.rs +130 -25
  80. package/src-tauri/src/pake.js +140 -77
  81. package/src-tauri/tauri.conf.json +30 -13
  82. package/bin/options/title.ts +0 -14
  83. package/src-tauri/icons/anymind.icns +0 -0
  84. package/src-tauri/icons/fanfou.icns +0 -0
  85. package/src-tauri/icons/fone.icns +0 -0
  86. package/src-tauri/icons/jdread.icns +0 -0
  87. package/src-tauri/icons/jike.icns +0 -0
  88. package/src-tauri/icons/roam.icns +0 -0
  89. package/src-tauri/icons/vercel.icns +0 -0
  90. package/src-tauri/icons/whatsapp.icns +0 -0
package/dist/cli.js CHANGED
@@ -1,20 +1,17 @@
1
1
  import * as Commander from 'commander';
2
2
  import { program } from 'commander';
3
- import url from 'url';
3
+ import url, { fileURLToPath } from 'url';
4
4
  import isurl from 'is-url';
5
+ import prompts from 'prompts';
5
6
  import crypto from 'crypto';
6
7
  import axios from 'axios';
7
8
  import { fileTypeFromBuffer } from 'file-type';
8
9
  import { dir } from 'tmp-promise';
9
10
  import path from 'path';
10
- import pageIcon from 'page-icon';
11
- import png2icons from 'png2icons';
12
- import ICO from 'icojs';
13
11
  import fs from 'fs/promises';
14
- import prompts from 'prompts';
12
+ import log from 'loglevel';
15
13
  import ora from 'ora';
16
14
  import shelljs from 'shelljs';
17
- import appRootPath from 'app-root-path';
18
15
 
19
16
  /******************************************************************************
20
17
  Copyright (c) Microsoft Corporation.
@@ -48,8 +45,1516 @@ const DEFAULT_PAKE_OPTIONS = {
48
45
  fullscreen: false,
49
46
  resizable: true,
50
47
  transparent: false,
48
+ debug: false,
51
49
  };
52
50
 
51
+ const tlds = [
52
+ 'aaa',
53
+ 'aarp',
54
+ 'abarth',
55
+ 'abb',
56
+ 'abbott',
57
+ 'abbvie',
58
+ 'abc',
59
+ 'able',
60
+ 'abogado',
61
+ 'abudhabi',
62
+ 'ac',
63
+ 'academy',
64
+ 'accenture',
65
+ 'accountant',
66
+ 'accountants',
67
+ 'aco',
68
+ 'actor',
69
+ 'ad',
70
+ 'adac',
71
+ 'ads',
72
+ 'adult',
73
+ 'ae',
74
+ 'aeg',
75
+ 'aero',
76
+ 'aetna',
77
+ 'af',
78
+ 'afl',
79
+ 'africa',
80
+ 'ag',
81
+ 'agakhan',
82
+ 'agency',
83
+ 'ai',
84
+ 'aig',
85
+ 'airbus',
86
+ 'airforce',
87
+ 'airtel',
88
+ 'akdn',
89
+ 'al',
90
+ 'alfaromeo',
91
+ 'alibaba',
92
+ 'alipay',
93
+ 'allfinanz',
94
+ 'allstate',
95
+ 'ally',
96
+ 'alsace',
97
+ 'alstom',
98
+ 'am',
99
+ 'amazon',
100
+ 'americanexpress',
101
+ 'americanfamily',
102
+ 'amex',
103
+ 'amfam',
104
+ 'amica',
105
+ 'amsterdam',
106
+ 'analytics',
107
+ 'android',
108
+ 'anquan',
109
+ 'anz',
110
+ 'ao',
111
+ 'aol',
112
+ 'apartments',
113
+ 'app',
114
+ 'apple',
115
+ 'aq',
116
+ 'aquarelle',
117
+ 'ar',
118
+ 'arab',
119
+ 'aramco',
120
+ 'archi',
121
+ 'army',
122
+ 'arpa',
123
+ 'art',
124
+ 'arte',
125
+ 'as',
126
+ 'asda',
127
+ 'asia',
128
+ 'associates',
129
+ 'at',
130
+ 'athleta',
131
+ 'attorney',
132
+ 'au',
133
+ 'auction',
134
+ 'audi',
135
+ 'audible',
136
+ 'audio',
137
+ 'auspost',
138
+ 'author',
139
+ 'auto',
140
+ 'autos',
141
+ 'avianca',
142
+ 'aw',
143
+ 'aws',
144
+ 'ax',
145
+ 'axa',
146
+ 'az',
147
+ 'azure',
148
+ 'ba',
149
+ 'baby',
150
+ 'baidu',
151
+ 'banamex',
152
+ 'bananarepublic',
153
+ 'band',
154
+ 'bank',
155
+ 'bar',
156
+ 'barcelona',
157
+ 'barclaycard',
158
+ 'barclays',
159
+ 'barefoot',
160
+ 'bargains',
161
+ 'baseball',
162
+ 'basketball',
163
+ 'bauhaus',
164
+ 'bayern',
165
+ 'bb',
166
+ 'bbc',
167
+ 'bbt',
168
+ 'bbva',
169
+ 'bcg',
170
+ 'bcn',
171
+ 'bd',
172
+ 'be',
173
+ 'beats',
174
+ 'beauty',
175
+ 'beer',
176
+ 'bentley',
177
+ 'berlin',
178
+ 'best',
179
+ 'bestbuy',
180
+ 'bet',
181
+ 'bf',
182
+ 'bg',
183
+ 'bh',
184
+ 'bharti',
185
+ 'bi',
186
+ 'bible',
187
+ 'bid',
188
+ 'bike',
189
+ 'bing',
190
+ 'bingo',
191
+ 'bio',
192
+ 'biz',
193
+ 'bj',
194
+ 'black',
195
+ 'blackfriday',
196
+ 'blockbuster',
197
+ 'blog',
198
+ 'bloomberg',
199
+ 'blue',
200
+ 'bm',
201
+ 'bms',
202
+ 'bmw',
203
+ 'bn',
204
+ 'bnpparibas',
205
+ 'bo',
206
+ 'boats',
207
+ 'boehringer',
208
+ 'bofa',
209
+ 'bom',
210
+ 'bond',
211
+ 'boo',
212
+ 'book',
213
+ 'booking',
214
+ 'bosch',
215
+ 'bostik',
216
+ 'boston',
217
+ 'bot',
218
+ 'boutique',
219
+ 'box',
220
+ 'br',
221
+ 'bradesco',
222
+ 'bridgestone',
223
+ 'broadway',
224
+ 'broker',
225
+ 'brother',
226
+ 'brussels',
227
+ 'bs',
228
+ 'bt',
229
+ 'build',
230
+ 'builders',
231
+ 'business',
232
+ 'buy',
233
+ 'buzz',
234
+ 'bv',
235
+ 'bw',
236
+ 'by',
237
+ 'bz',
238
+ 'bzh',
239
+ 'ca',
240
+ 'cab',
241
+ 'cafe',
242
+ 'cal',
243
+ 'call',
244
+ 'calvinklein',
245
+ 'cam',
246
+ 'camera',
247
+ 'camp',
248
+ 'canon',
249
+ 'capetown',
250
+ 'capital',
251
+ 'capitalone',
252
+ 'car',
253
+ 'caravan',
254
+ 'cards',
255
+ 'care',
256
+ 'career',
257
+ 'careers',
258
+ 'cars',
259
+ 'casa',
260
+ 'case',
261
+ 'cash',
262
+ 'casino',
263
+ 'cat',
264
+ 'catering',
265
+ 'catholic',
266
+ 'cba',
267
+ 'cbn',
268
+ 'cbre',
269
+ 'cbs',
270
+ 'cc',
271
+ 'cd',
272
+ 'center',
273
+ 'ceo',
274
+ 'cern',
275
+ 'cf',
276
+ 'cfa',
277
+ 'cfd',
278
+ 'cg',
279
+ 'ch',
280
+ 'chanel',
281
+ 'channel',
282
+ 'charity',
283
+ 'chase',
284
+ 'chat',
285
+ 'cheap',
286
+ 'chintai',
287
+ 'christmas',
288
+ 'chrome',
289
+ 'church',
290
+ 'ci',
291
+ 'cipriani',
292
+ 'circle',
293
+ 'cisco',
294
+ 'citadel',
295
+ 'citi',
296
+ 'citic',
297
+ 'city',
298
+ 'cityeats',
299
+ 'ck',
300
+ 'cl',
301
+ 'claims',
302
+ 'cleaning',
303
+ 'click',
304
+ 'clinic',
305
+ 'clinique',
306
+ 'clothing',
307
+ 'cloud',
308
+ 'club',
309
+ 'clubmed',
310
+ 'cm',
311
+ 'cn',
312
+ 'co',
313
+ 'coach',
314
+ 'codes',
315
+ 'coffee',
316
+ 'college',
317
+ 'cologne',
318
+ 'com',
319
+ 'comcast',
320
+ 'commbank',
321
+ 'community',
322
+ 'company',
323
+ 'compare',
324
+ 'computer',
325
+ 'comsec',
326
+ 'condos',
327
+ 'construction',
328
+ 'consulting',
329
+ 'contact',
330
+ 'contractors',
331
+ 'cooking',
332
+ 'cookingchannel',
333
+ 'cool',
334
+ 'coop',
335
+ 'corsica',
336
+ 'country',
337
+ 'coupon',
338
+ 'coupons',
339
+ 'courses',
340
+ 'cpa',
341
+ 'cr',
342
+ 'credit',
343
+ 'creditcard',
344
+ 'creditunion',
345
+ 'cricket',
346
+ 'crown',
347
+ 'crs',
348
+ 'cruise',
349
+ 'cruises',
350
+ 'cu',
351
+ 'cuisinella',
352
+ 'cv',
353
+ 'cw',
354
+ 'cx',
355
+ 'cy',
356
+ 'cymru',
357
+ 'cyou',
358
+ 'cz',
359
+ 'dabur',
360
+ 'dad',
361
+ 'dance',
362
+ 'data',
363
+ 'date',
364
+ 'dating',
365
+ 'datsun',
366
+ 'day',
367
+ 'dclk',
368
+ 'dds',
369
+ 'de',
370
+ 'deal',
371
+ 'dealer',
372
+ 'deals',
373
+ 'degree',
374
+ 'delivery',
375
+ 'dell',
376
+ 'deloitte',
377
+ 'delta',
378
+ 'democrat',
379
+ 'dental',
380
+ 'dentist',
381
+ 'desi',
382
+ 'design',
383
+ 'dev',
384
+ 'dhl',
385
+ 'diamonds',
386
+ 'diet',
387
+ 'digital',
388
+ 'direct',
389
+ 'directory',
390
+ 'discount',
391
+ 'discover',
392
+ 'dish',
393
+ 'diy',
394
+ 'dj',
395
+ 'dk',
396
+ 'dm',
397
+ 'dnp',
398
+ 'do',
399
+ 'docs',
400
+ 'doctor',
401
+ 'dog',
402
+ 'domains',
403
+ 'dot',
404
+ 'download',
405
+ 'drive',
406
+ 'dtv',
407
+ 'dubai',
408
+ 'dunlop',
409
+ 'dupont',
410
+ 'durban',
411
+ 'dvag',
412
+ 'dvr',
413
+ 'dz',
414
+ 'earth',
415
+ 'eat',
416
+ 'ec',
417
+ 'eco',
418
+ 'edeka',
419
+ 'edu',
420
+ 'education',
421
+ 'ee',
422
+ 'eg',
423
+ 'email',
424
+ 'emerck',
425
+ 'energy',
426
+ 'engineer',
427
+ 'engineering',
428
+ 'enterprises',
429
+ 'epson',
430
+ 'equipment',
431
+ 'er',
432
+ 'ericsson',
433
+ 'erni',
434
+ 'es',
435
+ 'esq',
436
+ 'estate',
437
+ 'et',
438
+ 'etisalat',
439
+ 'eu',
440
+ 'eurovision',
441
+ 'eus',
442
+ 'events',
443
+ 'exchange',
444
+ 'expert',
445
+ 'exposed',
446
+ 'express',
447
+ 'extraspace',
448
+ 'fage',
449
+ 'fail',
450
+ 'fairwinds',
451
+ 'faith',
452
+ 'family',
453
+ 'fan',
454
+ 'fans',
455
+ 'farm',
456
+ 'farmers',
457
+ 'fashion',
458
+ 'fast',
459
+ 'fedex',
460
+ 'feedback',
461
+ 'ferrari',
462
+ 'ferrero',
463
+ 'fi',
464
+ 'fiat',
465
+ 'fidelity',
466
+ 'fido',
467
+ 'film',
468
+ 'final',
469
+ 'finance',
470
+ 'financial',
471
+ 'fire',
472
+ 'firestone',
473
+ 'firmdale',
474
+ 'fish',
475
+ 'fishing',
476
+ 'fit',
477
+ 'fitness',
478
+ 'fj',
479
+ 'fk',
480
+ 'flickr',
481
+ 'flights',
482
+ 'flir',
483
+ 'florist',
484
+ 'flowers',
485
+ 'fly',
486
+ 'fm',
487
+ 'fo',
488
+ 'foo',
489
+ 'food',
490
+ 'foodnetwork',
491
+ 'football',
492
+ 'ford',
493
+ 'forex',
494
+ 'forsale',
495
+ 'forum',
496
+ 'foundation',
497
+ 'fox',
498
+ 'fr',
499
+ 'free',
500
+ 'fresenius',
501
+ 'frl',
502
+ 'frogans',
503
+ 'frontdoor',
504
+ 'frontier',
505
+ 'ftr',
506
+ 'fujitsu',
507
+ 'fun',
508
+ 'fund',
509
+ 'furniture',
510
+ 'futbol',
511
+ 'fyi',
512
+ 'ga',
513
+ 'gal',
514
+ 'gallery',
515
+ 'gallo',
516
+ 'gallup',
517
+ 'game',
518
+ 'games',
519
+ 'gap',
520
+ 'garden',
521
+ 'gay',
522
+ 'gb',
523
+ 'gbiz',
524
+ 'gd',
525
+ 'gdn',
526
+ 'ge',
527
+ 'gea',
528
+ 'gent',
529
+ 'genting',
530
+ 'george',
531
+ 'gf',
532
+ 'gg',
533
+ 'ggee',
534
+ 'gh',
535
+ 'gi',
536
+ 'gift',
537
+ 'gifts',
538
+ 'gives',
539
+ 'giving',
540
+ 'gl',
541
+ 'glass',
542
+ 'gle',
543
+ 'global',
544
+ 'globo',
545
+ 'gm',
546
+ 'gmail',
547
+ 'gmbh',
548
+ 'gmo',
549
+ 'gmx',
550
+ 'gn',
551
+ 'godaddy',
552
+ 'gold',
553
+ 'goldpoint',
554
+ 'golf',
555
+ 'goo',
556
+ 'goodyear',
557
+ 'goog',
558
+ 'google',
559
+ 'gop',
560
+ 'got',
561
+ 'gov',
562
+ 'gp',
563
+ 'gq',
564
+ 'gr',
565
+ 'grainger',
566
+ 'graphics',
567
+ 'gratis',
568
+ 'green',
569
+ 'gripe',
570
+ 'grocery',
571
+ 'group',
572
+ 'gs',
573
+ 'gt',
574
+ 'gu',
575
+ 'guardian',
576
+ 'gucci',
577
+ 'guge',
578
+ 'guide',
579
+ 'guitars',
580
+ 'guru',
581
+ 'gw',
582
+ 'gy',
583
+ 'hair',
584
+ 'hamburg',
585
+ 'hangout',
586
+ 'haus',
587
+ 'hbo',
588
+ 'hdfc',
589
+ 'hdfcbank',
590
+ 'health',
591
+ 'healthcare',
592
+ 'help',
593
+ 'helsinki',
594
+ 'here',
595
+ 'hermes',
596
+ 'hgtv',
597
+ 'hiphop',
598
+ 'hisamitsu',
599
+ 'hitachi',
600
+ 'hiv',
601
+ 'hk',
602
+ 'hkt',
603
+ 'hm',
604
+ 'hn',
605
+ 'hockey',
606
+ 'holdings',
607
+ 'holiday',
608
+ 'homedepot',
609
+ 'homegoods',
610
+ 'homes',
611
+ 'homesense',
612
+ 'honda',
613
+ 'horse',
614
+ 'hospital',
615
+ 'host',
616
+ 'hosting',
617
+ 'hot',
618
+ 'hoteles',
619
+ 'hotels',
620
+ 'hotmail',
621
+ 'house',
622
+ 'how',
623
+ 'hr',
624
+ 'hsbc',
625
+ 'ht',
626
+ 'hu',
627
+ 'hughes',
628
+ 'hyatt',
629
+ 'hyundai',
630
+ 'ibm',
631
+ 'icbc',
632
+ 'ice',
633
+ 'icu',
634
+ 'id',
635
+ 'ie',
636
+ 'ieee',
637
+ 'ifm',
638
+ 'ikano',
639
+ 'il',
640
+ 'im',
641
+ 'imamat',
642
+ 'imdb',
643
+ 'immo',
644
+ 'immobilien',
645
+ 'in',
646
+ 'inc',
647
+ 'industries',
648
+ 'infiniti',
649
+ 'info',
650
+ 'ing',
651
+ 'ink',
652
+ 'institute',
653
+ 'insurance',
654
+ 'insure',
655
+ 'int',
656
+ 'international',
657
+ 'intuit',
658
+ 'investments',
659
+ 'io',
660
+ 'ipiranga',
661
+ 'iq',
662
+ 'ir',
663
+ 'irish',
664
+ 'is',
665
+ 'ismaili',
666
+ 'ist',
667
+ 'istanbul',
668
+ 'it',
669
+ 'itau',
670
+ 'itv',
671
+ 'jaguar',
672
+ 'java',
673
+ 'jcb',
674
+ 'je',
675
+ 'jeep',
676
+ 'jetzt',
677
+ 'jewelry',
678
+ 'jio',
679
+ 'jll',
680
+ 'jm',
681
+ 'jmp',
682
+ 'jnj',
683
+ 'jo',
684
+ 'jobs',
685
+ 'joburg',
686
+ 'jot',
687
+ 'joy',
688
+ 'jp',
689
+ 'jpmorgan',
690
+ 'jprs',
691
+ 'juegos',
692
+ 'juniper',
693
+ 'kaufen',
694
+ 'kddi',
695
+ 'ke',
696
+ 'kerryhotels',
697
+ 'kerrylogistics',
698
+ 'kerryproperties',
699
+ 'kfh',
700
+ 'kg',
701
+ 'kh',
702
+ 'ki',
703
+ 'kia',
704
+ 'kids',
705
+ 'kim',
706
+ 'kinder',
707
+ 'kindle',
708
+ 'kitchen',
709
+ 'kiwi',
710
+ 'km',
711
+ 'kn',
712
+ 'koeln',
713
+ 'komatsu',
714
+ 'kosher',
715
+ 'kp',
716
+ 'kpmg',
717
+ 'kpn',
718
+ 'kr',
719
+ 'krd',
720
+ 'kred',
721
+ 'kuokgroup',
722
+ 'kw',
723
+ 'ky',
724
+ 'kyoto',
725
+ 'kz',
726
+ 'la',
727
+ 'lacaixa',
728
+ 'lamborghini',
729
+ 'lamer',
730
+ 'lancaster',
731
+ 'lancia',
732
+ 'land',
733
+ 'landrover',
734
+ 'lanxess',
735
+ 'lasalle',
736
+ 'lat',
737
+ 'latino',
738
+ 'latrobe',
739
+ 'law',
740
+ 'lawyer',
741
+ 'lb',
742
+ 'lc',
743
+ 'lds',
744
+ 'lease',
745
+ 'leclerc',
746
+ 'lefrak',
747
+ 'legal',
748
+ 'lego',
749
+ 'lexus',
750
+ 'lgbt',
751
+ 'li',
752
+ 'lidl',
753
+ 'life',
754
+ 'lifeinsurance',
755
+ 'lifestyle',
756
+ 'lighting',
757
+ 'like',
758
+ 'lilly',
759
+ 'limited',
760
+ 'limo',
761
+ 'lincoln',
762
+ 'linde',
763
+ 'link',
764
+ 'lipsy',
765
+ 'live',
766
+ 'living',
767
+ 'lk',
768
+ 'llc',
769
+ 'llp',
770
+ 'loan',
771
+ 'loans',
772
+ 'locker',
773
+ 'locus',
774
+ 'loft',
775
+ 'lol',
776
+ 'london',
777
+ 'lotte',
778
+ 'lotto',
779
+ 'love',
780
+ 'lpl',
781
+ 'lplfinancial',
782
+ 'lr',
783
+ 'ls',
784
+ 'lt',
785
+ 'ltd',
786
+ 'ltda',
787
+ 'lu',
788
+ 'lundbeck',
789
+ 'luxe',
790
+ 'luxury',
791
+ 'lv',
792
+ 'ly',
793
+ 'ma',
794
+ 'macys',
795
+ 'madrid',
796
+ 'maif',
797
+ 'maison',
798
+ 'makeup',
799
+ 'man',
800
+ 'management',
801
+ 'mango',
802
+ 'map',
803
+ 'market',
804
+ 'marketing',
805
+ 'markets',
806
+ 'marriott',
807
+ 'marshalls',
808
+ 'maserati',
809
+ 'mattel',
810
+ 'mba',
811
+ 'mc',
812
+ 'mckinsey',
813
+ 'md',
814
+ 'me',
815
+ 'med',
816
+ 'media',
817
+ 'meet',
818
+ 'melbourne',
819
+ 'meme',
820
+ 'memorial',
821
+ 'men',
822
+ 'menu',
823
+ 'merckmsd',
824
+ 'mg',
825
+ 'mh',
826
+ 'miami',
827
+ 'microsoft',
828
+ 'mil',
829
+ 'mini',
830
+ 'mint',
831
+ 'mit',
832
+ 'mitsubishi',
833
+ 'mk',
834
+ 'ml',
835
+ 'mlb',
836
+ 'mls',
837
+ 'mm',
838
+ 'mma',
839
+ 'mn',
840
+ 'mo',
841
+ 'mobi',
842
+ 'mobile',
843
+ 'moda',
844
+ 'moe',
845
+ 'moi',
846
+ 'mom',
847
+ 'monash',
848
+ 'money',
849
+ 'monster',
850
+ 'mormon',
851
+ 'mortgage',
852
+ 'moscow',
853
+ 'moto',
854
+ 'motorcycles',
855
+ 'mov',
856
+ 'movie',
857
+ 'mp',
858
+ 'mq',
859
+ 'mr',
860
+ 'ms',
861
+ 'msd',
862
+ 'mt',
863
+ 'mtn',
864
+ 'mtr',
865
+ 'mu',
866
+ 'museum',
867
+ 'music',
868
+ 'mutual',
869
+ 'mv',
870
+ 'mw',
871
+ 'mx',
872
+ 'my',
873
+ 'mz',
874
+ 'na',
875
+ 'nab',
876
+ 'nagoya',
877
+ 'name',
878
+ 'natura',
879
+ 'navy',
880
+ 'nba',
881
+ 'nc',
882
+ 'ne',
883
+ 'nec',
884
+ 'net',
885
+ 'netbank',
886
+ 'netflix',
887
+ 'network',
888
+ 'neustar',
889
+ 'new',
890
+ 'news',
891
+ 'next',
892
+ 'nextdirect',
893
+ 'nexus',
894
+ 'nf',
895
+ 'nfl',
896
+ 'ng',
897
+ 'ngo',
898
+ 'nhk',
899
+ 'ni',
900
+ 'nico',
901
+ 'nike',
902
+ 'nikon',
903
+ 'ninja',
904
+ 'nissan',
905
+ 'nissay',
906
+ 'nl',
907
+ 'no',
908
+ 'nokia',
909
+ 'northwesternmutual',
910
+ 'norton',
911
+ 'now',
912
+ 'nowruz',
913
+ 'nowtv',
914
+ 'np',
915
+ 'nr',
916
+ 'nra',
917
+ 'nrw',
918
+ 'ntt',
919
+ 'nu',
920
+ 'nyc',
921
+ 'nz',
922
+ 'obi',
923
+ 'observer',
924
+ 'office',
925
+ 'okinawa',
926
+ 'olayan',
927
+ 'olayangroup',
928
+ 'oldnavy',
929
+ 'ollo',
930
+ 'om',
931
+ 'omega',
932
+ 'one',
933
+ 'ong',
934
+ 'onl',
935
+ 'online',
936
+ 'ooo',
937
+ 'open',
938
+ 'oracle',
939
+ 'orange',
940
+ 'org',
941
+ 'organic',
942
+ 'origins',
943
+ 'osaka',
944
+ 'otsuka',
945
+ 'ott',
946
+ 'ovh',
947
+ 'pa',
948
+ 'page',
949
+ 'panasonic',
950
+ 'paris',
951
+ 'pars',
952
+ 'partners',
953
+ 'parts',
954
+ 'party',
955
+ 'passagens',
956
+ 'pay',
957
+ 'pccw',
958
+ 'pe',
959
+ 'pet',
960
+ 'pf',
961
+ 'pfizer',
962
+ 'pg',
963
+ 'ph',
964
+ 'pharmacy',
965
+ 'phd',
966
+ 'philips',
967
+ 'phone',
968
+ 'photo',
969
+ 'photography',
970
+ 'photos',
971
+ 'physio',
972
+ 'pics',
973
+ 'pictet',
974
+ 'pictures',
975
+ 'pid',
976
+ 'pin',
977
+ 'ping',
978
+ 'pink',
979
+ 'pioneer',
980
+ 'pizza',
981
+ 'pk',
982
+ 'pl',
983
+ 'place',
984
+ 'play',
985
+ 'playstation',
986
+ 'plumbing',
987
+ 'plus',
988
+ 'pm',
989
+ 'pn',
990
+ 'pnc',
991
+ 'pohl',
992
+ 'poker',
993
+ 'politie',
994
+ 'porn',
995
+ 'post',
996
+ 'pr',
997
+ 'pramerica',
998
+ 'praxi',
999
+ 'press',
1000
+ 'prime',
1001
+ 'pro',
1002
+ 'prod',
1003
+ 'productions',
1004
+ 'prof',
1005
+ 'progressive',
1006
+ 'promo',
1007
+ 'properties',
1008
+ 'property',
1009
+ 'protection',
1010
+ 'pru',
1011
+ 'prudential',
1012
+ 'ps',
1013
+ 'pt',
1014
+ 'pub',
1015
+ 'pw',
1016
+ 'pwc',
1017
+ 'py',
1018
+ 'qa',
1019
+ 'qpon',
1020
+ 'quebec',
1021
+ 'quest',
1022
+ 'racing',
1023
+ 'radio',
1024
+ 're',
1025
+ 'read',
1026
+ 'realestate',
1027
+ 'realtor',
1028
+ 'realty',
1029
+ 'recipes',
1030
+ 'red',
1031
+ 'redstone',
1032
+ 'redumbrella',
1033
+ 'rehab',
1034
+ 'reise',
1035
+ 'reisen',
1036
+ 'reit',
1037
+ 'reliance',
1038
+ 'ren',
1039
+ 'rent',
1040
+ 'rentals',
1041
+ 'repair',
1042
+ 'report',
1043
+ 'republican',
1044
+ 'rest',
1045
+ 'restaurant',
1046
+ 'review',
1047
+ 'reviews',
1048
+ 'rexroth',
1049
+ 'rich',
1050
+ 'richardli',
1051
+ 'ricoh',
1052
+ 'ril',
1053
+ 'rio',
1054
+ 'rip',
1055
+ 'ro',
1056
+ 'rocher',
1057
+ 'rocks',
1058
+ 'rodeo',
1059
+ 'rogers',
1060
+ 'room',
1061
+ 'rs',
1062
+ 'rsvp',
1063
+ 'ru',
1064
+ 'rugby',
1065
+ 'ruhr',
1066
+ 'run',
1067
+ 'rw',
1068
+ 'rwe',
1069
+ 'ryukyu',
1070
+ 'sa',
1071
+ 'saarland',
1072
+ 'safe',
1073
+ 'safety',
1074
+ 'sakura',
1075
+ 'sale',
1076
+ 'salon',
1077
+ 'samsclub',
1078
+ 'samsung',
1079
+ 'sandvik',
1080
+ 'sandvikcoromant',
1081
+ 'sanofi',
1082
+ 'sap',
1083
+ 'sarl',
1084
+ 'sas',
1085
+ 'save',
1086
+ 'saxo',
1087
+ 'sb',
1088
+ 'sbi',
1089
+ 'sbs',
1090
+ 'sc',
1091
+ 'sca',
1092
+ 'scb',
1093
+ 'schaeffler',
1094
+ 'schmidt',
1095
+ 'scholarships',
1096
+ 'school',
1097
+ 'schule',
1098
+ 'schwarz',
1099
+ 'science',
1100
+ 'scot',
1101
+ 'sd',
1102
+ 'se',
1103
+ 'search',
1104
+ 'seat',
1105
+ 'secure',
1106
+ 'security',
1107
+ 'seek',
1108
+ 'select',
1109
+ 'sener',
1110
+ 'services',
1111
+ 'ses',
1112
+ 'seven',
1113
+ 'sew',
1114
+ 'sex',
1115
+ 'sexy',
1116
+ 'sfr',
1117
+ 'sg',
1118
+ 'sh',
1119
+ 'shangrila',
1120
+ 'sharp',
1121
+ 'shaw',
1122
+ 'shell',
1123
+ 'shia',
1124
+ 'shiksha',
1125
+ 'shoes',
1126
+ 'shop',
1127
+ 'shopping',
1128
+ 'shouji',
1129
+ 'show',
1130
+ 'showtime',
1131
+ 'si',
1132
+ 'silk',
1133
+ 'sina',
1134
+ 'singles',
1135
+ 'site',
1136
+ 'sj',
1137
+ 'sk',
1138
+ 'ski',
1139
+ 'skin',
1140
+ 'sky',
1141
+ 'skype',
1142
+ 'sl',
1143
+ 'sling',
1144
+ 'sm',
1145
+ 'smart',
1146
+ 'smile',
1147
+ 'sn',
1148
+ 'sncf',
1149
+ 'so',
1150
+ 'soccer',
1151
+ 'social',
1152
+ 'softbank',
1153
+ 'software',
1154
+ 'sohu',
1155
+ 'solar',
1156
+ 'solutions',
1157
+ 'song',
1158
+ 'sony',
1159
+ 'soy',
1160
+ 'spa',
1161
+ 'space',
1162
+ 'sport',
1163
+ 'spot',
1164
+ 'sr',
1165
+ 'srl',
1166
+ 'ss',
1167
+ 'st',
1168
+ 'stada',
1169
+ 'staples',
1170
+ 'star',
1171
+ 'statebank',
1172
+ 'statefarm',
1173
+ 'stc',
1174
+ 'stcgroup',
1175
+ 'stockholm',
1176
+ 'storage',
1177
+ 'store',
1178
+ 'stream',
1179
+ 'studio',
1180
+ 'study',
1181
+ 'style',
1182
+ 'su',
1183
+ 'sucks',
1184
+ 'supplies',
1185
+ 'supply',
1186
+ 'support',
1187
+ 'surf',
1188
+ 'surgery',
1189
+ 'suzuki',
1190
+ 'sv',
1191
+ 'swatch',
1192
+ 'swiss',
1193
+ 'sx',
1194
+ 'sy',
1195
+ 'sydney',
1196
+ 'systems',
1197
+ 'sz',
1198
+ 'tab',
1199
+ 'taipei',
1200
+ 'talk',
1201
+ 'taobao',
1202
+ 'target',
1203
+ 'tatamotors',
1204
+ 'tatar',
1205
+ 'tattoo',
1206
+ 'tax',
1207
+ 'taxi',
1208
+ 'tc',
1209
+ 'tci',
1210
+ 'td',
1211
+ 'tdk',
1212
+ 'team',
1213
+ 'tech',
1214
+ 'technology',
1215
+ 'tel',
1216
+ 'temasek',
1217
+ 'tennis',
1218
+ 'teva',
1219
+ 'tf',
1220
+ 'tg',
1221
+ 'th',
1222
+ 'thd',
1223
+ 'theater',
1224
+ 'theatre',
1225
+ 'tiaa',
1226
+ 'tickets',
1227
+ 'tienda',
1228
+ 'tiffany',
1229
+ 'tips',
1230
+ 'tires',
1231
+ 'tirol',
1232
+ 'tj',
1233
+ 'tjmaxx',
1234
+ 'tjx',
1235
+ 'tk',
1236
+ 'tkmaxx',
1237
+ 'tl',
1238
+ 'tm',
1239
+ 'tmall',
1240
+ 'tn',
1241
+ 'to',
1242
+ 'today',
1243
+ 'tokyo',
1244
+ 'tools',
1245
+ 'top',
1246
+ 'toray',
1247
+ 'toshiba',
1248
+ 'total',
1249
+ 'tours',
1250
+ 'town',
1251
+ 'toyota',
1252
+ 'toys',
1253
+ 'tr',
1254
+ 'trade',
1255
+ 'trading',
1256
+ 'training',
1257
+ 'travel',
1258
+ 'travelchannel',
1259
+ 'travelers',
1260
+ 'travelersinsurance',
1261
+ 'trust',
1262
+ 'trv',
1263
+ 'tt',
1264
+ 'tube',
1265
+ 'tui',
1266
+ 'tunes',
1267
+ 'tushu',
1268
+ 'tv',
1269
+ 'tvs',
1270
+ 'tw',
1271
+ 'tz',
1272
+ 'ua',
1273
+ 'ubank',
1274
+ 'ubs',
1275
+ 'ug',
1276
+ 'uk',
1277
+ 'unicom',
1278
+ 'university',
1279
+ 'uno',
1280
+ 'uol',
1281
+ 'ups',
1282
+ 'us',
1283
+ 'uy',
1284
+ 'uz',
1285
+ 'va',
1286
+ 'vacations',
1287
+ 'vana',
1288
+ 'vanguard',
1289
+ 'vc',
1290
+ 've',
1291
+ 'vegas',
1292
+ 'ventures',
1293
+ 'verisign',
1294
+ 'vermögensberater',
1295
+ 'vermögensberatung',
1296
+ 'versicherung',
1297
+ 'vet',
1298
+ 'vg',
1299
+ 'vi',
1300
+ 'viajes',
1301
+ 'video',
1302
+ 'vig',
1303
+ 'viking',
1304
+ 'villas',
1305
+ 'vin',
1306
+ 'vip',
1307
+ 'virgin',
1308
+ 'visa',
1309
+ 'vision',
1310
+ 'viva',
1311
+ 'vivo',
1312
+ 'vlaanderen',
1313
+ 'vn',
1314
+ 'vodka',
1315
+ 'volkswagen',
1316
+ 'volvo',
1317
+ 'vote',
1318
+ 'voting',
1319
+ 'voto',
1320
+ 'voyage',
1321
+ 'vu',
1322
+ 'vuelos',
1323
+ 'wales',
1324
+ 'walmart',
1325
+ 'walter',
1326
+ 'wang',
1327
+ 'wanggou',
1328
+ 'watch',
1329
+ 'watches',
1330
+ 'weather',
1331
+ 'weatherchannel',
1332
+ 'webcam',
1333
+ 'weber',
1334
+ 'website',
1335
+ 'wed',
1336
+ 'wedding',
1337
+ 'weibo',
1338
+ 'weir',
1339
+ 'wf',
1340
+ 'whoswho',
1341
+ 'wien',
1342
+ 'wiki',
1343
+ 'williamhill',
1344
+ 'win',
1345
+ 'windows',
1346
+ 'wine',
1347
+ 'winners',
1348
+ 'wme',
1349
+ 'wolterskluwer',
1350
+ 'woodside',
1351
+ 'work',
1352
+ 'works',
1353
+ 'world',
1354
+ 'wow',
1355
+ 'ws',
1356
+ 'wtc',
1357
+ 'wtf',
1358
+ 'xbox',
1359
+ 'xerox',
1360
+ 'xfinity',
1361
+ 'xihuan',
1362
+ 'xin',
1363
+ 'xxx',
1364
+ 'xyz',
1365
+ 'yachts',
1366
+ 'yahoo',
1367
+ 'yamaxun',
1368
+ 'yandex',
1369
+ 'ye',
1370
+ 'yodobashi',
1371
+ 'yoga',
1372
+ 'yokohama',
1373
+ 'you',
1374
+ 'youtube',
1375
+ 'yt',
1376
+ 'yun',
1377
+ 'za',
1378
+ 'zappos',
1379
+ 'zara',
1380
+ 'zero',
1381
+ 'zip',
1382
+ 'zm',
1383
+ 'zone',
1384
+ 'zuerich',
1385
+ 'zw',
1386
+ 'ελ',
1387
+ 'ευ',
1388
+ 'бг',
1389
+ 'бел',
1390
+ 'дети',
1391
+ 'ею',
1392
+ 'католик',
1393
+ 'ком',
1394
+ 'мкд',
1395
+ 'мон',
1396
+ 'москва',
1397
+ 'онлайн',
1398
+ 'орг',
1399
+ 'рус',
1400
+ 'рф',
1401
+ 'сайт',
1402
+ 'срб',
1403
+ 'укр',
1404
+ 'қаз',
1405
+ 'հայ',
1406
+ 'ישראל',
1407
+ 'קום',
1408
+ 'ابوظبي',
1409
+ 'اتصالات',
1410
+ 'ارامكو',
1411
+ 'الاردن',
1412
+ 'البحرين',
1413
+ 'الجزائر',
1414
+ 'السعودية',
1415
+ 'العليان',
1416
+ 'المغرب',
1417
+ 'امارات',
1418
+ 'ایران',
1419
+ 'بارت',
1420
+ 'بازار',
1421
+ 'بيتك',
1422
+ 'بھارت',
1423
+ 'تونس',
1424
+ 'سودان',
1425
+ 'سورية',
1426
+ 'شبكة',
1427
+ 'عراق',
1428
+ 'عرب',
1429
+ 'عمان',
1430
+ 'فلسطين',
1431
+ 'قطر',
1432
+ 'كاثوليك',
1433
+ 'كوم',
1434
+ 'مصر',
1435
+ 'مليسيا',
1436
+ 'موريتانيا',
1437
+ 'موقع',
1438
+ 'همراه',
1439
+ 'پاکستان',
1440
+ 'ڀارت',
1441
+ 'कॉम',
1442
+ 'नेट',
1443
+ 'भारत',
1444
+ 'भारतम्',
1445
+ 'भारोत',
1446
+ 'संगठन',
1447
+ 'বাংলা',
1448
+ 'ভারত',
1449
+ 'ভাৰত',
1450
+ 'ਭਾਰਤ',
1451
+ 'ભારત',
1452
+ 'ଭାରତ',
1453
+ 'இந்தியா',
1454
+ 'இலங்கை',
1455
+ 'சிங்கப்பூர்',
1456
+ 'భారత్',
1457
+ 'ಭಾರತ',
1458
+ 'ഭാരതം',
1459
+ 'ලංකා',
1460
+ 'คอม',
1461
+ 'ไทย',
1462
+ 'ລາວ',
1463
+ 'გე',
1464
+ 'みんな',
1465
+ 'アマゾン',
1466
+ 'クラウド',
1467
+ 'グーグル',
1468
+ 'コム',
1469
+ 'ストア',
1470
+ 'セール',
1471
+ 'ファッション',
1472
+ 'ポイント',
1473
+ '世界',
1474
+ '中信',
1475
+ '中国',
1476
+ '中國',
1477
+ '中文网',
1478
+ '亚马逊',
1479
+ '企业',
1480
+ '佛山',
1481
+ '信息',
1482
+ '健康',
1483
+ '八卦',
1484
+ '公司',
1485
+ '公益',
1486
+ '台湾',
1487
+ '台灣',
1488
+ '商城',
1489
+ '商店',
1490
+ '商标',
1491
+ '嘉里',
1492
+ '嘉里大酒店',
1493
+ '在线',
1494
+ '大拿',
1495
+ '天主教',
1496
+ '娱乐',
1497
+ '家電',
1498
+ '广东',
1499
+ '微博',
1500
+ '慈善',
1501
+ '我爱你',
1502
+ '手机',
1503
+ '招聘',
1504
+ '政务',
1505
+ '政府',
1506
+ '新加坡',
1507
+ '新闻',
1508
+ '时尚',
1509
+ '書籍',
1510
+ '机构',
1511
+ '淡马锡',
1512
+ '游戏',
1513
+ '澳門',
1514
+ '点看',
1515
+ '移动',
1516
+ '组织机构',
1517
+ '网址',
1518
+ '网店',
1519
+ '网站',
1520
+ '网络',
1521
+ '联通',
1522
+ '诺基亚',
1523
+ '谷歌',
1524
+ '购物',
1525
+ '通販',
1526
+ '集团',
1527
+ '電訊盈科',
1528
+ '飞利浦',
1529
+ '食品',
1530
+ '餐厅',
1531
+ '香格里拉',
1532
+ '香港',
1533
+ '닷넷',
1534
+ '닷컴',
1535
+ '삼성',
1536
+ '한국',
1537
+ ];
1538
+
1539
+ function getDomain(inputUrl) {
1540
+ const parsed = url.parse(inputUrl).host;
1541
+ var parts = parsed.split('.');
1542
+ if (parts[0] === 'www' && parts[1] !== 'com') {
1543
+ parts.shift();
1544
+ }
1545
+ var ln = parts.length, i = ln, minLength = parts[parts.length - 1].length, part;
1546
+ // iterate backwards
1547
+ while ((part = parts[--i])) {
1548
+ // stop when we find a non-TLD part
1549
+ if (i === 0 || // 'asia.com' (last remaining must be the SLD)
1550
+ i < ln - 2 || // TLDs only span 2 levels
1551
+ part.length < minLength || // 'www.cn.com' (valid TLD as second-level domain)
1552
+ tlds.indexOf(part) < 0 // officialy not a TLD
1553
+ ) {
1554
+ return part;
1555
+ }
1556
+ }
1557
+ }
53
1558
  function appendProtocol(inputUrl) {
54
1559
  const parsed = url.parse(inputUrl);
55
1560
  if (!parsed.protocol) {
@@ -84,6 +1589,18 @@ function validateUrlInput(url) {
84
1589
  }
85
1590
  }
86
1591
 
1592
+ function promptText(message, initial) {
1593
+ return __awaiter(this, void 0, void 0, function* () {
1594
+ const response = yield prompts({
1595
+ type: 'text',
1596
+ name: 'content',
1597
+ message,
1598
+ initial,
1599
+ });
1600
+ return response.content;
1601
+ });
1602
+ }
1603
+
87
1604
  function getIdentifier(name, url) {
88
1605
  const hash = crypto.createHash('md5');
89
1606
  hash.update(url);
@@ -93,9 +1610,9 @@ function getIdentifier(name, url) {
93
1610
 
94
1611
  function handleIcon(options, url) {
95
1612
  return __awaiter(this, void 0, void 0, function* () {
96
- console.log(options.icon);
97
1613
  if (options.icon) {
98
- if (options.icon.startsWith('http')) {
1614
+ if (options.icon.startsWith("http")) {
1615
+ log.info(options.icon);
99
1616
  return downloadIcon(options.icon);
100
1617
  }
101
1618
  else {
@@ -103,62 +1620,55 @@ function handleIcon(options, url) {
103
1620
  }
104
1621
  }
105
1622
  if (!options.icon) {
106
- return inferIcon(options.name, url);
1623
+ return inferIcon(options.name);
107
1624
  }
108
1625
  });
109
1626
  }
110
1627
  function inferIcon(name, url) {
111
1628
  return __awaiter(this, void 0, void 0, function* () {
112
- let icon = yield getIconFromMacosIcons(name);
113
- if (!icon) {
114
- icon = yield getIconFromPageUrl(url);
115
- }
116
- return icon;
117
- });
118
- }
119
- function getIconFromPageUrl(url) {
120
- return __awaiter(this, void 0, void 0, function* () {
121
- const icon = yield pageIcon(url);
122
- console.log(icon);
123
- if (icon.ext === '.ico') {
124
- const a = yield ICO.parse(icon.data);
125
- icon.data = Buffer.from(a[0].buffer);
126
- }
127
- const iconDir = (yield dir()).path;
128
- const iconPath = path.join(iconDir, `/icon.icns`);
129
- const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
130
- yield fs.writeFile(iconPath, out);
131
- return iconPath;
132
- });
133
- }
134
- function getIconFromMacosIcons(name) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- const data = {
137
- query: name,
138
- filters: 'approved:true',
139
- hitsPerPage: 10,
140
- page: 1,
141
- };
142
- const res = yield axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
143
- headers: {
144
- 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
145
- 'x-algolia-application-id': 'P1TXH7ZFB3',
146
- },
147
- });
148
- if (!res.data.hits.length) {
149
- return '';
150
- }
151
- else {
152
- return downloadIcon(res.data.hits[0].icnsUrl);
153
- }
1629
+ log.info("You have not provided an app icon, use the default icon(can use --icon option to assign an icon)");
1630
+ const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
1631
+ return path.join(npmDirectory, "pake-default.icns");
154
1632
  });
155
1633
  }
1634
+ // export async function getIconFromPageUrl(url: string) {
1635
+ // const icon = await pageIcon(url);
1636
+ // console.log(icon);
1637
+ // if (icon.ext === '.ico') {
1638
+ // const a = await ICO.parse(icon.data);
1639
+ // icon.data = Buffer.from(a[0].buffer);
1640
+ // }
1641
+ // const iconDir = (await dir()).path;
1642
+ // const iconPath = path.join(iconDir, `/icon.icns`);
1643
+ // const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
1644
+ // await fs.writeFile(iconPath, out);
1645
+ // return iconPath;
1646
+ // }
1647
+ // export async function getIconFromMacosIcons(name: string) {
1648
+ // const data = {
1649
+ // query: name,
1650
+ // filters: 'approved:true',
1651
+ // hitsPerPage: 10,
1652
+ // page: 1,
1653
+ // };
1654
+ // const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
1655
+ // headers: {
1656
+ // 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
1657
+ // 'x-algolia-application-id': 'P1TXH7ZFB3',
1658
+ // },
1659
+ // });
1660
+ // if (!res.data.hits.length) {
1661
+ // return '';
1662
+ // } else {
1663
+ // return downloadIcon(res.data.hits[0].icnsUrl);
1664
+ // }
1665
+ // }
156
1666
  function downloadIcon(iconUrl) {
157
1667
  return __awaiter(this, void 0, void 0, function* () {
158
1668
  let iconResponse;
159
1669
  try {
160
1670
  iconResponse = yield axios.get(iconUrl, {
161
- responseType: 'arraybuffer',
1671
+ responseType: "arraybuffer",
162
1672
  });
163
1673
  }
164
1674
  catch (error) {
@@ -182,32 +1692,14 @@ function downloadIcon(iconUrl) {
182
1692
  });
183
1693
  }
184
1694
 
185
- const USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36';
186
- function getTitleByURL(url) {
187
- var _a, _b, _c;
188
- return __awaiter(this, void 0, void 0, function* () {
189
- const { data } = yield axios.get(url, {
190
- headers: {
191
- // Fake user agent for pages like http://messenger.com
192
- 'User-Agent': USER_AGENT,
193
- },
194
- });
195
- const title = (_c = (_b = (_a = /<\s*title.*?>(?<title>.+?)<\s*\/title\s*?>/i.exec(data)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : 'Webapp';
196
- return title;
197
- });
198
- }
199
-
200
1695
  function handleOptions(options, url) {
201
1696
  return __awaiter(this, void 0, void 0, function* () {
202
1697
  const appOptions = Object.assign(Object.assign({}, options), { identifier: '' });
203
- if (!appOptions.title) {
204
- appOptions.title = yield getTitleByURL(url);
205
- }
206
1698
  if (!appOptions.name) {
207
- appOptions.name = appOptions.title;
1699
+ appOptions.name = yield promptText('please input your application name', getDomain(url));
208
1700
  }
209
1701
  appOptions.identifier = getIdentifier(appOptions.name, url);
210
- appOptions.icon = yield handleIcon(appOptions, url);
1702
+ appOptions.icon = yield handleIcon(appOptions);
211
1703
  return appOptions;
212
1704
  });
213
1705
  }
@@ -251,13 +1743,12 @@ function checkRustInstalled() {
251
1743
  var tauri = {
252
1744
  windows: [
253
1745
  {
254
- url: "https://baidu.com",
255
- transparent: false,
1746
+ url: "https://weread.qq.com/",
1747
+ transparent: true,
256
1748
  fullscreen: false,
257
- width: 1280,
258
- height: 800,
259
- resizable: true,
260
- title: "百度一下,你就知道"
1749
+ width: 1200,
1750
+ height: 728,
1751
+ resizable: true
261
1752
  }
262
1753
  ],
263
1754
  allowlist: {
@@ -265,18 +1756,32 @@ var tauri = {
265
1756
  },
266
1757
  bundle: {
267
1758
  icon: [
268
- "/var/folders/vd/8qqrr2yd6gbf23bgx5vhdzrm0000gn/T/tmp-91408-NUAYXSkVg43n/icon.icns"
1759
+ "icons/weread.icns",
1760
+ "png/weread_256.ico",
1761
+ "png/weread_32.ico",
1762
+ "png/weread_512.png"
269
1763
  ],
1764
+ identifier: "com.tw93.weread",
270
1765
  active: true,
271
1766
  category: "DeveloperTool",
272
1767
  copyright: "",
273
1768
  deb: {
274
1769
  depends: [
275
- ]
1770
+ "libwebkit2gtk-4.0-dev",
1771
+ "build-essential",
1772
+ "curl",
1773
+ "wget",
1774
+ "libssl-dev",
1775
+ "libgtk-3-dev",
1776
+ "libayatana-appindicator3-dev",
1777
+ "librsvg2-dev"
1778
+ ],
1779
+ files: {
1780
+ "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
1781
+ }
276
1782
  },
277
1783
  externalBin: [
278
1784
  ],
279
- identifier: "pake-bb6e08",
280
1785
  longDescription: "",
281
1786
  macOS: {
282
1787
  entitlements: null,
@@ -289,11 +1794,21 @@ var tauri = {
289
1794
  resources: [
290
1795
  ],
291
1796
  shortDescription: "",
292
- targets: "all",
1797
+ targets: [
1798
+ "deb",
1799
+ "msi",
1800
+ "dmg"
1801
+ ],
293
1802
  windows: {
294
1803
  certificateThumbprint: null,
295
1804
  digestAlgorithm: "sha256",
296
- timestampUrl: ""
1805
+ timestampUrl: "",
1806
+ wix: {
1807
+ language: [
1808
+ "en-US",
1809
+ "zh-CN"
1810
+ ]
1811
+ }
297
1812
  }
298
1813
  },
299
1814
  security: {
@@ -311,7 +1826,7 @@ var build = {
311
1826
  };
312
1827
  var tauriConf = {
313
1828
  "package": {
314
- productName: "baidu",
1829
+ productName: "weread",
315
1830
  version: "0.2.0"
316
1831
  },
317
1832
  tauri: tauri,
@@ -322,10 +1837,8 @@ class MacBuilder {
322
1837
  prepare() {
323
1838
  return __awaiter(this, void 0, void 0, function* () {
324
1839
  if (checkRustInstalled()) {
325
- console.log('Rust has been installed');
326
1840
  return;
327
1841
  }
328
- console.warn('Rust is not installed, show prompt');
329
1842
  const res = yield prompts({
330
1843
  type: 'confirm',
331
1844
  message: 'Detect you have not installed Rust, install it now?',
@@ -336,37 +1849,38 @@ class MacBuilder {
336
1849
  yield installRust();
337
1850
  }
338
1851
  else {
339
- console.error('Error: Pake need Rust to package your webapp!!!');
1852
+ log.error('Error: Pake need Rust to package your webapp!!!');
340
1853
  process.exit(2);
341
1854
  }
342
1855
  });
343
1856
  }
344
1857
  build(url, options) {
345
1858
  return __awaiter(this, void 0, void 0, function* () {
346
- console.log('PakeAppOptions', options);
347
- const { width, height, fullscreen, transparent, title, resizable, identifier, name } = options;
1859
+ log.debug('PakeAppOptions', options);
1860
+ const { width, height, fullscreen, transparent, resizable, identifier, name } = options;
348
1861
  const tauriConfWindowOptions = {
349
1862
  width,
350
1863
  height,
351
1864
  fullscreen,
352
1865
  transparent,
353
- title,
354
1866
  resizable,
355
1867
  };
1868
+ // TODO 下面这块逻辑还可以再拆 目前比较简单
356
1869
  Object.assign(tauriConf.tauri.windows[0], Object.assign({ url }, tauriConfWindowOptions));
357
1870
  tauriConf.package.productName = name;
358
1871
  tauriConf.tauri.bundle.identifier = identifier;
359
1872
  tauriConf.tauri.bundle.icon = [options.icon];
360
- const { path: dirPath } = yield dir();
361
- const configJsonPath = `${dirPath}/config.json`;
1873
+ const npmDirectory = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
1874
+ const configJsonPath = path.join(npmDirectory, 'src-tauri/tauri.conf.json');
362
1875
  yield fs.writeFile(configJsonPath, Buffer.from(JSON.stringify(tauriConf), 'utf-8'));
363
- yield shellExec(`${path.join(appRootPath.path, '/node_modules/.bin/tauri')} build --config ${configJsonPath} --target universal-apple-darwin`);
1876
+ yield shellExec(`cd ${npmDirectory} && npm run build`);
364
1877
  const dmgName = `${name}_${'0.2.0'}_universal.dmg`;
365
- yield fs.copyFile(this.getBuildedAppPath(dmgName), path.resolve(dmgName));
1878
+ const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
1879
+ yield fs.copyFile(appPath, path.resolve(`${name}_universal.dmg`));
366
1880
  });
367
1881
  }
368
- getBuildedAppPath(dmgName) {
369
- return path.join(appRootPath.path, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
1882
+ getBuildedAppPath(npmDirectory, dmgName) {
1883
+ return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
370
1884
  }
371
1885
  }
372
1886
 
@@ -379,18 +1893,23 @@ class BuilderFactory {
379
1893
  }
380
1894
  }
381
1895
 
382
- program.version('0.0.1').description('A cli application can build app from website, driven by tauri');
1896
+ program.version('0.0.1').description('A cli application can package a web page to desktop application');
383
1897
  program
1898
+ .showHelpAfterError()
384
1899
  .argument('<url>', 'the web url you want to package', validateUrlInput)
385
1900
  .option('--name <string>', 'application name')
386
- .option('--title <string>', 'application window title')
387
1901
  .option('--icon <string>', 'application icon', DEFAULT_PAKE_OPTIONS.icon)
388
- .option('--height <number>', 'application window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
389
- .option('--width <number>', 'application window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
390
- .option('--no-resizable', 'whether the application window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
1902
+ .option('--height <number>', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
1903
+ .option('--width <number>', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
1904
+ .option('--no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
391
1905
  .option('--fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
392
1906
  .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
1907
+ .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
393
1908
  .action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
1909
+ log.setDefaultLevel('info');
1910
+ if (options.debug) {
1911
+ log.setLevel('debug');
1912
+ }
394
1913
  const builder = BuilderFactory.create();
395
1914
  yield builder.prepare();
396
1915
  const appOptions = yield handleOptions(options, url);