Skip to content

Commit 2bda1cc

Browse files
committed
build: exclude phoenix-pro/unit-tests from minification and concatenation
1 parent 4362753 commit 2bda1cc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

gulpfile.js/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ function makeJSDist() {
144144
return src(['src/**/*.js', '!src/**/unittest-files/**/*', "!src/thirdparty/prettier/**/*",
145145
"!src/thirdparty/no-minify/**/*", "!src/thirdparty/xterm/**/*",
146146
"!src/LiveDevelopment/BrowserScripts/RemoteFunctions.js",
147-
"!src/extensionsIntegrated/phoenix-pro/onboarding/**/*"])
147+
"!src/extensionsIntegrated/phoenix-pro/onboarding/**/*",
148+
"!src/extensionsIntegrated/phoenix-pro/unit-tests/**/*"])
148149
.pipe(minify({
149150
ext:{
150151
min:'.js'
@@ -178,7 +179,8 @@ function makeNonMinifyDist() {
178179
return src(["src/thirdparty/no-minify/**/*",
179180
"src/thirdparty/xterm/**/*",
180181
"src/LiveDevelopment/BrowserScripts/RemoteFunctions.js",
181-
"src/extensionsIntegrated/phoenix-pro/onboarding/**/*"], {base: 'src'})
182+
"src/extensionsIntegrated/phoenix-pro/onboarding/**/*",
183+
"src/extensionsIntegrated/phoenix-pro/unit-tests/**/*"], {base: 'src'})
182184
.pipe(dest('dist'));
183185
}
184186

@@ -549,6 +551,10 @@ function listAllJsFilesRecursively(dirPath) {
549551

550552
// Check if the file is a directory.
551553
if (fs.statSync(filePath).isDirectory()) {
554+
// Skip unit-tests folders in phoenix-pro - they should not be concatenated or minified
555+
if (filePath.includes('phoenix-pro') && file === 'unit-tests') {
556+
return;
557+
}
552558
// Recursively list all JS files in the directory.
553559
const nestedFiles = listAllJsFilesRecursively(filePath);
554560
allFiles.push(...nestedFiles);
@@ -670,7 +676,7 @@ function inlineTextRequire(file, content, srcDir, isDevBuild = true) {
670676
if((requirePath.endsWith(".js") && !requirePath.includes("./") && !requirePath.includes("../")) // js files that are relative paths are ok
671677
|| excludeSuffixPathsInlining.some(ext => requirePath.endsWith(ext))) {
672678
console.warn("Not inlining JS/JSON file:", requirePath, filePath);
673-
if(filePath.includes("phoenix-pro")) {
679+
if(filePath.includes("phoenix-pro") && !filePath.includes("unit-tests")) {
674680
// this is needed as we will delete the extension sources when packaging for release.
675681
// so non inlined content will not be available in the extension. throw early to detect that.
676682
throw new Error(`All Files in phoenix pro extension should be inlineable!: failed for ${filePath}`);

0 commit comments

Comments
 (0)