From 42ed863652de8e851824729c5540cb29a4bdddeb Mon Sep 17 00:00:00 2001 From: Patrick Arminio Date: Sat, 27 Nov 2021 17:17:01 +0000 Subject: [PATCH] Parse values from poetry --- dist/setup/index.js | 4 ++-- src/cache-distributions/poetry-cache.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 0e01139..599d0c4 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -38798,7 +38798,7 @@ class PoetryCache extends cache_distributor_1.default { const cacheDir = poetryConfig['cache-dir']; const virtualenvsPath = poetryConfig['virtualenvs.path'].replace('{cache-dir}', cacheDir); const paths = [virtualenvsPath]; - if (poetryConfig['virtualenvs.in-project'] === 'true') { + if (poetryConfig['virtualenvs.in-project'] === true) { paths.push(path.join(process.cwd(), '.venv')); } return paths; @@ -38830,7 +38830,7 @@ class PoetryCache extends cache_distributor_1.default { for (let line of lines) { line = line.replace(/#.*$/, ''); const [key, value] = line.split('=').map(part => part.trim()); - config[key] = value; + config[key] = JSON.parse(value); } return config; }); diff --git a/src/cache-distributions/poetry-cache.ts b/src/cache-distributions/poetry-cache.ts index 0e01886..9da683f 100644 --- a/src/cache-distributions/poetry-cache.ts +++ b/src/cache-distributions/poetry-cache.ts @@ -24,7 +24,7 @@ class PoetryCache extends CacheDistributor { const paths = [virtualenvsPath]; - if (poetryConfig['virtualenvs.in-project'] === 'true') { + if (poetryConfig['virtualenvs.in-project'] === true) { paths.push(path.join(process.cwd(), '.venv')); } @@ -57,21 +57,21 @@ class PoetryCache extends CacheDistributor { const lines = stdout.trim().split(os.EOL); - const config = {} as { - 'cache-dir': string; - 'virtualenvs.in-project': string; - 'virtualenvs.path': string; - }; + const config: any = {}; for (let line of lines) { line = line.replace(/#.*$/, ''); const [key, value] = line.split('=').map(part => part.trim()); - config[key as keyof typeof config] = value; + config[key] = JSON.parse(value); } - return config; + return config as { + 'cache-dir': string; + 'virtualenvs.in-project': boolean; + 'virtualenvs.path': string; + }; } }