@townco/secret 0.1.73 → 0.1.75

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/dist/index.js +17 -0
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import * as fs from "node:fs/promises";
1
2
  import * as path from "node:path";
2
3
  import { findRoot } from "@townco/core";
3
4
  import { EnvFile } from "@townco/env";
@@ -127,10 +128,26 @@ export const deleteSecret = withOpSignIn(async (name) => {
127
128
  return secrets;
128
129
  })(name);
129
130
  });
131
+ const symlinkEnvToPaths = async (envPath, symlinkPaths) => {
132
+ for (const symlinkPath of symlinkPaths) {
133
+ const targetPath = path.relative(path.dirname(symlinkPath), envPath);
134
+ try {
135
+ await fs.symlink(targetPath, symlinkPath);
136
+ }
137
+ catch (e) {
138
+ // Ignore if file already exists
139
+ if (e.code !== "EEXIST")
140
+ throw e;
141
+ }
142
+ }
143
+ };
130
144
  export const genenv = withOpSignIn(async () => {
131
145
  const root = await findRoot();
132
146
  const inputPath = path.join(root, SECRET_FILE);
133
147
  const outputPath = path.join(root, ".env");
134
148
  // Use OpItem to inject and resolve secret references
135
149
  await OnePassword.inject(inputPath, outputPath);
150
+ await symlinkEnvToPaths(outputPath, [
151
+ path.join(root, "apps/shed/.env.local"),
152
+ ]);
136
153
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/secret",
3
- "version": "0.1.73",
3
+ "version": "0.1.75",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,11 +21,11 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@1password/connect": "^1.4.2",
24
- "@townco/env": "0.1.23"
24
+ "@townco/env": "0.1.25"
25
25
  },
26
26
  "devDependencies": {
27
- "@townco/core": "0.0.51",
28
- "@townco/tsconfig": "0.1.70",
27
+ "@townco/core": "0.0.53",
28
+ "@townco/tsconfig": "0.1.72",
29
29
  "@types/bun": "^1.3.1"
30
30
  }
31
31
  }