Socket
Socket
Sign inDemoInstall

@coffeekraken/s-config-folder-adapter

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coffeekraken/s-config-folder-adapter

Config folder adapter that allows you to load .config.(j|t)s files from multiple folders. This is used in the @coffeekraken/s-sugar-config package.


Version published
Weekly downloads
172
decreased by-58.15%
Maintainers
1
Weekly downloads
 
Created
Source

@coffeekraken/s-config-folder-adapter

MIT 2.0.0-alpha.20 - Git repository

size downloads license discord

Config folder adapter that allows you to load .config.(j|t)s files from multiple folders. This is used in the @coffeekraken/s-sugar-config package.

Install

npm i @coffeekraken/s-config-folder-adapter

SConfigFolderAdapter

This package expose a simple SConfigFolderAdapter class that let you load some configuration from folders that you set. This adapter is used in the @coffeekraken/s-sugar-config package.

Features

  • Let you specify your own folders
  • Support for "scopes" in your folders
    • Allows you to specify your folders in different scopes:
      • default: Used for default configs
      • module: Used for configs that came from an imported module
      • repo: Used for root repo configs. In a monorepo, this will be the monorepo root
      • package: `Used for root package config.
      • user: Used for user configuration
    • Each of these levels will be overrided by the level bellow it. The user configs will be the most strong ones
  • Let you specify a fileName pattern like %name.config.js
    • The %name token will represent storage in the file named storage.config.js and will be used as config property name.
  • Let you specify a folderName like sugar that you can then use in your scopes folders paths like /my/cool/folder/%folderName.
  • And more...

Usage

Here's a simple example how to use the SConfigFolderAdapter class:

import __SConfigFolderAdapter from '@coffeekraken/s-config-folder-adapter';

const myFolderAdapter = new __SConfigFolderAdapter({
  configAdapter: {
    name: 'my-folder-adapter',
  },
  configFolderAdapter: {
    folderName: '.my-configs',
    fileName: '%name.config.js',
    scopes: {
      // obviously some paths here will be relative to your project...
      default: ['/where/to/find/my/default/configs/%folderName'],
      module: ['/where/to/find/my/module/configs/%folderName'],
      repo: ['/where/to/find/my/repo/configs/%folderName'],
      package: ['/where/to/find/my/package/configs/%folderName'],
      user: ['/where/to/find/my/user/configs/%folderName'],
    },
  },
});
const myConfig = new __SConfig('my-config', myFolderAdapter);

API

For more information about the API, please check out the API documentation

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Here's all the ways you can contact us listed:

discord email

FAQs

Package last updated on 15 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc