Skip to content

Commit

Permalink
quick save: Wed Jan 22 11:58:18 MSK 2025
Browse files Browse the repository at this point in the history
  • Loading branch information
nikelborm committed Jan 22, 2025
1 parent 8338235 commit 7839fb9
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 40 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/auto_merge_dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
11 changes: 11 additions & 0 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @module
*/

export {
destinationPathCLIOptionBackedByEnv,
gitRefCLIOptionBackedByEnv,
pathToEntityInRepoCLIOptionBackedByEnv,
repoNameCLIOptionBackedByEnv,
repoOwnerCLIOptionBackedByEnv,
} from './src/commandLineParams.js';
10 changes: 9 additions & 1 deletion jsr.json → deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@nikelborm/fetch-github-folder",
"version": "0.1.10",
"exports": "./src/index.ts",
"exports": {
".": "./index.ts",
"./index": "./index.ts",
"./errors": "./errors.ts",
"./cli": "./cli.ts"
},
"publish": {
"include": [
".github/FUNDING.yml",
"template.env",
"src/**/*.ts",
"index.ts",
"errors.ts",
"cli.ts",
"README.md",
"LICENSE"
],
Expand Down
23 changes: 23 additions & 0 deletions errors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @module
*/

export {
GitHubApiAuthRatelimited,
GitHubApiBadCredentials,
GitHubApiCommonErrors,
GitHubApiGeneralServerError,
GitHubApiGeneralUserError,
GitHubApiNoCommitFoundForGitRef,
GitHubApiRatelimited,
GitHubApiRepoIsEmpty,
GitHubApiSomethingDoesNotExistsOrPermissionsInsufficient,
} from './src/errors.js';
export { FailedToCastDataToReadableStream } from './src/castToReadableStream.js';
export {
FailedToParseGitLFSInfo,
InconsistentExpectedAndRealContentSize,
FailedToParseResponseFromRepoPathContentsMetaInfoAPI,
} from './src/getPathContents/index.js';
export { FailedToUnpackRepoFolderTarGzStreamToFs } from './src/unpackRepoFolderTarGzStreamToFs.js';
export { FailedToWriteFileStreamToDestinationPath } from './src/writeFileStreamToDestinationPath.js';
8 changes: 8 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @module
*/

export { downloadEntityFromRepo } from './src/downloadEntityFromRepo.js';
export { provideSingleDownloadTargetConfig } from './src/configContext.js';
export { OctokitLayer } from './src/octokit.js';
export * from './src/repo.interface.js';
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"coverage": "vitest run --coverage",
"test-once": "vitest --run",
"test-jsr": "tsc && jsr publish --dry-run",
"build": "./scripts/build.sh"
"build": "./scripts/build.sh",
"docs": "./scripts/generate_docs.sh"
},
"dependencies": {
"@effect/cli": "^0.51.2",
Expand Down Expand Up @@ -53,7 +54,7 @@
"type": "git",
"url": "git+ssh://[email protected]/nikelborm/fetch-github-folder.git"
},
"main": "./dist/src/index.js",
"main": "./dist/index.js",
"bin": {
"fetch-github-folder": "dist/fetch-github-folder.js",
"fgf": "dist/fetch-github-folder.js"
Expand All @@ -71,12 +72,16 @@
".github/FUNDING.yml",
"template.env"
],
"types": "./dist/src/index.d.ts",
"types": "./dist/index.d.ts",
"homepage": "https://github.com/nikelborm/fetch-github-folder#readme",
"exports": {
".": "./dist/src/index.js",
"./index": "./dist/src/index.js",
"./index.js": "./dist/src/index.js",
".": "./dist/index.js",
"./index": "./dist/index.js",
"./index.js": "./dist/index.js",
"./errors": "./dist/errors.js",
"./errors.js": "./dist/errors.js",
"./cli": "./dist/cli.js",
"./cli.js": "./dist/cli.js",
"./package.json": "./package.json"
},
"keywords": [
Expand Down
15 changes: 15 additions & 0 deletions scripts/generate_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail

rm -rf tmp

mkdir -p tmp

cp -r index.ts errors.ts cli.ts src package.json package-lock.json deno.json tmp/.

cd tmp

find src index.ts cli.ts errors.ts -type f -exec sed -i "s/.js';/.ts';/g" {} +

ln -s ../node_modules node_modules
deno doc --html --output=docs index.ts errors.ts cli.ts
6 changes: 3 additions & 3 deletions src/castToReadableStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ export const CastToReadableStream = <E, R>(self: Effect<unknown, E, R>) =>

// Extracting to a separate type is required by JSR, so that consumers of the
// library will have much faster type inference
export type FailedToCastDataToReadableStream =
ReturnTypeNoCauseNoStatic<'FailedToCastDataToReadableStream'>;

export const FailedToCastDataToReadableStream: FailedToCastDataToReadableStream =
TaggedErrorVerifyingCause()(
'FailedToCastDataToReadableStream',
'Error: Failed to cast data to Readable stream, type of argument is not familiar',
);

export type FailedToCastDataToReadableStream =
ReturnTypeNoCauseNoStatic<'FailedToCastDataToReadableStream'>;
5 changes: 2 additions & 3 deletions src/commandLineParams.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/**
* Reusable in [Effect]{@link https://effect.website/} applications CLI Options backed by ENV variables
*
* @file src/commandLineParams.ts
* @module
* @license https://github.com/nikelborm/fetch-github-folder/blob/main/LICENSE
* */
*/

import {
Options,
Expand Down Expand Up @@ -227,6 +225,7 @@ export const repoNameCLIOptionBackedByEnv: Options<string> = pipe(
* @since 0.1.7
* @category CLI options
* @constant
* @readonly
*/
export const destinationPathCLIOptionBackedByEnv: Options<string> = pipe(
text(`destinationPath`),
Expand Down
32 changes: 6 additions & 26 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
export {
GitHubApiAuthRatelimited,
GitHubApiBadCredentials,
GitHubApiCommonErrors,
GitHubApiGeneralServerError,
GitHubApiGeneralUserError,
GitHubApiNoCommitFoundForGitRef,
GitHubApiRatelimited,
GitHubApiRepoIsEmpty,
GitHubApiSomethingDoesNotExistsOrPermissionsInsufficient,
} from './errors.js';
/**
* @module
*/

export { downloadEntityFromRepo } from './downloadEntityFromRepo.js';
export { OctokitLayer } from './octokit.js';
export { provideSingleDownloadTargetConfig } from './configContext.js';
export {
destinationPathCLIOptionBackedByEnv,
gitRefCLIOptionBackedByEnv,
pathToEntityInRepoCLIOptionBackedByEnv,
repoNameCLIOptionBackedByEnv,
repoOwnerCLIOptionBackedByEnv,
} from './commandLineParams.js';

export { FailedToCastDataToReadableStream } from './castToReadableStream.js';
export { provideSingleDownloadTargetConfig } from './configContext.js';

export {
FailedToParseGitLFSInfo,
InconsistentExpectedAndRealContentSize,
} from './getPathContents/index.js';

export { OctokitLayer } from './octokit.js';
export * from './repo.interface.js';

export { FailedToUnpackRepoFolderTarGzStreamToFs } from './unpackRepoFolderTarGzStreamToFs.js';

export { FailedToWriteFileStreamToDestinationPath } from './writeFileStreamToDestinationPath.js';
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
"./fetch-github-folder.spec.ts",
"./scratchpad.ts",
"./reset.d.ts",
"./src/**/*"
"./src/**/*",
"cli.ts",
"errors.ts",
"index.ts"
]
}

0 comments on commit 7839fb9

Please sign in to comment.