forked from OpenUserJS/OpenUserJS.org
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* `npm run clean` ... clears the caches. This is usually done when *uglify-* *(at some point terser)* needs a refreshing after a dep update *(and what I usually get to do by hand for the last few years)* * Renamed existing scripts to match their counterpart names e.g. * `npm run preinstall` ... will get rid of that pesky `package-lock.json` when needed and is run on `npm install` always * `npm run postinstall`... well probably shouldn't run this directly at all but it's there none-the-less NOTE: * Most of these are meant to be very simple scripts. I'd use direct commands but then Windows users would be left out of the mix... so utilizing *node* native APIs Applies to OpenUserJS#249
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
// Define some pseudo module globals | ||
var isPro = require('../libs/debug').isPro; | ||
var isDev = require('../libs/debug').isDev; | ||
var isDbg = require('../libs/debug').isDbg; | ||
|
||
// | ||
// NOTE: Only use native *node* `require`s in this file | ||
// since dependencies may not be installed yet | ||
// | ||
var fs = require('fs'); | ||
|
||
var rmFilesExceptHidden = function (dirPath) { | ||
var files = null; | ||
var filePath = null; | ||
var i = null; | ||
|
||
try { | ||
files = fs.readdirSync(dirPath); | ||
} catch (aE) { | ||
console.warn(dirPath, 'path not found'); | ||
return; | ||
} | ||
|
||
if (files.length > 0) { | ||
for (i = 0; i < files.length; i++) { | ||
filePath = dirPath + '/' + files[i]; | ||
if (fs.statSync(filePath).isFile() && files[i].indexOf('.') !== 0) { | ||
fs.unlinkSync(filePath); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
console.log('Attempting to clean caches'); | ||
rmFilesExceptHidden('./dev/cache/express-minify/release/'); | ||
|
||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters