Skip to content

Commit

Permalink
Considering a single tag on package creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioszabo committed Jul 4, 2024
1 parent c971f82 commit 44efbcc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/vcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ async function newPackageData(userObj, ownerRepo, service, possibleTag) {
// information.
// See: https://github.com/pulsar-edit/package-backend/issues/205

let tags;
let tag;
if(possibleTag) {
tags = [{name: possibleTag}];
tag = await provider.tag(userObj, ownerRepo, possibleTag);
tag = tag.content

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (91% of all statements in
the enclosing function
have an explicit semicolon).
} else {
tags = await provider.tags(userObj, ownerRepo);

Check warning

Code scanning / CodeQL

Missing variable declaration Warning

Variable tags is used like a local variable, but is missing a declaration.

Expand All @@ -144,15 +145,16 @@ async function newPackageData(userObj, ownerRepo, service, possibleTag) {
}

// Sort the tags into descending order
tags = tags.content.sort((a, b) => {
tags.content.sort((a, b) => {
return semver.rcompare(a.name, b.name);
});
tag = tags.content[0]

Check notice

Code scanning / CodeQL

Semicolon insertion Note

Avoid automated semicolon insertion (91% of all statements in
the enclosing function
have an explicit semicolon).
}

let pack = await provider.packageJSON(
userObj,
ownerRepo,
tags[0]?.name
tag.name
);

if (!pack.ok) {
Expand All @@ -167,7 +169,7 @@ async function newPackageData(userObj, ownerRepo, service, possibleTag) {
const readme = await provider.readme(
userObj,
ownerRepo,
tags[0]?.name
tag.name
);

if (!readme.ok) {
Expand Down Expand Up @@ -208,7 +210,7 @@ async function newPackageData(userObj, ownerRepo, service, possibleTag) {
ownerRepo: ownerRepo,
provider: packRepoObj,
packageJson: pack.content,
tags: tags,
tag: tag,
readme: readme.content,
});
} catch (err) {
Expand Down

0 comments on commit 44efbcc

Please sign in to comment.