diff --git a/README.md b/README.md index 5a03d64..006f827 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,9 @@ To explore additional examples and filtering options for receiving runs, you can ### Caching artifacts -The `currents cache` command allows you to archive files from specified locations and save them under an ID in Currents storage. It also stores a meta file with configuration data. You can provide the ID manually or it can be generated based on CI environment variables (only GitHub and GitLab are supported). The files to archive can be defined using the `paths ` CLI option or predefined using a `preset`. +The `currents cache` command allows you to archive files from specified locations and save them under an ID in Currents storage. It also stores a meta file with configuration data. You can provide the ID manually or it can be generated based on CI environment variables (only GitHub and GitLab are supported). The files to archive can be defined using the `path ` CLI option or predefined using a `preset`. -To cache files, run `npx currents cache set --key --id --paths `. +To cache files, run `npx currents cache set --key --id --path `. To download files, run `npx currents cache get --key --id `. diff --git a/packages/cmd/README.md b/packages/cmd/README.md index de82c7a..fdfe6ba 100644 --- a/packages/cmd/README.md +++ b/packages/cmd/README.md @@ -76,7 +76,7 @@ The `currents cache` command allows you to archive files from specified location To cache files, use the following command: ```sh -npx currents cache set --key --id --paths +npx currents cache set --key --id --path ``` To download files, use the following command: diff --git a/packages/cmd/src/commands/cache/index.ts b/packages/cmd/src/commands/cache/index.ts index 01b32b3..d18858e 100644 --- a/packages/cmd/src/commands/cache/index.ts +++ b/packages/cmd/src/commands/cache/index.ts @@ -8,7 +8,7 @@ import { matrixIndexOption, matrixTotalOption, outputDirOption, - pathsOption, + pathOption, presetOption, presetOutputOption, pwOutputDirOption, @@ -22,7 +22,7 @@ const getExample = (name: string) => ` ${chalk.bold('Examples')} Save files to the cache under a specific ID: -${dim(`${name} ${COMMAND_NAME} set --key --id --paths `)} +${dim(`${name} ${COMMAND_NAME} set --key --id --path `)} Retrieve files from the cache saved under a specific ID: ${dim(`${name} ${COMMAND_NAME} get --key --id `)} @@ -57,7 +57,7 @@ export const getCacheSetCommand = () => { .addOption(recordKeyOption) .addOption(idOption) .addOption(presetOption) - .addOption(pathsOption) + .addOption(pathOption) .addOption(debugOption) .addOption(pwOutputDirOption) .addOption(matrixIndexOption) diff --git a/packages/cmd/src/commands/cache/options.ts b/packages/cmd/src/commands/cache/options.ts index b01700d..a73508c 100644 --- a/packages/cmd/src/commands/cache/options.ts +++ b/packages/cmd/src/commands/cache/options.ts @@ -17,8 +17,8 @@ export const idOption = new Option( 'The ID the data is saved under in the cache' ); -export const pathsOption = new Option( - '--paths ', +export const pathOption = new Option( + '--path ', 'Comma-separated list of paths to cache' ).argParser(parseCommaSeparatedList); diff --git a/packages/cmd/src/config/cache/config.ts b/packages/cmd/src/config/cache/config.ts index 4a02f48..a8b0632 100644 --- a/packages/cmd/src/config/cache/config.ts +++ b/packages/cmd/src/config/cache/config.ts @@ -26,7 +26,7 @@ type CommonConfig = { export type CacheSetCommandConfig = CacheCommandConfig & CommonConfig & { - paths?: string[]; + path?: string[]; pwOutputDir?: string; }; diff --git a/packages/cmd/src/config/cache/env.ts b/packages/cmd/src/config/cache/env.ts index 9e71e6c..9b9c12e 100644 --- a/packages/cmd/src/config/cache/env.ts +++ b/packages/cmd/src/config/cache/env.ts @@ -30,9 +30,9 @@ const cacheSetCommandConfigKeys = { name: 'Preset output path', cli: '--preset-output', }, - paths: { + path: { name: 'Paths to cache', - cli: '--paths', + cli: '--path', }, matrixIndex: { name: 'Matrix index', diff --git a/packages/cmd/src/config/cache/options.ts b/packages/cmd/src/config/cache/options.ts index 3ef7121..8965edb 100644 --- a/packages/cmd/src/config/cache/options.ts +++ b/packages/cmd/src/config/cache/options.ts @@ -25,7 +25,7 @@ export function cacheSetCommandOptsToConfig( id: options.id, preset: options.preset, pwOutputDir: options.pwOutputDir, - paths: options.paths, + path: options.path, debug: options.debug, matrixIndex: options.matrixIndex, matrixTotal: options.matrixTotal, diff --git a/packages/cmd/src/services/cache/lib.ts b/packages/cmd/src/services/cache/lib.ts index 5ede6c9..72c543c 100644 --- a/packages/cmd/src/services/cache/lib.ts +++ b/packages/cmd/src/services/cache/lib.ts @@ -7,7 +7,7 @@ export type MetaFile = { id: string; orgId: string; config: CacheSetCommandConfig; - paths: string[]; + path: string[]; ci: Record; createdAt: string; }; @@ -16,20 +16,20 @@ export function createMeta({ config, cacheId, orgId, - paths, + path, ci, }: { config: CacheSetCommandConfig; cacheId: string; orgId: string; - paths: string[]; + path: string[]; ci: Record; }) { const meta = { id: cacheId, orgId, config: omit(config, 'recordKey'), - paths, + path, ci, createdAt: new Date().toISOString(), }; diff --git a/packages/cmd/src/services/cache/set.ts b/packages/cmd/src/services/cache/set.ts index 7fa3ee1..066ca91 100644 --- a/packages/cmd/src/services/cache/set.ts +++ b/packages/cmd/src/services/cache/set.ts @@ -21,7 +21,7 @@ export async function handleSetCache() { const { recordKey, id, preset, pwOutputDir, matrixIndex, matrixTotal } = config.values; - const paths = config.values.paths ? filterPaths(config.values.paths) : []; + const paths = config.values.path ? filterPaths(config.values.path) : []; const uploadPaths: string[] = []; @@ -62,7 +62,7 @@ export async function handleSetCache() { config: config.values, ci, orgId: result.orgId, - paths: uploadPaths, + path: uploadPaths, }), cacheId: result.cacheId, uploadUrl: result.metaUploadUrl,