@@ -80,7 +80,8 @@ class Configuration {
8080}
8181
8282/**
83- * Start a D-Bus session and return the process and address.
83+ * Start a D-Bus session and return the process and the D-Bus address.
84+ *
8485 * @returns {Promise}
8586 */
8687const startDBusSession = () => {
@@ -101,12 +102,13 @@ const startDBusSession = () => {
101102}
102103
103104/**
104- * Compute a SHA-256 hash of the manifest file.
105- * @param {PathLike} manifestPath
105+ * Compute a SHA-256 hash of a file.
106+ *
107+ * @param {PathLike} path The file path.
106108 */
107- const computeHash = async (manifestPath ) => {
109+ const computeHash = async (path ) => {
108110 const hash = crypto.createHash('sha256')
109- const stream = await fs.readFile(manifestPath )
111+ const stream = await fs.readFile(path )
110112
111113 const buffer = Buffer.alloc(stream.byteLength)
112114 for (let i = 0; i < buffer.length; i++) {
@@ -118,10 +120,10 @@ const computeHash = async (manifestPath) => {
118120}
119121
120122/**
121- * Parses a flatpak manifest and returns it as a JS object
122- * It supports both supported file formats by flatpak-builder: JSON & YAML.
123+ * Parses a Flatpak manifest
123124 *
124- * @param {PathLike} manifestPath the relative/absolute path to the manifest
125+ * @param {PathLike} manifestPath The path to the manifest
126+ * @returns {object} The manifest
125127 */
126128const parseManifest = async (manifestPath) => {
127129 const data = await fs.readFile(manifestPath)
@@ -145,9 +147,9 @@ const parseManifest = async (manifestPath) => {
145147/**
146148 * Saves a manifest as a YAML or JSON file
147149 *
148- * @param {object} manifest A flatpak manifest
150+ * @param {object} manifest A Flatpak manifest
149151 * @param {PathLike} dest Where to save the flatpak manifest
150- * @returns {object} manifest
152+ * @returns {object} The manifest
151153 */
152154const saveManifest = async (manifest, dest) => {
153155 let data = null
@@ -169,13 +171,14 @@ const saveManifest = async (manifest, dest) => {
169171}
170172
171173/**
174+ * Modify the manifest to prepare it for tests.
175+ *
172176 * Applies the following changes to the original manifest:
173- * 1 - If tests are enabled, proper test-args are added
174- * to enable network & x11 access.
177+ * - Add test-args are to enable network & x11 access.
175178 *
176- * @param {Object} manifest the parsed manifest
177- * @param {boolean} runTests whether to run tests or not
178- * @param {Object} testEnv dictionary of environment variables
179+ * @param {Object} manifest The parsed manifest
180+ * @param {boolean} runTests Whether to run tests or not
181+ * @param {Object} testEnv Dictionary of environment variables
179182 * @returns {object} The modified manifest
180183 */
181184const modifyManifest = (manifest, runTests = false, testEnv = {}) => {
@@ -203,10 +206,10 @@ const modifyManifest = (manifest, runTests = false, testEnv = {}) => {
203206}
204207
205208/**
206- * Build the flatpak & create a bundle from the build
209+ * Build the Flatpak & create a bundle from the build
207210 *
208- * @param {object} manifest A flatpak manifest
209- * @param {PathLike} manifestPath The flatpak manifest path
211+ * @param {object} manifest A Flatpak manifest
212+ * @param {PathLike} manifestPath The Flatpak manifest path
210213 * @param {string} cacheHitKey The key used to restore the build directory
211214 * @param {Configuration} config The build configuration
212215 */
@@ -267,8 +270,9 @@ const build = async (manifest, manifestPath, cacheHitKey, config) => {
267270
268271/**
269272 * Initialize the build
270- * It consists mostly of setting up the flatpak remote if one other than the default is set
271- * along with restoring the cache from the latest build
273+ *
274+ * Consists of setting up the Flatpak remote if one other than the default is set
275+ * and restoring the cache from the latest build
272276 *
273277 * @param {Configuration} config The build configuration
274278 * @returns {Promise<String>} The cacheHitKey if a cache was hit
0 commit comments