Skip to content

Commit

Permalink
Allow workspaces outside the packages/ directory (#2169)
Browse files Browse the repository at this point in the history
* Remove packages/ verification

* Create spicy-hotels-cross.md
  • Loading branch information
cristiano-belloni authored Sep 28, 2022
1 parent 3c199ff commit 32f4a4d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-hotels-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"modular-scripts": minor
---

Allow workspaces outside the `packages` directory
6 changes: 3 additions & 3 deletions __fixtures__/verifiable-project/packages/app-one/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
},
"dependencies": {
"package-one": "workspace:*",
"package-two": "workspace:^",
"package-three": "workspace:~",
"package-four": "workspace:^1.0.0"
"package-two": "workspace:*",
"package-three": "workspace:*",
"package-four": "workspace:*"
},
"version": "1.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ describe('verifyWorkspaceDependencies', () => {
expect(error).not.toHaveBeenCalled();
});

it('rejects packages not in the "packages" directory', async () => {
it('doesn\'t reject packages not in the "packages" directory', async () => {
mock(getModularRoot).mockReturnValue('__fixtures__/verifiable-project');

const checked = await check('__fixtures__/verifiable-project');
expect(checked).toBe(false);
expect(error).toHaveBeenCalledWith(
expect.stringContaining(
`package-four is not located within the "/packages" directory`,
),
);
expect(checked).toBe(true);
expect(error).not.toHaveBeenCalled();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ export async function check(target?: string): Promise<boolean> {
valid = false;
}

if (!packageInfo.location.startsWith('packages')) {
logger.error(
`${packageName} is not located within the "/packages" directory in the repository, instead found "${packageInfo.location}"`,
);
valid = false;
}

if (!isValidModularType(path.join(modularRoot, packageInfo.location))) {
logger.error(
`${packageName} at ${
Expand Down

0 comments on commit 32f4a4d

Please sign in to comment.