Skip to content

Commit 0d4a6fa

Browse files
authored
chore(javascript): add yarn.lock on release process (#314)
* chore(javascript): add yarn.lock on release process * chore: update types * chore: fix types * revert: "chore: fix types" This reverts commit 66657e4. * revert: "chore: update types" This reverts commit 8f0b477. * chore: run BEFORE_CLIENT_COMMIT before git add .
1 parent 5b79563 commit 0d4a6fa

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

scripts/release/process-release.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ import {
2828
cloneRepository,
2929
} from './common';
3030
import TEXT from './text';
31-
import type { VersionsToRelease } from './types';
31+
import type {
32+
VersionsToRelease,
33+
BeforeClientGenerationCommand,
34+
BeforeClientCommitCommand,
35+
} from './types';
3236

3337
dotenv.config({ path: ROOT_ENV_PATH });
3438

35-
type BeforeClientGenerationCommand = (params: {
36-
releaseType: ReleaseType;
37-
dir: string;
38-
}) => Promise<void>;
39-
4039
const BEFORE_CLIENT_GENERATION: {
4140
[lang: string]: BeforeClientGenerationCommand;
4241
} = {
@@ -45,6 +44,12 @@ const BEFORE_CLIENT_GENERATION: {
4544
},
4645
};
4746

47+
const BEFORE_CLIENT_COMMIT: { [lang: string]: BeforeClientCommitCommand } = {
48+
javascript: async ({ dir }) => {
49+
await run(`yarn`, { cwd: dir }); // generate `yarn.lock` file
50+
},
51+
};
52+
4853
function getIssueBody(): string {
4954
return JSON.parse(
5055
execa.sync('curl', [
@@ -219,11 +224,13 @@ async function processRelease(): Promise<void> {
219224
await copy(clientPath, tempGitDir, { preserveTimestamps: true });
220225

221226
await configureGitHubAuthor(tempGitDir);
227+
await BEFORE_CLIENT_COMMIT[lang]?.({
228+
dir: tempGitDir,
229+
});
222230
await run(`git add .`, { cwd: tempGitDir });
223231

224232
const { current, releaseType } = versionsToRelease[lang];
225233
const next = semver.inc(current, releaseType);
226-
227234
await gitCommit({
228235
message: `chore: release v${next}`,
229236
cwd: tempGitDir,

scripts/release/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@ export type VersionsToRelease = {
3636
releaseType: ReleaseType;
3737
};
3838
};
39+
40+
export type BeforeClientGenerationCommand = (params: {
41+
releaseType: ReleaseType;
42+
dir: string;
43+
}) => Promise<void>;
44+
45+
export type BeforeClientCommitCommand = (params: {
46+
dir: string;
47+
}) => Promise<void>;

0 commit comments

Comments
 (0)