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

55 introducing profiles replace compilation targets with profiles #61

Merged

Conversation

jwloka
Copy link
Member

@jwloka jwloka commented Mar 20, 2025

Compilation Profiles are here. This PR replaces websmith targets with a concept of compilation profiles. Choose a single profile to customize the compilation process with adjusted compiler options, different outDir and extra addons. A compilation profile can depend on other profiles, which results in a merge of compiler options and addons config. The order in the dependency chain defines the resulting options (last wins) and the order in which the addons are applied.

This PR also establishes the websmith CLI as drop-in replacement for the tsc. The tsc's CLI options are supported and same compilation results are emitted with websmith's default configuration, i.e., no addon is applied if not explicitly configured. The package '@quatico/websmith-webpack' is renamed to 'websmith-loader' as new drop-in replacement for the 'ts-loader'. Simply replace the ts-loader with same configuration and add addons or a profile to customized the compilation process.

Last but not least this PR provides in-place compilation for addons written in TS. Simply add new addon code in TS and run websmith. No need compiling the addons in advance.

Besides these major changes, this PR includes several updates to the documentation and configuration files to improve clarity and functionality. These changes involve renaming concepts related to the compilation process, adding new ESLint rules, and updating examples in the documentation:

Documentation Updates:

Configuration Updates:

  • eslint.config.js: Added eslint-plugin-unicorn to the configuration and included new rules for unicorn plugin. [1] [2] [3] [4] [5]
  • jest-base.config.ts: Added a new pattern to modulePathIgnorePatterns to exclude temporary directories from Jest tests.

Introducing Profiles: Replace compilation targets with profiles #55
* Remove default value "*" for webpackTarget property
* Remove default value ["*"] for targets property

Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
…rOptions to CompilationConfig

Introducing Profiles: Replace compilation targets with profiles #55
…tion in WebsmithLoaderOptions

Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
…rename examples to indicate the addons intention

Introducing Profiles: Replace compilation targets with profiles #55
…ve unused profile property, use browser-system in tests

Introducing Profiles: Replace compilation targets with profiles #55
…e test API

Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Breaking: You can now use only a single property with 'profile' that should result in the same output as use of the prior 'webpackTarget' property. If you have used multiple profiles as a chain of profiles, try the new 'depends' property in the CompilationProfile configuration.

Introducing Profiles: Replace compilation targets with profiles #55
+ Replace public writeable properties
+ Limit the compilation to a single profile

Introducing Profiles: Replace compilation targets with profiles #55
…place types

Introducing Profiles: Replace compilation targets with profiles #55
…tate for Compiler and TsCompiler

Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
+ Move test function into production scope of module core
+ Remove test specific fallbacks

Introducing Profiles: Replace compilation targets with profiles #55
…ectConfig to parsedCommandLine

Introducing Profiles: Replace compilation targets with profiles #55
jwloka added 19 commits March 6, 2025 08:21
+ Adds dependency to comment-json for parsing tsconfig.json files with comments

Introducing Profiles: Replace compilation targets with profiles #55
Introducing Profiles: Replace compilation targets with profiles #55
…mpilerOptions

Introducing Profiles: Replace compilation targets with profiles #55
…rOptions

Introducing Profiles: Replace compilation targets with profiles #55
+ Remove buildDir from CompilationContext
+ Remove default tsconfig.json from PROD context
+ Fix default tsconfig.json in TEST context
+ Remove duplicates when copying with deepmerge
+ Remove program, compilationHost and LanguageService from compiler

Introducing Profiles: Replace compilation targets with profiles #55
…inimum

+ Replace duplicate of resolvePath with resolvePath from "core"
+ Reduce tsDefaults to be closer to tsc defaults
+ Remove program from Compiler state
+ Allow for same arguments with websmith
+ Provide common way of resolving a ParsedCommandLine
+ Replace WebsmithLoaderOptions with WebpackLoaderOptions
+ Replace more path.join with resolvePath calls
+ Remove Upath from project
+ Remove .js from testRegex and don't watch generated files
+ Remove deprecated @types declarations
+ Fixes linting issues in eslint.config.js
…Args

+ Replaces path.join and resolveProjectPath with resolvePath
+ Allow for overlapping relative path when merging paths
+ Unifies tsConfig from configFile, config param and profiles
+ Ensure we websmith config file is written correctly
+ Extract code for test file handling
@jwloka jwloka added documentation Improvements or additions to documentation enhancement New feature or request dependencies Pull requests that update a dependency file labels Mar 20, 2025
@jwloka jwloka added this to the 55 milestone Mar 20, 2025
@jwloka jwloka requested a review from meck93 March 20, 2025 07:15
@jwloka jwloka linked an issue Mar 20, 2025 that may be closed by this pull request
3 tasks
};

export const createWatchHost = (
rootFiles: string[],
compilerOptions: ts.CompilerOptions,
tsConfig: ts.CompilerOptions,
Copy link
Member

Choose a reason for hiding this comment

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

War der Name vorher nicht präziser?

Ich nehme an, dass gegeben der Typ nur der "CompilerOptions" Teil, der TS Config erlaubt ist. Eventuell hättest du es auch einfach tsConfigCompilerOptions nennen können.

Copy link
Member Author

Choose a reason for hiding this comment

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

tsConfig is aligned with tsConfigFile for the TS configuration vs. config and configFile for the websmith configuration. We've got a few compilerOptions and have to discriminate them somehow.

Introducing Profiles: Replace compilation targets with profiles #55
@jwloka jwloka merged commit e0f2ca3 into develop Mar 25, 2025
2 checks passed
@jwloka jwloka deleted the 55-introducing-profiles-replace-compilation-targets-with-profiles branch March 25, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introducing Profiles: Replace compilation targets with profiles
2 participants