@storm-software/workspace-tools 1.20.0 → 1.21.0

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.
@@ -60,7 +60,7 @@ var getWorkspaceRoot = () => {
60
60
  };
61
61
 
62
62
  // packages/workspace-tools/src/utils/apply-workspace-tokens.ts
63
- var applyWorkspaceExecutorTokens = (option, config) => {
63
+ var applyWorkspaceExecutorTokens = (option, tokenizerOptions) => {
64
64
  let result = option;
65
65
  if (!result) {
66
66
  return result;
@@ -68,17 +68,30 @@ var applyWorkspaceExecutorTokens = (option, config) => {
68
68
  let projectName;
69
69
  let projectRoot;
70
70
  let sourceRoot;
71
- if (config?.projectName) {
72
- const context = config;
71
+ if (tokenizerOptions?.projectName) {
72
+ const context = tokenizerOptions;
73
73
  projectName = context.projectName;
74
74
  projectRoot = context.root;
75
75
  sourceRoot = context.sourceRoot;
76
76
  } else {
77
- const projectConfig = config;
77
+ const projectConfig = tokenizerOptions;
78
78
  projectName = projectConfig.name;
79
79
  projectRoot = projectConfig.root;
80
80
  sourceRoot = projectConfig.sourceRoot;
81
81
  }
82
+ if (tokenizerOptions.config) {
83
+ const configKeys = Object.keys(tokenizerOptions.config);
84
+ if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
85
+ configKeys.forEach((configKey) => {
86
+ if (result.includes(`{${configKey}}`)) {
87
+ result = result.replaceAll(
88
+ `{${configKey}}`,
89
+ tokenizerOptions.config[configKey]
90
+ );
91
+ }
92
+ });
93
+ }
94
+ }
82
95
  if (result.includes("{projectName}")) {
83
96
  result = result.replaceAll("{projectName}", projectName);
84
97
  }
@@ -91,12 +104,12 @@ var applyWorkspaceExecutorTokens = (option, config) => {
91
104
  if (result.includes("{workspaceRoot}")) {
92
105
  result = result.replaceAll(
93
106
  "{workspaceRoot}",
94
- config.workspaceRoot ?? getWorkspaceRoot()
107
+ tokenizerOptions.workspaceRoot ?? getWorkspaceRoot()
95
108
  );
96
109
  }
97
110
  return result;
98
111
  };
99
- var applyWorkspaceGeneratorTokens = (option, config) => {
112
+ var applyWorkspaceGeneratorTokens = (option, tokenizerOptions) => {
100
113
  let result = option;
101
114
  if (!result) {
102
115
  return result;
@@ -104,7 +117,7 @@ var applyWorkspaceGeneratorTokens = (option, config) => {
104
117
  if (result.includes("{workspaceRoot}")) {
105
118
  result = result.replaceAll(
106
119
  "{workspaceRoot}",
107
- config.workspaceRoot ?? getWorkspaceRoot()
120
+ tokenizerOptions.workspaceRoot ?? tokenizerOptions.config.workspaceRoot ?? getWorkspaceRoot()
108
121
  );
109
122
  }
110
123
  return result;
@@ -117,7 +130,7 @@ var applyWorkspaceTokens = (options, config, tokenizerFn) => {
117
130
  return Object.keys(options).reduce(
118
131
  (ret, option) => {
119
132
  if (options[option] === void 0 || options[option] === null || typeof options[option] === "number" || typeof options[option] === "boolean" || typeof options[option] === "string") {
120
- ret[option] = tokenizerFn(option, config);
133
+ ret[option] = tokenizerFn(options[option], config);
121
134
  } else if (Array.isArray(options[option])) {
122
135
  ret[option] = options[option].map(
123
136
  (item) => tokenizerFn(item, config)