Skip to content

Commit 2b97141

Browse files
Support for running directly with gulp for assets install task
1 parent 6c21223 commit 2b97141

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

build/gulpfile.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { default: Bundler, ValidateRawConfig, MergeRawConfigs } = require("@userf
66
const { default: minifyJs } = require("gulp-uglify-es");
77
const { execSync } = require("child_process");
88
const { readFileSync, existsSync, writeFileSync } = require("fs");
9-
const { resolve: resolvePath } = require("path");
9+
const { resolve: resolvePath, normalize: normalisePath } = require("path");
1010
const { src, dest, series } = require("gulp");
1111
const { sync: deleteSync } = require("del");
1212
const concatCss = require("gulp-concat-css");
@@ -43,6 +43,7 @@ const publicAssetsDir = rootDir + "public/assets/";
4343
const legacyVendorAssetsGlob = rootDir + "sprinkles/*/assets/vendor/**";
4444
const sprinkleBundleFile = "asset-bundles.json";
4545
const vendorAssetsDir = rootDir + "app/assets/";
46+
const buildDirFromVendorAssetsDir = "../../build/";
4647

4748
// Load sprinkles
4849
let sprinkles;
@@ -88,14 +89,14 @@ async function assetsInstall() {
8889

8990
// Perform installation
9091
// NPM will automatically remove extraneous packages (barring algorithm failure) during install
91-
Logger("Running npm install");
92+
Logger("Running npm install (using npm from PATH)");
9293
execSync("npm install", {
9394
cwd: vendorAssetsDir,
9495
stdio: doILog ? "inherit" : ""
9596
});
9697

9798
// Conduct audit
98-
Logger("Running npm audit");
99+
Logger("Running npm audit (using npm from PATH)");
99100
try {
100101
execSync("npm audit", {
101102
cwd: vendorAssetsDir,
@@ -107,7 +108,7 @@ async function assetsInstall() {
107108
}
108109

109110
// Browserify dependencies
110-
Logger("Running browserify against npm dependencies with a main entrypoint");
111+
Logger("Running browserify against npm dependencies with a compatible main entrypoint");
111112
deleteSync(vendorAssetsDir + "browser_modules/", { force: true });
112113
await browserifyDependencies({
113114
dependencies: Object.keys(pkg.dependencies),
@@ -155,7 +156,7 @@ async function assetsInstall() {
155156
// Perform installation
156157
Logger("Running bower install -q --allow-root");
157158
// --allow-root stops bower from complaining about being in 'sudo' in various situations
158-
execSync("bower install -q --allow-root", {
159+
execSync(normalisePath(buildDirFromVendorAssetsDir + "node_modules/.bin/bower") + " install -q --allow-root", {
159160
cwd: vendorAssetsDir,
160161
stdio: doILog ? "inherit" : ""
161162
});

build/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"private": true,
33
"dependencies": {
4-
"@userfrosting/browserify-dependencies": "^1.0.0-alpha.3",
5-
"@userfrosting/gulp-bundle-assets": "^3.0.0-beta.1",
4+
"@userfrosting/browserify-dependencies": "^1.0.0-beta.1",
5+
"@userfrosting/gulp-bundle-assets": "^3.0.0-rc.1",
66
"@userfrosting/merge-package-dependencies": "^1.2.1",
77
"bower": "^1.8.4",
88
"del": "^3.0.0",

0 commit comments

Comments
 (0)