Skip to content

Commit

Permalink
chore(javascript): add yarn.lock on release process (#314)
Browse files Browse the repository at this point in the history
* 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 .
  • Loading branch information
eunjae-lee committed Mar 31, 2022
1 parent 59ce8b4 commit 0011fcc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
21 changes: 14 additions & 7 deletions scripts/release/process-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ import {
cloneRepository,
} from './common';
import TEXT from './text';
import type { VersionsToRelease } from './types';
import type {
VersionsToRelease,
BeforeClientGenerationCommand,
BeforeClientCommitCommand,
} from './types';

dotenv.config({ path: ROOT_ENV_PATH });

type BeforeClientGenerationCommand = (params: {
releaseType: ReleaseType;
dir: string;
}) => Promise<void>;

const BEFORE_CLIENT_GENERATION: {
[lang: string]: BeforeClientGenerationCommand;
} = {
Expand All @@ -45,6 +44,12 @@ const BEFORE_CLIENT_GENERATION: {
},
};

const BEFORE_CLIENT_COMMIT: { [lang: string]: BeforeClientCommitCommand } = {
javascript: async ({ dir }) => {
await run(`yarn`, { cwd: dir }); // generate `yarn.lock` file
},
};

function getIssueBody(): string {
return JSON.parse(
execa.sync('curl', [
Expand Down Expand Up @@ -219,11 +224,13 @@ async function processRelease(): Promise<void> {
await copy(clientPath, tempGitDir, { preserveTimestamps: true });

await configureGitHubAuthor(tempGitDir);
await BEFORE_CLIENT_COMMIT[lang]?.({
dir: tempGitDir,
});
await run(`git add .`, { cwd: tempGitDir });

const { current, releaseType } = versionsToRelease[lang];
const next = semver.inc(current, releaseType);

await gitCommit({
message: `chore: release v${next}`,
cwd: tempGitDir,
Expand Down
9 changes: 9 additions & 0 deletions scripts/release/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,12 @@ export type VersionsToRelease = {
releaseType: ReleaseType;
};
};

export type BeforeClientGenerationCommand = (params: {
releaseType: ReleaseType;
dir: string;
}) => Promise<void>;

export type BeforeClientCommitCommand = (params: {
dir: string;
}) => Promise<void>;

0 comments on commit 0011fcc

Please sign in to comment.