1+ const {
2+ fs,
3+ path
4+ } = require ( '@vuepress/shared-utils' )
5+ const _ = require ( 'lodash' ) ;
6+ const toTitleCase = require ( 'to-title-case' ) ;
7+
8+ const tutorials = [ ] ;
9+
10+ const getTutorialsFolderRoot = fs . readdirSync ( path . resolve ( __dirname , '../../../../api/guides/tutorials' ) ) ;
11+ // .map(filename => 'introduction/' + filename.slice(0, -3))
12+ // .sort()
13+
14+ _ . filter ( getTutorialsFolderRoot , function ( levelOne ) {
15+ if ( levelOne !== 'index.md' ) {
16+ // console.log('levelOne: ', levelOne);
17+
18+ let levelOneName = levelOne . replace ( / - / g, ' ' ) ;
19+
20+ levelOneName = toTitleCase ( levelOneName )
21+
22+ // console.log('levelOneName: ', levelOneName);
23+
24+ const getTutorialsFolderLevelOne = fs . readdirSync ( path . resolve ( __dirname , '../../../../api/guides/tutorials/' + levelOne ) ) ;
25+
26+ // console.log('levelTwo: ', getTutorialsFolderLevelOne);
27+
28+ let getTutorialsFolderLevelOneChildren = [ ]
29+
30+ _ . filter ( getTutorialsFolderLevelOne , function ( levelTwo ) {
31+
32+ let levelTwoName = levelTwo . replace ( / - / g, ' ' ) ;
33+
34+ levelTwoName = toTitleCase ( levelTwoName )
35+
36+ let child = [ '/api/guides/tutorials/' + levelOne + '/' + levelTwo + '/' , levelTwoName ]
37+
38+ // console.log('child: ', child);
39+
40+ getTutorialsFolderLevelOneChildren . push ( child )
41+ } )
42+
43+
44+ let tutorialSidebarGroup = {
45+ title : levelOneName , // required
46+ // collapsable: false,
47+ sidebarDepth : 0 ,
48+ children : getTutorialsFolderLevelOneChildren ,
49+ // children: create_and_Send_payments,
50+ // children: [
51+ // ['/api/guides/tutorials/payments/', 'Overview'],
52+ // ['/api/guides/tutorials/payments/request', 'Request Payment'],
53+ // ['/api/guides/tutorials/payments/send', 'Send Payment'],
54+ // ],
55+ initialOpenGroupIndex : - 1
56+ } ;
57+
58+ tutorials . push ( tutorialSidebarGroup )
59+ }
60+ } )
61+
62+ // console.log('tutorials: ', tutorials);
63+
64+ // console.log('create_and_Send_payments: ', create_and_Send_payments);
65+
166function tutorial_payments ( ) {
267 return {
368 title : 'Request and Send Payments' , // required
469 // collapsable: false,
570 sidebarDepth : 0 ,
6- children : [
7- [ '/api/guides/tutorials/payments/' , 'Overview' ] ,
8- [ '/api/guides/tutorials/payments/request' , 'Request Payment' ] ,
9- [ '/api/guides/tutorials/payments/send' , 'Send Payment' ] ,
10- ] ,
71+ // children: create_and_Send_payments,
72+ // children: [
73+ // ['/api/guides/tutorials/payments/', 'Overview'],
74+ // ['/api/guides/tutorials/payments/request', 'Request Payment'],
75+ // ['/api/guides/tutorials/payments/send', 'Send Payment'],
76+ // ],
1177 initialOpenGroupIndex : - 1
1278 } ;
1379}
@@ -26,12 +92,14 @@ function tutorial_implementation_integration() {
2692 } ;
2793}
2894
29- const sidebars = [
30- // Payments
31- tutorial_payments ( ) ,
32- // Implementation and Integration
33- tutorial_implementation_integration ( ) ,
34- ]
95+ const sidebars = tutorials ;
96+
97+ // const sidebars = [
98+ // // Payments
99+ // tutorial_payments(),
100+ // // Implementation and Integration
101+ // tutorial_implementation_integration(),
102+ // ]
35103
36104module . exports = {
37105 title : 'Tutorials' , // required
0 commit comments