Skip to content

Commit

Permalink
Revert "fix: ignore encrypted configs that cannot be decrypted"
Browse files Browse the repository at this point in the history
This reverts commit d008169.
  • Loading branch information
ZauberNerd committed Dec 15, 2020
1 parent d008169 commit cf88495
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 83 deletions.
25 changes: 0 additions & 25 deletions src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,6 @@ describe('normalize config', () => {
process.env.CANARIST_ENCRYPTION_KEY = undefined;
});

it('should ignore repositories that cannot be decrypted', () => {
// $ canarist -r a-repo -r enc:G6VSEW8lxBM3OYn7E3k4yGH61ExqKxx/rsUtKS/h8GU=
const config = normalizeConfig(
{
_: [],
help: false,
clean: true,
repository: [
'a-repo',
'enc:G6VSEW8lxBM3OYn7E3k4yGH61ExqKxx/rsUtKS/h8GU=',
],
},
null
);

expect(config.repositories).toEqual<Config['repositories']>([
{
url: 'a-repo',
branch: 'master',
directory: 'a-repo',
commands: ['yarn test'],
},
]);
});

it('should normalize arguments for multiple repositories', () => {
// $ canarist -r a-repo -r b-repo
const config = normalizeConfig(
Expand Down
62 changes: 4 additions & 58 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,69 +209,15 @@ export function normalizeConfig(
'';

if (typeof argv.repository === 'string') {
try {
repositories.push(normalizeRepository(argv.repository));
} catch (error) {
console.warn(
`[canarist] could not parse repository config from: "${argv.repository}"`,
error
);
}
repositories.push(normalizeRepository(argv.repository));
} else if (Array.isArray(argv.repository)) {
repositories.push(
...argv.repository
.map((repo) => {
try {
return normalizeRepository(repo);
} catch (error) {
console.warn(
`[canarist] could not parse repository config from:`,
repo,
error
);
return undefined;
}
})
.filter((repo): repo is RepositoryConfig => typeof repo !== 'undefined')
);
repositories.push(...argv.repository.map(normalizeRepository));
} else if (argv.project && config && isProjectsConfig(config.config)) {
if (project) {
repositories.push(
...project.repositories
.map((repo) => {
try {
return normalizeRepository(repo);
} catch (error) {
console.warn(
`[canarist] could not parse repository config from:`,
repo,
error
);
return undefined;
}
})
.filter(
(repo): repo is RepositoryConfig => typeof repo !== 'undefined'
)
);
repositories.push(...project.repositories.map(normalizeRepository));
}
} else if (config && isSingleConfig(config.config)) {
repositories.push(
...config.config.repositories
.map((repo) => {
try {
return normalizeRepository(repo);
} catch (error) {
console.warn(
`[canarist] could not parse repository config from:`,
repo,
error
);
return undefined;
}
})
.filter((repo): repo is RepositoryConfig => typeof repo !== 'undefined')
);
repositories.push(...config.config.repositories.map(normalizeRepository));
}

return {
Expand Down

0 comments on commit cf88495

Please sign in to comment.