-
Notifications
You must be signed in to change notification settings - Fork 325
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
Browserify src #311
Merged
Merged
Browserify src #311
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
09558d9
adds browserify
alanshaw 2ff61b0
tweaks and fixes for browserify build
alanshaw 751480f
removes package-lock and pins dependencies
alanshaw 7d2a04a
adds package-lock
alanshaw c852270
excludes the src dir from the build
alanshaw f72b158
adds yarn lockfile and removes and ignores npm package lockfile
alanshaw b366b37
renames common.js to ipfs-companion-common.js
alanshaw cdacf16
adds safeIpfsPath tests
alanshaw 3fecd1a
extracts dns-link module and adds test
alanshaw feb974d
pulls out IPFS request and path validation functions and makes modify…
alanshaw 692efc4
extract storeMissingOptions into options module and get tests to pass
alanshaw 1c55cf7
removes unnecessary eslint hint
alanshaw 2dbdc09
Merge branch 'master' into browserify
alanshaw 7b0f739
fixes travis script ordering
alanshaw cbe164b
Merge branch 'browserify' of github.com:tableflip/ipfs-companion into…
alanshaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
vendor | ||
node_modules | ||
package-lock.json | ||
firefox | ||
cache | ||
build | ||
npm-debug.log | ||
crowdin.yml | ||
.*~ | ||
add-on/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,4 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<script src="../lib/npm/is-ipfs.min.js"></script> | ||
<script src="../lib/npm/ipfs-api.min.js"></script> | ||
<script src="../lib/npm/lru.js"></script> | ||
<script src="../lib/npm/browser-polyfill.min.js"></script> | ||
<script src="../lib/option-defaults.js"></script> | ||
<script src="../lib/ipfs-companion.js"></script> | ||
<script src="../common.js"></script> | ||
<script src="background.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
'use strict' | ||
/* eslint-env browser, webextensions */ | ||
/* global init */ | ||
|
||
const init = require('../lib/ipfs-companion') | ||
|
||
// init add-on after all libs are loaded | ||
document.addEventListener('DOMContentLoaded', init) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
'use strict' | ||
/* eslint-env browser, webextensions */ | ||
|
||
const browser = require('webextension-polyfill') | ||
|
||
function safeTranslation (key) { | ||
const translation = browser.i18n.getMessage(key) | ||
return translation || '[i18n: ' + key + ']' | ||
} | ||
|
||
// Search for items with data-i18n attribute and replace them with values from current locale | ||
const items = document.querySelectorAll('[data-i18n]') | ||
for (let item of items) { | ||
const key = item.getAttribute('data-i18n') | ||
if (key) { | ||
const translation = safeTranslation(key) | ||
if (typeof item.value !== 'undefined' && item.value === 'i18n') { | ||
// things like inputs can trigger translation with value equal "i18n" | ||
item.value = translation | ||
} else { | ||
item.innerText = translation | ||
module.exports = function () { | ||
// Search for items with data-i18n attribute and replace them with values from current locale | ||
const items = document.querySelectorAll('[data-i18n]') | ||
for (let item of items) { | ||
const key = item.getAttribute('data-i18n') | ||
if (key) { | ||
const translation = safeTranslation(key) | ||
if (typeof item.value !== 'undefined' && item.value === 'i18n') { | ||
// things like inputs can trigger translation with value equal "i18n" | ||
item.value = translation | ||
} else { | ||
item.innerText = translation | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚲🏠
ipfs-companion-bundle.js
(or justbundle.js
) may be a better name (common.js
is too vague, we've just deprecated it inmaster
branch)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
ipfs-companion-common.js
? It's not the full bundle, just the dependencies that are common to more than one of our bundles.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
ps. This PR is our priority, as it gives us the biggest bang for the buck (potentially closes #306) and is required by other PRs. Let me know when you feel it is ready to merge, I will do my best to find time to review it before anything else 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing the tests is the only thing left to do for this...