@@ -4,12 +4,12 @@ import path from 'path';
44import { Callback } from '@verdaccio/types' ;
55
66// locks a file by creating a lock file
7- const lockFile = function ( name : string , callback : Callback ) {
7+ const lockFile = function ( name : string , callback : Callback ) {
88 const statDir = ( name : string ) => {
9- return new Promise ( ( resolve , reject ) => {
9+ return new Promise < any > ( ( resolve , reject ) => {
1010 // test to see if the directory exists
1111 const dirPath = path . dirname ( name ) ;
12- fs . stat ( dirPath , function ( err , stats ) {
12+ fs . stat ( dirPath , function ( err , stats ) {
1313 if ( err ) {
1414 return reject ( err ) ;
1515 } else if ( ! stats . isDirectory ( ) ) {
@@ -22,9 +22,9 @@ const lockFile = function (name: string, callback: Callback) {
2222 } ;
2323
2424 const statfile = ( name : string ) => {
25- return new Promise ( ( resolve , reject ) => {
25+ return new Promise < any > ( ( resolve , reject ) => {
2626 // test to see if the directory exists
27- fs . stat ( name , function ( err , stats ) {
27+ fs . stat ( name , function ( err , stats ) {
2828 if ( err ) {
2929 return reject ( err ) ;
3030 } else if ( ! stats . isFile ( ) ) {
@@ -76,9 +76,9 @@ const lockFile = function (name: string, callback: Callback) {
7676} ;
7777
7878// unlocks file by removing existing lock file
79- const unlockFile = function ( name : string , next : Callback ) {
79+ const unlockFile = function ( name : string , next : Callback ) {
8080 const lockFileName = `${ name } .lock` ;
81- locker . unlock ( lockFileName , function ( ) {
81+ locker . unlock ( lockFileName , function ( ) {
8282 return next ( null ) ;
8383 } ) ;
8484} ;
@@ -92,7 +92,7 @@ const unlockFile = function (name: string, next: Callback) {
9292 * @param {* } options
9393 * @param {* } callback
9494 */
95- function readFile ( name : string , options : any = { } , callback : any = ( ) => { } ) {
95+ function readFile ( name : string , options : any = { } , callback : any = ( ) => { } ) {
9696 if ( typeof options === 'function' ) {
9797 callback = options ;
9898 options = { } ;
@@ -101,13 +101,13 @@ function readFile(name: string, options: any = {}, callback: any = () => { }) {
101101 options . lock = options . lock || false ;
102102 options . parse = options . parse || false ;
103103
104- const lock = function ( options : { lock : string } ) {
105- return new Promise ( ( resolve , reject ) => {
104+ const lock = function ( options : { lock : string } ) {
105+ return new Promise < any > ( ( resolve , reject ) => {
106106 if ( ! options . lock ) {
107107 return resolve ( null ) ;
108108 }
109109
110- lockFile ( name , function ( err : any ) {
110+ lockFile ( name , function ( err : any ) {
111111 if ( err ) {
112112 return reject ( err ) ;
113113 }
@@ -116,9 +116,9 @@ function readFile(name: string, options: any = {}, callback: any = () => { }) {
116116 } ) ;
117117 } ;
118118
119- const read = function ( ) {
120- return new Promise ( ( resolve , reject ) => {
121- fs . readFile ( name , 'utf8' , function ( err , contents ) {
119+ const read = function ( ) {
120+ return new Promise < any > ( ( resolve , reject ) => {
121+ fs . readFile ( name , 'utf8' , function ( err , contents ) {
122122 if ( err ) {
123123 return reject ( err ) ;
124124 }
@@ -128,7 +128,7 @@ function readFile(name: string, options: any = {}, callback: any = () => { }) {
128128 } ) ;
129129 } ;
130130
131- const parseJSON = function ( contents : any ) {
131+ const parseJSON = function ( contents : any ) {
132132 return new Promise ( ( resolve , reject ) => {
133133 if ( ! options . parse ) {
134134 return resolve ( contents ) ;
0 commit comments