@catladder/cli 2.10.0 → 2.10.1
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.
- package/dist/bundles/catenv/index.js +1 -1
- package/dist/bundles/cli/index.js +1 -1
- package/dist/cli/src/apps/catenv/printVariables.js +4 -1
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/apps/catenv/utils.d.ts +6 -2
- package/dist/cli/src/apps/catenv/utils.js +4 -2
- package/dist/cli/src/apps/catenv/utils.js.map +1 -1
- package/dist/pipeline/src/bash/bashEscape.d.ts +4 -1
- package/dist/pipeline/src/bash/bashEscape.js +4 -2
- package/dist/pipeline/src/bash/bashEscape.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/printVariables.ts +4 -1
- package/src/apps/catenv/utils.ts +12 -3
package/package.json
CHANGED
|
@@ -55,4 +55,7 @@ export const printVariables = async (config: Config, choice?: Choice) => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
const makeExportKeyValuestring = (variables: Record<string, string>) =>
|
|
58
|
-
makeKeyValueString(variables,
|
|
58
|
+
makeKeyValueString(variables, {
|
|
59
|
+
keyPrefix: "export ",
|
|
60
|
+
escapeOptions: { quoteMode: "always" },
|
|
61
|
+
});
|
package/src/apps/catenv/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Config } from "@catladder/pipeline";
|
|
1
|
+
import type { Config, EscapeForDotEnvOptions } from "@catladder/pipeline";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { getGitRoot } from "../../utils/projects";
|
|
4
4
|
import type { Choice } from "./types";
|
|
@@ -32,13 +32,22 @@ export const getCurrentComponentAndEnvFromChoice = async (
|
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
+
export type MakeKeyValueStringOptions = {
|
|
36
|
+
keyPrefix?: string;
|
|
37
|
+
escapeOptions?: EscapeForDotEnvOptions;
|
|
38
|
+
};
|
|
35
39
|
export const makeKeyValueString = (
|
|
36
40
|
variables: Record<string, string>,
|
|
37
|
-
keyPrefix =
|
|
41
|
+
{ keyPrefix, escapeOptions }: MakeKeyValueStringOptions = {
|
|
42
|
+
keyPrefix: "",
|
|
43
|
+
},
|
|
38
44
|
) =>
|
|
39
45
|
Object.entries(variables)
|
|
40
46
|
// quotes are important, otherwise line breaks don't work properly
|
|
41
|
-
.map(
|
|
47
|
+
.map(
|
|
48
|
+
([key, value]) =>
|
|
49
|
+
`${keyPrefix}${key}=${escapeForDotEnv(value, escapeOptions)}`,
|
|
50
|
+
)
|
|
42
51
|
.join("\n");
|
|
43
52
|
|
|
44
53
|
export const sanitizeEnvVarName = (name: string) =>
|