Unverified Commit 13d33a88 authored by Paul Merlin's avatar Paul Merlin Committed by GitHub
Browse files

Merge pull request #52 from eskatos/dd/update-versions

Update dependency versions
parents 15bf8034 738bda98
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+749 −770

File changed.

Preview size limit exceeded, changes collapsed.

+17 −19
Changes for package.json: 17 added lines, 19 removed lines.
Original line number Diff line number Diff line
@@ -24,30 +24,28 @@
  "author": "Paul Merlin <[email protected]>",
  "license": "MIT",
  "dependencies": {
    "@actions/cache": "1.0.5",
    "@actions/core": "1.2.6",
    "@actions/exec": "1.0.4",
    "@actions/glob": "0.1.1",
    "@actions/http-client": "1.0.9",
    "@actions/io": "1.0.2",
    "@actions/tool-cache": "1.6.1",
    "string-argv": "0.3.1",
    "unzipper": "0.10.11"
    "@actions/cache": "1.0.7",
    "@actions/core": "1.4.0",
    "@actions/exec": "1.1.0",
    "@actions/glob": "0.2.0",
    "@actions/http-client": "1.0.11",
    "@actions/tool-cache": "1.7.1",
    "string-argv": "0.3.1"
  },
  "devDependencies": {
    "@types/jest": "26.0.19",
    "@types/node": "12.12.6",
    "@types/unzipper": "0.10.3",
    "@typescript-eslint/parser": "4.11.0",
    "@types/jest": "26.0.23",
    "@types/node": "14.17.3",
    "@types/unzipper": "0.10.4",
    "@typescript-eslint/parser": "4.28.2",
    "@zeit/ncc": "0.22.3",
    "eslint": "7.16.0",
    "eslint-plugin-github": "4.1.1",
    "eslint-plugin-jest": "24.1.3",
    "eslint": "7.30.0",
    "eslint-plugin-github": "4.1.3",
    "eslint-plugin-jest": "24.3.6",
    "jest": "26.6.3",
    "jest-circus": "26.6.3",
    "js-yaml": "3.14.1",
    "prettier": "2.2.1",
    "ts-jest": "26.4.4",
    "typescript": "4.0.2"
    "prettier": "2.3.2",
    "ts-jest": "26.5.6",
    "typescript": "4.3.5"
  }
}
+5 −36
Changes for src/crypto-utils.ts: 5 added lines, 36 removed lines.
Original line number Diff line number Diff line
import * as crypto from 'crypto'
import * as fs from 'fs'
import * as path from 'path'
import * as stream from 'stream'
import * as util from 'util'

import * as glob from '@actions/glob'

export async function hashFiles(
    baseDir: string,
    globs: string[] = ['**'],
    patterns: string[] = ['**'],
    followSymbolicLinks = false
): Promise<string | null> {
    let hasMatch = false
    type FileHashes = Record<string, Buffer>
    const hashes: FileHashes = {}
    for await (const globPattern of globs) {
        const globMatch = `${baseDir}${path.sep}${globPattern}`
        const globber = await glob.create(globMatch, {followSymbolicLinks})
        for await (const file of globber.globGenerator()) {
            // console.log(file)
            if (!file.startsWith(`${baseDir}${path.sep}`)) {
                // console.log(`Ignore '${file}' since it is not under '${baseDir}'.`)
                continue
            }
            if (fs.statSync(file).isDirectory()) {
                // console.log(`Skip directory '${file}'.`)
                continue
            }
            const hash = crypto.createHash('sha256')
            const pipeline = util.promisify(stream.pipeline)
            await pipeline(fs.createReadStream(file), hash)
            hashes[path.relative(baseDir, file)] = hash.digest()
            hasMatch = true
        }
    }
    if (!hasMatch) return null
    const result = crypto.createHash('sha256')
    for (const file of Object.keys(hashes).sort()) {
        result.update(hashes[file])
    }
    result.end()
    return result.digest('hex')
    const combinedPatterns = patterns
        .map(pattern => `${baseDir}${path.sep}${pattern}`)
        .join('\n')
    return glob.hashFiles(combinedPatterns, {followSymbolicLinks})
}
Loading