Skip to content

Commit 7f8bc1b

Browse files
authored
Fix highlights.js and gulpfile (#317)
1 parent 6dad458 commit 7f8bc1b

File tree

4 files changed

+23
-382
lines changed

4 files changed

+23
-382
lines changed

gulpfile.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ var fs = require("graceful-fs"),
2424
// For compat with older versions of Node.js.
2525
require("es6-promise").polyfill();
2626

27+
// Suppress Node.js deprecation warnings during build output.
28+
// process.noDeprecation = true;
29+
2730
// To suppress memory leak warning from gulp.watch().
2831
require("events").EventEmitter.prototype._maxListeners = 100;
2932

@@ -121,16 +124,31 @@ function resolveAssetGroupPaths(assetGroup, assetManifestPath) {
121124
assetGroup.inputs.forEach(inputPath => {
122125

123126
var resolvedPath = path.resolve(path.join(assetGroup.basePath, inputPath)).replace(/\\/g, '/');
127+
var isNodeModulesPath = inputPath.startsWith("node_modules/") || inputPath.startsWith("./node_modules/");
124128

125129
if (resolvedPath.includes('*')) {
126130
var sortedPaths = glob.sync(resolvedPath, {});
127131

132+
// Fall back to repo root 'node_modules' when modules are not restored locally.
133+
if (isNodeModulesPath && sortedPaths.length === 0) {
134+
var rootResolvedPath = path.resolve(inputPath).replace(/\\/g, '/');
135+
sortedPaths = glob.sync(rootResolvedPath, {});
136+
}
137+
128138
sortedPaths.sort();
129139

130140
sortedPaths.forEach(sortedPath => {
131141
inputPaths.push(sortedPath.replace(/\\/g, '/'));
132142
});
133143
} else {
144+
// Fall back to repo root 'node_modules' when modules are not restored locally.
145+
if (isNodeModulesPath && !fs.existsSync(resolvedPath)) {
146+
var rootResolvedPath = path.resolve(inputPath).replace(/\\/g, '/');
147+
if (fs.existsSync(rootResolvedPath)) {
148+
resolvedPath = rootResolvedPath;
149+
}
150+
}
151+
134152
inputPaths.push(resolvedPath);
135153
}
136154
});
@@ -205,6 +223,7 @@ function buildCssPipeline(assetGroup, doConcat, doRebuild) {
205223
.pipe(gulpif("*.less", less()))
206224
.pipe(gulpif("*.scss", scss({
207225
precision: 10,
226+
silenceDeprecations: ["legacy-js-api"],
208227

209228
})))
210229
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
@@ -239,7 +258,8 @@ function buildCssPipeline(assetGroup, doConcat, doRebuild) {
239258
.pipe(gulpif(generateSourceMaps, sourcemaps.init()))
240259
.pipe(gulpif("*.less", less()))
241260
.pipe(gulpif("*.scss", scss({
242-
precision: 10
261+
precision: 10,
262+
silenceDeprecations: ["legacy-js-api"]
243263
})))
244264
.pipe(gulpif(doConcat, concat(assetGroup.outputFileName)))
245265
.pipe(gulpif(generateRTL, postcss([rtl()])))
@@ -266,12 +286,6 @@ function buildJsPipeline(assetGroup, doConcat, doRebuild) {
266286
declaration: false,
267287
noImplicitAny: true,
268288
noEmitOnError: true,
269-
lib: [
270-
"dom",
271-
"es5",
272-
"scripthost",
273-
"es2015.iterable"
274-
],
275289
target: "es5",
276290
};
277291

src/Modules/CrestApps.OrchardCore.Resources/ResourceManagementOptionsConfiguration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ static ResourceManagementOptionsConfiguration()
100100
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js",
101101
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js")
102102
.SetCdnIntegrity(
103-
"sha384-ckHiE7G6MBk/VbsEcbfcaFLRwMRNnHMOP4LQwuAfJJTMKHGEcsFXkTjl1HBO7UBR",
104-
"sha384-ckHiE7G6MBk/VbsEcbfcaFLRwMRNnHMOP4LQwuAfJJTMKHGEcsFXkTjl1HBO7UBR")
103+
"sha384-RH2xi4eIQ/gjtbs9fUXM68sLSi99C7ZWBRX1vDrVv6GQXRibxXLbwO2NGZB74MbU",
104+
"sha384-RH2xi4eIQ/gjtbs9fUXM68sLSi99C7ZWBRX1vDrVv6GQXRibxXLbwO2NGZB74MbU")
105105
.SetVersion("11.11.1");
106106

107107
_manifest

0 commit comments

Comments
 (0)