From e2f1088cbe6f1037486c9feda25891d615eeb44c Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:30:59 +0900 Subject: [PATCH 1/4] fix: add return type --- src/resolve_util.ts | 2 +- src/str.ts | 4 ++-- src/transform.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/resolve_util.ts b/src/resolve_util.ts index 303b411..e7d28ce 100644 --- a/src/resolve_util.ts +++ b/src/resolve_util.ts @@ -5,7 +5,7 @@ export const resolveModuleName = (args: { fileName: string; targetFileAbsPath: string; tsConfigObject: ts.ParsedCommandLine; -}) => { +}): ts.ResolvedModuleWithFailedLookupLocations => { const { fileName, targetFileAbsPath, tsConfigObject } = args; return ts.resolveModuleName( fileName, diff --git a/src/str.ts b/src/str.ts index 0245324..50e76ba 100644 --- a/src/str.ts +++ b/src/str.ts @@ -21,7 +21,7 @@ export const NEW_LINE = '\n//_PRESERVE_NEWLINE_//\n'; * @param str * @returns */ -export const preserveNewLine = (str: string) => { +export const preserveNewLine = (str: string): string => { return str.replace(/(\r|\n)\n/g, NEW_LINE); }; @@ -30,7 +30,7 @@ export const preserveNewLine = (str: string) => { * @param str * @returns */ -export const restoreNewLine = (str: string) => { +export const restoreNewLine = (str: string): string => { return str // with newline .replace(/\/\/_PRESERVE_NEWLINE_\/\/\n/g, fs.EOL) diff --git a/src/transform.ts b/src/transform.ts index 46c93e6..ad0bcc9 100644 --- a/src/transform.ts +++ b/src/transform.ts @@ -8,7 +8,7 @@ import { hasUnicodeStr, unescapeUnicodeStr } from './str.ts'; const transformModuleSpecifier = ( sourceFile: ts.SourceFile, imports: Array, -) => { +): (context: ts.TransformationContext) => (rootNode: ts.Node) => ts.Node => { return (context: ts.TransformationContext) => (rootNode: ts.Node) => { const visit = (node: ts.Node): ts.Node => { const newNode = ts.visitEachChild(node, visit, context); From fcdec2f38c4a7f9b9ddfb1e32652ee7a385cb641 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:34:17 +0900 Subject: [PATCH 2/4] feat(action): testing for publish --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1a2e643..e99651d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,3 +51,6 @@ jobs: - name: test run: deno task test + + - name: publish test + run: deno publish --dry-run From 6202e9613b85e094a5bddf7b1ab397a9e383bbc4 Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:35:00 +0900 Subject: [PATCH 3/4] feat: to `1.0.24` --- README.md | 4 ++-- deno.jsonc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f9b24a4..7c039dc 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,9 @@ Please install [Deno](https://deno.land/manual@v1.30.3/getting_started/installat ## command ### remote - dry run - - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.23/bin.ts -b=./src -c=./tsconfig.json -d` + - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.24/bin.ts -b=./src -c=./tsconfig.json -d` - transform - - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.23/bin.ts -b=./src -c=./tsconfig.json -r` + - `deno run --allow-env --allow-read --allow-write https://deno.land/x/module_specifier_resolver@v1.0.24/bin.ts -b=./src -c=./tsconfig.json -r` ### local - `deno task run-dry` - `deno task run` diff --git a/deno.jsonc b/deno.jsonc index 07e5950..97fe8ed 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -1,6 +1,6 @@ { "name": "@hajime-san/specifier-resolver", - "version": "1.0.23", + "version": "1.0.24", "exports": "./bin.ts", "tasks": { "set-up": "cd examples/repo && npm ci", From a4a1b0bd81f89fecfd73f2027f5672a98e1761de Mon Sep 17 00:00:00 2001 From: Hajime-san <41257923+Hajime-san@users.noreply.github.com> Date: Mon, 26 Feb 2024 18:37:26 +0900 Subject: [PATCH 4/4] fix(action): add OIDC token permission --- .github/workflows/ci.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e99651d..bb47893 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,6 +13,10 @@ jobs: test: runs-on: ubuntu-latest timeout-minutes: 10 + permissions: + contents: read # need for checkout + id-token: write # The OIDC ID token is used for authentication with JSR. + steps: - uses: actions/checkout@v4