Skip to content

chore(ci): make pre-commit hook instant #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/ci/githubActions/setRunVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const COMMON_DEPENDENCIES = {
'.github/workflows',
'.github/.cache_version',
],
SCRIPTS_CHANGED: ['scripts', 'eslint', 'yarn.lock'],
SCRIPTS_CHANGED: ['scripts', 'eslint', 'yarn.lock', '.eslintrc.js'],
COMMON_SPECS_CHANGED: ['specs/common'],
};

Expand Down
12 changes: 7 additions & 5 deletions scripts/ci/husky/pre-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,17 @@ async function preCommit() {
const stagedFiles = (await run('git diff --name-only --cached')).split('\n');

const toUnstage = micromatch.match(stagedFiles, getPatterns());
if (toUnstage.length === 0) {
return;
}

for (const file of toUnstage) {
toUnstage.forEach((file) =>
console.log(
chalk.black.bgYellow('[INFO]'),
`Generated file found, unstaging: ${file}`
);

await run(`git restore --staged ${file}`);
}
)
);
await run(`git restore --staged ${toUnstage.join(' ')}`);
}

if (require.main === module && !process.env.CI) {
Expand Down
11 changes: 5 additions & 6 deletions scripts/release/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ export type Version = {
noCommit?: boolean;
};

export type Versions = {
[lang: string]: Version;
};
export type Versions = Record<string, Version>;

export type VersionsBeforeBump = {
[lang: string]: Omit<Version, 'next' | 'releaseType'>;
};
export type VersionsBeforeBump = Record<
string,
Omit<Version, 'next' | 'releaseType'>
>;

export type Scope = Language | 'clients' | 'specs';

Expand Down
9 changes: 5 additions & 4 deletions scripts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ export type Spec = {
*/
type Server = {
url: string;
variables?: {
[k: string]: {
variables?: Record<
string,
{
enum?: string[];
default: string;
};
};
}
>;
};

/**
Expand Down