Skip to content

lttr/deno-dsc

Repository files navigation

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);

Test

deno task test

About

Simple desired state configuration library, inspired by Powershell DSC

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published