Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .github/workflows/unused-dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: 'Unused Dependencies'
on: [pull_request]

permissions:
contents: read
permissions:
contents: read

jobs:
unused-dependecies:
Expand All @@ -20,11 +20,10 @@ jobs:
with:
node-version: '18.x'
- name: 'Run depcheck'
run: |
npx depcheck --skip-missing --ignores="@babel/*,@commitlint/*,eslint,eslint-*,husky,mocha,concurrently,nyc,prettier"
run: |
npx depcheck --skip-missing --ignores="tsx,@babel/*,@commitlint/*,eslint,eslint-*,husky,mocha,concurrently,nyc,prettier,typescript,vite-tsconfig-paths"
echo $?
if [[ $? == 1 ]]; then
echo "Unused dependencies or devDependencies found"
exit 1
fi

27 changes: 15 additions & 12 deletions index.js → index.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
#!/usr/bin/env node
#!/usr/bin/env tsx
/* eslint-disable max-len */
const argv = require('yargs/yargs')(process.argv.slice(2))
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import * as fs from 'fs';
import config from './src/config/file';
import proxy from './src/proxy';
import service from './src/service';

const argv = yargs(hideBin(process.argv))
.usage('Usage: $0 [options]')
.options({
validate: {
description:
'Check the proxy.config.json file in the current working directory for validation errors.',
required: false,
alias: 'v',
type: 'boolean',
},
config: {
description: 'Path to custom git-proxy configuration file.',
default: 'proxy.config.json',
required: false,
alias: 'c',
type: 'string',
},
})
.strict().argv;
.strict()
.parseSync();

const config = require('./src/config/file');
config.configFile = argv.c ? argv.c : undefined;

if (argv.v) {
const fs = require('fs');

if (!fs.existsSync(config.configFile)) {
if (!fs.existsSync(config.configFile as string)) {
console.error(
`Config file ${config.configFile} doesn't exist, nothing to validate! Did you forget -c/--config?`,
);
Expand All @@ -38,11 +45,7 @@ if (argv.v) {

config.validate();

const proxy = require('./src/proxy');
const service = require('./src/service');

proxy.start();
service.start();

module.exports.proxy = proxy;
module.exports.service = service;
export { proxy, service };
Loading