@jondotsoy/envs 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/envs.js +11 -0
  2. package/package.json +1 -1
package/envs.js CHANGED
@@ -477,11 +477,22 @@ async function edit(ctx) {
477
477
  const pulled = await pull(ctx);
478
478
  if (pulled !== 0)
479
479
  return pulled;
480
+ const original = await Bun.file(valuesPath).text();
481
+ await Bun.write(valuesPath, EDIT_NOTICE + original);
480
482
  const code = await ctx.openEditor(valuesPath);
483
+ const edited = await Bun.file(valuesPath).text();
484
+ if (edited.startsWith(EDIT_NOTICE)) {
485
+ await Bun.write(valuesPath, edited.slice(EDIT_NOTICE.length));
486
+ }
481
487
  if (code !== 0)
482
488
  return code;
483
489
  return await push(ctx);
484
490
  }
491
+ var EDIT_NOTICE = `# \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
492
+ # Close this file when your changes are ready, then they are pushed.
493
+ # To cancel the edit, press Ctrl+C in the terminal and then close this file.
494
+ # \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
495
+ `;
485
496
  async function run(args, ctx = defaultContext()) {
486
497
  const [command = "help"] = args;
487
498
  switch (command) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jondotsoy/envs",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Jonathan Delgado",