@learnpack/learnpack 2.1.44 → 2.1.46
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.
- package/README.md +29 -364
- package/lib/commands/start.js +12 -43
- package/lib/managers/config/index.js +1 -2
- package/lib/utils/checkNotInstalled.d.ts +7 -1
- package/lib/utils/checkNotInstalled.js +156 -16
- package/lib/utils/console.d.ts +1 -1
- package/lib/utils/console.js +7 -7
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/commands/start.ts +315 -339
- package/src/managers/config/exercise.ts +311 -311
- package/src/managers/config/index.ts +455 -455
- package/src/utils/checkNotInstalled.ts +253 -42
- package/src/utils/console.ts +24 -24
package/README.md
CHANGED
@@ -1,55 +1,36 @@
|
|
1
|
-
# learnpack
|
2
|
-
|
3
|
-
Create, sell or download and take learning amazing learning packages.
|
4
|
-
|
5
|
-
[](https://oclif.io)
|
6
|
-
[](https://npmjs.org/package/learnpack)
|
7
|
-
[](https://npmjs.org/package/learnpack)
|
8
|
-
[](https://github.com/learnpack/learnpack-cli/blob/master/package.json)
|
9
|
-
|
1
|
+
# learnpack
|
2
|
+
|
3
|
+
Create, sell or download and take learning amazing learning packages.
|
4
|
+
|
5
|
+
[](https://oclif.io)
|
6
|
+
[](https://npmjs.org/package/learnpack)
|
7
|
+
[](https://npmjs.org/package/learnpack)
|
8
|
+
[](https://github.com/learnpack/learnpack-cli/blob/master/package.json)
|
9
|
+
|
10
10
|
<!-- toc -->
|
11
11
|
* [learnpack](#learnpack)
|
12
12
|
* [Usage](#usage)
|
13
13
|
* [Commands](#commands)
|
14
|
-
<!-- tocstop -->
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
- [Commands](#commands)
|
19
|
-
<!-- tocstop -->
|
20
|
-
|
21
|
-
# Usage
|
22
|
-
|
14
|
+
<!-- tocstop -->
|
15
|
+
|
16
|
+
# Usage
|
17
|
+
|
23
18
|
<!-- usage -->
|
24
19
|
```sh-session
|
25
20
|
$ npm install -g @learnpack/learnpack
|
26
21
|
$ learnpack COMMAND
|
27
22
|
running command...
|
28
23
|
$ learnpack (-v|--version|version)
|
29
|
-
@learnpack/learnpack/2.1.
|
24
|
+
@learnpack/learnpack/2.1.46 win32-x64 node-v20.10.0
|
30
25
|
$ learnpack --help [COMMAND]
|
31
26
|
USAGE
|
32
27
|
$ learnpack COMMAND
|
33
28
|
...
|
34
29
|
```
|
35
|
-
<!-- usagestop -->
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
$ learnpack COMMAND
|
40
|
-
running command...
|
41
|
-
$ learnpack (-v|--version|version)
|
42
|
-
@learnpack/learnpack/2.1.42 win32-x64 node-v20.10.0
|
43
|
-
$ learnpack --help [COMMAND]
|
44
|
-
USAGE
|
45
|
-
$ learnpack COMMAND
|
46
|
-
...
|
47
|
-
```
|
48
|
-
|
49
|
-
<!-- usagestop -->
|
50
|
-
|
51
|
-
# Commands
|
52
|
-
|
30
|
+
<!-- usagestop -->
|
31
|
+
|
32
|
+
# Commands
|
33
|
+
|
53
34
|
<!-- commands -->
|
54
35
|
* [`learnpack audit`](#learnpack-audit)
|
55
36
|
* [`learnpack clean`](#learnpack-clean)
|
@@ -93,7 +74,7 @@ DESCRIPTION
|
|
93
74
|
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
94
75
|
```
|
95
76
|
|
96
|
-
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
77
|
+
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\audit.ts)_
|
97
78
|
|
98
79
|
## `learnpack clean`
|
99
80
|
|
@@ -108,7 +89,7 @@ DESCRIPTION
|
|
108
89
|
Extra documentation goes here
|
109
90
|
```
|
110
91
|
|
111
|
-
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
92
|
+
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\clean.ts)_
|
112
93
|
|
113
94
|
## `learnpack download [PACKAGE]`
|
114
95
|
|
@@ -126,7 +107,7 @@ DESCRIPTION
|
|
126
107
|
Extra documentation goes here
|
127
108
|
```
|
128
109
|
|
129
|
-
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
110
|
+
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\download.ts)_
|
130
111
|
|
131
112
|
## `learnpack help [COMMAND]`
|
132
113
|
|
@@ -157,7 +138,7 @@ OPTIONS
|
|
157
138
|
-h, --grading show CLI help
|
158
139
|
```
|
159
140
|
|
160
|
-
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
141
|
+
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\init.ts)_
|
161
142
|
|
162
143
|
## `learnpack login [PACKAGE]`
|
163
144
|
|
@@ -175,7 +156,7 @@ DESCRIPTION
|
|
175
156
|
Extra documentation goes here
|
176
157
|
```
|
177
158
|
|
178
|
-
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
159
|
+
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\login.ts)_
|
179
160
|
|
180
161
|
## `learnpack logout [PACKAGE]`
|
181
162
|
|
@@ -193,7 +174,7 @@ DESCRIPTION
|
|
193
174
|
Extra documentation goes here
|
194
175
|
```
|
195
176
|
|
196
|
-
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
177
|
+
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\logout.ts)_
|
197
178
|
|
198
179
|
## `learnpack plugins`
|
199
180
|
|
@@ -328,7 +309,7 @@ DESCRIPTION
|
|
328
309
|
Extra documentation goes here
|
329
310
|
```
|
330
311
|
|
331
|
-
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
312
|
+
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\publish.ts)_
|
332
313
|
|
333
314
|
## `learnpack start`
|
334
315
|
|
@@ -349,7 +330,7 @@ OPTIONS
|
|
349
330
|
-w, --watch Watch for file changes
|
350
331
|
```
|
351
332
|
|
352
|
-
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
333
|
+
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\start.ts)_
|
353
334
|
|
354
335
|
## `learnpack test [EXERCISESLUG]`
|
355
336
|
|
@@ -363,323 +344,7 @@ ARGUMENTS
|
|
363
344
|
EXERCISESLUG The name of the exercise to test
|
364
345
|
```
|
365
346
|
|
366
|
-
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.
|
367
|
-
<!-- commandsstop -->
|
368
|
-
|
369
|
-
- [`learnpack audit`](#learnpack-audit)
|
370
|
-
- [`learnpack clean`](#learnpack-clean)
|
371
|
-
- [`learnpack download [PACKAGE]`](#learnpack-download-package)
|
372
|
-
- [`learnpack help [COMMAND]`](#learnpack-help-command)
|
373
|
-
- [`learnpack init`](#learnpack-init)
|
374
|
-
- [`learnpack login [PACKAGE]`](#learnpack-login-package)
|
375
|
-
- [`learnpack logout [PACKAGE]`](#learnpack-logout-package)
|
376
|
-
- [`learnpack plugins`](#learnpack-plugins)
|
377
|
-
- [`learnpack plugins:install PLUGIN...`](#learnpack-pluginsinstall-plugin)
|
378
|
-
- [`learnpack plugins:link PLUGIN`](#learnpack-pluginslink-plugin)
|
379
|
-
- [`learnpack plugins:uninstall PLUGIN...`](#learnpack-pluginsuninstall-plugin)
|
380
|
-
- [`learnpack plugins:update`](#learnpack-pluginsupdate)
|
381
|
-
- [`learnpack publish [PACKAGE]`](#learnpack-publish-package)
|
382
|
-
- [`learnpack start`](#learnpack-start)
|
383
|
-
- [`learnpack test [EXERCISESLUG]`](#learnpack-test-exerciseslug)
|
384
|
-
|
385
|
-
## `learnpack audit`
|
386
|
-
|
387
|
-
learnpack audit is the command in charge of creating an auditory of the repository
|
388
|
-
|
389
|
-
```
|
390
|
-
USAGE
|
391
|
-
$ learnpack audit
|
392
|
-
|
393
|
-
DESCRIPTION
|
394
|
-
...
|
395
|
-
learnpack audit checks for the following information in a repository:
|
396
|
-
1. The configuration object has slug, repository and description. (Error)
|
397
|
-
2. The command learnpack clean has been run. (Error)
|
398
|
-
3. If a markdown or test file doesn't have any content. (Error)
|
399
|
-
4. The links are accessing to valid servers. (Error)
|
400
|
-
5. The relative images are working (If they have the shortest path to the image or if the images exists in the
|
401
|
-
assets). (Error)
|
402
|
-
6. The external images are working (If they are pointing to a valid server). (Error)
|
403
|
-
7. The exercises directory names are valid. (Error)
|
404
|
-
8. If an exercise doesn't have a README file. (Error)
|
405
|
-
9. The exercises array (Of the config file) has content. (Error)
|
406
|
-
10. The exercses have the same translations. (Warning)
|
407
|
-
11. The .gitignore file exists. (Warning)
|
408
|
-
12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)
|
409
|
-
```
|
410
|
-
|
411
|
-
_See code: [src\commands\audit.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\audit.ts)_
|
412
|
-
|
413
|
-
## `learnpack clean`
|
414
|
-
|
415
|
-
Clean the configuration object
|
416
|
-
|
417
|
-
```
|
418
|
-
USAGE
|
419
|
-
$ learnpack clean
|
420
|
-
|
421
|
-
DESCRIPTION
|
422
|
-
...
|
423
|
-
Extra documentation goes here
|
424
|
-
```
|
425
|
-
|
426
|
-
_See code: [src\commands\clean.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\clean.ts)_
|
427
|
-
|
428
|
-
## `learnpack download [PACKAGE]`
|
429
|
-
|
430
|
-
Describe the command here
|
431
|
-
|
432
|
-
```
|
433
|
-
USAGE
|
434
|
-
$ learnpack download [PACKAGE]
|
435
|
-
|
436
|
-
ARGUMENTS
|
437
|
-
PACKAGE The unique string that identifies this package on learnpack
|
438
|
-
|
439
|
-
DESCRIPTION
|
440
|
-
...
|
441
|
-
Extra documentation goes here
|
442
|
-
```
|
443
|
-
|
444
|
-
_See code: [src\commands\download.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\download.ts)_
|
445
|
-
|
446
|
-
## `learnpack help [COMMAND]`
|
447
|
-
|
448
|
-
display help for learnpack
|
449
|
-
|
450
|
-
```
|
451
|
-
USAGE
|
452
|
-
$ learnpack help [COMMAND]
|
453
|
-
|
454
|
-
ARGUMENTS
|
455
|
-
COMMAND command to show help for
|
456
|
-
|
457
|
-
OPTIONS
|
458
|
-
--all see all commands in CLI
|
459
|
-
```
|
460
|
-
|
461
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.1.0/src\commands\help.ts)_
|
462
|
-
|
463
|
-
## `learnpack init`
|
464
|
-
|
465
|
-
Create a new learning package: Book, Tutorial or Exercise
|
466
|
-
|
467
|
-
```
|
468
|
-
USAGE
|
469
|
-
$ learnpack init
|
470
|
-
|
471
|
-
OPTIONS
|
472
|
-
-h, --grading show CLI help
|
473
|
-
```
|
474
|
-
|
475
|
-
_See code: [src\commands\init.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\init.ts)_
|
476
|
-
|
477
|
-
## `learnpack login [PACKAGE]`
|
478
|
-
|
479
|
-
Describe the command here
|
480
|
-
|
481
|
-
```
|
482
|
-
USAGE
|
483
|
-
$ learnpack login [PACKAGE]
|
484
|
-
|
485
|
-
ARGUMENTS
|
486
|
-
PACKAGE The unique string that identifies this package on learnpack
|
487
|
-
|
488
|
-
DESCRIPTION
|
489
|
-
...
|
490
|
-
Extra documentation goes here
|
491
|
-
```
|
492
|
-
|
493
|
-
_See code: [src\commands\login.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\login.ts)_
|
494
|
-
|
495
|
-
## `learnpack logout [PACKAGE]`
|
496
|
-
|
497
|
-
Describe the command here
|
498
|
-
|
499
|
-
```
|
500
|
-
USAGE
|
501
|
-
$ learnpack logout [PACKAGE]
|
502
|
-
|
503
|
-
ARGUMENTS
|
504
|
-
PACKAGE The unique string that identifies this package on learnpack
|
505
|
-
|
506
|
-
DESCRIPTION
|
507
|
-
...
|
508
|
-
Extra documentation goes here
|
509
|
-
```
|
510
|
-
|
511
|
-
_See code: [src\commands\logout.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\logout.ts)_
|
512
|
-
|
513
|
-
## `learnpack plugins`
|
514
|
-
|
515
|
-
list installed plugins
|
516
|
-
|
517
|
-
```
|
518
|
-
USAGE
|
519
|
-
$ learnpack plugins
|
520
|
-
|
521
|
-
OPTIONS
|
522
|
-
--core show core plugins
|
523
|
-
|
524
|
-
EXAMPLE
|
525
|
-
$ learnpack plugins
|
526
|
-
```
|
527
|
-
|
528
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\index.ts)_
|
529
|
-
|
530
|
-
## `learnpack plugins:install PLUGIN...`
|
531
|
-
|
532
|
-
installs a plugin into the CLI
|
533
|
-
|
534
|
-
```
|
535
|
-
USAGE
|
536
|
-
$ learnpack plugins:install PLUGIN...
|
537
|
-
|
538
|
-
ARGUMENTS
|
539
|
-
PLUGIN plugin to install
|
540
|
-
|
541
|
-
OPTIONS
|
542
|
-
-f, --force yarn install with force flag
|
543
|
-
-h, --help show CLI help
|
544
|
-
-v, --verbose
|
545
|
-
|
546
|
-
DESCRIPTION
|
547
|
-
Can be installed from npm or a git url.
|
548
|
-
|
549
|
-
Installation of a user-installed plugin will override a core plugin.
|
550
|
-
|
551
|
-
e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
|
552
|
-
will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
|
553
|
-
the CLI without the need to patch and update the whole CLI.
|
554
|
-
|
555
|
-
ALIASES
|
556
|
-
$ learnpack plugins:add
|
557
|
-
|
558
|
-
EXAMPLES
|
559
|
-
$ learnpack plugins:install myplugin
|
560
|
-
$ learnpack plugins:install https://github.com/someuser/someplugin
|
561
|
-
$ learnpack plugins:install someuser/someplugin
|
562
|
-
```
|
563
|
-
|
564
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\install.ts)_
|
565
|
-
|
566
|
-
## `learnpack plugins:link PLUGIN`
|
567
|
-
|
568
|
-
links a plugin into the CLI for development
|
569
|
-
|
570
|
-
```
|
571
|
-
USAGE
|
572
|
-
$ learnpack plugins:link PLUGIN
|
573
|
-
|
574
|
-
ARGUMENTS
|
575
|
-
PATH [default: .] path to plugin
|
576
|
-
|
577
|
-
OPTIONS
|
578
|
-
-h, --help show CLI help
|
579
|
-
-v, --verbose
|
580
|
-
|
581
|
-
DESCRIPTION
|
582
|
-
Installation of a linked plugin will override a user-installed or core plugin.
|
583
|
-
|
584
|
-
e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
|
585
|
-
command will override the user-installed or core plugin implementation. This is useful for development work.
|
586
|
-
|
587
|
-
EXAMPLE
|
588
|
-
$ learnpack plugins:link myplugin
|
589
|
-
```
|
590
|
-
|
591
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\link.ts)_
|
592
|
-
|
593
|
-
## `learnpack plugins:uninstall PLUGIN...`
|
594
|
-
|
595
|
-
removes a plugin from the CLI
|
596
|
-
|
597
|
-
```
|
598
|
-
USAGE
|
599
|
-
$ learnpack plugins:uninstall PLUGIN...
|
600
|
-
|
601
|
-
ARGUMENTS
|
602
|
-
PLUGIN plugin to uninstall
|
603
|
-
|
604
|
-
OPTIONS
|
605
|
-
-h, --help show CLI help
|
606
|
-
-v, --verbose
|
607
|
-
|
608
|
-
ALIASES
|
609
|
-
$ learnpack plugins:unlink
|
610
|
-
$ learnpack plugins:remove
|
611
|
-
```
|
612
|
-
|
613
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\uninstall.ts)_
|
614
|
-
|
615
|
-
## `learnpack plugins:update`
|
616
|
-
|
617
|
-
update installed plugins
|
618
|
-
|
619
|
-
```
|
620
|
-
USAGE
|
621
|
-
$ learnpack plugins:update
|
622
|
-
|
623
|
-
OPTIONS
|
624
|
-
-h, --help show CLI help
|
625
|
-
-v, --verbose
|
626
|
-
```
|
627
|
-
|
628
|
-
_See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v1.8.0/src\commands\plugins\update.ts)_
|
629
|
-
|
630
|
-
## `learnpack publish [PACKAGE]`
|
631
|
-
|
632
|
-
Describe the command here
|
633
|
-
|
634
|
-
```
|
635
|
-
USAGE
|
636
|
-
$ learnpack publish [PACKAGE]
|
637
|
-
|
638
|
-
ARGUMENTS
|
639
|
-
PACKAGE The unique string that identifies this package on learnpack
|
640
|
-
|
641
|
-
DESCRIPTION
|
642
|
-
...
|
643
|
-
Extra documentation goes here
|
644
|
-
```
|
645
|
-
|
646
|
-
_See code: [src\commands\publish.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\publish.ts)_
|
647
|
-
|
648
|
-
## `learnpack start`
|
649
|
-
|
650
|
-
Runs a small server with all the exercise instructions
|
651
|
-
|
652
|
-
```
|
653
|
-
USAGE
|
654
|
-
$ learnpack start
|
655
|
-
|
656
|
-
OPTIONS
|
657
|
-
-D, --disableGrading disble grading functionality
|
658
|
-
-d, --debug debugger mode for more verbage
|
659
|
-
-e, --editor=extension|preview [preview, extension]
|
660
|
-
-g, --grading=isolated|incremental [isolated, incremental]
|
661
|
-
-h, --host=host server host
|
662
|
-
-p, --port=port server port
|
663
|
-
-v, --version=version E.g: 1.0.1
|
664
|
-
-w, --watch Watch for file changes
|
665
|
-
```
|
666
|
-
|
667
|
-
_See code: [src\commands\start.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\start.ts)_
|
668
|
-
|
669
|
-
## `learnpack test [EXERCISESLUG]`
|
670
|
-
|
671
|
-
Test exercises
|
672
|
-
|
673
|
-
```
|
674
|
-
USAGE
|
675
|
-
$ learnpack test [EXERCISESLUG]
|
676
|
-
|
677
|
-
ARGUMENTS
|
678
|
-
EXERCISESLUG The name of the exercise to test
|
679
|
-
```
|
680
|
-
|
681
|
-
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.42/src\commands\test.ts)_
|
682
|
-
|
683
|
-
<!-- commandsstop -->
|
684
|
-
|
347
|
+
_See code: [src\commands\test.ts](https://github.com/learnpack/learnpack-cli/blob/v2.1.46/src\commands\test.ts)_
|
348
|
+
<!-- commandsstop -->
|
349
|
+
|
685
350
|
> > > > > > > 0cb3e56d84c197f9d008836bb573eade212b7e57
|
package/lib/commands/start.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const tslib_1 = require("tslib");
|
4
3
|
// import path from "path";
|
5
4
|
const command_1 = require("@oclif/command");
|
6
5
|
const SessionCommand_1 = require("../utils/SessionCommand");
|
@@ -12,7 +11,6 @@ const fileQueue_1 = require("../utils/fileQueue");
|
|
12
11
|
const file_1 = require("../managers/file");
|
13
12
|
const misc_1 = require("../utils/misc");
|
14
13
|
const osOperations_1 = require("../utils/osOperations");
|
15
|
-
const cli_ux_1 = require("cli-ux");
|
16
14
|
const checkNotInstalled_1 = require("../utils/checkNotInstalled");
|
17
15
|
class StartCommand extends SessionCommand_1.default {
|
18
16
|
// 🛑 IMPORTANT
|
@@ -22,54 +20,25 @@ class StartCommand extends SessionCommand_1.default {
|
|
22
20
|
await this.initSession(flags);
|
23
21
|
}
|
24
22
|
async run() {
|
25
|
-
var
|
26
|
-
var _b, _c, _d, _e, _f, _g;
|
23
|
+
var _a, _b, _c, _d, _e, _f;
|
27
24
|
// get configuration object
|
28
|
-
const configObject = (
|
25
|
+
const configObject = (_a = this.configManager) === null || _a === void 0 ? void 0 : _a.get();
|
29
26
|
// TODO: console.log(this.config.platform); get the platfrom from Oclif
|
30
27
|
const hasXDG = await osOperations_1.eventManager.checkXDGInstalled();
|
31
28
|
const installedPlugins = this.config.plugins.map(plugin => {
|
32
29
|
return `${plugin.pjson.name}`;
|
33
30
|
});
|
34
|
-
const neededToInstallPlugins = checkNotInstalled_1.checkNotInstalledPlugins((configObject === null || configObject === void 0 ? void 0 : configObject.exercises) || [], installedPlugins);
|
35
|
-
if (neededToInstallPlugins.length > 0) {
|
36
|
-
console_1.default.error("These plugins are not installed but required: ", neededToInstallPlugins);
|
37
|
-
const confirmInstall = await cli_ux_1.cli.confirm("Do you want to install the needed plugins? (y/n)");
|
38
|
-
if (confirmInstall) {
|
39
|
-
console_1.default.info("Installing the needed plugins...");
|
40
|
-
try {
|
41
|
-
for (var neededToInstallPlugins_1 = tslib_1.__asyncValues(neededToInstallPlugins), neededToInstallPlugins_1_1; neededToInstallPlugins_1_1 = await neededToInstallPlugins_1.next(), !neededToInstallPlugins_1_1.done;) {
|
42
|
-
const p = neededToInstallPlugins_1_1.value;
|
43
|
-
await this.config.runCommand(`plugins:install`, [p]);
|
44
|
-
console_1.default.log(`Plugin ${p} installed`);
|
45
|
-
}
|
46
|
-
}
|
47
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
48
|
-
finally {
|
49
|
-
try {
|
50
|
-
if (neededToInstallPlugins_1_1 && !neededToInstallPlugins_1_1.done && (_a = neededToInstallPlugins_1.return)) await _a.call(neededToInstallPlugins_1);
|
51
|
-
}
|
52
|
-
finally { if (e_1) throw e_1.error; }
|
53
|
-
}
|
54
|
-
console_1.default.log("All needed plugins installed, please restart LearnPack to load them.");
|
55
|
-
console_1.default.info("Run: $ learnpack start");
|
56
|
-
this.exit(0);
|
57
|
-
}
|
58
|
-
else {
|
59
|
-
console_1.default.error("You need to install the plugins to complete this exercise");
|
60
|
-
console_1.default.info("To install the plugins run each of the following commands: ");
|
61
|
-
for (const p of neededToInstallPlugins) {
|
62
|
-
console_1.default.log(`learnpack plugins:install ${p}`);
|
63
|
-
}
|
64
|
-
this.exit(1);
|
65
|
-
}
|
66
|
-
}
|
67
31
|
if (configObject) {
|
68
32
|
const { config } = configObject;
|
69
33
|
// build exerises
|
70
|
-
(
|
71
|
-
console_1.default.debug(`Grading: ${config === null || config === void 0 ? void 0 : config.grading} ${((
|
34
|
+
(_b = this.configManager) === null || _b === void 0 ? void 0 : _b.buildIndex();
|
35
|
+
console_1.default.debug(`Grading: ${config === null || config === void 0 ? void 0 : config.grading} ${((_c = config === null || config === void 0 ? void 0 : config.disabledActions) === null || _c === void 0 ? void 0 : _c.includes("test")) ? "(disabled)" : ""}, editor: ${config === null || config === void 0 ? void 0 : config.editor.mode} ${config === null || config === void 0 ? void 0 : config.editor.version}, for ${Array.isArray(configObject === null || configObject === void 0 ? void 0 : configObject.exercises) ? configObject === null || configObject === void 0 ? void 0 : configObject.exercises.length :
|
72
36
|
0} exercises found`);
|
37
|
+
const neededPlugins = await checkNotInstalled_1.checkNotInstalledPlugins((configObject === null || configObject === void 0 ? void 0 : configObject.exercises) || [], installedPlugins, this);
|
38
|
+
const allDepsInstalled = await checkNotInstalled_1.checkNotInstalledDependencies(neededPlugins.needed);
|
39
|
+
if (!allDepsInstalled) {
|
40
|
+
this.exit(1);
|
41
|
+
}
|
73
42
|
const appAlreadyExists = file_1.checkIfDirectoryExists(`${config === null || config === void 0 ? void 0 : config.dirPath}/_app`);
|
74
43
|
if (!appAlreadyExists) {
|
75
44
|
// download app and decompress
|
@@ -87,9 +56,9 @@ class StartCommand extends SessionCommand_1.default {
|
|
87
56
|
path: `${config.dirPath}/vscode_queue.json`,
|
88
57
|
});
|
89
58
|
if (configObject.exercises) {
|
90
|
-
const agent = ((
|
91
|
-
const path = ((
|
92
|
-
const tutorialSlug = ((
|
59
|
+
const agent = ((_d = configObject.config) === null || _d === void 0 ? void 0 : _d.editor.agent) || "";
|
60
|
+
const path = ((_e = configObject.config) === null || _e === void 0 ? void 0 : _e.dirPath) || "";
|
61
|
+
const tutorialSlug = ((_f = configObject.config) === null || _f === void 0 ? void 0 : _f.slug) || "";
|
93
62
|
const steps = configObject.exercises.map((e, index) => ({
|
94
63
|
slug: e.slug,
|
95
64
|
position: e.position || index,
|
@@ -51,7 +51,6 @@ const getCodespacesNamespace = () => {
|
|
51
51
|
if (!codespace_name ||
|
52
52
|
codespace_name === "" ||
|
53
53
|
codespace_name === undefined ||
|
54
|
-
// ! I added this line
|
55
54
|
codespace_name === "$CODESPACE_NAME") {
|
56
55
|
return null;
|
57
56
|
}
|
@@ -143,7 +142,7 @@ exports.default = async ({ grading, mode, disableGrading, version, }) => {
|
|
143
142
|
console_1.default.debug("Config version not found, downloading default.");
|
144
143
|
const resp = await fetch("https://raw.githubusercontent.com/learnpack/ide/master/package.json");
|
145
144
|
const packageJSON = await resp.json();
|
146
|
-
configObj.config.editor.version = packageJSON.version || "3.1.
|
145
|
+
configObj.config.editor.version = packageJSON.version || "3.1.23";
|
147
146
|
}
|
148
147
|
configObj.config.dirPath = "./" + confPath.base;
|
149
148
|
configObj.config.exercisesPath = getExercisesPath(confPath.base) || "./";
|
@@ -1,2 +1,8 @@
|
|
1
1
|
import { IExercise } from "../models/exercise-obj";
|
2
|
-
|
2
|
+
declare type TNeededPlugins = {
|
3
|
+
needed: string[];
|
4
|
+
notInstalled: string[];
|
5
|
+
};
|
6
|
+
export declare const checkNotInstalledPlugins: (exercises: IExercise[], installedPlugins: string[], command: any) => Promise<TNeededPlugins>;
|
7
|
+
export declare const checkNotInstalledDependencies: (neededPlugins: string[]) => Promise<boolean | undefined>;
|
8
|
+
export {};
|