@jdeighan/coffee-utils 4.0.6 → 4.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
 - package/src/fs_utils.coffee +22 -1
 - package/src/fs_utils.js +25 -1
 
    
        package/package.json
    CHANGED
    
    
    
        package/src/fs_utils.coffee
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ import { 
     | 
|
| 
       7 
7 
     | 
    
         
             
            import {fileURLToPath} from 'url'
         
     | 
| 
       8 
8 
     | 
    
         
             
            import {
         
     | 
| 
       9 
9 
     | 
    
         
             
            	existsSync, copyFileSync, readFileSync, writeFileSync, readdirSync,
         
     | 
| 
       10 
     | 
    
         
            -
            	createReadStream, mkdirSync, renameSync,
         
     | 
| 
      
 10 
     | 
    
         
            +
            	createReadStream, mkdirSync, renameSync, statSync,
         
     | 
| 
       11 
11 
     | 
    
         
             
            	} from 'fs'
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            import {
         
     | 
| 
         @@ -184,3 +184,24 @@ export allPathsTo = (fname, searchDir) -> 
     | 
|
| 
       184 
184 
     | 
    
         
             
            		return lPaths
         
     | 
| 
       185 
185 
     | 
    
         
             
            	else
         
     | 
| 
       186 
186 
     | 
    
         
             
            		return []
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
            # ---------------------------------------------------------------------------
         
     | 
| 
      
 189 
     | 
    
         
            +
             
     | 
| 
      
 190 
     | 
    
         
            +
            export newerDestFileExists = (srcPath, destPath) ->
         
     | 
| 
      
 191 
     | 
    
         
            +
             
     | 
| 
      
 192 
     | 
    
         
            +
            	debug "enter newerDestFileExists()"
         
     | 
| 
      
 193 
     | 
    
         
            +
            	if ! existsSync(destPath)
         
     | 
| 
      
 194 
     | 
    
         
            +
            		debug "return false from newerDestFileExists() - no file"
         
     | 
| 
      
 195 
     | 
    
         
            +
            		return false
         
     | 
| 
      
 196 
     | 
    
         
            +
            	srcModTime = statSync(srcPath).mtimeMs
         
     | 
| 
      
 197 
     | 
    
         
            +
            	destModTime = statSync(destPath).mtimeMs
         
     | 
| 
      
 198 
     | 
    
         
            +
            	debug "srcModTime = #{srcModTime}"
         
     | 
| 
      
 199 
     | 
    
         
            +
            	debug "destModTime = #{destModTime}"
         
     | 
| 
      
 200 
     | 
    
         
            +
            	if destModTime >= srcModTime
         
     | 
| 
      
 201 
     | 
    
         
            +
            		debug "#{destPath} is up to date"
         
     | 
| 
      
 202 
     | 
    
         
            +
            		debug "return true from newerDestFileExists()"
         
     | 
| 
      
 203 
     | 
    
         
            +
            		return true
         
     | 
| 
      
 204 
     | 
    
         
            +
            	else
         
     | 
| 
      
 205 
     | 
    
         
            +
            		debug "#{destPath} is old"
         
     | 
| 
      
 206 
     | 
    
         
            +
            		debug "return false from newerDestFileExists()"
         
     | 
| 
      
 207 
     | 
    
         
            +
            		return false
         
     | 
    
        package/src/fs_utils.js
    CHANGED
    
    | 
         @@ -22,7 +22,8 @@ import { 
     | 
|
| 
       22 
22 
     | 
    
         
             
              readdirSync,
         
     | 
| 
       23 
23 
     | 
    
         
             
              createReadStream,
         
     | 
| 
       24 
24 
     | 
    
         
             
              mkdirSync,
         
     | 
| 
       25 
     | 
    
         
            -
              renameSync
         
     | 
| 
      
 25 
     | 
    
         
            +
              renameSync,
         
     | 
| 
      
 26 
     | 
    
         
            +
              statSync
         
     | 
| 
       26 
27 
     | 
    
         
             
            } from 'fs';
         
     | 
| 
       27 
28 
     | 
    
         | 
| 
       28 
29 
     | 
    
         
             
            import {
         
     | 
| 
         @@ -238,3 +239,26 @@ export var allPathsTo = function(fname, searchDir) { 
     | 
|
| 
       238 
239 
     | 
    
         
             
                return [];
         
     | 
| 
       239 
240 
     | 
    
         
             
              }
         
     | 
| 
       240 
241 
     | 
    
         
             
            };
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
      
 243 
     | 
    
         
            +
            // ---------------------------------------------------------------------------
         
     | 
| 
      
 244 
     | 
    
         
            +
            export var newerDestFileExists = function(srcPath, destPath) {
         
     | 
| 
      
 245 
     | 
    
         
            +
              var destModTime, srcModTime;
         
     | 
| 
      
 246 
     | 
    
         
            +
              debug("enter newerDestFileExists()");
         
     | 
| 
      
 247 
     | 
    
         
            +
              if (!existsSync(destPath)) {
         
     | 
| 
      
 248 
     | 
    
         
            +
                debug("return false from newerDestFileExists() - no file");
         
     | 
| 
      
 249 
     | 
    
         
            +
                return false;
         
     | 
| 
      
 250 
     | 
    
         
            +
              }
         
     | 
| 
      
 251 
     | 
    
         
            +
              srcModTime = statSync(srcPath).mtimeMs;
         
     | 
| 
      
 252 
     | 
    
         
            +
              destModTime = statSync(destPath).mtimeMs;
         
     | 
| 
      
 253 
     | 
    
         
            +
              debug(`srcModTime = ${srcModTime}`);
         
     | 
| 
      
 254 
     | 
    
         
            +
              debug(`destModTime = ${destModTime}`);
         
     | 
| 
      
 255 
     | 
    
         
            +
              if (destModTime >= srcModTime) {
         
     | 
| 
      
 256 
     | 
    
         
            +
                debug(`${destPath} is up to date`);
         
     | 
| 
      
 257 
     | 
    
         
            +
                debug("return true from newerDestFileExists()");
         
     | 
| 
      
 258 
     | 
    
         
            +
                return true;
         
     | 
| 
      
 259 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 260 
     | 
    
         
            +
                debug(`${destPath} is old`);
         
     | 
| 
      
 261 
     | 
    
         
            +
                debug("return false from newerDestFileExists()");
         
     | 
| 
      
 262 
     | 
    
         
            +
                return false;
         
     | 
| 
      
 263 
     | 
    
         
            +
              }
         
     | 
| 
      
 264 
     | 
    
         
            +
            };
         
     |