Skip to content

完成0.3.0版本#2

Merged
TM-SunnyDay merged 10 commits into
mainfrom
next
Jul 29, 2025
Merged

完成0.3.0版本#2
TM-SunnyDay merged 10 commits into
mainfrom
next

Conversation

@TM-SunnyDay

Copy link
Copy Markdown
Member

This pull request introduces several significant updates to the project, including the addition of a development container, a GitHub Actions workflow for testing, enhancements to documentation, and expanded test coverage. Below is a breakdown of the most important changes:

Development Environment Enhancements

  • Added a new development container configuration in .devcontainer/devcontainer.json to streamline setup with a pre-configured TypeScript Node environment and useful VS Code extensions.

Continuous Integration

  • Introduced a GitHub Actions workflow in .github/workflows/tests.yml to automate testing across Node.js versions 18, 20, and 22. The workflow also uploads code coverage reports to Codecov.

Documentation Improvements

  • Created a CHANGELOG.md file following the "Keep a Changelog" format to document all notable changes in the project.
  • Updated README.md and README.zh-CN.md with examples for new features, such as map rules, transform options, and nested processing. Added a Codecov badge to indicate test coverage. [1] [2] [3] [4] [5] [6]

Feature Enhancements

  • Expanded the test suite in __tests__/index.test.ts to include both filter and map rule scenarios, ensuring comprehensive coverage of the new functionality. [1] [2] [3]

These changes collectively improve the project's development experience, testing reliability, and documentation clarity.

@TM-SunnyDay TM-SunnyDay requested a review from Copilot July 29, 2025 09:20
@codecov

codecov Bot commented Jul 29, 2025

Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces version 0.3.0 of the postcss-wrap-up-layer plugin with significant enhancements including map rules support, transform options configuration, improved development tooling, and comprehensive test coverage. The update maintains backward compatibility while adding powerful new features for dynamic layer name generation.

  • Added map rules functionality for dynamic layer name generation based on file paths
  • Introduced transform options to control which at-rules stay outside @layer blocks
  • Enhanced development environment with devcontainer, GitHub Actions CI/CD, and updated tooling

Reviewed Changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/utils.ts New utility file defining FilterRuleItem, MapRuleItem interfaces and type guards
src/transform.ts Enhanced transform function with TransformOptions interface and configurable outsideAtRules
src/index.ts Updated main plugin logic to support both filter and map rules with transform options
tsconfig.main.json Updated TypeScript configuration to extend Node.js 22 config and added verbatimModuleSyntax
package.json Version bump to 0.3.0 with updated dependencies and build scripts
tests/*.test.ts Expanded test suite covering new functionality and type definitions
README.md Updated documentation with examples for new features and comprehensive API reference
CHANGELOG.md Added comprehensive changelog following "Keep a Changelog" format
.github/workflows/tests.yml New GitHub Actions workflow for automated testing across Node.js versions
.devcontainer/devcontainer.json Development container configuration for consistent development environment
Comments suppressed due to low confidence (1)

tests/index.test.ts:305

  • The test for unknown rule types uses @ts-expect-error but doesn't verify runtime behavior. Consider adding assertions to ensure unknown rule types are properly filtered out or handled gracefully.
        // @ts-expect-error - unknown rule type

Comment thread src/index.ts
import { transform } from './transform';
import { transform, type TransformOptions } from './transform.js';
import { isFilterRule, isMapRule, type RuleItem } from './utils.js';
export type { RuleItem, FilterRuleItem, MapRuleItem } from './utils.js';

Copilot AI Jul 29, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Consider placing type exports at the end of the file after the main plugin export to follow conventional TypeScript module organization patterns.

Copilot uses AI. Check for mistakes.
Comment thread src/index.ts
} else if (isMapRule(rule)) {
const mapResult = rule.map(path, source.input);
if (typeof mapResult === 'string') {
root.nodes = transform(nodes, mapResult, root.source, Object.assign({}, opts.transformOptions));

Copilot AI Jul 29, 2025

Copy link

Choose a reason for hiding this comment

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

The Object.assign pattern is used inconsistently. Consider using the spread operator { ...opts.transformOptions } for consistency with line 49, or use Object.assign consistently throughout.

Suggested change
root.nodes = transform(nodes, mapResult, root.source, Object.assign({}, opts.transformOptions));
root.nodes = transform(nodes, mapResult, root.source, { ...opts.transformOptions });

Copilot uses AI. Check for mistakes.
@TM-SunnyDay TM-SunnyDay merged commit e3da294 into main Jul 29, 2025
7 checks passed
@TM-SunnyDay TM-SunnyDay deleted the next branch July 29, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants