Skip to content

Check for last instance of .js extension in filename #709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 12, 2022

Conversation

arielsilvestri
Copy link
Contributor

@arielsilvestri arielsilvestri commented Nov 17, 2022

What does this PR do?

Testing

  • Testing completed successfully with local builds of files.

To prevent having to change the structure of a number of filenames/potentially breaking existing functionality, I scoped this change to account for a middleware that's prefix'ed with analytics.js in its filename.

@cysp
Copy link

cysp commented Nov 18, 2022

Sweet, looks like this will fix #703

const clientName = file.substring(0, file.indexOf('.'));
const clientName = file.includes('analytics.js-') ?
file.substring(0, file.lastIndexOf('.js')) :
file.substring(0, file.indexOf('.'));
Copy link
Contributor

@silesky silesky Dec 6, 2022

Choose a reason for hiding this comment

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

Can we simplify to this?

const clientName  = file.substring(0, file.lastIndexOf('.js'))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would affect the way our .dynamic.js.gz files are obfuscated and uploaded, which would require a change in how we fetch those files in ajs. It's doable, just would require a bit of a larger change to support and would still have some extra logic, just elsewhere.

Copy link
Contributor

@silesky silesky Dec 7, 2022

Choose a reason for hiding this comment

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

ah K... I didn't realize that was a case we had to handle.

Maybe we should we add a comment in the code about what the expected filename formats are?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @silesky !

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @arielsilvestri -- I suggested a tweak to the comment (doctests like they have in elixir would be great here =))

@arielsilvestri arielsilvestri merged commit 2d71ec3 into master Dec 12, 2022
@arielsilvestri arielsilvestri deleted the LIBWEB-1278 branch December 12, 2022 15:06
sinhaayush7 pushed a commit to CleverTap/analytics.js-integrations that referenced this pull request Jan 3, 2023
* Check for last instance of .js extension in filename

* adding clarifying comments for change

* Update scripts/upload-assets.js

Co-authored-by: Seth Silesky <[email protected]>

Co-authored-by: Seth Silesky <[email protected]>
pooyaj pushed a commit that referenced this pull request Jan 10, 2023
* updates clevertap sdks path

* updates clevertap sdk url

* updates clevertap version in history.md and package.json

* updates clevertap sdks path

* updates clevertap sdk url

* updates clevertap version in history.md and package.json

* Check for last instance of .js extension in filename (#709)

* Check for last instance of .js extension in filename

* adding clarifying comments for change

* Update scripts/upload-assets.js

Co-authored-by: Seth Silesky <[email protected]>

Co-authored-by: Seth Silesky <[email protected]>

* Add WalkMe SRI (cloned) (#718)

* Add WalkMe SRI
Fix previous test and add new cases

* Fix unit test

Co-authored-by: Francisco Garcia <[email protected]>

* version bump (#719)

* updates tag from http to https

* removes use-https library; loads clevertap over https only

* modifies segment identify to use onUserLogin instead of profile.push

Co-authored-by: Ariel Silvestri <[email protected]>
Co-authored-by: Seth Silesky <[email protected]>
Co-authored-by: dsjackins <[email protected]>
Co-authored-by: Francisco Garcia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants