Skip to content

Commit

Permalink
feat: support ${this.vars} ${resources.xx.vars}
Browse files Browse the repository at this point in the history
Signed-off-by: zxypro1 <[email protected]>
  • Loading branch information
zxypro1 committed Jul 18, 2024
1 parent 3d31b00 commit 9dad5b0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/engine/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions packages/engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/parse-spec/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
6 changes: 2 additions & 4 deletions packages/parse-spec/src/parse-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ParseContent {
const temp = {} as Record<string, any>;
const tempCom = {} as Record<string, any>;
each(resources, (item, key) => {
set(temp, `${key}.props`, item.props || {});
set(temp, `${key}`, item || {});
});
each(components, (item, key) => {
set(tempCom, `${key}.props`, item.props || {});
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/parse-spec/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export interface IStep {
projectName: string;
component: string;
props: Record<string, any>;
vars?: Record<string, any>;
actions?: Record<string, any>;
order: number;
access: string | undefined;
Expand Down

0 comments on commit 9dad5b0

Please sign in to comment.