( updater: (workspace: WorkspaceDefinition) => void | Rule | PromiseLike<void | Rule>, )
| 56 | * workspace. A {@link WorkspaceDefinition} is provided as the first argument to the function. |
| 57 | */ |
| 58 | export function updateWorkspace( |
| 59 | updater: (workspace: WorkspaceDefinition) => void | Rule | PromiseLike<void | Rule>, |
| 60 | ): Rule { |
| 61 | return async (host: Tree) => { |
| 62 | const workspace = await getWorkspace(host); |
| 63 | |
| 64 | const result = await updater(workspace); |
| 65 | |
| 66 | await workspaces.writeWorkspace(workspace, new TreeWorkspaceHost(host)); |
| 67 | |
| 68 | return result || noop; |
| 69 | }; |
| 70 | } |
| 71 | |
| 72 | // TODO: This should be renamed `readWorkspace` once deep imports are restricted (already exported from `utility` with that name) |
| 73 | /** |
no test coverage detected