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

feat(config): update config package #82

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ardalanamini
Copy link
Member

No description provided.

This commit updates the `config` package with the following changes:
- Renamed `#src/config` to `#src/config-content`
- Updated imports in `config.cjs.ts` and `config.esm.ts`
- Added a new file, `config.ts`, which exports a class called `Config`
- Added a new file, `index.ts`, which exports an instance of the `Config` class
- Added new files for different configurations: json, jsonp, proxy, query, server and subdomain.
- Each configuration has its own schema and constructor function.
@ardalanamini ardalanamini self-assigned this Jun 25, 2023
@ardalanamini ardalanamini linked an issue Jun 25, 2023 that may be closed by this pull request
@changeset-bot
Copy link

changeset-bot bot commented Jun 25, 2023

⚠️ No Changeset found

Latest commit: 923e128

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Jun 25, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 923e128. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


🟥 Failed Commands
nx affected -t test --parallel 2 -- --ci --coverage --verbose --runInBand
✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@codecov
Copy link

codecov bot commented Jun 25, 2023

Codecov Report

Merging #82 (a1ce0e5) into main (0ed9a81) will increase coverage by 8.91%.
The diff coverage is 97.00%.

❗ Current head a1ce0e5 differs from pull request most recent head 923e128. Consider uploading reports for the commit 923e128 to get more accurate results

@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
+ Coverage   84.67%   93.59%   +8.91%     
==========================================
  Files          47       63      +16     
  Lines        1684     6558    +4874     
  Branches      401      567     +166     
==========================================
+ Hits         1426     6138    +4712     
- Misses        242      410     +168     
+ Partials       16       10       -6     
Flag Coverage Δ
config 96.27% <97.00%> (+31.27%) ⬆️
foxify 84.10% <ø> (+23.82%) ⬆️
fresh 100.00% <ø> (ø)
http 94.26% <ø> (+6.33%) ⬆️
inject 98.38% <ø> (+0.98%) ⬆️
router 98.80% <ø> (+1.87%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/config/src/config.esm.ts 0.00% <0.00%> (ø)
packages/config/src/config/query.config.ts 87.91% <87.91%> (ø)
packages/config/src/config/server.config.ts 88.48% <88.48%> (ø)
packages/config/src/config.cjs.ts 100.00% <100.00%> (+14.28%) ⬆️
packages/config/src/config/config.ts 100.00% <100.00%> (ø)
packages/config/src/config/index.ts 100.00% <100.00%> (ø)
packages/config/src/config/json.config.ts 100.00% <100.00%> (ø)
packages/config/src/config/jsonp.config.ts 100.00% <100.00%> (ø)
packages/config/src/config/proxy.config.ts 100.00% <100.00%> (ø)
packages/config/src/config/router.config.ts 100.00% <100.00%> (ø)
... and 9 more

... and 38 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ardalanamini ardalanamini marked this pull request as draft July 1, 2023 11:59
This change moves the `etag` property from `Config` to `ServerConfig` class.
This commit adds an event emitter to the config module that emits a `change` event whenever a configuration value is modified.
The event includes the name of the modified property, the new value, and the old value.
This allows other parts of the application to listen for these events and react accordingly.
- Added `RouterConfig` class to handle router configuration.
- Updated `Config` class to include `router` property.
- Updated `index.ts` to export `Config` type.
- Updated `JsonpConfig` class to fix the type of the `callback` property from number to string.
- Updated `ProxyConfig` class to fix the type of the `trust` property and added validation for different types of values.
- Updated `QueryConfig` class to fix the type of the `parser` property and added validation for different types of values.
- Updated `ServerConfig` class to add support for ETag generation and HTTP2/HTTPS certificates.
Signed-off-by: Ardalan Amini <ardalanamini22@gmail.com>
This commit adds support for configuring views in the Foxify framework. It introduces a new `ViewConfig` class that allows users to specify the directory containing view templates, the view template file extension, and a custom renderer function. The `Foxify` class now has methods to enable/disable view rendering and set the view engine.

The changes also include updates to the `Server` class to pass the view configuration settings when creating instances of `Request` and `Response`.
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.

refactor: improve @foxify/config usability
1 participant