Skip to content
Merged

Dev #155

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
11 changes: 11 additions & 0 deletions packages/ducdxf/release.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
module.exports = {
branches: ["main", { name: "next", prerelease: true }, { name: "dev", prerelease: true }],
plugins: [
[
require.resolve("../../scripts/semrel-path-filter.cjs"),
{
paths: [
"packages/ducdxf",
"packages/ducpy"
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing comma after the last array element. The codebase convention is to include trailing commas in array and object literals in JavaScript configuration files for better diff readability and consistency.

Suggested change
"packages/ducpy"
"packages/ducpy",

Copilot uses AI. Check for mistakes.
],
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
],
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Comment on lines 15 to 16
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate plugin configuration detected. The semrel-path-filter.cjs plugin internally uses @semantic-release/commit-analyzer and @semantic-release/release-notes-generator (as seen in lines 56 and 65 of the plugin). Having these plugins listed again on lines 15-16 will cause them to run twice, which could lead to unexpected behavior in the release process. Remove lines 15-16 to avoid duplication.

Suggested change
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",

Copilot uses AI. Check for mistakes.
[
Expand Down
4 changes: 3 additions & 1 deletion packages/ducjs/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ module.exports = {
[
require.resolve("../../scripts/semrel-path-filter.cjs"),
{
path: "packages/ducjs",
paths: [
"packages/ducjs"
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing comma after the last array element. The codebase convention is to include trailing commas in array and object literals in JavaScript configuration files for better diff readability and consistency.

Suggested change
"packages/ducjs"
"packages/ducjs",

Copilot uses AI. Check for mistakes.
],
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
Expand Down
8 changes: 6 additions & 2 deletions packages/ducpdf/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ module.exports = {
[
require.resolve("../../scripts/semrel-path-filter.cjs"),
{
path: "packages/ducpdf",
paths: [
"packages/ducpdf",
"packages/ducjs",
"packages/ducrs"
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing comma after the last array element. The codebase convention is to include trailing commas in array and object literals in JavaScript configuration files for better diff readability and consistency.

Suggested change
"packages/ducrs"
"packages/ducrs",

Copilot uses AI. Check for mistakes.
],
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
],
[
"@semantic-release/exec",
{
prepareCmd: "node ../../scripts/semrel-set-version.js packages/ducsvg ${nextRelease.version}",
prepareCmd: "node ../../scripts/semrel-set-version.js packages/ducpdf ${nextRelease.version}",
publishCmd: "bun publish"
}
],
Expand Down
5 changes: 4 additions & 1 deletion packages/ducpdf/src/duc2pdf/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ module.exports = {
[
require.resolve("../../../../scripts/semrel-path-filter.cjs"),
{
path: "packages/ducpdf/src/duc2pdf",
paths: [
"packages/ducpdf/src/duc2pdf",
"packages/ducrs",
],
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
Expand Down
4 changes: 3 additions & 1 deletion packages/ducpy/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ module.exports = {
[
require.resolve("../../scripts/semrel-path-filter.cjs"),
{
path: "packages/ducpy",
paths: [
"packages/ducpy"
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing comma after the last array element. The codebase convention is to include trailing commas in array and object literals in JavaScript configuration files for better diff readability and consistency.

Suggested change
"packages/ducpy"
"packages/ducpy",

Copilot uses AI. Check for mistakes.
],
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
Expand Down
1 change: 0 additions & 1 deletion packages/ducpy/src/ducpy/builders/element_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def _create_element_wrapper(element_class, base_params, element_params, explicit
# Set required list fields with defaults
base_params.setdefault('group_ids', [])
base_params.setdefault('block_ids', [])
base_params.setdefault('block_ids', [])
base_params.setdefault('region_ids', [])
base_params.setdefault('instance_id', None)

Expand Down
4 changes: 3 additions & 1 deletion packages/ducrs/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ module.exports = {
[
require.resolve("../../scripts/semrel-path-filter.cjs"),
{
path: "packages/ducrs",
paths: [
"packages/ducrs"
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing comma after the last array element. The codebase convention is to include trailing commas in array and object literals in JavaScript configuration files for better diff readability and consistency.

Suggested change
"packages/ducrs"
"packages/ducrs",

Copilot uses AI. Check for mistakes.
],
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
Expand Down
2 changes: 2 additions & 0 deletions packages/ducsvg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

> This library leverages the stable renderer from `ducpdf`, first converting the `duc` document to PDF format before transforming it into SVG using `pdf-into-svg`. This approach ensures high fidelity in the SVG output by utilizing the robust rendering capabilities of the PDF format.

> 💡 Maybe in the future we could refactor `ducpdf` to leverage the growing library [`hayro_svg`](https://docs.rs/hayro-svg/latest/hayro_svg/) to convert PDF to SVG more seamlessly instead of using `pdf-into-svg` (C# library). Reference: [hayro project](https://github.com/LaurenzV/hayro?tab=readme-ov-file)
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent naming in the library reference. The link uses "hayro-svg" (with hyphen) in the URL path, but the text uses "hayro_svg" (with underscore). Based on the actual URL "https://docs.rs/hayro-svg/latest/hayro_svg/", the library name should be "hayro-svg" in the descriptive text to match the package name convention.

Suggested change
> 💡 Maybe in the future we could refactor `ducpdf` to leverage the growing library [`hayro_svg`](https://docs.rs/hayro-svg/latest/hayro_svg/) to convert PDF to SVG more seamlessly instead of using `pdf-into-svg` (C# library). Reference: [hayro project](https://github.com/LaurenzV/hayro?tab=readme-ov-file)
> 💡 Maybe in the future we could refactor `ducpdf` to leverage the growing library [`hayro-svg`](https://docs.rs/hayro-svg/latest/hayro_svg/) to convert PDF to SVG more seamlessly instead of using `pdf-into-svg` (C# library). Reference: [hayro project](https://github.com/LaurenzV/hayro?tab=readme-ov-file)

Copilot uses AI. Check for mistakes.

## Documentation

For detailed documentation, including all available types and utility functions, visit our [Documentation](https://duc.ducflair.com).
Expand Down
13 changes: 8 additions & 5 deletions packages/ducsvg/release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ module.exports = {
[
require.resolve('../../scripts/semrel-path-filter.cjs'),
{
// relative to repo root
path: 'packages/ducsvg',
// pass through any analyzer/notes options you like
analyzer: { preset: 'conventionalcommits' },
notes: { preset: 'conventionalcommits' },
paths: [
"packages/ducsvg",
"packages/ducpdf",
"packages/ducjs",
"packages/ducrs",
],
Comment on lines +7 to +12
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent quote style within the same configuration object. The file uses single quotes for require.resolve('../../scripts/semrel-path-filter.cjs') on line 5, but double quotes for the strings in the paths array and other properties. Consider using double quotes consistently throughout the configuration object to match the codebase convention.

Copilot uses AI. Check for mistakes.
analyzer: { preset: "conventionalcommits" },
notes: { preset: "conventionalcommits" },
},
],
[
Expand Down
38 changes: 29 additions & 9 deletions scripts/semrel-path-filter.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,31 @@ function normalizePrefix(p) {
return p.replace(/\\/g, '/').replace(/\/+$/, '') + '/';
}

async function filterCommitsByPath(commits, pkgPath) {
if (!pkgPath) return commits;
const prefix = normalizePrefix(pkgPath);
/**
* Normalize paths config to an array of prefixes
* Supports `paths` (array) option
*/
function normalizePaths(pluginConfig) {
const { paths } = pluginConfig;

// Ensure paths is an array
const allPaths = Array.isArray(paths) ? paths : [];

// Remove duplicates and normalize
return [...new Set(allPaths)].map(normalizePrefix);
}

async function filterCommitsByPaths(commits, prefixes) {
if (!prefixes || prefixes.length === 0) return commits;
const filtered = [];

for (const c of commits) {
const files = gitChangedFiles(c.hash);
if (files.some(f => f.replace(/\\/g, '/').startsWith(prefix))) {
// Check if any file matches any of the prefixes
if (files.some(f => {
const normalizedFile = f.replace(/\\/g, '/');
return prefixes.some(prefix => normalizedFile.startsWith(prefix));
})) {
filtered.push(c);
}
}
Expand All @@ -28,19 +45,22 @@ async function filterCommitsByPath(commits, pkgPath) {

module.exports = {
analyzeCommits: async (pluginConfig = {}, context) => {
const { path: pkgPath, analyzer = {} } = pluginConfig;
const filtered = await filterCommitsByPath(context.commits, pkgPath);
const { analyzer = {} } = pluginConfig;
const prefixes = normalizePaths(pluginConfig);
const filtered = await filterCommitsByPaths(context.commits, prefixes);

context.logger.log(`[path-filter] ${filtered.length}/${context.commits.length} commits affect "${pkgPath}"`);
const pathsDisplay = prefixes.map(p => p.slice(0, -1)).join(', ');
context.logger.log(`[path-filter] ${filtered.length}/${context.commits.length} commits affect "${pathsDisplay}"`);
if (filtered.length === 0) return null;

const { analyzeCommits: analyze } = await import('@semantic-release/commit-analyzer');
return analyze(analyzer, { ...context, commits: filtered });
},

generateNotes: async (pluginConfig = {}, context) => {
const { path: pkgPath, notes = {} } = pluginConfig;
const filtered = await filterCommitsByPath(context.commits, pkgPath);
const { notes = {} } = pluginConfig;
const prefixes = normalizePaths(pluginConfig);
const filtered = await filterCommitsByPaths(context.commits, prefixes);

const { generateNotes: genNotes } = await import('@semantic-release/release-notes-generator');
return genNotes(notes, { ...context, commits: filtered });
Expand Down