Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align properties of websmith CLI and webpack-loader options #53

Open
2 tasks done
jwloka opened this issue Jan 24, 2025 · 0 comments · May be fixed by #54
Open
2 tasks done

Align properties of websmith CLI and webpack-loader options #53

jwloka opened this issue Jan 24, 2025 · 0 comments · May be fixed by #54
Assignees
Labels
enhancement New feature or request

Comments

@jwloka
Copy link
Member

jwloka commented Jan 24, 2025

Suggestion

websmith in the current version uses different names, value types and even structure in configuration properties. We should align the properties in CompilerOptions and CompilationConfig with the properties in PluginArguments to use similar if not the same naming and structure.

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing websmith addons
  • This wouldn't negatively impact the performance of the websmith build process without opt-in

Existing addons wouldn't be affected by the change, but existing configuration need be adjusted

⭐ Suggestion

  • Move and rename CompilationConfig#configFilePath to CompilerOptions#configFile.
  • Change PluginArguments#addons to string[]
  • Rename PluginArguments#config to PluginArguments#configFile
  • Add PluginArguments#config: CompilationConfig
  • Add PluginArguments#tsConfig: tsCompilerOptions
  • Change PluginArguments#targets to string[]
  • Rename PluginArguments to WebsmithLoaderOptions
  • Rename PluginOptions to WebsmithLoaderConfig

All added and changed properties should remain optional.

📃 Motivating Example

After this refactoring the configurations would almost look the same:

compilerConfig = {
    targets: ["*"],
    configFile: path.join(OUTPUT_DIR, "websmith.config.json"),
    config: {
        addonsDir: ADDONS_DIR,
        addons: ["example-transformer"],
        targets: {
            "target-expected": {
                addons: ["example-transformer"],
            },
        },
    },
};
loaderConfig = {
    targets: ["*"],
    webpackTarget: "*",
    configFile: path.join(OUTPUT_DIR, "websmith.config.json"),
    config: {
        addonsDir: ADDONS_DIR,
        addons: ["example-transformer"],
        targets: {
            "target-expected": {
                addons: ["example-transformer"],
            },
        },
    }.
}
@jwloka jwloka added the enhancement New feature or request label Jan 24, 2025
@jwloka jwloka self-assigned this Jan 24, 2025
jwloka added a commit that referenced this issue Jan 25, 2025
* Remove unused default values
* Handle targets in compiler and webpack still differently

fixes #53
jwloka added a commit that referenced this issue Jan 25, 2025
jwloka added a commit that referenced this issue Jan 25, 2025
jwloka added a commit that referenced this issue Jan 25, 2025
jwloka added a commit that referenced this issue Jan 25, 2025
and PluginOptions to WebsmithLoaderConfig

fixes #53
jwloka added a commit that referenced this issue Jan 26, 2025
jwloka added a commit that referenced this issue Jan 26, 2025
jwloka added a commit that referenced this issue Jan 26, 2025
jwloka added a commit that referenced this issue Jan 26, 2025
This change aligns the CLI with standard TSC.

fixes #53
jwloka added a commit that referenced this issue Jan 26, 2025
jwloka added a commit that referenced this issue Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant