Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
config-runtime
Advanced tools
The handoff from the server to client of config values is not simple. Typings are hard, global variables are used and usually not cleaned up and there's no distinction of server and client only configs.
This library is heavily inspired from NextJS Runtime Config.
import { CreateRuntimeConfig, RuntimeConfig } from 'config-runtime'
interface ClientConfig {
foo: string
}
interface ServerConfig {
bar: number
}
const myConfig: RuntimeConfig<ClientConfig, ServerConfig> = {
client: {
foo: 'hello',
},
server: {
bar: 5,
},
}
const Config = new CreateRuntimeConfig<ClientConfig, ServerConfig>(
// Useful for different kinds of config
'__MY_CONFIG_NAME_TOTALLY_OPTIONAL__'
)
// Server entrypoint (only once)
Config.setConfig(
myConfig
)
// Handoff between server and client (html payload)
`<script>${Config.serializedClientConfig}</script>`
// On the server
config.client // { foo: 'hello' }
config.server // { bar: 5 }
// On the client
config.client // { foo: 'hello' }
config.server // Error
new CreateRuntimeConfig(configName)
)serializedClientConfig
, this allows it to be available in Config.clientConfig.client
anywhere and call Config.server
only on the server, doing something else will throw errorsIt doesn't protect against possible runtime errors due to something relying on a server value in the client so be careful.
FAQs
## Motivation
The npm package config-runtime receives a total of 4 weekly downloads. As such, config-runtime popularity was classified as not popular.
We found that config-runtime demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.