Simple desired state configuration library for Deno

deno-dsc

Simple desired state configuration library for deno. Inspired by Powershell DSC.

What

When you need to get your system into desired state. Quickly, reliably, repeatedly. You can use Ansible, Puppet, Powershell or something else. But this is simple and you can use JavaScript/TypeScript. Deno is the only runtime dependency.

Why

I have built this to spin up my development machine using my dotfiles.

How does it work

Based on your configuration the library build a dependency graph and executes everything missing in right order. Every configuration is first tested and only executed, when the test does not pass. Therefore it is idempotent - you can start it multiple times without worries.

Adding resource

Add configuration type and implement the resource

export interface LoginShellConfig extends Config {
  shell: "zsh";
}

export const LoginShell: Resource<LoginShellConfig> = {
  name: "loginShell",
  get: (config) => {
    //...
  },
  test: async (config, verbose) => {
    //...
  },
  set: async (config, verbose) => {
    //...
  }
};

Add to list of types of resources

type MyResources = Resources | Resource<LoginShellConfig>;

Registr the new resource

registerResource(LoginShell);

Download Details:

Author: lttr

Source Code: https://github.com/lttr/deno-dsc

#deno #nodejs #javascript #node

Simple desired state configuration library for Deno
2.55 GEEK