Skip to content
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

Support pnpm #3

Merged
merged 6 commits into from
Apr 1, 2024
Merged
Changes from 1 commit
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
19 changes: 12 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ try {
const {payload} = github.context;
const octokit = github.getOctokit(process.env.GITHUB_TOKEN);
const isYarn = existsSync('yarn.lock');
const isPnpm = existsSync('pnpm-lock.yaml');
const isNpm = existsSync('package-lock.json');

if (
!payload.comment ||
Expand Down Expand Up @@ -99,7 +101,11 @@ try {

if (isYarn) {
await exec('yarn', ['install', '--frozen-lockfile']);
} else {
}
if (isPnpm) {
await exec('pnpm', ['install']);
}
if (isNpm) {
await exec('npm', ['ci']);
}

Expand Down Expand Up @@ -142,6 +148,10 @@ try {
}

const multiple = newTags.length > 1;
let installMessage;
if (isYarn) installMessage = 'yarn add';
else if (isPnpm) installMessage = 'pnpm add --workspace-root';
else if (isNpm) installMessage = 'npm install';

await octokit.rest.issues.createComment({
...ownerRepo,
Expand All @@ -156,12 +166,7 @@ try {
} by updating your \`package.json\` ` +
`with the newly published version${multiple ? 's' : ''}:\n` +
newTags
.map(
(tag) =>
'```sh\n' +
`${isYarn ? 'yarn add' : 'npm install'} ${tag}\n` +
'```',
)
.map((tag) => '```sh\n' + `${installMessage} ${tag}\n` + '```')
.join('\n'),
});

Expand Down
Loading