1+ const fs = require ( 'fs' ) ;
12const path = require ( 'path' ) ;
23const packlist = require ( 'npm-packlist' ) ;
34const tar = require ( 'tar' ) ;
@@ -8,12 +9,12 @@ const { validate_path, promisified, default_ignore_rules, definitely_posix } = r
89/**
910 *
1011 * @param relative_package_path {string}
11- * @returns {Promise< {package_json_path: string, package_path: string, package_json_filename: string, package_json_content: *}> }
12+ * @returns {{package_json_path: string, package_path: string, package_json_filename: string, package_json_content: *} }
1213 */
13- async function get_package_details ( relative_package_path ) {
14+ function get_package_details ( relative_package_path ) {
1415 const package_path = path . resolve ( relative_package_path ) ;
1516
16- if ( ! await promisified . fs . exists ( package_path ) ) {
17+ if ( ! fs . existsSync ( package_path ) ) {
1718 throw new Error ( `Module '${ relative_package_path } ' was not found in '${ path . resolve ( ) } '.` ) ;
1819 }
1920
@@ -42,11 +43,11 @@ async function get_ignore_file_rules(relative_package_path) {
4243
4344 try {
4445 // try to read .npmignore
45- ignorefile = await promisified . fs . readFile ( npmignorePath , 'utf-8' ) ;
46+ ignorefile = await fs . promises . readFile ( npmignorePath , 'utf-8' ) ;
4647 } catch ( e ) {
4748 // .npmignore not found, try to read .gitignore
4849 try {
49- ignorefile = await promisified . fs . readFile ( gitignorePath , 'utf-8' ) ;
50+ ignorefile = await fs . promises . readFile ( gitignorePath , 'utf-8' ) ;
5051 } catch ( e ) {
5152 // No ignore file found
5253 return [ ] ;
@@ -133,7 +134,7 @@ async function create_tarball({ name: local_dependency_name, version: local_depe
133134 throw new Error ( `Could not pack module '${ local_dependency_path } '` ) ;
134135 }
135136
136- if ( ! await promisified . fs . exists ( tarball_path ) ) {
137+ if ( ! fs . existsSync ( tarball_path ) ) {
137138 throw new Error ( `Could not locate the created tarball '${ tarball_name } ' in '${ temp_path } '.` ) ;
138139 }
139140
@@ -179,7 +180,7 @@ async function install_tarball(tarball_name, { temp_path, cwd, manager = 'pnpm'
179180async function delete_tarball ( tarball_name , { temp_path } ) {
180181 // console.log('delete_tarball', tarball_name);
181182 const tarball_path = path . resolve ( temp_path , tarball_name ) ;
182- await promisified . fs . unlink ( tarball_path ) ;
183+ await fs . promises . unlink ( tarball_path ) ;
183184}
184185
185186module . exports = {
0 commit comments