Skip to content

Commit

Permalink
update dependencies, tweak lint setup, rebuild files (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simek authored May 11, 2024
1 parent 23b5437 commit 5b249bc
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 352 deletions.
8 changes: 5 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"es2021": true,
"node": true
},
"plugins": ["jest", "prettier"],
"plugins": ["prettier"],
"extends": [
"eslint:recommended",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"plugin:n/recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
Expand All @@ -18,7 +19,8 @@
"prefer-arrow-callback": "error",
"prefer-const": "error",
"quotes": ["error", "single"],
"semi": ["error", "always"]
"semi": ["error", "always"],
"n/no-unpublished-import": "off"
},
"ignorePatterns": ["dist", "node_modules"]
}
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
- name: '🔏 Yarn Lock Changes'
uses: ./
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"js-base64": "^3.7.6",
"js-base64": "^3.7.7",
"markdown-table": "^3.0.3",
"semver": "^7.5.4"
"semver": "^7.6.2"
},
"devDependencies": {
"@vercel/ncc": "^0.38.1",
"@yarnpkg/lockfile": "^1.1.0",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-n": "^17.6.0",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.4",
"svgo": "^3.2.0",
"prettier": "^3.2.5",
"svgo": "^3.3.2",
"uvu": "^0.5.6"
}
}
10 changes: 5 additions & 5 deletions src/action.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { debug, getBooleanInput, getInput, setFailed, warning } from '@actions/core';
import { context, getOctokit } from '@actions/github';
import { Base64 } from 'js-base64';
import fs from 'node:fs';
import path from 'node:path';
import { existsSync, readFileSync } from 'node:fs';
import { resolve } from 'node:path';

import { createTable, createSummary } from './comment.mjs';
import { STATUS, countStatuses, diffLocks, parseLock } from './utils.mjs';
Expand Down Expand Up @@ -49,15 +49,15 @@ const run = async () => {
const baseBranch = ref || default_branch;
debug('Base branch: ' + baseBranch);

const lockPath = path.resolve(process.cwd(), inputPath);
const lockPath = resolve(process.cwd(), inputPath);

if (!fs.existsSync(lockPath)) {
if (!existsSync(lockPath)) {
throw Error(
'💥 The code has not been checkout or the lock file does not exist in this PR, aborting!'
);
}

const content = fs.readFileSync(lockPath, { encoding: 'utf8' });
const content = readFileSync(lockPath, { encoding: 'utf8' });
const updatedLock = parseLock(content);

const oktokitParams = { owner, repo };
Expand Down
2 changes: 1 addition & 1 deletion src/comment.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { markdownTable }from 'markdown-table';
import { markdownTable } from 'markdown-table';

import { STATUS_ORDER, countStatuses } from './utils.mjs';

Expand Down
6 changes: 3 additions & 3 deletions tests/performance/parse.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { test } from 'uvu';
import { is } from 'uvu/assert';

import { getTestLockContent } from '../testUtils.mjs';
import { parseLock }from '../../src/utils.mjs';
import { parseLock } from '../../src/utils.mjs';

test('naive performance test', () => {
const contentA = getTestLockContent('classic-downgrade', 'a.lock');
Expand All @@ -27,7 +27,7 @@ test('naive performance test', () => {
const internalEnd = performance.now();
console.timeEnd('Internal parser');

is((end - start) > (internalEnd - internalStart), true);
is(end - start > internalEnd - internalStart, true);
});

test.run();
test.run();
Loading

0 comments on commit 5b249bc

Please sign in to comment.