Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/vf-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
31 changes: 27 additions & 4 deletions tools/vf-core/gulp-tasks/vf-assets.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import svgmin from "gulp-svgmin";
import _toesmTemp1 from "stream";
"use strict";

/**
Expand All @@ -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
Expand All @@ -22,29 +41,33 @@ 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"));
});

// copy all the files in a component
// 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"));
});

Expand Down
21 changes: 19 additions & 2 deletions tools/vf-core/gulp-tasks/vf-css.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,37 @@ 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() {
return gulp
.src(vfScssLintPaths)
.pipe(gulpStylelint({
failAfterError: true,
reporters: [{formatter: "string", console: true}]
reporters: [{formatter: vfStylelintFormatter, console: true}]
}));
});

Expand Down
2 changes: 1 addition & 1 deletion tools/vf-core/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Loading