update scripts with upath
now using upath within build scripts for better compatibility
This commit is contained in:
parent
0bcdad5961
commit
591ec679dd
6
package-lock.json
generated
6
package-lock.json
generated
@ -2268,6 +2268,12 @@
|
|||||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
|
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"upath": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/upath/-/upath-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"utils-merge": {
|
"utils-merge": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
"prettier": "2.2.1",
|
"prettier": "2.2.1",
|
||||||
"pug": "3.0.2",
|
"pug": "3.0.2",
|
||||||
"sass": "1.32.8",
|
"sass": "1.32.8",
|
||||||
"shelljs": "0.8.4"
|
"shelljs": "0.8.4",
|
||||||
|
"upath": "2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
const sh = require('shelljs');
|
const sh = require('shelljs');
|
||||||
const renderPug = require('./render-pug');
|
const renderPug = require('./render-pug');
|
||||||
|
|
||||||
const srcPath = path.resolve(path.dirname(__filename), '../src');
|
const srcPath = upath.resolve(upath.dirname(__filename), '../src');
|
||||||
|
|
||||||
sh.find(srcPath).forEach(_processFile);
|
sh.find(srcPath).forEach(_processFile);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const sh = require('shelljs');
|
const sh = require('shelljs');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
|
|
||||||
const destPath = path.resolve(path.dirname(__filename), '../dist');
|
const destPath = upath.resolve(upath.dirname(__filename), '../dist');
|
||||||
|
|
||||||
sh.rm('-rf', `${destPath}/*`)
|
sh.rm('-rf', `${destPath}/*`)
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
const sh = require('shelljs');
|
const sh = require('shelljs');
|
||||||
|
|
||||||
module.exports = function renderAssets() {
|
module.exports = function renderAssets() {
|
||||||
const sourcePath = path.resolve(path.dirname(__filename), '../src/assets');
|
const sourcePath = upath.resolve(upath.dirname(__filename), '../src/assets');
|
||||||
const destPath = path.resolve(path.dirname(__filename), '../dist/.');
|
const destPath = upath.resolve(upath.dirname(__filename), '../dist/.');
|
||||||
|
|
||||||
sh.cp('-R', sourcePath, destPath)
|
sh.cp('-R', sourcePath, destPath)
|
||||||
};
|
};
|
@ -1,13 +1,13 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
const pug = require('pug');
|
const pug = require('pug');
|
||||||
const sh = require('shelljs');
|
const sh = require('shelljs');
|
||||||
const prettier = require('prettier');
|
const prettier = require('prettier');
|
||||||
|
|
||||||
module.exports = function renderPug(filePath) {
|
module.exports = function renderPug(filePath) {
|
||||||
const destPath = filePath.replace(/src\/pug\//, 'dist/').replace(/\.pug$/, '.html');
|
const destPath = filePath.replace(/src\/pug\//, 'dist/').replace(/\.pug$/, '.html');
|
||||||
const srcPath = path.resolve(path.dirname(__filename), '../src');
|
const srcPath = upath.resolve(upath.dirname(__filename), '../src');
|
||||||
|
|
||||||
console.log(`### INFO: Rendering ${filePath} to ${destPath}`);
|
console.log(`### INFO: Rendering ${filePath} to ${destPath}`);
|
||||||
const html = pug.renderFile(filePath, {
|
const html = pug.renderFile(filePath, {
|
||||||
@ -16,7 +16,7 @@ module.exports = function renderPug(filePath) {
|
|||||||
basedir: srcPath
|
basedir: srcPath
|
||||||
});
|
});
|
||||||
|
|
||||||
const destPathDirname = path.dirname(destPath);
|
const destPathDirname = upath.dirname(destPath);
|
||||||
if (!sh.test('-e', destPathDirname)) {
|
if (!sh.test('-e', destPathDirname)) {
|
||||||
sh.mkdir('-p', destPathDirname);
|
sh.mkdir('-p', destPathDirname);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const packageJSON = require('../package.json');
|
const packageJSON = require('../package.json');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
const sh = require('shelljs');
|
const sh = require('shelljs');
|
||||||
|
|
||||||
module.exports = function renderScripts() {
|
module.exports = function renderScripts() {
|
||||||
const sourcePath = path.resolve(path.dirname(__filename), '../src/js/scripts.js');
|
|
||||||
const destPath = path.resolve(path.dirname(__filename), '../dist/js/scripts.js');
|
const sourcePath = upath.resolve(upath.dirname(__filename), '../src/js');
|
||||||
|
const destPath = upath.resolve(upath.dirname(__filename), '../dist/.');
|
||||||
|
|
||||||
|
sh.cp('-R', sourcePath, destPath)
|
||||||
|
|
||||||
|
const sourcePathScriptsJS = upath.resolve(upath.dirname(__filename), '../src/js/scripts.js');
|
||||||
|
const destPathScriptsJS = upath.resolve(upath.dirname(__filename), '../dist/js/scripts.js');
|
||||||
|
|
||||||
const copyright = `/*!
|
const copyright = `/*!
|
||||||
* Start Bootstrap - ${packageJSON.title} v${packageJSON.version} (${packageJSON.homepage})
|
* Start Bootstrap - ${packageJSON.title} v${packageJSON.version} (${packageJSON.homepage})
|
||||||
@ -14,12 +20,7 @@ module.exports = function renderScripts() {
|
|||||||
* Licensed under ${packageJSON.license} (https://github.com/StartBootstrap/${packageJSON.name}/blob/master/LICENSE)
|
* Licensed under ${packageJSON.license} (https://github.com/StartBootstrap/${packageJSON.name}/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
`
|
`
|
||||||
const scriptsJS = fs.readFileSync(sourcePath);
|
const scriptsJS = fs.readFileSync(sourcePathScriptsJS);
|
||||||
const destPathDirname = path.dirname(destPath);
|
|
||||||
|
|
||||||
if (!sh.test('-e', destPathDirname)) {
|
fs.writeFileSync(destPathScriptsJS, copyright + scriptsJS);
|
||||||
sh.mkdir('-p', destPathDirname);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFileSync(destPath, copyright + scriptsJS);
|
|
||||||
};
|
};
|
@ -2,24 +2,24 @@
|
|||||||
const autoprefixer = require('autoprefixer')
|
const autoprefixer = require('autoprefixer')
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const packageJSON = require('../package.json');
|
const packageJSON = require('../package.json');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
const postcss = require('postcss')
|
const postcss = require('postcss')
|
||||||
const sass = require('sass');
|
const sass = require('sass');
|
||||||
const sh = require('shelljs');
|
const sh = require('shelljs');
|
||||||
|
|
||||||
const stylesPath = '../src/scss/styles.scss';
|
const stylesPath = '../src/scss/styles.scss';
|
||||||
const destPath = path.resolve(path.dirname(__filename), '../dist/css/styles.css');
|
const destPath = upath.resolve(upath.dirname(__filename), '../dist/css/styles.css');
|
||||||
|
|
||||||
module.exports = function renderSCSS() {
|
module.exports = function renderSCSS() {
|
||||||
|
|
||||||
const results = sass.renderSync({
|
const results = sass.renderSync({
|
||||||
data: entryPoint,
|
data: entryPoint,
|
||||||
includePaths: [
|
includePaths: [
|
||||||
path.resolve(path.dirname(__filename), '../node_modules')
|
upath.resolve(upath.dirname(__filename), '../node_modules')
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
const destPathDirname = path.dirname(destPath);
|
const destPathDirname = upath.dirname(destPath);
|
||||||
if (!sh.test('-e', destPathDirname)) {
|
if (!sh.test('-e', destPathDirname)) {
|
||||||
sh.mkdir('-p', destPathDirname);
|
sh.mkdir('-p', destPathDirname);
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const chokidar = require('chokidar');
|
const chokidar = require('chokidar');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
const renderAssets = require('./render-assets');
|
const renderAssets = require('./render-assets');
|
||||||
const renderPug = require('./render-pug');
|
const renderPug = require('./render-pug');
|
||||||
const renderScripts = require('./render-scripts');
|
const renderScripts = require('./render-scripts');
|
||||||
@ -18,8 +18,8 @@ process.title = 'pug-watch';
|
|||||||
process.stdout.write('Loading');
|
process.stdout.write('Loading');
|
||||||
let allPugFiles = {};
|
let allPugFiles = {};
|
||||||
|
|
||||||
watcher.on('add', filePath => _processFile(filePath, 'add'));
|
watcher.on('add', filePath => _processFile(upath.normalize(filePath), 'add'));
|
||||||
watcher.on('change', filePath => _processFile(filePath, 'change'));
|
watcher.on('change', filePath => _processFile(upath.normalize(filePath), 'change'));
|
||||||
watcher.on('ready', () => {
|
watcher.on('ready', () => {
|
||||||
READY = true;
|
READY = true;
|
||||||
console.log(' READY TO ROLL!');
|
console.log(' READY TO ROLL!');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const concurrently = require('concurrently');
|
const concurrently = require('concurrently');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
|
|
||||||
const browserSyncPath = path.resolve(path.dirname(__filename), '../node_modules/.bin/browser-sync');
|
const browserSyncPath = upath.resolve(upath.dirname(__filename), '../node_modules/.bin/browser-sync');
|
||||||
|
|
||||||
concurrently([
|
concurrently([
|
||||||
{ command: 'node --inspect scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
|
{ command: 'node --inspect scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const concurrently = require('concurrently');
|
const concurrently = require('concurrently');
|
||||||
const path = require('path');
|
const upath = require('upath');
|
||||||
|
|
||||||
const browserSyncPath = path.resolve(path.dirname(__filename), '../node_modules/.bin/browser-sync');
|
const browserSyncPath = upath.resolve(upath.dirname(__filename), '../node_modules/.bin/browser-sync');
|
||||||
|
|
||||||
concurrently([
|
concurrently([
|
||||||
{ command: 'node scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
|
{ command: 'node scripts/sb-watch.js', name: 'SB_WATCH', prefixColor: 'bgBlue.bold' },
|
||||||
|
Loading…
Reference in New Issue
Block a user