Skip to content

Commit d342d4c

Browse files
authored
Merge pull request #8890 from CesiumGS/npx
Remove hardcoded node_modules in gulpfile.
2 parents 6b7322a + 114bf48 commit d342d4c

File tree

1 file changed

+15
-33
lines changed

1 file changed

+15
-33
lines changed

gulpfile.cjs

+15-33
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,11 @@ gulp.task("clean", function (done) {
272272

273273
function cloc() {
274274
var cmdLine;
275-
var clocPath = path.join("node_modules", "cloc", "lib", "cloc");
276275

277276
//Run cloc on primary Source files only
278277
var source = new Promise(function (resolve, reject) {
279278
cmdLine =
280-
"perl " +
281-
clocPath +
279+
"npx cloc" +
282280
" --quiet --progress-rate=0" +
283281
" Source/ --exclude-dir=Assets,ThirdParty,Workers --not-match-f=copyrightHeader.js";
284282

@@ -297,8 +295,7 @@ function cloc() {
297295
return source.then(function () {
298296
return new Promise(function (resolve, reject) {
299297
cmdLine =
300-
"perl " +
301-
clocPath +
298+
"npx cloc" +
302299
" --quiet --progress-rate=0" +
303300
" Specs/ --exclude-dir=Data";
304301
child_process.exec(cmdLine, function (error, stdout, stderr) {
@@ -341,30 +338,16 @@ gulp.task("combineRelease", gulp.series("build", combineRelease));
341338

342339
//Builds the documentation
343340
function generateDocumentation() {
344-
var envPathSeperator = os.platform() === "win32" ? ";" : ":";
345-
346-
return new Promise(function (resolve, reject) {
347-
child_process.exec(
348-
"jsdoc --configure Tools/jsdoc/conf.json",
349-
{
350-
env: {
351-
PATH: process.env.PATH + envPathSeperator + "node_modules/.bin",
352-
CESIUM_VERSION: version,
353-
},
354-
},
355-
function (error, stdout, stderr) {
356-
if (error) {
357-
console.log(stderr);
358-
return reject(error);
359-
}
360-
console.log(stdout);
361-
var stream = gulp
362-
.src("Documentation/Images/**")
363-
.pipe(gulp.dest("Build/Documentation/Images"));
364-
return streamToPromise(stream).then(resolve);
365-
}
366-
);
341+
child_process.execSync("npx jsdoc --configure Tools/jsdoc/conf.json", {
342+
stdio: "inherit",
343+
env: Object.assign({}, process.env, { CESIUM_VERSION: version }),
367344
});
345+
346+
var stream = gulp
347+
.src("Documentation/Images/**")
348+
.pipe(gulp.dest("Build/Documentation/Images"));
349+
350+
return streamToPromise(stream);
368351
}
369352
gulp.task("generateDocumentation", generateDocumentation);
370353

@@ -1481,10 +1464,9 @@ function createCesiumJs() {
14811464

14821465
function createTypeScriptDefinitions() {
14831466
// Run jsdoc with tsd-jsdoc to generate an initial Cesium.d.ts file.
1484-
child_process.execSync(
1485-
"node_modules/.bin/jsdoc --configure Tools/jsdoc/ts-conf.json",
1486-
{ stdio: "inherit" }
1487-
);
1467+
child_process.execSync("npx jsdoc --configure Tools/jsdoc/ts-conf.json", {
1468+
stdio: "inherit",
1469+
});
14881470

14891471
var source = fs.readFileSync("Source/Cesium.d.ts").toString();
14901472

@@ -1608,7 +1590,7 @@ ${source}
16081590
fs.writeFileSync("Source/Cesium.d.ts", source);
16091591

16101592
// Use tsc to compile it and make sure it is valid
1611-
child_process.execSync("node_modules/.bin/tsc -p Tools/jsdoc/tsconfig.json", {
1593+
child_process.execSync("npx tsc -p Tools/jsdoc/tsconfig.json", {
16121594
stdio: "inherit",
16131595
});
16141596

0 commit comments

Comments
 (0)