-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.json
More file actions
766 lines (766 loc) · 41.8 KB
/
tasks.json
File metadata and controls
766 lines (766 loc) · 41.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
[
{
"description": "Find out what commands and options npm provides.",
"expectedCommand": "npm help",
"explanation": "Displays general help information about npm, including available commands and usage examples."
},
{
"description": "Initialize a new npm project with default values.",
"expectedCommand": "npm init -y",
"checkCommand": "test -f package.json",
"windowsCheckCommand": "if exist package.json (exit 0) else (exit 1)",
"explanation": "Creates a default package.json file to define your project and manage dependencies."
},
{
"description": "Install the lodash package into your project.",
"expectedCommand": "npm install lodash",
"checkCommand": "npm list lodash | grep -q 'lodash'",
"windowsCheckCommand": "npm list lodash | findstr /C:\"lodash\"",
"explanation": "Installs the lodash package and adds it to your dependencies in package.json."
},
{
"description": "Install the axios package into your project.",
"expectedCommand": "npm install axios",
"checkCommand": "npm list axios | grep -q 'axios'",
"windowsCheckCommand": "npm list axios | findstr /C:\"axios\"",
"explanation": "Installs the axios package and adds it to your dependencies in package.json."
},
{
"description": "Uninstall the lodash package from your project.",
"expectedCommand": "npm uninstall lodash",
"checkCommand": "! npm list lodash | grep -q 'lodash'",
"windowsCheckCommand": "npm list lodash | findstr /C:\"lodash\" || exit 0",
"explanation": "Removes the lodash package from node_modules and deletes it from package.json dependencies."
},
{
"description": "Bump the version of your project using npm. Try increasing it with a patch update.",
"expectedCommand": "npm version patch",
"checkCommand": "grep -q '\"version\": \"1.0.1\"' package.json",
"windowsCheckCommand": "findstr /C:\"\\\"version\\\": \\\"1.0.1\\\"\" package.json",
"explanation": "Increments the version field in package.json using semantic versioning (patch level)."
},
{
"description": "List installed packages in your project.",
"expectedCommand": "npm ls",
"explanation": "Displays a tree of all installed packages and their dependencies."
},
{
"description": "Reinstall project dependencies cleanly using lockfile.",
"expectedCommand": "npm ci",
"beforeCommand": "rm -rf node_modules",
"windowsBeforeCommand": "if exist node_modules (rmdir /s /q node_modules)",
"preCheckCommand": "test ! -d node_modules && test -f package-lock.json",
"windowsPreCheckCommand": "if not exist node_modules (if exist package-lock.json (exit 0) else (exit 1)) else (exit 1)",
"checkCommand": "npm list axios | grep -q 'axios' && test -d node_modules",
"windowsCheckCommand": "npm list axios | findstr /C:\"axios\" && if exist node_modules (exit 0) else (exit 1)",
"explanation": "Performs a clean install of dependencies based on package-lock.json, removing node_modules first."
},
{
"description": "Verify the integrity of the npm cache.",
"expectedCommand": "npm cache verify",
"beforeCommand": "mkdir -p ~/.npm/_cacache/tmp && touch ~/.npm/_cacache/tmp/fake.tar.gz",
"windowsBeforeCommand": "powershell -Command \"New-Item -ItemType Directory -Path \\\"$env:LOCALAPPDATA\\npm-cache\\_cacache\\tmp\\\" -Force | Out-Null; New-Item -ItemType File -Path \\\"$env:LOCALAPPDATA\\npm-cache\\_cacache\\tmp\\fake.tar.gz\\\" -Force | Out-Null\"",
"preCheckCommand": "test -f ~/.npm/_cacache/tmp/fake.tar.gz",
"windowsPreCheckCommand": "powershell -Command \"Test-Path \\\"$env:LOCALAPPDATA\\npm-cache\\_cacache\\tmp\\fake.tar.gz\\\"\"",
"checkCommand": "test ! -f ~/.npm/_cacache/tmp/fake.tar.gz",
"windowsCheckCommand": "powershell -Command \"if (Test-Path \\\"$env:LOCALAPPDATA\\npm-cache\\_cacache\\tmp\\fake.tar.gz\\\") { exit 1 } else { exit 0 }\"",
"explanation": "Checks and cleans the npm cache to ensure it's valid and not corrupted."
},
{
"description": "Install the lodash package into node_modules without saving it to package.json.",
"expectedCommand": "npm install lodash --no-save",
"checkCommand": "test -d node_modules/lodash && ! grep -q 'lodash' package.json",
"windowsCheckCommand": "if exist node_modules\\lodash (findstr /C:\"lodash\" package.json || exit 0) else (exit 1)",
"explanation": "Installs lodash temporarily into node_modules without adding it to package.json dependencies."
},
{
"description": "List installed packages in your project.",
"expectedCommand": "npm ls",
"explanation": "Displays a tree of all installed packages and their dependencies."
},
{
"description": "Remove extraneous packages from node_modules.",
"expectedCommand": "npm prune",
"checkCommand": "! test -d node_modules/lodash && test -d node_modules/axios",
"windowsCheckCommand": "if not exist node_modules\\lodash (if exist node_modules\\axios (exit 0) else (exit 1)) else (exit 1)",
"explanation": "Deletes packages from node_modules that are not listed in package.json."
},
{
"description": "List installed packages in your project.",
"expectedCommand": "npm ls",
"explanation": "Displays a tree of all installed packages and their dependencies."
},
{
"description": "Install express version 5.1.0 and body-parser version 2.2.0 to create a duplicate dependency scenario.",
"expectedCommand": "npm install express@5.1.0 body-parser@2.2.0",
"checkCommand": "npm list express | grep -q 'express@5.1.0' && npm list body-parser | grep -q 'body-parser@2.2.0' && npm ls statuses | grep -q 'statuses@'",
"windowsCheckCommand": "npm list express | findstr /C:\"express@5.1.0\" && npm list body-parser | findstr /C:\"body-parser@2.2.0\" && npm ls statuses | findstr /C:\"statuses@\"",
"explanation": "Installs two packages that depend on different versions of 'statuses', creating a duplicate in the tree."
},
{
"description": "Inspect the dependency tree for the 'statuses' package.",
"expectedCommand": "npm ls statuses",
"explanation": "Shows how multiple versions of 'statuses' are nested under different packages."
},
{
"description": "Detect duplicate versions of packages in your dependency tree.",
"expectedCommand": "npm find-dupes",
"outputIncludes": "up to date",
"explanation": "Reports multiple versions of packages and suggests deduplication. Note: Modern npm (v7+) auto-dedupes during install, so this may show no duplicates."
},
{
"description": "Deduplicate your dependency tree to flatten duplicate packages.",
"expectedCommand": "npm dedupe",
"checkCommand": "npm ls statuses | grep -q 'statuses@2.0.2'",
"windowsCheckCommand": "npm ls statuses | findstr /C:\"statuses@2.0.2\"",
"explanation": "Attempts to flatten the dependency tree by hoisting shared packages like 'statuses'."
},
{
"description": "Recheck the dependency tree for 'statuses' after deduplication.",
"expectedCommand": "npm ls statuses",
"explanation": "Verifies that 'statuses' has been hoisted and duplicates removed."
},
{
"description": "Run 'npm find-dupes' again to confirm duplicates are gone.",
"expectedCommand": "npm find-dupes",
"outputIncludes": "up to date",
"explanation": "Confirms that the dependency tree is now clean and deduplicated."
},
{
"description": "Install the chalk package version 4.1.1 into your project.",
"expectedCommand": "npm install chalk@4.1.1",
"checkCommand": "npm list chalk | grep -q 'chalk@4.1.1'",
"windowsCheckCommand": "npm list chalk | findstr /C:\"chalk@4.1.1\"",
"explanation": "Installs the chalk package version 4.1.1 and adds it to your dependencies in package.json."
},
{
"description": "Check for outdated packages in your project.",
"expectedCommand": "npm outdated",
"outputIncludes": "chalk",
"nonZeroOkay": true,
"explanation": "Shows which installed packages are outdated and what newer versions are available."
},
{
"description": "Update all outdated packages in your project.",
"expectedCommand": "npm update",
"checkCommand": "npm list chalk | grep -q 'chalk@' && ! npm list chalk | grep -q 'chalk@4.1.1'",
"windowsCheckCommand": "npm list chalk | findstr /C:\"chalk@\" && (npm list chalk | findstr /C:\"chalk@4.1.1\" || exit 0)",
"explanation": "Updates all dependencies in package.json to their latest compatible versions."
},
{
"description": "Inspect the installed version of chalk directly by listing only that package.",
"expectedCommand": "npm ls chalk",
"explanation": "Displays the installed version of the chalk package to confirm it's present in your project."
},
{
"description": "Install the latest chalk package into your project.",
"expectedCommand": "npm install chalk@latest",
"checkCommand": "npm list chalk | grep -q 'chalk@' && ! npm list chalk | grep -q 'chalk@4.1.2' && test $(npm outdated | wc -l) -eq 0",
"windowsCheckCommand": "npm list chalk | findstr /C:\"chalk@\" && (npm list chalk | findstr /C:\"chalk@4.1.2\" || (npm outdated 2>nul | find /c /v \"\") || exit 0)",
"explanation": "Installs the chalk package latest version and adds it to your dependencies in package.json."
},
{
"description": "Now check for outdated packages in your project.",
"expectedCommand": "npm outdated",
"explanation": "Shows which installed packages are outdated and what newer versions are available."
},
{
"description": "View details about the axios package.",
"expectedCommand": "npm view axios",
"explanation": "Displays metadata about the axios package, such as version, description, and dependencies."
},
{
"description": "Compare two versions 4.1.2 and 5.0.0 of chalk to see what changed.",
"expectedCommand": "npm diff --diff=chalk@4.1.2 --diff=chalk@5.0.0",
"explanation": "Displays file-level differences between chalk version 4.1.2 and 5.0.0 using npm diff."
},
{
"description": "Install the native module 'sqlite3' to prepare for a rebuild scenario.",
"expectedCommand": "npm install sqlite3",
"checkCommand": "test -d node_modules/sqlite3",
"windowsCheckCommand": "if exist node_modules\\sqlite3 (exit 0) else (exit 1)",
"outputIncludes": "added",
"explanation": "Installs a native Node.js module that compiles binary bindings during install. We'll simulate a broken build next."
},
{
"description": "Rebuild the native module 'sqlite3' after simulating a broken build.",
"expectedCommand": "npm rebuild",
"beforeCommand": "rm -rf node_modules/sqlite3/build/Release",
"windowsBeforeCommand": "if exist node_modules\\sqlite3\\build\\Release (rmdir /s /q node_modules\\sqlite3\\build\\Release)",
"preCheckCommand": "test ! -f node_modules/sqlite3/build/Release/*.node",
"windowsPreCheckCommand": "if not exist node_modules\\sqlite3\\build\\Release\\*.node (exit 0) else (exit 1)",
"checkCommand": "test -f node_modules/sqlite3/build/Release/*.node",
"windowsCheckCommand": "if exist node_modules\\sqlite3\\build\\Release\\*.node (exit 0) else (exit 1)",
"outputIncludes": "rebuilt dependencies successfully",
"explanation": "Recompiles native bindings for 'sqlite3', restoring the missing binary after we deleted it."
},
{
"description": "Diagnose common environment problems.",
"expectedCommand": "npm doctor",
"beforeCommand": "npm install -g npm@10.8.0",
"beforeRequiresSudo": true,
"preCheckCommand": "npm -v | grep -q '^10\\.8\\.0$'",
"windowsPreCheckCommand": "npm -v | findstr \"10.8.0\"",
"outputIncludes": "Use npm v",
"nonZeroOkay": true,
"explanation": "Runs a set of checks to identify potential issues in your npm and Node.js setup."
},
{
"description": "Upgrade npm to the latest version to resolve the issue.",
"expectedCommand": "npm install -g npm@latest",
"checkCommand": "! npm -v | grep -q '^10\\.8\\.0$'",
"windowsCheckCommand": "(npm -v | findstr \"10.8.0\" || exit 0)",
"requireSudo": true,
"skipTest": true,
"explanation": "Upgrades npm to the latest version so that npm doctor no longer reports it as outdated."
},
{
"description": "Run npm doctor again to confirm the issue is resolved.",
"expectedCommand": "npm doctor",
"nonZeroOkay": true,
"explanation": "Verifies that npm doctor no longer reports the outdated npm version."
},
{
"description": "Lock down your dependencies using shrinkwrap.",
"expectedCommand": "npm shrinkwrap",
"checkCommand": "test -f npm-shrinkwrap.json",
"windowsCheckCommand": "if exist npm-shrinkwrap.json (exit 0) else (exit 1)",
"afterCommand": "rm npm-shrinkwrap.json",
"windowsAfterCommand": "if exist npm-shrinkwrap.json (del npm-shrinkwrap.json)",
"explanation": "Generates a npm-shrinkwrap.json file to lock exact versions of dependencies for reproducible installs."
},
{
"description": "List your current npm configuration settings.",
"expectedCommand": "npm config list",
"explanation": "Displays all current npm configuration values, including user-level and global settings."
},
{
"description": "Install lodash version 4.17.11 which has known vulnerabilities.",
"expectedCommand": "npm install lodash@4.17.11",
"checkCommand": "npm list lodash | grep -q 'lodash@4.17.11'",
"windowsCheckCommand": "npm list lodash | findstr /C:\"lodash@4.17.11\"",
"explanation": "Installs an older version of lodash that is known to have security issues for testing npm audit."
},
{
"description": "Run a security audit on your dependencies.",
"expectedCommand": "npm audit",
"outputIncludes": "1 critical severity vulnerability",
"nonZeroOkay": true,
"explanation": "Scans your project for known security vulnerabilities in installed packages."
},
{
"description": "Fix the vulnerability using npm's automated tool.",
"expectedCommand": "npm audit fix",
"checkCommand": "! npm audit | grep -q '1 critical severity vulnerability'",
"windowsCheckCommand": "npm audit | findstr /C:\"1 critical severity vulnerability\" || exit 0",
"outputIncludes": "found 0 vulnerabilities",
"explanation": "Runs npm's built-in fix tool to resolve known vulnerabilities automatically."
},
{
"description": "Confirm that your project is now free of vulnerabilities.",
"expectedCommand": "npm audit",
"outputIncludes": "0 vulnerabilities",
"explanation": "Verifies that your dependency tree is now secure."
},
{
"description": "Generate a software bill of materials for your project in SPDX format.",
"expectedCommand": "npm sbom --sbom-format=spdx",
"outputIncludes": "spdxVersion",
"explanation": "Creates a standardized SPDX report listing all dependencies and licenses in your project."
},
{
"description": "Check which dependencies are seeking funding.",
"expectedCommand": "npm fund",
"explanation": "Shows which packages support open-source funding and how to contribute."
},
{
"description": "Create a tarball of your package for publishing.",
"expectedCommand": "npm pack",
"checkCommand": "ls my-npm-project-*.tgz | grep -q '.tgz'",
"windowsCheckCommand": "dir my-npm-project-*.tgz 2>nul | findstr /C:\".tgz\"",
"outputIncludes": ".tgz",
"afterCommand": "rm my-npm-project-*.tgz",
"windowsAfterCommand": "del my-npm-project-*.tgz 2>nul",
"explanation": "Generates a compressed archive of your package, simulating what would be published to npm."
},
{
"description": "Symlink your local package for development.",
"expectedCommand": "npm link",
"checkCommand": "npm ls -g | grep -q 'my-npm-project@'",
"windowsCheckCommand": "npm ls -g | findstr /C:\"my-npm-project@\"",
"requireSudo": true,
"explanation": "Creates a global symlink to your package, useful for testing CLI tools or shared modules."
},
{
"description": "Verify that your package is now globally linked.",
"expectedCommand": "npm ls -g",
"explanation": "Checks the global npm registry to confirm your package is linked and available for use."
},
{
"description": "Remove the global symlink to your package.",
"expectedCommand": "npm unlink -g my-npm-project",
"checkCommand": "! npm ls -g | grep -q 'my-npm-project@'",
"windowsCheckCommand": "npm ls -g | findstr /C:\"my-npm-project@\" || exit 0",
"outputIncludes": "removed",
"requireSudo": true,
"explanation": "Unlinks your package from the global registry, cleaning up your development environment."
},
{
"description": "Verify that your package is no longer globally linked.",
"expectedCommand": "npm ls -g",
"explanation": "Ensures your package has been successfully unlinked from the global npm registry."
},
{
"description": "Log in to your npm account.",
"expectedCommand": "npm login",
"checkCommand": "npm whoami | grep -q '.'",
"windowsCheckCommand": "npm whoami 2>nul | findstr /R \".\"",
"outputIncludes": "Logged in",
"requiresUserInput": true,
"skipTest": true,
"explanation": "Authenticates your npm account so you can publish, install private packages, or manage your profile."
},
{
"description": "Check which npm user is currently logged in.",
"expectedCommand": "npm whoami",
"skipTest": true,
"explanation": "Displays the username of the currently authenticated npm account."
},
{
"description": "Log out of your npm account.",
"expectedCommand": "npm logout",
"checkCommand": "! npm whoami 2>/dev/null",
"windowsCheckCommand": "npm whoami 2>nul || exit 0",
"skipTest": true,
"explanation": "Removes your authentication token and ends your npm session."
},
{
"description": "Install Verdaccio globally to create a local npm registry.",
"expectedCommand": "npm install -g verdaccio",
"checkCommand": "verdaccio --version",
"windowsCheckCommand": "verdaccio --version",
"requireSudo": true,
"explanation": "Verdaccio is a lightweight local npm registry. Installing it lets you publish and test packages privately."
},
{
"description": "Point npm to your local registry at http://localhost:4873.",
"expectedCommand": "npm config set registry http://localhost:4873",
"checkCommand": "npm config get registry | grep -q 'localhost:4873'",
"windowsCheckCommand": "npm config get registry | findstr /C:\"localhost:4873\"",
"explanation": "This tells npm to use your local registry instead of the public one."
},
{
"description": "Validate that previous change has been applied successfully.",
"expectedCommand": "npm get registry",
"outputIncludes": "localhost:4873",
"explanation": "This tells npm to use your local registry instead of the public one."
},
{
"description": "Create a local npm user for Verdaccio.",
"expectedCommand": "npm adduser --registry http://localhost:4873",
"beforeCommand": "lsof -ti :4873 | xargs kill 2>/dev/null || true && sleep 2 && rm -rf ~/.config/verdaccio && mkdir -p ~/.config/verdaccio && cat > ~/.config/verdaccio/config.yaml << 'EOF'\nstorage: ./storage\nauth:\n htpasswd:\n file: ./htpasswd\nuplinks:\n npmjs:\n url: https://registry.npmjs.org/\n timeout: 1s\n max_fails: 1\n fail_timeout: 1s\npackages:\n '**':\n access: $all\n publish: $authenticated\n unpublish: $authenticated\nlogs: { type: stdout, format: pretty, level: warn }\nEOF\nverdaccio --listen 0.0.0.0:4873 > verdaccio.log 2>&1 & i=1; while [ $i -le 20 ]; do sleep 1; curl -s http://localhost:4873 >/dev/null 2>&1 && curl -s http://localhost:4873 | grep -q 'Verdaccio' && break; if [ $i -eq 20 ]; then echo 'Verdaccio failed to start'; exit 1; fi; i=$((i + 1)); done && sleep 2",
"windowsBeforeCommand": "node ..\\scripts\\start-verdaccio-detached.js --force",
"preCheckCommand": "curl -s http://localhost:4873 | grep -q 'Verdaccio'",
"windowsPreCheckCommand": "curl -s http://localhost:4873 2>nul | findstr /C:\"Verdaccio\"",
"checkCommand": "npm whoami --registry http://localhost:4873 | grep -q '.'",
"windowsCheckCommand": "npm whoami --registry http://localhost:4873 2>nul | findstr /R \".\"",
"outputIncludes": "Logged in",
"requiresUserInput": true,
"skipTest": true,
"explanation": "Authenticates you with your local registry so you can publish packages. Make sure Verdaccio is running at http://localhost:4873 before proceeding. Verdaccio was installed globally in Task 49. Use --registry flag to ensure you're logging into the local registry, not the public one."
},
{
"description": "Publish your package to the local registry.",
"expectedCommand": "npm publish",
"preCheckCommand": "curl -s http://localhost:4873 | grep -q 'Verdaccio'",
"windowsPreCheckCommand": "curl -s http://localhost:4873 2>nul | findstr /C:\"Verdaccio\"",
"beforeCommand": "if ! curl -s http://localhost:4873 >/dev/null 2>&1; then nohup verdaccio --listen 0.0.0.0:4873 > verdaccio.log 2>&1 & sleep 3; fi",
"windowsBeforeCommand": "npm config set access public && node ..\\scripts\\start-verdaccio-detached.js",
"checkCommand": "npm view my-npm-project --registry http://localhost:4873 | grep -q 'version'",
"windowsCheckCommand": "npm view my-npm-project --registry http://localhost:4873 2>nul | findstr /C:\"version\"",
"outputIncludes": "my-npm-project",
"windowsAfterCommand": "npm config delete access",
"skipTest": true,
"explanation": "Publishes your package to the local registry. We ensure Verdaccio is running before publishing."
},
{
"description": "Install your package from the local registry.",
"expectedCommand": "npm install my-npm-project",
"preCheckCommand": "curl -s http://localhost:4873 | grep -q 'Verdaccio'",
"windowsPreCheckCommand": "curl -s http://localhost:4873 2>nul | findstr /C:\"Verdaccio\"",
"beforeCommand": "if ! curl -s http://localhost:4873 >/dev/null 2>&1; then nohup verdaccio --listen 0.0.0.0:4873 > verdaccio.log 2>&1 & sleep 3; fi",
"windowsBeforeCommand": "node ..\\scripts\\start-verdaccio-detached.js",
"checkCommand": "ls node_modules | grep -q 'my-npm-project'",
"windowsCheckCommand": "dir node_modules 2>nul | findstr /C:\"my-npm-project\"",
"outputIncludes": "added",
"skipTest": true,
"explanation": "Installs your package from the local registry."
},
{
"description": "Remove your my-npm-project package from current project.",
"expectedCommand": "npm uninstall my-npm-project",
"checkCommand": "! ls node_modules | grep -q 'my-npm-project'",
"windowsCheckCommand": "dir node_modules 2>nul | findstr /C:\"my-npm-project\" || exit 0",
"outputIncludes": "removed",
"skipTest": true,
"explanation": "Removes your package from the current project."
},
{
"description": "Deprecate a version of your package with a warning message.",
"expectedCommand": "npm deprecate my-npm-project \"Deprecated due to critical bug\"",
"preCheckCommand": "curl -s http://localhost:4873 | grep -q 'Verdaccio'",
"windowsPreCheckCommand": "curl -s http://localhost:4873 2>nul | findstr /C:\"Verdaccio\"",
"beforeCommand": "if ! curl -s http://localhost:4873 >/dev/null 2>&1; then nohup verdaccio --listen 0.0.0.0:4873 > verdaccio.log 2>&1 & sleep 3; fi",
"windowsBeforeCommand": "node ..\\scripts\\start-verdaccio-detached.js",
"checkCommand": "npm view my-npm-project | grep -i 'deprecated'",
"windowsCheckCommand": "npm view my-npm-project 2>nul | findstr /I /C:\"deprecated\"",
"outputIncludes": "npm notice deprecating",
"skipTest": true,
"explanation": "Marks a specific version of your package as deprecated, warning users who try to install it. We check for any deprecation notice, not a specific message."
},
{
"description": "Remove the deprecation warning from your package version.",
"expectedCommand": "npm undeprecate my-npm-project",
"preCheckCommand": "curl -s http://localhost:4873 | grep -q 'Verdaccio'",
"beforeCommand": "if ! curl -s http://localhost:4873 >/dev/null 2>&1; then nohup verdaccio --listen 0.0.0.0:4873 > verdaccio.log 2>&1 & sleep 3; fi",
"windowsBeforeCommand": "node ..\\scripts\\start-verdaccio-detached.js",
"windowsPreCheckCommand": "exit /b 0",
"checkCommand": "! npm view my-npm-project | grep -i 'deprecated'",
"windowsCheckCommand": "npm view my-npm-project 2>nul | findstr /I /C:\"deprecated\" || exit 0",
"outputIncludes": "npm notice undeprecating",
"skipTest": true,
"explanation": "Undeprecates a previously deprecated version by clearing the warning message."
},
{
"description": "Remove your package from the local registry.",
"expectedCommand": "npm unpublish --force",
"preCheckCommand": "curl -s http://localhost:4873 | grep -q 'Verdaccio'",
"windowsPreCheckCommand": "curl -s http://localhost:4873 2>nul | findstr /C:\"Verdaccio\"",
"beforeCommand": "if ! curl -s http://localhost:4873 >/dev/null 2>&1; then nohup verdaccio --listen 0.0.0.0:4873 > verdaccio.log 2>&1 & sleep 3; fi",
"windowsBeforeCommand": "node ..\\scripts\\start-verdaccio-detached.js",
"checkCommand": "! npm view my-npm-project --registry http://localhost:4873 | grep -q 'version'",
"windowsCheckCommand": "npm view my-npm-project --registry http://localhost:4873 2>nul | findstr /C:\"version\" || exit 0",
"skipTest": true,
"explanation": "Unpublishes your package from the local Verdaccio registry so it can be republished or removed completely."
},
{
"description": "Uninstall Verdaccio from your system.",
"expectedCommand": "npm uninstall -g verdaccio",
"checkCommand": "! command -v verdaccio",
"windowsCheckCommand": "where verdaccio 2>nul || exit 0",
"afterCommand": "lsof -ti :4873 | xargs kill 2>/dev/null || true && rm -f verdaccio.log 2>/dev/null || true && rm -rf ~/.config/verdaccio ~/.local/share/verdaccio ~/.verdaccio 2>/dev/null || true",
"windowsAfterCommand": "..\\scripts\\cleanup-verdaccio.cmd",
"requireSudo": true,
"explanation": "Removes the Verdaccio CLI and clears its registry data so you can start fresh next time."
},
{
"description": "Reset your npm registry to the official public registry https://registry.npmjs.org/",
"expectedCommand": "npm config set registry https://registry.npmjs.org/",
"checkCommand": "npm config get registry | grep -q 'registry.npmjs.org'",
"windowsCheckCommand": "npm config get registry | findstr /C:\"registry.npmjs.org\"",
"explanation": "Restores your npm configuration to use the official public registry. This ensures future installs and publishes go to npmjs.com."
},
{
"description": "Validate your previous change.",
"expectedCommand": "npm get registry",
"outputIncludes": "registry.npmjs.org",
"explanation": "Restores your npm configuration to use the official public registry. This ensures future installs and publishes go to npmjs.com."
},
{
"description": "List owners of lodash npm package.",
"expectedCommand": "npm owner ls lodash",
"explanation": "Displays all users who have publish rights for lodash package."
},
{
"description": "View angular organization memberships.",
"expectedCommand": "npm org ls angular",
"explanation": "Lists users in the angular organization on npm (requires appropriate permissions)."
},
{
"description": "List teams in angular organization.",
"expectedCommand": "npm team ls angular",
"explanation": "Shows all teams within the specified npm organization."
},
{
"description": "Show access permissions for @babel/core.",
"expectedCommand": "npm access list collaborators @babel/core",
"explanation": "Displays who has access to @babel/core and what level of permission they have."
},
{
"description": "Log in to your npm account using npm official registry https://registry.npmjs.org/.",
"expectedCommand": "npm login --registry=https://registry.npmjs.org/",
"strictCommandMatch": true,
"requiresUserInput": true,
"checkCommand": "npm whoami",
"windowsCheckCommand": "npm whoami 2>nul",
"outputIncludes": "Logged in",
"skipTest": true,
"explanation": "Authenticates your npm account using legacy credentials. This is useful for older workflows or when MFA isn't required."
},
{
"description": "List your authentication tokens.",
"expectedCommand": "npm token list",
"skipTest": true,
"explanation": "Shows all active authentication tokens for your account, including automation and session tokens."
},
{
"description": "View the bug tracker URL for axios.",
"expectedCommand": "npm bugs axios",
"strictCommandMatch": true,
"isBrowserCommand": true,
"explanation": "Opens the bug tracker or issue page for the specified package."
},
{
"description": "View the repository URL for axios.",
"expectedCommand": "npm repo axios",
"strictCommandMatch": true,
"isBrowserCommand": true,
"explanation": "Opens the source code repository for the specified package."
},
{
"description": "List dist-tags for axios.",
"expectedCommand": "npm dist-tag ls axios",
"explanation": "Shows all distribution tags for the specified package, such as 'latest' or 'beta'."
},
{
"description": "View the path where global npm packages are installed.",
"expectedCommand": "npm prefix -g",
"explanation": "Displays the global installation prefix, which determines where globally installed packages are stored."
},
{
"description": "Find the root directory of your current npm project.",
"expectedCommand": "npm root",
"explanation": "Shows the root directory where npm installs local packages — typically the node_modules folder."
},
{
"description": "Check if npm command-line completion is available.",
"expectedCommand": "npm completion",
"outputIncludes": "complete",
"windowsOutputIncludes": "ENOTSUP",
"nonZeroOkay": true,
"explanation": "Outputs shell completion script for npm commands, useful for enabling tab-completion in your terminal. Note: On Windows, this only works in Git Bash/MINGW."
},
{
"description": "Star the lodash package to mark it as a favorite.",
"expectedCommand": "npm star lodash ",
"outputIncludes": "lodash",
"skipTest": true,
"explanation": "Stars the specified package on npm, marking it as a favorite in your account."
},
{
"description": "Star the @max-black/npm-practice package to mark it as a favorite.",
"expectedCommand": "npm star @max-black/npm-practice",
"outputIncludes": "npm-practice",
"skipTest": true,
"explanation": "Stars the specified package on npm, marking it as a favorite in your account."
},
{
"doesntWork": true,
"description": "List all packages you've starred on npm.",
"expectedCommand": "npm stars",
"strictCommandMatch": true,
"explanation": "Displays a list of packages you've starred, showing your favorites across npm."
},
{
"description": "Unstar the lodash package to remove it from your favorites.",
"expectedCommand": "npm unstar lodash",
"outputIncludes": "lodash",
"skipTest": true,
"explanation": "Removes the star from the specified package, unmarking it as a favorite."
},
{
"doesntWork": true,
"description": "List all packages you've starred on npm.",
"expectedCommand": "npm stars",
"strictCommandMatch": true,
"explanation": "Displays a list of packages you've starred, showing your favorites across npm."
},
{
"description": "Set VS Code as your editor for npm edit. You need to have VS Code installed and available in your PATH, you can download it from here https://code.visualstudio.com/.",
"expectedCommand": "npm config set editor code",
"checkCommand": "test -n \"$(npm config get editor)\"",
"windowsCheckCommand": "npm config get editor | findstr /R \".\"",
"explanation": "Configures npm to use VS Code for editing packages. VS Code works perfectly with npm edit as it can open entire package folders. If you don't have VS Code installed, download it from https://code.visualstudio.com/ and make sure it's available in your PATH."
},
{
"description": "Verify that VS Code has been configured as your npm editor.",
"expectedCommand": "npm config get editor",
"outputIncludes": "code",
"explanation": "Displays the currently configured npm editor to confirm VS Code has been set. You should see 'code' as the output."
},
{
"description": "Edit the axios package using VS Code editor we configured in previous steps.",
"expectedCommand": "npm edit axios",
"strictCommandMatch": true,
"outputIncludes": "rebuilt dependencies successfully",
"afterCommand": "npm config delete editor",
"requireSudo": true,
"skipTest": true,
"doesntWorkOnWindows": true,
"requiresDisplay": true,
"explanation": "Opens the entire axios package folder in VS Code, where you can browse and edit all files including package.json, source code, and documentation. Note: npm edit has known issues on Windows where the editor doesn't spawn correctly and the rebuild process fails. On Linux/Mac, this command works as expected."
},
{
"description": "Inspect metadata for the current package, and print it's name.",
"expectedCommand": "npm pkg get name",
"explanation": "Retrieves a specific field from your package.json file using npm's pkg subcommand."
},
{
"description": "View your name from your profile information.",
"expectedCommand": "npm profile get name",
"skipTest": true,
"explanation": "Displays your public npm profile name."
},
{
"description": "Install the cowsay package to use in the next exercise.",
"expectedCommand": "npm install cowsay",
"checkCommand": "test -d node_modules/cowsay",
"windowsCheckCommand": "if exist node_modules\\cowsay (exit 0) else (exit 1)",
"explanation": "Installs the cowsay package which provides a fun command-line utility for displaying messages."
},
{
"description": "Execute the cowsay package to print a 'hello' message.",
"expectedCommand": "npm exec cowsay hello",
"outputIncludes": "hello",
"explanation": "Runs the cowsay binary from node_modules using npm exec, demonstrating how to execute package binaries."
},
{
"description": "Execute the cowsay package to print a 'world' message using npx.",
"expectedCommand": "npx cowsay world",
"outputIncludes": "world",
"explanation": "Runs the cowsay binary using npx, which is a shorthand for npm exec and can also download packages temporarily if not installed."
},
{
"description": "Set a start script in your package.json to echo 'Running application...'",
"expectedCommand": "npm pkg set scripts.start=\"echo 'Running application...'\"",
"checkCommand": "npm pkg get scripts.start | grep -q 'Running application'",
"windowsCheckCommand": "npm pkg get scripts.start | findstr /C:\"Running application\"",
"explanation": "Adds or updates the start script in package.json using npm's pkg command to set a simple echo command."
},
{
"description": "Verify the start script was added to your package.json.",
"expectedCommand": "npm pkg get scripts.start",
"explanation": "Retrieves the start script value from package.json to confirm it was set correctly."
},
{
"description": "Run a script named 'start' from your package.json.",
"expectedCommand": "npm run start",
"outputIncludes": "Running",
"explanation": "Executes the 'start' script defined in your package.json file using npm's run command."
},
{
"description": "Start your project using the default script(don't use run).",
"expectedCommand": "npm start",
"outputIncludes": "Running",
"explanation": "Runs the 'start' script from your package.json. Equivalent to 'npm run start'."
},
{
"description": "Set a test script in your package.json to echo 'All tests passed!'",
"expectedCommand": "npm pkg set scripts.test=\"echo 'All tests passed!'\"",
"checkCommand": "npm pkg get scripts.test | grep -q 'All tests passed'",
"windowsCheckCommand": "npm pkg get scripts.test | findstr /C:\"All tests passed\"",
"explanation": "Adds or updates the test script in package.json using npm's pkg command to set a simple echo command that simulates passing tests."
},
{
"description": "Verify the test script was added to your package.json.",
"expectedCommand": "npm pkg get scripts.test",
"outputIncludes": "All tests passed",
"explanation": "Retrieves the test script value from package.json to confirm it was set correctly."
},
{
"description": "Run tests defined in your package.json.",
"expectedCommand": "npm test",
"checkCommand": "grep -q 'test' package.json",
"windowsCheckCommand": "findstr /C:\"test\" package.json",
"outputIncludes": "All tests passed",
"explanation": "Executes the 'test' script from your package.json to run automated tests."
},
{
"description": "Set a stop script in your package.json to echo 'Application stopped.'",
"expectedCommand": "npm pkg set scripts.stop=\"echo 'Application stopped.'\"",
"checkCommand": "npm pkg get scripts.stop | grep -q 'Application stopped'",
"windowsCheckCommand": "npm pkg get scripts.stop | findstr /C:\"Application stopped\"",
"explanation": "Adds or updates the stop script in package.json using npm's pkg command to set a simple echo command that simulates stopping an application."
},
{
"description": "Verify the stop script was added to your package.json.",
"expectedCommand": "npm pkg get scripts.stop",
"outputIncludes": "Application stopped",
"explanation": "Retrieves the stop script value from package.json to confirm it was set correctly."
},
{
"description": "Stop your running npm script using npm stop.",
"expectedCommand": "npm stop",
"outputIncludes": "Application stopped",
"explanation": "Executes the 'stop' script from your package.json to stop the application gracefully."
},
{
"description": "Set a restart script in your package.json to echo 'Application restarted.'",
"expectedCommand": "npm pkg set scripts.restart=\"echo 'Application restarted.'\"",
"checkCommand": "npm pkg get scripts.restart | grep -q 'Application restarted'",
"windowsCheckCommand": "npm pkg get scripts.restart | findstr /C:\"Application restarted\"",
"explanation": "Adds or updates the restart script in package.json using npm's pkg command to set a simple echo command that simulates restarting an application."
},
{
"description": "Verify the restart script was added to your package.json.",
"expectedCommand": "npm pkg get scripts.restart",
"outputIncludes": "Application restarted",
"explanation": "Retrieves the restart script value from package.json to confirm it was set correctly."
},
{
"description": "Restart your npm script by running the restart command.",
"expectedCommand": "npm restart",
"checkCommand": "grep -q 'restart' package.json",
"windowsCheckCommand": "findstr /C:\"restart\" package.json",
"outputIncludes": "Application restarted",
"explanation": "Executes the 'restart' script from your package.json to restart the application gracefully."
},
{
"description": "Search for packages related to 'chalk'.",
"expectedCommand": "npm search chalk",
"outputIncludes": "chalk",
"explanation": "Searches the npm registry for packages matching the keyword 'chalk'."
},
{
"description": "Ping the npm registry to check connectivity.",
"expectedCommand": "npm ping",
"outputIncludes": "PONG",
"explanation": "Tests your connection to the npm registry. Useful for diagnosing network or auth issues."
},
{
"description": "Open documentation for the npm CLI.",
"expectedCommand": "npm docs npm",
"isBrowserCommand": true,
"explanation": "Opens the npm documentation in your default browser, providing help and usage guides."
},
{
"description": "Explain axios package.",
"expectedCommand": "npm explain axios",
"explanation": "Shows how a package is used in your project and why it's installed, including its dependency chain."
},
{
"description": "Search npm help documentation for a keyword 'install'.",
"expectedCommand": "npm help-search install",
"outputIncludes": "npm help install",
"explanation": "Searches the npm CLI documentation for topics related to the keyword, helping you discover relevant commands."
},
{
"description": "Explore the axios package directory and list its contents.",
"expectedCommand": "npm explore axios -- ls",
"windowsExpectedCommand": "npm explore axios -- dir",
"outputIncludes": "index.d.cts",
"explanation": "Spawns a subshell in the axios package directory and runs the 'ls' command to list its contents. This is useful for inspecting package structure and files."
},
{
"description": "Query all direct dependencies using CSS-style selectors.",
"expectedCommand": "npm query ':root > *'",
"windowsExpectedCommand": "npm query \":root > *\"",
"outputIncludes": "axios",
"explanation": "Uses CSS-style selectors to query your dependency tree. The ':root > *' selector returns all direct dependencies of your project."
},
{
"description": "List installed packages with extended information.",
"expectedCommand": "npm ll",
"explanation": "Lists all installed packages with extended information. This is an alias for 'npm ls --long' and shows additional details like package descriptions and homepage URLs."
}
]