File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 22 "extends": ["airbnb-base", "plugin:node/recommended"],
33 "rules": {
44 "no-console": off,
5+ "comma-dangle": [error, always-multiline, {functions: never}]
56 }
67}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const utils = require('../utils');
1111 */
1212function getToken ( user = undefined , jsonPath = '' ) {
1313 let auth = { } ;
14+ let ghData ;
1415 const authPath = jsonPath || settings . authPath ;
1516 const authFile = utils . resolvePath ( authPath ) ;
1617
@@ -20,12 +21,14 @@ function getToken(user = undefined, jsonPath = '') {
2021 throw error ;
2122 }
2223
23- let { token } = auth . github [ 0 ] ;
24-
2524 if ( user ) {
26- token = auth . github . filter ( obj => obj . user === user ) [ 0 ] . token ;
25+ [ ghData ] = auth . github . filter ( obj => obj . user === user ) ;
26+ } else {
27+ [ ghData ] = auth . github ;
2728 }
2829
30+ const { token } = ghData ;
31+
2932 if ( ! token ) {
3033 throw new Error ( 'Token missing' ) ;
3134 }
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ function normalizeName(filepath) {
4545 */
4646function copyDirRecursive ( currentPath = './' , destPath = '../new' ) {
4747 let dest = resolvePath ( destPath ) ;
48- let current = resolvePath ( currentPath ) ;
48+ const current = resolvePath ( currentPath ) ;
4949
5050 // Create the dest folder
5151 if ( ! fs . existsSync ( dest ) ) {
@@ -54,7 +54,8 @@ function copyDirRecursive(currentPath = './', destPath = '../new') {
5454 }
5555
5656 // Read files in folder
57- let files = fs . readdirSync ( current ) ;
57+ const files = fs . readdirSync ( current ) ;
58+
5859 for ( file of files ) {
5960 src = resolvePath ( path . join ( current , file ) ) ;
6061 dest = resolvePath ( path . join ( destPath , file ) ) ;
@@ -72,6 +73,7 @@ function copyDirRecursive(currentPath = './', destPath = '../new') {
7273
7374function deleteDirRecursive ( folderPath ) {
7475 const dirPath = resolvePath ( folderPath ) ;
76+
7577 if ( fs . existsSync ( dirPath ) ) {
7678 fs . readdirSync ( dirPath ) . forEach ( ( file ) => {
7779 const curPath = resolvePath ( path . join ( dirPath , file ) ) ;
You can’t perform that action at this time.
0 commit comments