diff --git a/docs/reference/Source_Documentation.md b/docs/reference/Source_Documentation.md
index 4d434e94..a255e346 100644
--- a/docs/reference/Source_Documentation.md
+++ b/docs/reference/Source_Documentation.md
@@ -651,7 +651,7 @@ function.
* [vcs](#module_vcs)
* [~ownership(userObj, packObj, [opts])](#module_vcs..ownership) ⇒ object
* [~newPackageData(userObj, ownerRepo, service)](#module_vcs..newPackageData) ⇒ object
- * [~newVersionData(userObj, ownerRepo, service)](#module_vcs..newVersionData) ⇒ [SSO\_VCS\_newVersionData
](#SSO_VCS_newVersionData)
+ * [~newVersionData(userObj, ownerRepo, tagRef, service)](#module_vcs..newVersionData) ⇒ [SSO\_VCS\_newVersionData
](#SSO_VCS_newVersionData)
* [~featureDetection(userObj, ownerRepo, service)](#module_vcs..featureDetection) ⇒ object
* [~determineProvider(repo)](#module_vcs..determineProvider) ⇒ object
@@ -699,7 +699,7 @@ Contains the full package data. This includes the Readme, the package.json, and
-### vcs~newVersionData(userObj, ownerRepo, service) ⇒ [SSO\_VCS\_newVersionData
](#SSO_VCS_newVersionData)
+### vcs~newVersionData(userObj, ownerRepo, tagRef, service) ⇒ [SSO\_VCS\_newVersionData
](#SSO_VCS_newVersionData)
Replaces the previously used `git.metadataAppendTarballInfo()`
Intended to retrieve the most basic of a package's data.
Bundles all the special handling of crafting such an object into this single
@@ -714,6 +714,7 @@ upload a new version.
| --- | --- | --- |
| userObj | object
| The Full User Object as returned by `auth.verifyAuth()` |
| ownerRepo | string
| The Owner Repo Combo of the package affected. Such as `pulsar-edit/pulsar` |
+| tagRef | string
| The version number or ref where data should be sought from the remote resource. |
| service | string
| The service to use as expected to be returned by `vcs.determineProvider()`. Currently should be hardcoded to "git" |
diff --git a/docs/resources/complexity-report.md b/docs/resources/complexity-report.md
index cb2f0486..b6bafc33 100644
--- a/docs/resources/complexity-report.md
+++ b/docs/resources/complexity-report.md
@@ -1,12 +1,12 @@
-# Complexity report, 4/13/2024
-
-* Mean per-function logical LOC: 14.905797101449275
-* Mean per-function parameter count: 0.1673913043478261
-* Mean per-function cyclomatic complexity: 1.2594202898550726
-* Mean per-function Halstead effort: 3181.0354243656466
-* Mean per-module maintainability index: 67.98276367366883
-* First-order density: 0.7141356857802983%
-* Change cost: 4.452846040747742%
+# Complexity report, 6/28/2024
+
+* Mean per-function logical LOC: 15.104166666666666
+* Mean per-function parameter count: 0.16041666666666668
+* Mean per-function cyclomatic complexity: 1.2486111111111111
+* Mean per-function Halstead effort: 3138.7585527439614
+* Mean per-module maintainability index: 67.69225045749998
+* First-order density: 0.6558641975308641%
+* Change cost: 4.147376543209877%
* Core size: 100%
## /home/runner/work/package-backend/package-backend/jest.config.js
@@ -281,7 +281,7 @@
## /home/runner/work/package-backend/package-backend/src/models/callStack.js
-* Physical LOC: 83
+* Physical LOC: 94
* Logical LOC: 2
* Mean parameter count: 0
* Cyclomatic complexity: 1
@@ -909,6 +909,36 @@
* Maintainability index: 71.71259723250154
* Dependency count: 0
+## /home/runner/work/package-backend/package-backend/tests/full/fixtures/d-pulsar-package/initial-tags.js
+
+* Physical LOC: 11
+* Logical LOC: 6
+* Mean parameter count: 0
+* Cyclomatic complexity: 1
+* Cyclomatic complexity density: 16.666666666666664%
+* Maintainability index: 71.71259723250154
+* Dependency count: 0
+
+## /home/runner/work/package-backend/package-backend/tests/full/fixtures/d-pulsar-package/match.js
+
+* Physical LOC: 50
+* Logical LOC: 42
+* Mean parameter count: 0
+* Cyclomatic complexity: 1
+* Cyclomatic complexity density: 2.380952380952381%
+* Maintainability index: 47.396064939782065
+* Dependency count: 0
+
+## /home/runner/work/package-backend/package-backend/tests/full/fixtures/d-pulsar-package/tags.js
+
+* Physical LOC: 20
+* Logical LOC: 11
+* Mean parameter count: 0
+* Cyclomatic complexity: 1
+* Cyclomatic complexity density: 9.090909090909092%
+* Maintainability index: 63.92267728456596
+* Dependency count: 0
+
## /home/runner/work/package-backend/package-backend/scripts/deprecated/test/handlers/common_handler/express_fakes.js
* Physical LOC: 26
diff --git a/docs/swagger/openapi3_def.yaml b/docs/swagger/openapi3_def.yaml
index 4e44669a..f539befd 100644
--- a/docs/swagger/openapi3_def.yaml
+++ b/docs/swagger/openapi3_def.yaml
@@ -679,13 +679,12 @@ paths:
- $ref: '#/components/parameters/rename'
- $ref: '#/components/parameters/auth'
- $ref: '#/components/parameters/packageName'
+ - $ref: '#/components/parameters/tag'
responses:
'201':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/packageObjectFull'
- description: The package details indicating success.
+ description: >-
+ An object with a key 'message' indicating what version has been
+ published.
summary: Creates a new package version.
/api/packages/{packageName}/versions/{versionName}:
delete:
@@ -1029,13 +1028,12 @@ paths:
- $ref: '#/components/parameters/rename'
- $ref: '#/components/parameters/auth'
- $ref: '#/components/parameters/packageName'
+ - $ref: '#/components/parameters/tag'
responses:
'201':
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/packageObjectFull'
- description: The package details indicating success.
+ description: >-
+ An object with a key 'message' indicating what version has been
+ published.
summary: Creates a new package version.
/api/themes/{packageName}/versions/{versionName}:
delete:
diff --git a/src/bundled_packages/bundled.json b/src/bundled_packages/bundled.json
index 53d76211..0cf47c4c 100644
--- a/src/bundled_packages/bundled.json
+++ b/src/bundled_packages/bundled.json
@@ -293,9 +293,7 @@
"title": "File Blacklist",
"description": "Suggestions will not be provided for files matching this list, e.g. `*.md` for Markdown files. To blacklist more than one file extension, use comma as a separator, e.g. `*.md, *.txt` (both Markdown and text files).",
"type": "array",
- "default": [
- ".*"
- ],
+ "default": [".*"],
"items": {
"type": "string"
},
@@ -370,10 +368,7 @@
"description": "With 'Cursor' the suggestion list appears at the cursor's position. With 'Word' it appears at the beginning of the word that's being completed.",
"type": "string",
"default": "Word",
- "enum": [
- "Word",
- "Cursor"
- ],
+ "enum": ["Word", "Cursor"],
"order": 15
},
"suppressActivationForEditorClasses": {
@@ -470,9 +465,7 @@
"main": "./lib/autoflow",
"description": "Format the current selection to have lines no longer than 80 characters.\n\nThis packages uses the config value of `editor.preferredLineLength` when set.",
"activationCommands": {
- "atom-text-editor": [
- "autoflow:reflow-selection"
- ]
+ "atom-text-editor": ["autoflow:reflow-selection"]
},
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
@@ -537,11 +530,7 @@
"theme": "syntax",
"version": "1.6.0",
"description": "Base16 dark theme developed for Atom, repurposed for Pulsar",
- "keywords": [
- "base16",
- "dark",
- "syntax"
- ],
+ "keywords": ["base16", "dark", "syntax"],
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
"engines": {
@@ -556,11 +545,7 @@
"theme": "syntax",
"version": "1.6.0",
"description": "Base16 light theme developed for Atom, repurposed for Pulsar",
- "keywords": [
- "base16",
- "light",
- "syntax"
- ],
+ "keywords": ["base16", "light", "syntax"],
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
"engines": {
@@ -631,11 +616,7 @@
"pairsWithExtraNewline": {
"description": "Automatically add a newline between the pair when enter is pressed.",
"type": "array",
- "default": [
- "()",
- "[]",
- "{}"
- ],
+ "default": ["()", "[]", "{}"],
"items": {
"type": "string"
}
@@ -671,9 +652,7 @@
"main": "./lib/command-palette-package",
"description": "Find and run available commands using `cmd-shift-p` (macOS) or `ctrl-shift-p` (Linux/Windows).",
"activationCommands": {
- "atom-workspace": [
- "command-palette:toggle"
- ]
+ "atom-workspace": ["command-palette:toggle"]
},
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
@@ -895,11 +874,7 @@
"projectSearchResultsPaneSplitDirection": {
"type": "string",
"default": "none",
- "enum": [
- "none",
- "right",
- "down"
- ],
+ "enum": ["none", "right", "down"],
"title": "Direction to open results pane",
"description": "Direction to split the active pane when showing project search results. If 'none', the results will be shown in the active pane."
},
@@ -1084,9 +1059,7 @@
"description": "Jump to a specific editor line number with `ctrl-g`.",
"license": "MIT",
"activationCommands": {
- "atom-text-editor": [
- "go-to-line:toggle"
- ]
+ "atom-text-editor": ["go-to-line:toggle"]
},
"repository": "https://github.com/pulsar-edit/pulsar",
"engines": {
@@ -1214,9 +1187,7 @@
"version": "0.60.20",
"name": "language-c",
"description": "Atom language support for C/C++",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"main": "lib/main",
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
@@ -1296,11 +1267,7 @@
"private": true,
"description": "C# language support for Atom",
"repository": "https://github.com/pulsar-edit/pulsar",
- "keywords": [
- "C#",
- "csharp",
- ".Net"
- ],
+ "keywords": ["C#", "csharp", ".Net"],
"license": "MIT",
"engines": {
"atom": ">0.50.0"
@@ -1312,9 +1279,7 @@
"metadata": {
"name": "language-css",
"description": "CSS support in Atom",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"version": "0.45.4",
"engines": {
"atom": "*",
@@ -1384,9 +1349,7 @@
"name": "language-go",
"description": "Go language support in Atom",
"main": "lib/main",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"version": "0.47.3",
"license": "MIT",
"engines": {
@@ -1418,9 +1381,7 @@
"main": "lib/main",
"version": "0.53.1",
"description": "HTML language support in Atom",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"engines": {
"atom": "*",
"node": ">=14"
@@ -1514,9 +1475,7 @@
"main": "lib/main",
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"dependencies": {
"tree-sitter-javascript": "0.19.0",
"tree-sitter-jsdoc": "0.19.0",
@@ -1738,9 +1697,7 @@
"node": ">=12"
},
"description": "Python language support in Atom",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
"dependencies": {
@@ -1767,9 +1724,7 @@
"name": "language-ruby",
"version": "0.73.0",
"description": "Ruby language support in Atom",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"engines": {
"atom": "*",
"node": ">=12"
@@ -1818,11 +1773,7 @@
"name": "language-rust-bundled",
"version": "0.1.1",
"description": "Rust support for Pulsar",
- "keywords": [
- "language",
- "grammar",
- "rust"
- ],
+ "keywords": ["language", "grammar", "rust"],
"main": "lib/main.js",
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
@@ -1884,9 +1835,7 @@
"version": "0.28.2",
"main": "lib/main",
"description": "ShellScript language support in Atom",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"engines": {
"atom": "*",
"node": ">=12"
@@ -2010,9 +1959,7 @@
"name": "language-typescript",
"version": "0.6.4",
"description": "TypeScript language support in Atom",
- "keywords": [
- "tree-sitter"
- ],
+ "keywords": ["tree-sitter"],
"engines": {
"atom": ">=1.19.1",
"node": ">=12"
@@ -2164,11 +2111,7 @@
"description": "Line ending to use for new files",
"type": "string",
"default": "OS Default",
- "enum": [
- "OS Default",
- "LF",
- "CRLF"
- ]
+ "enum": ["OS Default", "LF", "CRLF"]
}
}
}
@@ -2186,9 +2129,7 @@
"atom": "*"
},
"activationCommands": {
- "atom-workspace": [
- "link:open"
- ]
+ "atom-workspace": ["link:open"]
},
"dependencies": {
"underscore-plus": "^1.7.0"
@@ -2380,11 +2321,7 @@
"theme": "syntax",
"version": "1.8.4",
"description": "A dark syntax theme",
- "keywords": [
- "dark",
- "blue",
- "syntax"
- ],
+ "keywords": ["dark", "blue", "syntax"],
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
"engines": {
@@ -2399,11 +2336,7 @@
"theme": "ui",
"version": "1.12.5",
"description": "Pulsar One dark UI theme",
- "keywords": [
- "dark",
- "adaptive",
- "ui"
- ],
+ "keywords": ["dark", "adaptive", "ui"],
"license": "MIT",
"repository": "https://github.com/pulsar-edit/pulsar",
"main": "lib/main",
@@ -2416,19 +2349,7 @@
"description": "Change the font size for the UI.",
"type": "integer",
"default": 12,
- "enum": [
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20
- ],
+ "enum": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
"order": 1
},
"tabSizing": {
@@ -2436,11 +2357,7 @@
"description": "In Even mode all tabs will be the same size. Great for quickly closing many tabs. In Maximum mode the tabs will expand to take up the full width. In Minimum mode the tabs will only take as little space as needed and also show longer file names.",
"type": "string",
"default": "Even",
- "enum": [
- "Even",
- "Maximum",
- "Minimum"
- ],
+ "enum": ["Even", "Maximum", "Minimum"],
"order": 2
},
"tabCloseButton": {
@@ -2448,10 +2365,7 @@
"description": "Choose the position of the close button shown in tabs.",
"type": "string",
"default": "Right",
- "enum": [
- "Left",
- "Right"
- ],
+ "enum": ["Left", "Right"],
"order": 3
},
"hideDockButtons": {
@@ -2477,10 +2391,7 @@
"theme": "syntax",
"version": "1.8.4",
"description": "One light syntax theme developed for Atom, repurposed for Pulsar",
- "keywords": [
- "light",
- "syntax"
- ],
+ "keywords": ["light", "syntax"],
"repository": "https://github.com/pulsar-edit/pulsar",
"license": "MIT",
"engines": {
@@ -2495,11 +2406,7 @@
"theme": "ui",
"version": "1.12.5",
"description": "One light UI theme developed for Atom, repurposed for Pulsar",
- "keywords": [
- "light",
- "adaptive",
- "ui"
- ],
+ "keywords": ["light", "adaptive", "ui"],
"license": "MIT",
"repository": "https://github.com/pulsar-edit/pulsar",
"main": "lib/main",
@@ -2512,19 +2419,7 @@
"description": "Change the font size for the UI.",
"type": "integer",
"default": 12,
- "enum": [
- 10,
- 11,
- 12,
- 13,
- 14,
- 15,
- 16,
- 17,
- 18,
- 19,
- 20
- ],
+ "enum": [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
"order": 1
},
"tabSizing": {
@@ -2532,11 +2427,7 @@
"description": "In Even mode all tabs will be the same size. Great for quickly closing many tabs. In Maximum mode the tabs will expand to take up the full width. In Minimum mode the tabs will only take as little space as needed and also show longer file names.",
"type": "string",
"default": "Even",
- "enum": [
- "Even",
- "Maximum",
- "Minimum"
- ],
+ "enum": ["Even", "Maximum", "Minimum"],
"order": 2
},
"tabCloseButton": {
@@ -2544,10 +2435,7 @@
"description": "Choose the position of the close button shown in tabs.",
"type": "string",
"default": "Right",
- "enum": [
- "Left",
- "Right"
- ],
+ "enum": ["Left", "Right"],
"order": 3
},
"hideDockButtons": {
@@ -2637,10 +2525,7 @@
"packageSyntax": {
"default": "javascript",
"type": "string",
- "enum": [
- "coffeescript",
- "javascript"
- ],
+ "enum": ["coffeescript", "javascript"],
"description": "The syntax to generate packages with."
}
}
@@ -3237,15 +3122,8 @@
"description": "Show the tab bar even when only one tab is open."
},
"tabScrolling": {
- "type": [
- "boolean",
- "string"
- ],
- "enum": [
- true,
- false,
- "platform"
- ],
+ "type": ["boolean", "string"],
+ "enum": [true, false, "platform"],
"default": "platform",
"description": "Jump to next or previous tab by scrolling on the tab bar."
},
@@ -3405,9 +3283,7 @@
"atom": ">0.39.0"
},
"activationCommands": {
- "atom-workspace": [
- "update-package-dependencies:update"
- ]
+ "atom-workspace": ["update-package-dependencies:update"]
},
"consumedServices": {
"status-bar": {
@@ -3710,11 +3586,7 @@
"viewChangesForCurrentFileDiffPaneSplitDirection": {
"type": "string",
"default": "none",
- "enum": [
- "none",
- "right",
- "down"
- ],
+ "enum": ["none", "right", "down"],
"title": "Direction to open diff pane",
"description": "Direction to split the active pane when showing diff associated with open file. If 'none', the results will be shown in the active pane."
},
@@ -3730,9 +3602,7 @@
},
"performanceMask": {
"type": "array",
- "default": [
- ".*"
- ],
+ "default": [".*"],
"items": {
"type": "string"
},
@@ -3786,10 +3656,7 @@
"remoteFetchProtocol": {
"type": "string",
"default": "https",
- "enum": [
- "https",
- "ssh"
- ],
+ "enum": ["https", "ssh"],
"description": "Transport protocol to prefer when creating a new git remote"
}
},
@@ -3805,11 +3672,8 @@
"ReviewsStub": "createReviewsStub"
},
"greenkeeper": {
- "ignore": [
- "electron-link",
- "electron-mksnapshot"
- ]
+ "ignore": ["electron-link", "electron-mksnapshot"]
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/controllers/postPackagesPackageNameVersions.js b/src/controllers/postPackagesPackageNameVersions.js
index dff597c4..500589d1 100644
--- a/src/controllers/postPackagesPackageNameVersions.js
+++ b/src/controllers/postPackagesPackageNameVersions.js
@@ -7,7 +7,8 @@ module.exports = {
summary: "Creates a new package version.",
responses: {
201: {
- description: "An object with a key 'message' indicating what version has been published.",
+ description:
+ "An object with a key 'message' indicating what version has been published.",
},
},
},
@@ -36,7 +37,7 @@ module.exports = {
},
tag: (context, req) => {
return context.query.tag(req);
- }
+ },
},
async postReturnHTTP(req, res, context, obj) {
// We use postReturnHTTP to ensure the user doesn't wait on these other actions
@@ -44,7 +45,10 @@ module.exports = {
// Lets bail early in case these values don't exist.
// Such as the original request failing
- if (typeof obj?.webhook?.pack !== "string" || typeof obj?.webhook?.user !== "string") {
+ if (
+ typeof obj?.webhook?.pack !== "string" ||
+ typeof obj?.webhook?.user !== "string"
+ ) {
// This data isn't defined, and we cannot work with it
return;
}
diff --git a/src/vcs.js b/src/vcs.js
index 39eb9087..827f1da2 100644
--- a/src/vcs.js
+++ b/src/vcs.js
@@ -140,9 +140,15 @@ async function newPackageData(userObj, ownerRepo, service) {
}
// Sort the tags into descending order
- tags.content.sort((a, b) => { return semver.rcompare(a.name, b.name)} );
-
- let pack = await provider.packageJSON(userObj, ownerRepo, tags.content[0]?.name);
+ tags.content.sort((a, b) => {
+ return semver.rcompare(a.name, b.name);
+ });
+
+ let pack = await provider.packageJSON(
+ userObj,
+ ownerRepo,
+ tags.content[0]?.name
+ );
if (!pack.ok) {
return new ServerStatus()
@@ -153,7 +159,11 @@ async function newPackageData(userObj, ownerRepo, service) {
}
// Now to get our Readme
- const readme = await provider.readme(userObj, ownerRepo, tags.content[0]?.name);
+ const readme = await provider.readme(
+ userObj,
+ ownerRepo,
+ tags.content[0]?.name
+ );
if (!readme.ok) {
return new ServerStatus()
diff --git a/src/vcs_providers/github.js b/src/vcs_providers/github.js
index 3a083b46..71c0f7fb 100644
--- a/src/vcs_providers/github.js
+++ b/src/vcs_providers/github.js
@@ -184,10 +184,7 @@ class GitHub extends Git {
reqString += `?ref=${ver}`;
}
- const readmeRaw = await this._webRequestAuth(
- reqString,
- userObj.token
- );
+ const readmeRaw = await this._webRequestAuth(reqString, userObj.token);
// Using just `/readme` will let GitHub attempt to get the repos prefferred readme file,
// so we don't have to check mutliple times.
// https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-a-repository-readme
@@ -309,10 +306,7 @@ class GitHub extends Git {
reqString += `?ref=${ver}`;
}
- const raw = await this._webRequestAuth(
- reqString,
- userObj.token
- );
+ const raw = await this._webRequestAuth(reqString, userObj.token);
if (!raw.ok) {
if (raw.short === "Failed Request") {
@@ -435,10 +429,7 @@ class GitHub extends Git {
reqString += `?ref=${ref}`;
}
- const raw = await this._webRequestAuth(
- reqString,
- userObj.token
- );
+ const raw = await this._webRequestAuth(reqString, userObj.token);
if (!raw.ok) {
if (raw.short === "Failed Request") {
@@ -464,10 +455,7 @@ class GitHub extends Git {
reqString += `?ref=${ref}`;
}
- const raw = await this._webRequestAuth(
- ref,
- userObj.token
- );
+ const raw = await this._webRequestAuth(ref, userObj.token);
if (
!raw.ok &&
@@ -489,10 +477,7 @@ class GitHub extends Git {
innerReqString += `?ref=${ref}`;
}
- const rawInner = this._webRequestAuth(
- innerReqString,
- userObj.token
- );
+ const rawInner = this._webRequestAuth(innerReqString, userObj.token);
if (!rawInner.ok) {
continue;
@@ -546,12 +531,14 @@ class GitHub extends Git {
// after the HTTP request returns.
return {
ok: false,
- content: tags
+ content: tags,
};
}
// Sort the tags into descending order
- tags.content.sort((a, b) => { return semver.rcompare(a.name, b.name)} );
+ tags.content.sort((a, b) => {
+ return semver.rcompare(a.name, b.name);
+ });
const grammars = await getGrammars(tags.content[0]?.name);
const snippets = await providesSnippets(tags.content[0]?.name);
diff --git a/tests/full/fixtures/d-pulsar-package/initial-tags.js b/tests/full/fixtures/d-pulsar-package/initial-tags.js
index 94151dd0..2d0725c6 100644
--- a/tests/full/fixtures/d-pulsar-package/initial-tags.js
+++ b/tests/full/fixtures/d-pulsar-package/initial-tags.js
@@ -1,10 +1,11 @@
module.exports = [
{
name: "v1.0.0",
- tarball_url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/tarball/refs/tags/v1.0.0",
+ tarball_url:
+ "https://api.github.com/repos/confused-Techie/d-pulsar-package/tarball/refs/tags/v1.0.0",
commit: {
sha: "09f",
- url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/commits/09f"
- }
- }
+ url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/commits/09f",
+ },
+ },
];
diff --git a/tests/full/fixtures/d-pulsar-package/match.js b/tests/full/fixtures/d-pulsar-package/match.js
index 88d9f44c..17f4c278 100644
--- a/tests/full/fixtures/d-pulsar-package/match.js
+++ b/tests/full/fixtures/d-pulsar-package/match.js
@@ -9,7 +9,7 @@ module.exports = {
license: "MIT",
version: "2.0.0",
repository: "https://github.com/confused-Techie/d-pulsar-package",
- description: "An old package for stuff"
+ description: "An old package for stuff",
},
releases: { latest: "2.0.0" },
versions: {
@@ -24,7 +24,7 @@ module.exports = {
license: "MIT",
version: "2.0.0",
repository: "https://github.com/confused-Techie/d-pulsar-package",
- description: "An old package for stuff"
+ description: "An old package for stuff",
},
"1.0.0": {
dist: {
@@ -37,12 +37,12 @@ module.exports = {
license: "MIT",
version: "1.0.0",
repository: "https://github.com/confused-Techie/d-pulsar-package",
- description: "A new package for stuff"
- }
+ description: "A new package for stuff",
+ },
},
repository: {
url: "https://github.com/confused-Techie/d-pulsar-package",
- type: "git"
+ type: "git",
},
downloads: "0",
stargazers_count: "0",
diff --git a/tests/full/fixtures/d-pulsar-package/tags.js b/tests/full/fixtures/d-pulsar-package/tags.js
index 8b439ac9..e4e729b6 100644
--- a/tests/full/fixtures/d-pulsar-package/tags.js
+++ b/tests/full/fixtures/d-pulsar-package/tags.js
@@ -1,18 +1,20 @@
module.exports = [
{
name: "v2.0.0",
- tarball_url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/tarball/refs/tags/v2.0.0",
+ tarball_url:
+ "https://api.github.com/repos/confused-Techie/d-pulsar-package/tarball/refs/tags/v2.0.0",
commit: {
sha: "09f",
- url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/commits/09f"
- }
+ url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/commits/09f",
+ },
},
{
name: "v1.0.0",
- tarball_url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/tarball/refs/tags/v1.0.0",
+ tarball_url:
+ "https://api.github.com/repos/confused-Techie/d-pulsar-package/tarball/refs/tags/v1.0.0",
commit: {
sha: "09f",
- url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/commits/09f"
- }
- }
+ url: "https://api.github.com/repos/confused-Techie/d-pulsar-package/commits/09f",
+ },
+ },
];
diff --git a/tests/full/publish-version.test.js b/tests/full/publish-version.test.js
index dd1428e6..2f790b1b 100644
--- a/tests/full/publish-version.test.js
+++ b/tests/full/publish-version.test.js
@@ -28,81 +28,82 @@ describe("publish package versions", () => {
// Add our test package
// ====================
- // Ensure the ownership tests passes for our test user
- nock("https://api.github.com").get("/user").reply(200, {
- node_id: "full-publish-version-test-user-node-id"
- });
-
- // Lets publish the initial version of our package to test additional versions with
-
- // Ensure user has ownership of our repo
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/collaborators?page=1")
- .reply(200, [
- {
- node_id: "full-publish-version-test-user-node-id",
- permissions: {
- admin: true,
- maintain: true,
- push: true
- },
- role_name: "Admin"
- }
- ]);
-
- // Ensure we can report that the package exists
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package")
- .reply(200, {
- full_name: "confused-Techie/d-pulsar-package"
- });
-
- // Ensure we can get the readme
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/readme?ref=v1.0.0")
- .reply(200, {
- content: getFileEncoded(
- "./tests/full/fixtures/d-pulsar-package/readme.md"
- ),
- encoding: "base64"
- });
-
- // Ensure we can get the tags
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/tags")
- .reply(200, require("./fixtures/d-pulsar-package/initial-tags.js"));
-
- // Ensure we can get the 'package.json'
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v1.0.0")
- .reply(200, {
- content: getFileEncoded(
- "./tests/full/fixtures/d-pulsar-package/initial-package.json"
- ),
- encoding: "base64"
- });
-
- // Lets fail on any feature detection
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/snippets")
- .reply(404);
-
- nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/grammars")
- .reply(404);
-
- const res = await supertest(app)
- .post("/api/packages")
- .query({ repository: "confused-Techie/d-pulsar-package" })
- .set({ Authorization: "any-token-will-do" });
-
- expect(res).toHaveHTTPCode(201);
- expect(res.body.name).toBe("d-pulsar-package");
- // Notice we don't remove the package yet, until the end all of tests
+ // Ensure the ownership tests passes for our test user
+ nock("https://api.github.com").get("/user").reply(200, {
+ node_id: "full-publish-version-test-user-node-id",
+ });
+
+ // Lets publish the initial version of our package to test additional versions with
+
+ // Ensure user has ownership of our repo
+ nock("https://api.github.com")
+ .get("/repos/confused-Techie/d-pulsar-package/collaborators?page=1")
+ .reply(200, [
+ {
+ node_id: "full-publish-version-test-user-node-id",
+ permissions: {
+ admin: true,
+ maintain: true,
+ push: true,
+ },
+ role_name: "Admin",
+ },
+ ]);
+
+ // Ensure we can report that the package exists
+ nock("https://api.github.com")
+ .get("/repos/confused-Techie/d-pulsar-package")
+ .reply(200, {
+ full_name: "confused-Techie/d-pulsar-package",
+ });
+
+ // Ensure we can get the readme
+ nock("https://api.github.com")
+ .get("/repos/confused-Techie/d-pulsar-package/readme?ref=v1.0.0")
+ .reply(200, {
+ content: getFileEncoded(
+ "./tests/full/fixtures/d-pulsar-package/readme.md"
+ ),
+ encoding: "base64",
+ });
+
+ // Ensure we can get the tags
+ nock("https://api.github.com")
+ .get("/repos/confused-Techie/d-pulsar-package/tags")
+ .reply(200, require("./fixtures/d-pulsar-package/initial-tags.js"));
+
+ // Ensure we can get the 'package.json'
+ nock("https://api.github.com")
+ .get(
+ "/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v1.0.0"
+ )
+ .reply(200, {
+ content: getFileEncoded(
+ "./tests/full/fixtures/d-pulsar-package/initial-package.json"
+ ),
+ encoding: "base64",
+ });
+
+ // Lets fail on any feature detection
+ nock("https://api.github.com")
+ .get("/repos/confused-Techie/d-pulsar-package/contents/snippets")
+ .reply(404);
+
+ nock("https://api.github.com")
+ .get("/repos/confused-Techie/d-pulsar-package/contents/grammars")
+ .reply(404);
+
+ const res = await supertest(app)
+ .post("/api/packages")
+ .query({ repository: "confused-Techie/d-pulsar-package" })
+ .set({ Authorization: "any-token-will-do" });
+ expect(res).toHaveHTTPCode(201);
+ expect(res.body.name).toBe("d-pulsar-package");
+ // Notice we don't remove the package yet, until the end all of tests
});
- afterAll(async () => {
+ afterAll(async () => {
// Lets delete our test package versions
await database.removePackageByName("d-pulsar-package", true);
@@ -113,7 +114,7 @@ describe("publish package versions", () => {
beforeEach(() => {
// Ensure the ownership tests passes for our test user
nock("https://api.github.com").get("/user").reply(200, {
- node_id: "full-publish-version-test-user-node-id"
+ node_id: "full-publish-version-test-user-node-id",
});
});
@@ -132,10 +133,10 @@ describe("publish package versions", () => {
permissions: {
admin: true,
maintain: true,
- push: true
+ push: true,
},
- role_name: "Admin"
- }
+ role_name: "Admin",
+ },
]);
// Ensure we can report that the package exists
@@ -150,7 +151,7 @@ describe("publish package versions", () => {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/readme.md"
),
- encoding: "base64"
+ encoding: "base64",
});
// Ensure we can get the tags
@@ -160,12 +161,14 @@ describe("publish package versions", () => {
// Ensure we can get the 'package.json'
nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0")
+ .get(
+ "/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0"
+ )
.reply(200, {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/package.json"
),
- encoding: "base64"
+ encoding: "base64",
});
// Lets fail on any feature detection
@@ -198,17 +201,17 @@ describe("publish package versions", () => {
permissions: {
admin: true,
maintain: true,
- push: true
+ push: true,
},
- role_name: "Admin"
- }
+ role_name: "Admin",
+ },
]);
// Ensure we can report that the package exists
nock("https://api.github.com")
.get("/repos/confused-Techie/d-pulsar-package")
.reply(200, {
- full_name: "confused-Techie/d-pulsar-package"
+ full_name: "confused-Techie/d-pulsar-package",
});
// Ensure we can get the readme
@@ -223,12 +226,14 @@ describe("publish package versions", () => {
// Ensure we can get the 'package.json'
nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0")
+ .get(
+ "/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0"
+ )
.reply(200, {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/package.json"
),
- encoding: "base64"
+ encoding: "base64",
});
// Lets fail on any feature detection
@@ -261,17 +266,17 @@ describe("publish package versions", () => {
permissions: {
admin: true,
maintain: true,
- push: true
+ push: true,
},
- role_name: "Admin"
- }
+ role_name: "Admin",
+ },
]);
// Ensure we can report that the package exists
nock("https://api.github.com")
.get("/repos/confused-Techie/d-pulsar-package")
.reply(200, {
- full_name: "confused-Techie/d-pulsar-package"
+ full_name: "confused-Techie/d-pulsar-package",
});
// Ensure we can get the readme
@@ -281,7 +286,7 @@ describe("publish package versions", () => {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/readme.md"
),
- encoding: "base64"
+ encoding: "base64",
});
// Ensure we can get the tags
@@ -291,12 +296,14 @@ describe("publish package versions", () => {
// Ensure we can get the 'package.json'
nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0")
+ .get(
+ "/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0"
+ )
.reply(200, {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/package.json"
),
- encoding: "base64"
+ encoding: "base64",
});
// Lets fail on any feature detection
@@ -329,17 +336,17 @@ describe("publish package versions", () => {
permissions: {
admin: true,
maintain: true,
- push: true
+ push: true,
},
- role_name: "Admin"
- }
+ role_name: "Admin",
+ },
]);
// Ensure we can report that the package exists
nock("https://api.github.com")
.get("/repos/confused-Techie/d-pulsar-package")
.reply(200, {
- full_name: "confused-Techie/d-pulsar-package"
+ full_name: "confused-Techie/d-pulsar-package",
});
// Ensure we can get the readme
@@ -349,7 +356,7 @@ describe("publish package versions", () => {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/readme.md"
),
- encoding: "base64"
+ encoding: "base64",
});
// Ensure we can get the tags
@@ -359,12 +366,14 @@ describe("publish package versions", () => {
// Ensure we can get the 'package.json'
nock("https://api.github.com")
- .get("/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0")
+ .get(
+ "/repos/confused-Techie/d-pulsar-package/contents/package.json?ref=v2.0.0"
+ )
.reply(200, {
content: getFileEncoded(
"./tests/full/fixtures/d-pulsar-package/package.json"
),
- encoding: "base64"
+ encoding: "base64",
});
// Lets fail on any feature detection
@@ -382,12 +391,15 @@ describe("publish package versions", () => {
.set({ Authorization: "any-token-will-do" });
expect(res).toHaveHTTPCode(201);
- expect(res.body.content).toBe("Successfully added new version: d-pulsar-package@2.0.0");
+ expect(res.body.content).toBe(
+ "Successfully added new version: d-pulsar-package@2.0.0"
+ );
- const resPack = await supertest(app)
- .get("/api/packages/d-pulsar-package");
+ const resPack = await supertest(app).get("/api/packages/d-pulsar-package");
expect(resPack).toHaveHTTPCode(200);
- expect(resPack.body).toMatchObject(require("./fixtures/d-pulsar-package/match.js"));
+ expect(resPack.body).toMatchObject(
+ require("./fixtures/d-pulsar-package/match.js")
+ );
});
});
diff --git a/tests/full/publish.test.js b/tests/full/publish.test.js
index 134e7c32..dcdca496 100644
--- a/tests/full/publish.test.js
+++ b/tests/full/publish.test.js
@@ -84,7 +84,9 @@ describe("publish packages", () => {
// Ensure we can get the `package.json`
nock("https://api.github.com")
- .get("/repos/confused-Techie/a-pulsar-package/contents/package.json?ref=v1.0.0")
+ .get(
+ "/repos/confused-Techie/a-pulsar-package/contents/package.json?ref=v1.0.0"
+ )
.reply(200, {
content: getFileEncoded(
"./tests/full/fixtures/a-pulsar-package/package.json"