Skip to content

Commit 4a89927

Browse files
committed
Support ON name
1 parent 00a8252 commit 4a89927

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ Optional.
5757

5858
Run [all repositories](./projects.json) by default.
5959

60-
Comma separated repository list. (Currently only allow repositories defined in `projects.json`)
60+
Comma separated repository or name list. (Currently only allow repositories defined in `projects.json`)
6161

6262
```
63+
RUN #110168 ON babel/babel
6364
RUN #110168 ON https://github.com/babel/babel.git
64-
RUN #110168 ON https://github.com/babel/babel.git,https://github.com/prettier/prettier.git
65-
RUN #110168 VS 1.0.0 ON https://github.com/babel/babel.git,https://github.com/prettier/prettier.git
65+
RUN #110168 ON babel/babel,prettier/prettier
66+
RUN #110168 VS 1.0.0 ON babel/babel,prettier/prettier
6667
```
6768

6869
## Add new project

__tests__/parse-command.spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,32 @@ describe("parse", () => {
8787
],
8888
}
8989
`);
90+
{
91+
const { alternative, original, repositories } = parseCommand(
92+
"run 1.0.0 vs 2.0.0 on babel/babel,prettier/prettier",
93+
);
94+
expect({
95+
alternative,
96+
original,
97+
repositories: repositories.map(({ name }) => name),
98+
}).toMatchInlineSnapshot(`
99+
{
100+
"alternative": {
101+
"raw": "1.0.0",
102+
"type": "PACKAGE",
103+
"version": "1.0.0",
104+
},
105+
"original": {
106+
"raw": "2.0.0",
107+
"type": "PACKAGE",
108+
"version": "2.0.0",
109+
},
110+
"repositories": [
111+
"babel/babel",
112+
"prettier/prettier",
113+
],
114+
}
115+
`);
116+
}
90117
});
91118
});

src/parse-command.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ function parseRepositories(repositories: string | undefined) {
6565
const result: Project[] = [];
6666
for (const repository of shouldRun) {
6767
const matched = allRepositories.find(
68-
(searching) => searching.repository === repository,
68+
(searching) =>
69+
searching.repository === repository || searching.name === repository,
6970
);
7071

7172
if (!matched) {

0 commit comments

Comments
 (0)