From 9dad5b045fc27b907a79e173dee465a7f7d87e58 Mon Sep 17 00:00:00 2001 From: zxypro1 <1018995004@qq.com> Date: Thu, 18 Jul 2024 17:56:15 +0800 Subject: [PATCH] feat: support ${this.vars} ${resources.xx.vars} Signed-off-by: zxypro1 <1018995004@qq.com> --- packages/engine/package.json | 2 +- packages/engine/src/index.ts | 2 ++ packages/parse-spec/package.json | 2 +- packages/parse-spec/src/parse-content.ts | 6 ++---- packages/parse-spec/src/types.ts | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/engine/package.json b/packages/engine/package.json index a5f5780..d69c87b 100644 --- a/packages/engine/package.json +++ b/packages/engine/package.json @@ -1,6 +1,6 @@ { "name": "@serverless-devs/engine", - "version": "0.1.4-beta.7", + "version": "0.1.4-beta.8", "description": "a engine lib for serverless-devs", "main": "lib/index.js", "scripts": { diff --git a/packages/engine/src/index.ts b/packages/engine/src/index.ts index a348302..6754209 100644 --- a/packages/engine/src/index.ts +++ b/packages/engine/src/index.ts @@ -399,6 +399,7 @@ class Engine { output: obj.output || get(stepItem, 'output') || {}, props: obj.props || get(stepItem, 'props') || {}, info: this.info[obj.projectName] || {}, + vars: obj.vars || get(stepItem, 'vars') || {}, }; // support ${components.xx.output.xx} data.components[obj.projectName] = { @@ -413,6 +414,7 @@ class Engine { component: item.component, props: data.resources[item.projectName].props, output: data.resources[item.projectName].output, + vars: data.resources[item.projectName].vars, }; } return data; diff --git a/packages/parse-spec/package.json b/packages/parse-spec/package.json index e1134dd..b416fd2 100644 --- a/packages/parse-spec/package.json +++ b/packages/parse-spec/package.json @@ -1,6 +1,6 @@ { "name": "@serverless-devs/parse-spec", - "version": "0.0.28-beta.6", + "version": "0.0.28-beta.7", "description": "a parse yaml spec lib for serverless-devs", "main": "lib/index.js", "scripts": { diff --git a/packages/parse-spec/src/parse-content.ts b/packages/parse-spec/src/parse-content.ts index 68dd2c8..636afcb 100644 --- a/packages/parse-spec/src/parse-content.ts +++ b/packages/parse-spec/src/parse-content.ts @@ -45,7 +45,7 @@ class ParseContent { const temp = {} as Record; const tempCom = {} as Record; each(resources, (item, key) => { - set(temp, `${key}.props`, item.props || {}); + set(temp, `${key}`, item || {}); }); each(components, (item, key) => { set(tempCom, `${key}.props`, item.props || {}); @@ -59,9 +59,7 @@ class ParseContent { name, access: item.access, component: item.component, - props: temp[name].props, - output: temp[name].output, - info: temp[name].info, + ...temp[name] }, }; // parse props magic diff --git a/packages/parse-spec/src/types.ts b/packages/parse-spec/src/types.ts index c5cd8ba..60f0d5b 100644 --- a/packages/parse-spec/src/types.ts +++ b/packages/parse-spec/src/types.ts @@ -2,6 +2,7 @@ export interface IStep { projectName: string; component: string; props: Record; + vars?: Record; actions?: Record; order: number; access: string | undefined;