dotsec 4.0.0-alpha.2 → 4.0.0-alpha.23
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/CHANGELOG.md +84 -0
- package/README.md +105 -63
- package/bin/dotsec.js +1 -1
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +1379 -37
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1368 -37
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.ts +234 -0
- package/dist/index.js +210 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +188 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/prompts.ts","../src/utils/fromEnv.ts","../src/lib/io.ts","../src/utils/logging.ts"],"sourcesContent":["import prompts from \"prompts\";\n\nexport const promptConfirm = async ({\n\tpredicate,\n\tskip,\n\tmessage,\n}: {\n\tpredicate?: (...args: unknown[]) => Promise<boolean> | boolean;\n\tskip?: boolean;\n\tmessage: string;\n}): Promise<boolean> => {\n\tif (skip === true) {\n\t\treturn true;\n\t} else {\n\t\tconst result = predicate ? await predicate() : true;\n\t\tif (result) {\n\t\t\tconst confirmResult = await prompts({\n\t\t\t\ttype: \"confirm\",\n\t\t\t\tname: \"confirm\",\n\t\t\t\tmessage: () => {\n\t\t\t\t\treturn message;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (confirmResult.confirm === true) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\nexport const promptExecute = async ({\n\tskip,\n\tmessage,\n\texecute,\n}: {\n\tskip?: boolean;\n\tmessage: string;\n\texecute: () => unknown | Promise<unknown>;\n}) => {\n\tlet shouldExecute = false;\n\tif (skip) {\n\t\tshouldExecute = true;\n\t} else {\n\t\tconst promptResponse = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirm\",\n\t\t\tmessage,\n\t\t});\n\n\t\tif (promptResponse.confirm === true) {\n\t\t\tshouldExecute = true;\n\t\t}\n\t}\n\n\tif (shouldExecute) {\n\t\tawait execute();\n\t}\n};\n","import { expand } from \"dotenv-expand\";\n\nexport const resolveFromEnv = (options: {\n\tfromEnvValue?: string;\n\tenv: NodeJS.ProcessEnv;\n\tvariables: Record<string, string>;\n}) => {\n\tconst { fromEnvValue, env, variables } = options;\n\n\tif (!fromEnvValue) {\n\t\treturn \"\";\n\t}\n\n\treturn (\n\t\texpand({\n\t\t\tignoreProcessEnv: true,\n\t\t\tparsed: {\n\t\t\t\t// add standard env variables\n\t\t\t\t...(env as Record<string, string>),\n\t\t\t\t// add custom env variables, either from .env or .sec, (or empty object if none)\n\t\t\t\t...variables,\n\t\t\t\tRESOLVED: fromEnvValue || \"\",\n\t\t\t},\n\t\t}) as { parsed?: { RESOLVED?: string } }\n\t).parsed?.RESOLVED;\n};\n","import fs, { stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport prompts from \"prompts\";\n\nexport const readContentsFromFile = async (\n\tfilePath: string,\n): Promise<string> => {\n\treturn await fs.readFile(filePath, \"utf-8\");\n};\n\nexport const writeContentsToFile = async (\n\tfilePath: string,\n\tcontents: string,\n): Promise<void> => {\n\treturn await fs.writeFile(filePath, contents, \"utf-8\");\n};\n\nexport const fileExists = async (source: string): Promise<boolean> => {\n\ttry {\n\t\tawait stat(source);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport const promptOverwriteIfFileExists = async ({\n\tfilePath,\n\tskip,\n}: {\n\tfilePath: string;\n\tskip?: boolean;\n}) => {\n\tlet overwriteResponse: prompts.Answers<\"overwrite\"> | undefined;\n\n\tif ((await fileExists(filePath)) && skip !== true) {\n\t\toverwriteResponse = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"overwrite\",\n\t\t\tmessage: () => {\n\t\t\t\treturn `Overwrite './${path.relative(process.cwd(), filePath)}' ?`;\n\t\t\t},\n\t\t});\n\t} else {\n\t\toverwriteResponse = undefined;\n\t}\n\treturn overwriteResponse;\n};\n","import chalk from \"chalk\";\nimport Table from \"cli-table\";\nexport { Table };\n\nlet _logger: Pick<Console, \"info\" | \"error\" | \"table\">;\nexport const getLogger = () => {\n\tif (!_logger) {\n\t\t_logger = console;\n\t}\n\n\treturn _logger;\n};\nexport const writeLine = (str: string) => {\n\tprocess.stdout.write(str);\n};\nexport const emphasis = (str: string): string => chalk.yellowBright(str);\nexport const strong = (str: string): string => chalk.yellow.bold(str);\n\nexport const clientLogger = {\n\tdebug(content: object) {\n\t\tconsole.log(content);\n\t},\n\tinfo(content: object) {\n\t\tconsole.log(content);\n\t},\n\twarn(content: object) {\n\t\tconsole.log(content);\n\t},\n\terror(content: object) {\n\t\tconsole.error(content);\n\t},\n};\n"],"mappings":"AAAA,OAAOA,MAAa,UAgCb,IAAMC,EAAgB,MAAO,CACnC,KAAAC,EACA,QAAAC,EACA,QAAAC,CACD,IAIM,CACL,IAAIC,EAAgB,IAChBH,IAGoB,MAAMI,EAAQ,CACpC,KAAM,UACN,KAAM,UACN,QAAAH,CACD,CAAC,GAEkB,UAAY,MAC9BE,EAAgB,IAIdA,GACH,MAAMD,EAAQ,CAEhB,EC3DA,OAAS,UAAAG,MAAc,gBAEhB,IAAMC,EAAkBC,GAIzB,CACL,GAAM,CAAE,aAAAC,EAAc,IAAAC,EAAK,UAAAC,CAAU,EAAIH,EAEzC,OAAKC,EAKJH,EAAO,CACN,iBAAkB,GAClB,OAAQ,CAEP,GAAII,EAEJ,GAAGC,EACH,SAAUF,GAAgB,EAC3B,CACD,CAAC,EACA,QAAQ,SAdF,EAeT,ECzBA,OAAOG,GAAM,QAAAC,MAAY,mBACzB,OAAOC,MAAU,YACjB,OAAOC,MAAa,UAEb,IAAMC,EAAuB,MACnCC,GAEO,MAAML,EAAG,SAASK,EAAU,OAAO,EAG9BC,EAAsB,MAClCD,EACAE,IAEO,MAAMP,EAAG,UAAUK,EAAUE,EAAU,OAAO,EAGzCC,EAAa,MAAOC,GAAqC,CACrE,GAAI,CACH,aAAMR,EAAKQ,CAAM,EACV,EACR,MAAE,CACD,MAAO,EACR,CACD,EAEaC,EAA8B,MAAO,CACjD,SAAAL,EACA,KAAAM,CACD,IAGM,CACL,IAAIC,EAEJ,OAAK,MAAMJ,EAAWH,CAAQ,GAAMM,IAAS,GAC5CC,EAAoB,MAAMT,EAAQ,CACjC,KAAM,UACN,KAAM,YACN,QAAS,IACD,gBAAgBD,EAAK,SAAS,QAAQ,IAAI,EAAGG,CAAQ,MAE9D,CAAC,EAEDO,EAAoB,OAEdA,CACR,EC/CA,OAAOC,MAAW,QAClB,OAAOC,MAAW,YAWX,IAAMC,EAAaC,GAAgB,CACzC,QAAQ,OAAO,MAAMA,CAAG,CACzB,EACaC,EAAYD,GAAwBE,EAAM,aAAaF,CAAG,EAC1DG,EAAUH,GAAwBE,EAAM,OAAO,KAAKF,CAAG","names":["prompts","promptExecute","skip","message","execute","shouldExecute","prompts","expand","resolveFromEnv","options","fromEnvValue","env","variables","fs","stat","path","prompts","readContentsFromFile","filePath","writeContentsToFile","contents","fileExists","source","promptOverwriteIfFileExists","skip","overwriteResponse","chalk","Table","writeLine","str","emphasis","chalk","strong"]}
|
|
1
|
+
{"version":3,"sources":["../src/lib/parse.ts","../src/utils/prompts.ts","../src/utils/fromEnv.ts","../src/lib/io.ts","../src/utils/logging.ts"],"names":["prompts"],"mappings":";AAAA,IAAM,OACL;AAUM,IAAM,QAAQ,CAAC,QAAgB;AACrC,QAAM,MAA8B,CAAC;AACrC,QAAM,SAAsB,CAAC;AAG7B,MAAI,QAAQ,IAAI,SAAS;AAGzB,UAAQ,MAAM,QAAQ,WAAW,IAAI;AAErC,MAAI;AACJ,UAAQ,QAAQ,KAAK,KAAK,KAAK,MAAM,MAAM;AAC1C,UAAM,MAAM,MAAM,CAAC;AAEnB,QAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAA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AACD,WAAO;AAAA,EACR;AACD;AAEO,IAAM,8BAA8B,OAAO;AAAA,EACjD;AAAA,EACA;AACD,MAGM;AACL,MAAI;AAEJ,MAAK,MAAM,WAAW,QAAQ,KAAM,SAAS,MAAM;AAClD,wBAAoB,MAAMA,SAAQ;AAAA,MACjC,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS,MAAM;AACd,eAAO,gBAAgB,KAAK,SAAS,QAAQ,IAAI,GAAG,QAAQ;AAAA,MAC7D;AAAA,IACD,CAAC;AAAA,EACF,OAAO;AACN,wBAAoB;AAAA,EACrB;AACA,SAAO;AACR;;;AC/CA,OAAO,WAAW;AAClB,OAAO,WAAW;AAWX,IAAM,YAAY,CAAC,QAAgB;AACzC,UAAQ,OAAO,MAAM,GAAG;AACzB;AACO,IAAM,WAAW,CAAC,QAAwB,MAAM,aAAa,GAAG;AAChE,IAAM,SAAS,CAAC,QAAwB,MAAM,OAAO,KAAK,GAAG","sourcesContent":["const LINE =\n\t/^(#.*)|(\\s?\\r?\\n)|(?:^|^)\\s*(?:export\\s+)?([\\w.-]*)(?:\\s*=\\s*?|:\\s+?)(\\s*'(?:\\\\'|[^'])*'|\\s*\"(?:\\\\\"|[^\"])*\"|\\s*`(?:\\\\`|[^`])*`|[^#\\r\\n]+)?(\\s*)(#.*)?(?:$|$)/gm;\n\nexport type ParseResult = {\n\ttype: \"value\" | \"comment\" | \"whitespace\";\n\tkey?: string;\n\tvalue?: string;\n\traw?: string;\n}[];\n\n// Parser src into an Object\nexport const parse = (src: string) => {\n\tconst obj: Record<string, string> = {};\n\tconst blocks: ParseResult = [];\n\n\t// Convert buffer to string\n\tlet lines = src.toString();\n\n\t// Convert line breaks to same format\n\tlines = lines.replace(/\\r\\n?/gm, \"\\n\");\n\n\tlet match;\n\twhile ((match = LINE.exec(lines)) != null) {\n\t\tconst key = match[3];\n\n\t\tif (match?.[1]?.[0] === \"#\") {\n\t\t\tblocks.push({ type: \"comment\", raw: match[1] });\n\t\t} else if (match?.[2]) {\n\t\t\tblocks.push({ type: \"whitespace\", raw: match[2] });\n\t\t} else {\n\t\t\t// Default undefined or null to empty string\n\t\t\tlet value = match[4] || \"\";\n\n\t\t\t// Remove whitespace\n\t\t\tvalue = value.trim();\n\n\t\t\t// Check if double quoted\n\t\t\tconst maybeQuote = value[0];\n\n\t\t\t// Remove surrounding quotes\n\t\t\tvalue = value.replace(/^(['\"`])([\\s\\S]*)\\1$/gm, \"$2\");\n\n\t\t\t// Expand newlines if double quoted\n\t\t\tif (maybeQuote === '\"') {\n\t\t\t\tvalue = value.replace(/\\\\n/g, \"\\n\");\n\t\t\t\tvalue = value.replace(/\\\\r/g, \"\\r\");\n\t\t\t}\n\n\t\t\tobj[key] = value;\n\n\t\t\t// Add to object\n\t\t\tblocks.push({\n\t\t\t\ttype: \"value\",\n\t\t\t\tkey,\n\t\t\t\tvalue,\n\t\t\t\traw: value + (match[5] ? match[5] : \"\") + (match[6] ? match[6] : \"\"),\n\t\t\t});\n\t\t}\n\t}\n\n\treturn { blocks, obj };\n};\n\nif (import.meta.vitest) {\n\tconst { it, expect } = import.meta.vitest;\n\n\tit(\"parse\", () => {\n\t\tconst input1 = \"KEY=value\";\n\t\tconst input2 = 'KEY=\"value\"';\n\t\tconst input3 = \"KEY='value'\";\n\t\tconst input4 = \"KEY=value # this is a comment\";\n\n\t\t// const expectedResult1 = [\n\t\t// { type: 'value', key: 'KEY', value: 'value', raw: 'value' },\n\t\t// ];\n\t\t// const expectedResult2 = [\n\t\t// { type: 'value', key: 'KEY', value: 'value', raw: '\"value\"' },\n\t\t// ];\n\t\t// const expectedResult3 = [\n\t\t// { type: 'value', key: 'KEY', value: 'value', raw: \"'value'\" },\n\t\t// ];\n\t\t// const expectedResult4 = [\n\t\t// {\n\t\t// type: 'value',\n\t\t// key: 'KEY',\n\t\t// value: 'value',\n\t\t// raw: 'value # this is a comment',\n\t\t// },\n\t\t// ];\n\n\t\texpect(parse(input1)).toMatchInlineSnapshot(`\n\t\t\t{\n\t\t\t \"blocks\": [\n\t\t\t {\n\t\t\t \"key\": \"KEY\",\n\t\t\t \"raw\": \"value\",\n\t\t\t \"type\": \"value\",\n\t\t\t \"value\": \"value\",\n\t\t\t },\n\t\t\t ],\n\t\t\t \"obj\": {\n\t\t\t \"KEY\": \"value\",\n\t\t\t },\n\t\t\t}\n\t\t`);\n\t\texpect(parse(input2)).toMatchInlineSnapshot(`\n\t\t\t{\n\t\t\t \"blocks\": [\n\t\t\t {\n\t\t\t \"key\": \"KEY\",\n\t\t\t \"raw\": \"value\",\n\t\t\t \"type\": \"value\",\n\t\t\t \"value\": \"value\",\n\t\t\t },\n\t\t\t ],\n\t\t\t \"obj\": {\n\t\t\t \"KEY\": \"value\",\n\t\t\t },\n\t\t\t}\n\t\t`);\n\t\texpect(parse(input3)).toMatchInlineSnapshot(`\n\t\t\t{\n\t\t\t \"blocks\": [\n\t\t\t {\n\t\t\t \"key\": \"KEY\",\n\t\t\t \"raw\": \"value\",\n\t\t\t \"type\": \"value\",\n\t\t\t \"value\": \"value\",\n\t\t\t },\n\t\t\t ],\n\t\t\t \"obj\": {\n\t\t\t \"KEY\": \"value\",\n\t\t\t },\n\t\t\t}\n\t\t`);\n\t\texpect(parse(input4)).toMatchInlineSnapshot(`\n {\n \"blocks\": [\n {\n \"key\": \"KEY\",\n \"raw\": \"value# this is a comment\",\n \"type\": \"value\",\n \"value\": \"value\",\n },\n ],\n \"obj\": {\n \"KEY\": \"value\",\n },\n }\n `);\n\t});\n}\n","import prompts from \"prompts\";\n\nexport const promptConfirm = async ({\n\tpredicate,\n\tskip,\n\tmessage,\n}: {\n\tpredicate?: (...args: unknown[]) => Promise<boolean> | boolean;\n\tskip?: boolean;\n\tmessage: string;\n}): Promise<boolean> => {\n\tif (skip === true) {\n\t\treturn true;\n\t} else {\n\t\tconst result = predicate ? await predicate() : true;\n\t\tif (result) {\n\t\t\tconst confirmResult = await prompts({\n\t\t\t\ttype: \"confirm\",\n\t\t\t\tname: \"confirm\",\n\t\t\t\tmessage: () => {\n\t\t\t\t\treturn message;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (confirmResult.confirm === true) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\nexport const promptExecute = async ({\n\tskip,\n\tmessage,\n\texecute,\n}: {\n\tskip?: boolean;\n\tmessage: string;\n\texecute: () => unknown | Promise<unknown>;\n}) => {\n\tlet shouldExecute = false;\n\tif (skip) {\n\t\tshouldExecute = true;\n\t} else {\n\t\tconst promptResponse = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirm\",\n\t\t\tmessage,\n\t\t});\n\n\t\tif (promptResponse.confirm === true) {\n\t\t\tshouldExecute = true;\n\t\t}\n\t}\n\n\tif (shouldExecute) {\n\t\tawait execute();\n\t}\n};\n","import { expand } from \"dotenv-expand\";\n\nexport const resolveFromEnv = (options: {\n\tfromEnvValue?: string;\n\tenv: NodeJS.ProcessEnv;\n\tvariables: Record<string, string>;\n}) => {\n\tconst { fromEnvValue, env, variables } = options;\n\n\tif (!fromEnvValue) {\n\t\treturn \"\";\n\t}\n\n\treturn (\n\t\texpand({\n\t\t\tignoreProcessEnv: true,\n\t\t\tparsed: {\n\t\t\t\t// add standard env variables\n\t\t\t\t...(env as Record<string, string>),\n\t\t\t\t// add custom env variables, either from .env or .sec, (or empty object if none)\n\t\t\t\t...variables,\n\t\t\t\tRESOLVED: fromEnvValue || \"\",\n\t\t\t},\n\t\t}) as { parsed?: { RESOLVED?: string } }\n\t).parsed?.RESOLVED;\n};\n","import fs, { stat } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport prompts from \"prompts\";\n\nexport const readContentsFromFile = async (\n\tfilePath: string,\n): Promise<string> => {\n\treturn await fs.readFile(filePath, \"utf-8\");\n};\n\nexport const writeContentsToFile = async (\n\tfilePath: string,\n\tcontents: string,\n): Promise<void> => {\n\treturn await fs.writeFile(filePath, contents, \"utf-8\");\n};\n\nexport const fileExists = async (source: string): Promise<boolean> => {\n\ttry {\n\t\tawait stat(source);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\nexport const promptOverwriteIfFileExists = async ({\n\tfilePath,\n\tskip,\n}: {\n\tfilePath: string;\n\tskip?: boolean;\n}) => {\n\tlet overwriteResponse: prompts.Answers<\"overwrite\"> | undefined;\n\n\tif ((await fileExists(filePath)) && skip !== true) {\n\t\toverwriteResponse = await prompts({\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"overwrite\",\n\t\t\tmessage: () => {\n\t\t\t\treturn `Overwrite './${path.relative(process.cwd(), filePath)}' ?`;\n\t\t\t},\n\t\t});\n\t} else {\n\t\toverwriteResponse = undefined;\n\t}\n\treturn overwriteResponse;\n};\n","import chalk from \"chalk\";\nimport Table from \"cli-table\";\nexport { Table };\n\nlet _logger: Pick<Console, \"info\" | \"error\" | \"table\">;\nexport const getLogger = () => {\n\tif (!_logger) {\n\t\t_logger = console;\n\t}\n\n\treturn _logger;\n};\nexport const writeLine = (str: string) => {\n\tprocess.stdout.write(str);\n};\nexport const emphasis = (str: string): string => chalk.yellowBright(str);\nexport const strong = (str: string): string => chalk.yellow.bold(str);\n\nexport const clientLogger = {\n\tdebug(content: object) {\n\t\tconsole.log(content);\n\t},\n\tinfo(content: object) {\n\t\tconsole.log(content);\n\t},\n\twarn(content: object) {\n\t\tconsole.log(content);\n\t},\n\terror(content: object) {\n\t\tconsole.error(content);\n\t},\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dotsec",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.23",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/node": "^18.14.6",
|
|
44
44
|
"@types/prompts": "^2.0.14",
|
|
45
45
|
"@types/yargs-parser": "^21.0.0",
|
|
46
|
-
"tsup": "^6.
|
|
46
|
+
"tsup": "^6.7.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@npmcli/arborist": "^6.1.4",
|
|
@@ -57,10 +57,11 @@
|
|
|
57
57
|
"cross-spawn": "^7.0.3",
|
|
58
58
|
"dotenv": "^16.0.0",
|
|
59
59
|
"dotenv-expand": "^10.0.0",
|
|
60
|
+
"esbuild": "~0.16",
|
|
60
61
|
"joycon": "^3.1.1",
|
|
61
62
|
"prompts": "^2.4.2",
|
|
62
63
|
"typescript": "~4.9.3",
|
|
63
64
|
"yargs-parser": "^21.1.1"
|
|
64
65
|
},
|
|
65
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "81c248119f8443aeef6ea9465d7fe550859a7bb1"
|
|
66
67
|
}
|