Skip to content

setup our own youtube link utils library which will be open sourced#1

Merged
TomHipsh-genway merged 21 commits intomainfrom
initial-setup
Sep 29, 2025
Merged

setup our own youtube link utils library which will be open sourced#1
TomHipsh-genway merged 21 commits intomainfrom
initial-setup

Conversation

@TomHipsh-genway
Copy link
Copy Markdown
Contributor

@TomHipsh-genway TomHipsh-genway commented Sep 11, 2025

added all setup needed for package

  • added source code of the youtube utils
  • added tests based on vite
  • added build management for browser, node or CDN with tsup
  • support typescript
  • added CI/CD with git tags
  • added security checks based on audit-ci
  • added git action to label a PR as internal/external contributer

added all setup needed for package
Copilot AI review requested due to automatic review settings September 11, 2025 11:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR sets up a complete npm package for YouTube link utilities with TypeScript support, multiple build targets, and comprehensive tooling configuration.

  • Complete package setup with TypeScript, build configuration, and testing framework
  • YouTube URL validation, parsing, and video information fetching utilities
  • Multiple build targets including ESM, CJS, and browser IIFE builds

Reviewed Changes

Copilot reviewed 20 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Package configuration with dependencies, scripts, and build targets
src/* Core YouTube utilities for validation, parsing, and fetching video info
tsup.config.ts Build configuration for multiple output formats
vitest.config.ts Test configuration setup
eslint.config.js ESLint configuration with TypeScript support
.prettierrc.json Code formatting configuration
README.md Documentation with usage examples
example.html Browser usage example
test-build.js Build verification script
.vscode/* VS Code workspace configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread package.json
Comment thread package.json
finished tests
fix
fix
added hook
added tests for hook
switched to jsdom
fix
fix
fix
fix
Copy link
Copy Markdown

@ofekby ofekby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

added more infra setup files
@github-actions
Copy link
Copy Markdown

👋 Welcome External Contributor! Thank you for your contribution to youtube-link-utils! Your PR will be reviewed by GENWAY-AI organization members before merging.

added CI/CD flows
@github-actions
Copy link
Copy Markdown

👋 Welcome External Contributor! Thank you for your contribution to youtube-link-utils! Your PR will be reviewed by GENWAY-AI organization members before merging.

@ghost

This comment has been minimized.

fix
@github-actions
Copy link
Copy Markdown

👋 Welcome External Contributor! Thank you for your contribution to youtube-link-utils! Your PR will be reviewed by GENWAY-AI organization members before merging.

updated versions
@github-actions
Copy link
Copy Markdown

👋 Welcome External Contributor! Thank you for your contribution to youtube-link-utils! Your PR will be reviewed by GENWAY-AI organization members before merging.

fix CI
fix
fix
updated CI
more CI improvements
@TomHipsh-genway TomHipsh-genway changed the title Added all setup needed for package setup our own youtube link utils library which will be open sourced Sep 14, 2025
Comment thread .github/workflows/auto-tag.yml
Comment thread .github/workflows/auto-tag.yml
@@ -0,0 +1,108 @@
name: Label Pull Request Contributors
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of this yml file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when some github user makes a pull request I tag it with internal contributer if he is part of this repository organization's or has write permissions
or external contributer if he is unknown user which want to contribute to this open source

Comment thread src/consts.ts Outdated
Comment on lines +12 to +13
if (!trimmedUrl || currentValidationRef.current === trimmedUrl) {
return true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understood this - if the link is empty (!trimmedUrl) - so its a valid URL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes
this function will set a ref which starts as empty
therefore, the initial state is valid
until you enter a non-trimmed input and then it will try to validate it

}

currentValidationRef.current = trimmedUrl;
setIsValidating(true);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't it the first thing on the function?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to avoid validation on the same value,
for example, a user can copy paste the same

Comment thread src/utils/validate.ts Outdated
Comment thread src/utils/validate.ts
});

describe('validateWithLoading', () => {
it('should return true for empty or whitespace-only URL without validation', async () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it return true for empty URL's?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the initial state of the validator is empty string
I think that on empty is better to avoid validation, its more usful in components usage
on empty the input will be considered valid

Comment thread tests/consts.ts
@@ -0,0 +1,248 @@
import axios from 'axios';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see here use of mocks, let's talk F2F so you will explain on the mocks infrastructure here

@OmriBenShoham
Copy link
Copy Markdown

General comments:

  • How did we tested the new package?

@TomHipsh-genway
Copy link
Copy Markdown
Contributor Author

General comments:

  • How did we tested the new package?

I made the needed changes to use the new package on our client side as a dependancy
and it all worked as expected

…t array

combined YOUTUBE_URL_PATTERNS and PATTERN_VIDEO_ID_GROUPS to an object array
Copy link
Copy Markdown

@OmriBenShoham OmriBenShoham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TomHipsh-genway TomHipsh-genway merged commit 9a0b666 into main Sep 29, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants