path#basename TypeScript Examples

The following examples show how to use path#basename. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: utils.ts    From picgo-plugin-compress with MIT License 7 votes vote down vote up
export function getImageInfo(imageUrl: string, buffer: Buffer): ImageInfo {
  const { width, height } = imageSize(buffer)
  return {
    buffer,
    width: width as number,
    height: height as number,
    fileName: basename(imageUrl),
    extname: extname(imageUrl),
  }
}
Example #2
Source File: framework-utils.spec.ts    From ng-spotify-importer with GNU General Public License v3.0 7 votes vote down vote up
describe(basename(__filename).split('.spec.ts')[0], () => {
    describe(getFailureScreenshotFilename.name + '()', () => {
        it('should handle spaces', () => {
            const result = getFailureScreenshotFilename({ title: 'Name With Spaces', parent: 'Parent With Spaces' });
            expect(result).toContain('parent-with-spaces_name-with-spaces_failure_');
        });

        it('should handle mixed case', () => {
            const result = getFailureScreenshotFilename({ title: 'TestName', parent: 'ParentName' });
            expect(result).toContain('parentname_testname_failure_');
        });

        it('should contain a timestamp', () => {
            const result = getFailureScreenshotFilename({ title: 'TestName', parent: 'ParentName' });
            expect(result).toMatch(/_\d+\.png/);
        });
    });
});
Example #3
Source File: util.ts    From DefinitelyTyped-tools with MIT License 7 votes vote down vote up
export function getCommonDirectoryName(files: readonly string[]): string {
  let minLen = 999;
  let minDir = "";
  for (const file of files) {
    const dir = dirname(file);
    if (dir.length < minLen) {
      minDir = dir;
      minLen = dir.length;
    }
  }
  return basename(minDir);
}
Example #4
Source File: index.ts    From nestjs-proto-gen-ts with MIT License 6 votes vote down vote up
private output(file: string, pkg: string, tmpl: string): void {
        const root = new Root();

        this.resolveRootPath(root);

        root.loadSync(file, {
            keepCase: this.options.keepCase,
            alternateCommentMode: this.options.comments
        }).resolveAll();

        this.walkTree(root);

        const results = compile(tmpl)(root);
        const outputFile = this.options.output ? join(this.options.output, file.replace(/^.+?[/\\]/, '')) : file;
        const outputPath = join(dirname(outputFile), `${basename(file, extname(file))}.ts`);

        outputFileSync(outputPath, results, 'utf8');
    }
Example #5
Source File: previewStore.ts    From vscode-openscad with GNU General Public License v3.0 6 votes vote down vote up
// Delete and dispose of a preview
    public delete(preview: Preview, informUser?: boolean): void {
        preview.dispose();
        if (informUser)
            vscode.window.showInformationMessage(
                `Killed: ${basename(preview.uri.fsPath)}`
            );
        this._previews.delete(preview);

        if (this.size === 0) {
            this.setAreOpenPreviews(false);
        }
    }
Example #6
Source File: StackHandler.ts    From vscode-autohotkey with MIT License 6 votes vote down vote up
public handle(args: DebugProtocol.StackTraceArguments, response: DbgpResponse): StackFrame[] {
        if (response) {
            const stackList = Array.isArray(response.stack) ? response.stack : Array.of(response.stack);
            return stackList.map((stack, index) => {
                return new StackFrame(index, stack.attr.where, new Source(basename(stack.attr.filename), stack.attr.filename), parseInt(stack.attr.lineno));
            })
        } else {
            return [];
        }

    }
Example #7
Source File: canary-release.ts    From graphql-eslint with MIT License 6 votes vote down vote up
getRelevantChangesets = (baseBranch: string): string[] => {
  const comparePoint = spawnSync('git', ['merge-base', `origin/${baseBranch}`, 'HEAD'])
    .stdout.toString()
    .trimEnd();
  console.log('compare point', comparePoint);

  const modifiedFiles = spawnSync('git', ['diff', '--name-only', comparePoint]).stdout.toString().trimEnd().split('\n');
  console.log('modified files', modifiedFiles);

  const changesets = modifiedFiles
    .filter(filePath => filePath.startsWith('.changeset/'))
    .map(filePath => basename(filePath, '.md'));
  console.log('changesets', changesets);

  return changesets;
}
Example #8
Source File: utils.ts    From bluebubbles-server with Apache License 2.0 6 votes vote down vote up
convertAudio = async (
    attachment: Attachment,
    { originalMimeType = null }: { originalMimeType?: string } = {}
): Promise<string> => {
    if (!attachment) return null;
    const newPath = `${FileSystem.convertDir}/${attachment.guid}.mp3`;
    const mType = originalMimeType ?? attachment.getMimeType();
    let failed = false;
    let ext = null;

    if (attachment.uti === "com.apple.coreaudio-format" || mType == "audio/x-caf") {
        ext = "caf";
    }

    if (!fs.existsSync(newPath)) {
        try {
            if (isNotEmpty(ext)) {
                Server().log(`Converting attachment, ${attachment.transferName}, to an MP3...`);
                await FileSystem.convertCafToMp3(attachment.filePath, newPath);
            }
        } catch (ex: any) {
            failed = true;
            Server().log(`Failed to convert CAF to MP3 for attachment, ${attachment.transferName}`, "debug");
            Server().log(ex?.message ?? ex, "error");
        }
    } else {
        Server().log("Attachment has already been converted! Skipping...", "debug");
    }

    if (!failed && ext && fs.existsSync(newPath)) {
        // If conversion is successful, we need to modify the attachment a bit
        attachment.mimeType = "audio/mp3";
        attachment.filePath = newPath;
        attachment.transferName = basename(newPath).replace(`.${ext}`, ".mp3");

        // Set the fPath to the newly converted path
        return newPath;
    }

    return null;
}
Example #9
Source File: TestProject.ts    From yarn-plugins with MIT License 6 votes vote down vote up
public static async setup(): Promise<TestProject> {
    const dir = await tmp.dir();
    const pluginBundles = await globby('packages/*/bundles/**/*.js', {
      cwd: PROJECT_DIR,
    });
    const plugins = pluginBundles.map((src) => ({
      src,
      name: '@yarnpkg/' + basename(src, extname(src)),
      dest: posix.join('.yarn', 'plugins', ...src.split(sep).slice(3)),
    }));

    for (const path of plugins) {
      await copy(join(PROJECT_DIR, path.src), join(dir.path, path.dest));
    }

    const yarnConfig = safeLoad(
      await readFile(join(PROJECT_DIR, '.yarnrc.yml'), 'utf8'),
    ) as Record<string, unknown>;

    // Create .yarnrc.yml
    await outputFile(
      join(dir.path, '.yarnrc.yml'),
      safeDump({
        yarnPath: join(PROJECT_DIR, yarnConfig.yarnPath as string),
        plugins: plugins.map((plugin) => ({
          path: plugin.dest,
          spec: plugin.name,
        })),
      }),
    );

    // Create package.json
    await outputJSON(join(dir.path, 'package.json'), {
      private: true,
      workspaces: ['packages/*'],
    });

    return new TestProject(dir);
  }
Example #10
Source File: utils.ts    From picgo-plugin-compress with MIT License 6 votes vote down vote up
export function getUrlInfo(imageUrl: string) {
  return {
    fileName: basename(imageUrl),
    extname: extname(imageUrl),
  }
}
Example #11
Source File: event-store.publisher.ts    From nestjs-geteventstore with MIT License 6 votes vote down vote up
protected getStreamName(
    correlationId: EventBase['metadata']['correlation_id'],
  ): string {
    const defaultName = process.argv?.[1]
      ? basename(process.argv?.[1], extname(process.argv?.[1]))
      : `${hostname()}_${process.argv?.[0] || 'unknown'}`;

    return `${this.config.serviceName || defaultName}-${correlationId}`;
  }
Example #12
Source File: format.ts    From Obsidian_to_Anki with GNU General Public License v3.0 6 votes vote down vote up
getAndFormatMedias(note_text: string): string {
		if (!(this.file_cache.hasOwnProperty("embeds"))) {
			return note_text
		}
		for (let embed of this.file_cache.embeds) {
			if (note_text.includes(embed.original)) {
				this.detectedMedia.add(embed.link)
				if (AUDIO_EXTS.includes(extname(embed.link))) {
					note_text = note_text.replace(new RegExp(c.escapeRegex(embed.original), "g"), "[sound:" + basename(embed.link) + "]")
				} else if (IMAGE_EXTS.includes(extname(embed.link))) {
					note_text = note_text.replace(
						new RegExp(c.escapeRegex(embed.original), "g"),
						'<img src="' + basename(embed.link) + '" alt="' + embed.displayText + '">'
					)
				} else {
					console.warn("Unsupported extension: ", extname(embed.link))
				}
			}
		}
		return note_text
	}
Example #13
Source File: snapshots-diagnostics-spec.ts    From ui5-language-assistant with Apache License 2.0 6 votes vote down vote up
describe(`The language server diagnostics capability`, () => {
  // The test files are in the source dir, not lib
  const snapshotTestsDir = toSourcesTestDir(__dirname);
  const klawItems = klawSync(snapshotTestsDir, { nodir: true });
  const inputFiles = filter(klawItems, (item) => {
    return item.path.endsWith(INPUT_FILE_NAME);
  });
  const testDirs = map(inputFiles, (_) => dirname(_.path));

  forEach(testDirs, (dirPath) => {
    const dirName = basename(dirPath);

    // UNCOMMENT THE LINES BELOW AND CHANGE onlyTestDirName TO ONLY RUN A SPECIFIC SNAPSHOT TEST
    // const onlyTestDirName = "my-test-dir";
    // if (dirName !== onlyTestDirName) {
    //   return;
    // }
    const optionsPath = resolve(dirPath, "options.js");
    let options: LSPDiagnosticOptions;
    if (existsSync(optionsPath)) {
      options = require(optionsPath);
    } else {
      options = { flexEnabled: false };
    }

    it(`Can create diagnostic for ${dirName.replace(/-/g, " ")} (${relative(
      snapshotTestsDir,
      dirPath
    )})`, async () => {
      await snapshotTestLSPDiagnostic(dirPath, options);
    });
  });
});
Example #14
Source File: FileManager.ts    From huawei-lte-api-ts with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
     * Uploads firmware update and triggers it
     * @param uploadfile file to upload
     * @param uploadfileName name of uploaded file
     */
    upload(uploadfile: Blob, uploadfileName: string): Promise<SetResponseType> {
        const uploadfileBasename = basename(uploadfileName);
        const extension = extname(uploadfileBasename).toLowerCase();
        if (!(extension in ['.bin', '.zip'])) {
            throw new Error('Only *.bin or *.zip is allowed');
        }
       
        return this._connection.postFile('filemanager/upload', {
            'uploadfile': uploadfile,
        }, {
            'cur_path': `OU:${uploadfileBasename}`
        }).then((response: AxiosResponse) => {
            return response.data;
        });
    }
Example #15
Source File: spFunctionItem.ts    From sourcepawn-vscode with MIT License 6 votes vote down vote up
toHover(): Hover {
    let filename: string = basename(this.filePath, ".inc");
    if (this.description == "") {
      return new Hover({ language: "sourcepawn", value: this.detail });
    }
    if (this.IsBuiltIn) {
      return new Hover([
        { language: "sourcepawn", value: this.detail },
        `[Online Documentation](https://sourcemod.dev/#/${filename}/function.${this.name})`,
        descriptionToMD(
          `${this.description}${
            this.deprecated ? `\nDEPRECATED ${this.deprecated}` : ""
          }`
        ),
      ]);
    }
    return new Hover([
      { language: "sourcepawn", value: this.detail },
      descriptionToMD(
        `${this.description}${
          this.deprecated ? `\nDEPRECATED ${this.deprecated}` : ""
        }`
      ),
    ]);
  }
Example #16
Source File: docs.ts    From WebCord with MIT License 6 votes vote down vote up
ipcRenderer.once('documentation-load', (_event, readmeFile:string) => {
    const mdHeader = document.createElement('header');
    const mdArticle = document.createElement('article');
    const mdBody = document.createElement('div');
    mdArticle.appendChild(mdBody);
    mdHeader.id = "markdown-header";
    mdBody.id = "markdown-body";
    menuHeader.innerText = basename(readmeFile);
    mdHeader.appendChild(menu);
    mdHeader.appendChild(menuHeader);
    setBody(mdBody, mdHeader, readmeFile, mdArticle);
    mdBody.getElementsByTagName('sub')[0]?.parentElement?.remove();
    document.body.appendChild(mdHeader);
    document.body.appendChild(mdArticle);
    menu.onclick = () => {
        let scrollOptions:ScrollIntoViewOptions|undefined;
        if(!menuHeader.innerText.includes('Readme.md')) {
            window.scroll(0,0);
            menuHeader.innerText = basename(readmeFile);
            setBody(mdBody, mdHeader, readmeFile, mdArticle);
            mdBody.getElementsByTagName('sub')[0]?.parentElement?.remove();
        } else {
            scrollOptions = {behavior:'smooth'}
        }
        let docsId = 'documentation';
        if(navigator.language === 'pl')
            docsId = 'dokumentacja-w-większości-jeszcze-nie-przetłumaczona';

        const docsHeader = document.getElementById(docsId);
        if(docsHeader) docsHeader.scrollIntoView(scrollOptions);
    }
    ipcRenderer.send('documentation-show');
})
Example #17
Source File: thrift-calculator.test.ts    From graphql-mesh with MIT License 6 votes vote down vote up
describe('Thrift Calculator', () => {
  it('should generate correct schema', async () => {
    const { schema } = await mesh$;
    expect(
      introspectionFromSchema(lexicographicSortSchema(schema), {
        descriptions: false,
      })
    ).toMatchSnapshot('thrift-calculator-schema');
  });
  it('should give correct response for example queries', async () => {
    const { documents } = await config$;
    const { execute } = await mesh$;
    for (const source of documents) {
      const result = await execute(source.document, {});
      expect(result.errors).toBeFalsy();
      expect(result).toMatchSnapshot(basename(source.location) + '-thrift-calculator-result');
    }
  });
  afterAll(() => {
    mesh$.then(mesh => mesh.destroy());
    thriftServer.close();
  });
});
Example #18
Source File: zip-provider.ts    From WowUp with GNU General Public License v3.0 6 votes vote down vote up
public async searchByUrl(addonUri: URL): Promise<SearchByUrlResult> {
    if (!addonUri.pathname.toLowerCase().endsWith(".zip")) {
      throw new Error(`Invalid zip URL ${addonUri.toString()}`);
    }

    await this.validateUrlContentType(addonUri);

    const fileName = _.last(addonUri.pathname.split("/")) ?? "unknown";
    const fileNameNoExt = basename(fileName, ".zip");

    const potentialFile: AddonSearchResultFile = {
      channelType: AddonChannelType.Stable,
      downloadUrl: addonUri.toString(),
      folders: [fileNameNoExt],
      gameVersion: "",
      version: fileNameNoExt,
      releaseDate: new Date(),
      changelog: "",
    };

    const potentialAddon: AddonSearchResult = {
      author: addonUri.hostname,
      downloadCount: 1,
      externalId: addonUri.toString(),
      externalUrl: addonUri.origin,
      name: fileName,
      providerName: this.name,
      thumbnailUrl: "",
      files: [potentialFile],
    };

    return {
      errors: [],
      searchResult: potentialAddon,
    };
  }
Example #19
Source File: main.ts    From rewind with MIT License 6 votes vote down vote up
function persistWithMongoDB(blueprintsFolder: string) {
  const walker = walk.walk(blueprintsFolder);
  walker.on("file", (root, fileStats, next) => {
    const dir = basename(root);
    const name = fileStats.name;

    // console.log(dir, name);
    if (extname(name) !== ".osu") {
      next();
      return;
    }
    // console.log(dir, name);
    next();
  });
  walker.on("end", () => {
    console.log("done");
  });
}
Example #20
Source File: local_path.ts    From ardrive-cli with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Resolves the path, verifies its existance and type to conditionally return its dir and file name
 * @param {string} destOutputPath - the path from where to extract the dir path and name
 * @returns {FilePathAndName} - the directory where to put the file and the file name (which is undefined when the provided destOutputPath is a directory)
 */
export function getOutputFilePathAndName(
	destOutputPath: string,
	fsStatSyncAndPathResolveWrapper = fsStatSyncAndPathResolve
): FilePathAndName {
	const resolvedOutputPath = fsStatSyncAndPathResolveWrapper.resolve(destOutputPath);
	const outputDirname = dirname(resolvedOutputPath);
	const outputBasename = basename(resolvedOutputPath);
	try {
		const outputPathStats = fsStatSyncAndPathResolveWrapper.statSync(resolvedOutputPath);
		// the destination does exist
		if (outputPathStats.isDirectory()) {
			// and is a directory
			return [resolvedOutputPath];
		} else if (outputPathStats.isFile()) {
			// as an existing file
			return [outputDirname, outputBasename];
		}
	} catch (e) {
		// the destination doesn't exist
		const outputParentPathStats = fsStatSyncAndPathResolveWrapper.statSync(outputDirname);
		// the parent exists
		if (outputParentPathStats.isDirectory()) {
			return [outputDirname, outputBasename];
		}
		throw new Error(`The path ${outputDirname} is not a directory!`);
	}
	throw new Error(`The destination is neither a folder nor a file!`);
}
Example #21
Source File: ReadableArrayResponse.ts    From backstage with Apache License 2.0 6 votes vote down vote up
async dir(options?: ReadTreeResponseDirOptions): Promise<string> {
    this.onlyOnce();

    const dir =
      options?.targetDir ??
      (await fs.mkdtemp(platformPath.join(this.workDir, 'backstage-')));

    for (let i = 0; i < this.stream.length; i++) {
      if (!this.stream[i].path.endsWith('/')) {
        await pipeline(
          this.stream[i].data,
          fs.createWriteStream(
            platformPath.join(dir, basename(this.stream[i].path)),
          ),
        );
      }
    }

    return dir;
  }
Example #22
Source File: reload.ts    From coc-clangd with Apache License 2.0 6 votes vote down vote up
async reload(url: string) {
    const notification = this.ctx.config.showDBChangedNotification;
    if (notification) {
      const msg = `${basename(url)} has changed, clangd is reloading...`;
      window.showMessage(msg);
    }

    for (const sub of this.ctx.subscriptions) {
      try {
        sub.dispose();
      } catch (e) {
        console.error(e);
      }
    }

    this.activate();
    if (notification) window.showMessage(`clangd has reloaded`);
  }
Example #23
Source File: add-js-extensions.ts    From blake3 with MIT License 6 votes vote down vote up
/**
 * Script that adds .js extension to imports so that it's compatible with plain
 * browser/non-webpack bundlers. TS doesn't support this natively yet.
 * @see https://github.com/microsoft/TypeScript/issues/16577
 */

function processFile(file: string) {
  let source = readFileSync(file, 'utf-8');
  const program = ts.createSourceFile(basename(file), source, ts.ScriptTarget.ES2015, true);

  let offset = 0;
  const process = (node: ts.Node): void => {
    if ((!ts.isImportDeclaration(node) && !ts.isExportDeclaration(node)) || !node.moduleSpecifier) {
      return ts.forEachChild(node, process);
    }

    const specifier = node.moduleSpecifier;
    if (extname(specifier.getText()) === '') {
      const idx = specifier.end + offset - 1;
      source = source.slice(0, idx) + '.js' + source.slice(idx);
      offset += 3;
    }
  };

  process(program);

  writeFileSync(file, source);
}
Example #24
Source File: service.ts    From dendron with GNU Affero General Public License v3.0 6 votes vote down vote up
/** Given a standard vault, convert it into a self contained vault.
   *
   * The function **mutates** (modifies) the vault object. */
  static standardToSelfContainedVault(vault: DVault): SelfContainedVault {
    if (VaultUtils.isSelfContained(vault)) return vault;

    if (vault.remote?.url) {
      // Remote vault, calculate path based on the remote
      vault.fsPath = path.join(
        FOLDERS.DEPENDENCIES,
        GitUtils.remoteUrlToDependencyPath({
          vaultName: vault.name || basename(vault.fsPath),
          url: vault.remote.url,
        })
      );
    } else {
      // Local vault, calculate path for local deps
      vault.fsPath = path.join(
        FOLDERS.DEPENDENCIES,
        FOLDERS.LOCAL_DEPENDENCY,
        path.basename(vault.fsPath)
      );
    }

    vault.selfContained = true;
    // Cast required, because TypeScript doesn't recognize `selfContained` is always set to true
    return vault as SelfContainedVault;
  }
Example #25
Source File: patch.ts    From graphql-typed-document-node with MIT License 6 votes vote down vote up
export async function getAvailablePatches() {
  const baseDir = join(__dirname, './patches/');
  const files = readdirSync(baseDir).filter(d => extname(d) === '.patch');

  return {
    baseDir,
    availablePatches: files.map(fileName => {
      const cleanName = basename(fileName, extname(fileName));
      const parts = cleanName.split('+');
      const versionRange = parts.pop();
      const name = parts.join('/');

      return {
        fileName,
        details: {
          // This structure and fields are required internally in `patch-package` code.
          version: versionRange,
          name,
          pathSpecifier: name,
          humanReadablePathSpecifier: name,
          packageNames: [name],
        },
      };
    })
  };
}
Example #26
Source File: typeorm-uml.class.ts    From typeorm-uml with MIT License 6 votes vote down vote up
/**
	 * Creates and returns Typeorm connection based on selected configuration file.
	 *
	 * @async
	 * @private
	 * @param {string} configPath A path to Typeorm config file.
	 * @param {Flags} flags An object with command flags.
	 * @returns {Connection} A connection instance.
	 */
	private async getConnection( configPath: string, flags: Flags ): Promise<Connection> {
		let root = process.cwd();
		let configName = configPath;

		if ( isAbsolute( configName ) ) {
			root = dirname( configName );
			configName = basename( configName );
		}

		const cwd = dirname( resolve( root, configName ) );
		process.chdir( cwd );

		const connectionOptionsReader = new ConnectionOptionsReader( { root, configName } );
		const connectionOptions = await connectionOptionsReader.get( flags.connection || 'default' );
		return getConnectionManager().create( connectionOptions );
	}
Example #27
Source File: RoundtripGrammar.test.ts    From legend-studio with Apache License 2.0 6 votes vote down vote up
testNameFrom = (filePath: string): string => {
  const isSkipped = isTestSkipped(filePath);
  const isPartial = isPartialTest(filePath);
  const name = basename(filePath, '.pure').split('-').join(' ').trim();
  if (!name) {
    throw new Error(`Found bad name for test file '${filePath}'`);
  }
  return `${isSkipped ? '(SKIPPED) ' : isPartial ? '(partial) ' : ''}${(
    name[0] as string
  ).toUpperCase()}${name.substring(1, name.length)}`;
}
Example #28
Source File: extractSwfs.ts    From shroom with GNU Lesser General Public License v3.0 6 votes vote down vote up
export async function extractSwfs(
  logger: Logger,
  name: string,
  swfs: string[],
  onAfter: OnAfterCallback
) {
  const dumpFurnitureProgress = new ProgressBar(
    logger,
    swfs.length,
    (current, count, extra) => {
      if (extra != null) {
        return `Extracting ${name}: ${current} / ${count} (${extra})`;
      } else {
        return `Extracting ${name}: ${current} / ${count}`;
      }
    }
  );

  await Bluebird.map(
    swfs,
    async (path) => {
      await dumpSwf(path, onAfter);
      dumpFurnitureProgress.increment(basename(path));
    },
    {
      concurrency: 4,
    }
  );

  dumpFurnitureProgress.done();
}
Example #29
Source File: upload-artifact-as-is.ts    From upload-artifact-as-is with MIT License 6 votes vote down vote up
async function run(): Promise<void> {
    try {
        const path = core.getInput(Inputs.Path, { required: true })

        const searchResult = await findFilesToUpload(path)
        if (searchResult.filesToUpload.length === 0) {
            core.warning(
                `No files were found for the provided path: ${path}. No artifacts will be uploaded.`
            )
        } else {
            core.info(
                `With the provided path, there will be ${searchResult.filesToUpload.length} files uploaded`
            )
            core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)

            const artifactClient = create()
            const options: UploadOptions = {
                continueOnError: true
            }
            for (const file of searchResult.filesToUpload) {
                core.debug(`Uploading ${file} as ${basename(file)}`)
                await artifactClient.uploadArtifact(
                    basename(file),
                    [file],
                    searchResult.rootDirectory,
                    options
                )
            }

            core.info('Artifact upload has finished successfully!')
        }
    } catch (err) {
        core.setFailed(err.message)
    }
}