这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@humphd
Copy link
Owner

@humphd humphd commented Dec 29, 2024

This adds support for more runtimes (deno, bun, node.js, browser, etc) and simplifies the public interface to be a single function, decryptSops(), which can accept a file-like object/stream, or an options Object with filepath or URL where a SOPS file can be found.

I've cleaned up some old code/files that I missed before.

I should add tests for Deno, Bun, Browser, etc. but it can happen in a follow-up.

@humphd
Copy link
Owner Author

humphd commented Dec 29, 2024

In a follow-up, the rest of the node-specific stuff should get removed (e.g., process.env.*).

@humphd
Copy link
Owner Author

humphd commented Dec 29, 2024

Added smoke tests for node (CJS), deno (ESM/TS), and bun (ESM/TS). Made env var access work in deno and bun as well as node. Moved test related stuff below tests/*

@@ -1,3 +1,4 @@
// @ts-ignore - need to build before this will exist
import { decryptSops } from "../../../dist/index.js";
Copy link
Collaborator

@tarasglek tarasglek Dec 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about bun, but I suspect for deno the correct solution is to import-map sops-age to ../../../src/index.ts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can leave this as is, more for future reference for experimentation

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For smoke tests, I wanted to use the built version vs. what's in src/ so I can test how the various formats get bundled. We could add a prepare script to build things when you install, or even put dist in git; but I think the above is fine for testing.

Copy link
Collaborator

@tarasglek tarasglek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really impressive. I didn't think about adding a smoketest for deno/bun. Would be nice to smoketest browser too, but no idea how to do that.

@humphd
Copy link
Owner Author

humphd commented Dec 30, 2024

For browser, we can use Playwright, but I didn't feel like (re)learning it over the holidays. I'll add one when I have some time.

@humphd humphd merged commit 5a1fa81 into main Dec 30, 2024
8 checks passed
@humphd humphd deleted the humphd/support-more-runtimes branch December 30, 2024 14:17
@tarasglek
Copy link
Collaborator

For browser, we can use Playwright, but I didn't feel like (re)learning it over the holidays. I'll add one when I have some time.

i was hoping there was some playwright vitest mode by now.

@humphd
Copy link
Owner Author

humphd commented Dec 31, 2024

Playwright basically is Vitest, it won't be hard to add.

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.

3 participants