Skip to content
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

Maintenance #74

Merged
merged 8 commits into from
Apr 6, 2021
Merged

Maintenance #74

merged 8 commits into from
Apr 6, 2021

Conversation

Avaq
Copy link
Member

@Avaq Avaq commented Apr 6, 2021

Closes #73

Avaq added 6 commits March 30, 2021 14:53
See #73

The main problem was the `.cjs` extensions, which confused content
delivery networks. Simply changing the extension to `.js` won't work,
because that'd confuse Node 12 and up.

So besides changing the extension, the file has also been moved into a
sub-directory containing a package.json file that tells newer Node
versions that the files here are CommonJS (without the need for a file
extension).

This commit also adds documentation for the different ways that the
module can now be obtained.
@Avaq Avaq self-assigned this Apr 6, 2021
@codecov
Copy link

codecov bot commented Apr 6, 2021

Codecov Report

Merging #74 (6c924a5) into master (35cc13c) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 6c924a5 differs from pull request most recent head 12dd03b. Consider uploading reports for the commit 12dd03b to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##            master       #74   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          110       130   +20     
=========================================
+ Hits           110       130   +20     
Impacted Files Coverage Δ
index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 35cc13c...12dd03b. Read the comment docs.

Comment on lines 19 to 20
sed --in-place "s/[email protected]/$pkg@$VERSION/" "$files"
sed --in-place "s/$pkg@$PREVIOUS_VERSION/$pkg@$VERSION/" "$files"
Copy link
Contributor

Choose a reason for hiding this comment

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

The --in-place flag is not supported on macOS; one must use -i '' on that platform. It may not be possible to write a portable script that uses this sed feature. Portability may not be important.

Strictly speaking the first pattern should use 0[.]0[.]0 rather than 0.0.0.

"$files" only works correctly because .config specifies only a single source file. I suggest using "${files[@]}" in conjunction with files=($(get source-files)).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, David. The portability problem I'm not going to solve now, but I noted it down in fluture-js/fluture-template#10

The other suggestions are great and I'll add them upstream before pulling them down and updating this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

Strictly speaking the first pattern should use 0[.]0[.]0 rather than 0.0.0.

Hm, I guess the same is true for $PREVIOUS_VERSION, which also contains periods. I'd have to regex-escape that to be truly robust, or tell sed somehow that we want a literal match.

LICENSE Outdated
Copyright (c) 2019 Aldwin Vlasblom
Copyright (c) 2021 Aldwin Vlasblom
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this not happen automatically during the release process?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does, but this is an upstream (from the template repo) change that got included automatically upon merging. So let's say it gets updated in one of two ways. :)

Comment on lines +19 to +20
sed --in-place "s/[email protected]/$pkg@$VERSION/" "${files[@]}"
sed --in-place "s/$pkg@$PREVIOUS_VERSION/$pkg@$VERSION/" "${files[@]}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you consider combining the patterns?

Suggested change
sed --in-place "s/[email protected]/$pkg@$VERSION/" "${files[@]}"
sed --in-place "s/$pkg@$PREVIOUS_VERSION/$pkg@$VERSION/" "${files[@]}"
sed -E --in-place "s/$pkg@(0.0.0|$PREVIOUS_VERSION)/$pkg@$VERSION/" "${files[@]}"

Should substitutions be performed globally? Currently only the first occurrence of the pattern on each line will be replaced.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you consider combining the patterns?

I tried and failed. I guess the -E is needed for groupings.

Should substitutions be performed globally?

Hm, that does sounds like it would be better, although now it's just being used to update URLs, each on their own line like //. [foo]: foo.example.com/[email protected].

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll look into this later: fluture-js/fluture-template#11

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.

Add support for script tag usage in browsers - rename index.cjs
2 participants