From cfe8e2bceb984e28fc41ddaf6954e9bec43bb4d4 Mon Sep 17 00:00:00 2001 From: Bhushan Palsapure Date: Tue, 18 Aug 2026 21:09:34 +0100 Subject: [PATCH] fix: Issue 2447 - Updated code to remove 'vf-core-components' folder under assets --- tools/vf-core/CHANGELOG.md | 4 ++++ tools/vf-core/gulp-tasks/vf-assets.mjs | 31 ++++++++++++++++++++++---- tools/vf-core/gulp-tasks/vf-css.mjs | 21 +++++++++++++++-- tools/vf-core/package.json | 2 +- 4 files changed, 51 insertions(+), 7 deletions(-) diff --git a/tools/vf-core/CHANGELOG.md b/tools/vf-core/CHANGELOG.md index ac8e9b1092..2a671a3bd2 100644 --- a/tools/vf-core/CHANGELOG.md +++ b/tools/vf-core/CHANGELOG.md @@ -1,5 +1,9 @@ ### 2.2.52 +* Fix : Fixed the issue for the 'vf-core-components' folder being added for component assets [Tracking issue](https://github.com/visual-framework/vf-core/issues/2447) + +### 2.2.52 + * Removed : Removed reference of Slack from the website [Tracking issue](https://github.com/visual-framework/vf-core/issues/2366) ### 2.2.51 diff --git a/tools/vf-core/gulp-tasks/vf-assets.mjs b/tools/vf-core/gulp-tasks/vf-assets.mjs index 34c55e14f4..ecd9b2d81f 100644 --- a/tools/vf-core/gulp-tasks/vf-assets.mjs +++ b/tools/vf-core/gulp-tasks/vf-assets.mjs @@ -1,4 +1,5 @@ import svgmin from "gulp-svgmin"; +import _toesmTemp1 from "stream"; "use strict"; /** @@ -8,6 +9,24 @@ import svgmin from "gulp-svgmin"; export default function(gulp, path, componentPath, buildDestionation) { + const Transform = _toesmTemp1.Transform; + + // Keep output layout stable for downstream consumers by removing only a + // leading vf-core-components/ segment when present. + function stripVfCoreComponentsPrefix() { + return new Transform({ + objectMode: true, + transform(file, _, done) { + const relativePath = file.relative.replace(/\\/g, "/"); + if (relativePath.indexOf("vf-core-components/") === 0) { + const normalizedPath = relativePath.replace(/^vf-core-components\//, ""); + file.path = path.resolve(file.base, normalizedPath); + } + done(null, file); + } + }); + } + // Utility task to minify SVGs // After running you should check the quality differences of an SVG, and the @@ -22,21 +41,24 @@ export default function(gulp, path, componentPath, buildDestionation) { // make each component's `./assets` directory available gulp.task("vf-component-assets:directory", function() { return gulp - .src([componentPath + "/**/assets/**/*"], { encoding: false }) + .src([componentPath + "/**/assets/**/*"], { encoding: false, base: componentPath }) + .pipe(stripVfCoreComponentsPrefix()) .pipe(gulp.dest(buildDestionation + "/assets")); }); // make each component's `./vf-component.css` compiled CSS available gulp.task("vf-component-assets:compiled-css", function() { return gulp - .src([componentPath + "/**/*.css"], { encoding: false }) + .src([componentPath + "/**/*.css"], { encoding: false, base: componentPath }) + .pipe(stripVfCoreComponentsPrefix()) .pipe(gulp.dest(buildDestionation + "/assets")); }); // make each component's `./*.js` files available gulp.task("vf-component-assets:js", function() { return gulp - .src([componentPath + "/**/*.js"], { encoding: false }) + .src([componentPath + "/**/*.js"], { encoding: false, base: componentPath }) + .pipe(stripVfCoreComponentsPrefix()) .pipe(gulp.dest(buildDestionation + "/assets")); }); @@ -44,7 +66,8 @@ export default function(gulp, path, componentPath, buildDestionation) { // note: you shouldn't use this in combination with the other vf-commponent-assets tasks (redundant) gulp.task("vf-component-assets:everything", function() { return gulp - .src([componentPath + "/**/*.*"], { encoding: false }) + .src([componentPath + "/**/*.*"], { encoding: false, base: componentPath }) + .pipe(stripVfCoreComponentsPrefix()) .pipe(gulp.dest(buildDestionation + "/assets")); }); diff --git a/tools/vf-core/gulp-tasks/vf-css.mjs b/tools/vf-core/gulp-tasks/vf-css.mjs index 0eb813e999..dfd116a929 100644 --- a/tools/vf-core/gulp-tasks/vf-css.mjs +++ b/tools/vf-core/gulp-tasks/vf-css.mjs @@ -209,12 +209,29 @@ const Transform = _toesmTemp1.Transform; // Sass Lint // For stylelint config rules see .stylelinrc const vfScssLintPaths = [componentPath+"/**/embl-*.scss", componentPath+"/**/vf-*.scss", "!"+componentPath+"/**/index.scss", "!assets/**/*.scss", "!"+componentPath+"/vf-design-tokens/dist/**/*.scss"]; + + function vfStylelintFormatter(results) { + let output = ""; + results.forEach(function(result) { + if (!result.warnings || result.warnings.length === 0) { + return; + } + + output += result.source + "\n"; + result.warnings.forEach(function(warning) { + output += " " + warning.line + ":" + warning.column + " " + warning.severity + " " + warning.text + "\n"; + }); + }); + + return output; + } + gulp.task("vf-lint:scss-soft-fail", function() { return gulp .src(vfScssLintPaths) .pipe(gulpStylelint({ failAfterError: false, - reporters: [{formatter: "string", console: false}] + reporters: [{formatter: vfStylelintFormatter, console: false}] })); }); gulp.task("vf-lint:scss-hard-fail", function() { @@ -222,7 +239,7 @@ const Transform = _toesmTemp1.Transform; .src(vfScssLintPaths) .pipe(gulpStylelint({ failAfterError: true, - reporters: [{formatter: "string", console: true}] + reporters: [{formatter: vfStylelintFormatter, console: true}] })); }); diff --git a/tools/vf-core/package.json b/tools/vf-core/package.json index 58abab0759..08742b6084 100644 --- a/tools/vf-core/package.json +++ b/tools/vf-core/package.json @@ -1,6 +1,6 @@ { "name": "@visual-framework/vf-core", - "version": "2.2.52", + "version": "2.2.53", "description": "Common dependencies for the Visual Framework.", "engines": { "node": ">=14.x"