MCPcopy
hub / github.com/redwoodjs/graphql / enforceFieldsWithValuesOnAllWorkspaces

Function enforceFieldsWithValuesOnAllWorkspaces

yarn.config.cjs:147–161  ·  view source on GitHub ↗

* This rule will enforce that the specified fields are present in the * `package.json` of all workspaces and that they have the expected value. * * @param {Context} context * @param {Record any) | string>} fields

({ Yarn }, fields)

Source from the content-addressed store, hash-verified

145 * @param {Record<string, ((workspace: Workspace) => any) | string>} fields
146 */
147function enforceFieldsWithValuesOnAllWorkspaces({ Yarn }, fields) {
148 for (const workspace of Yarn.workspaces()) {
149 // Skip the root workspace
150 if (workspace.cwd === '.') {
151 continue
152 }
153
154 for (const [field, value] of Object.entries(fields)) {
155 workspace.set(
156 field,
157 typeof value === `function` ? value(workspace) : value,
158 )
159 }
160 }
161}
162
163module.exports = defineConfig({
164 constraints: async (ctx) => {

Callers 1

yarn.config.cjsFile · 0.85

Calls 2

entriesMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected