-
Notifications
You must be signed in to change notification settings - Fork 430
feat: support ipfs #46
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bd17d72
feat: support ipfs
hugomrdias 6e48474
fix: remove unused dep
hugomrdias 148b52a
add all-relative dep and ipfs build scripts
cwaring 9b322dc
add circleci config for ipfs-dns-deploy
cwaring e68fd22
enable circleci build
cwaring 9991e85
add npm scripts and module cache
cwaring 060faf9
yml fml
cwaring 2fc6b5d
bump all-relative
cwaring 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/node:10.15.1-browsers | ||
environment: | ||
NO_SANDBOX: true | ||
steps: | ||
- checkout | ||
- run: | ||
name: update-npm | ||
command: 'sudo npm install -g npm@latest' | ||
- restore_cache: | ||
key: dependency-cache-{{ checksum "package-lock.json" }} | ||
- run: | ||
name: install-npm | ||
command: npm install | ||
- save_cache: | ||
key: dependency-cache-{{ checksum "package-lock.json" }} | ||
paths: | ||
- ./node_modules | ||
- run: | ||
name: build-docs-ipfs | ||
command: npm run docs:build:ipfs | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- ./docs/.vuepress/dist | ||
|
||
deploy: | ||
docker: | ||
- image: olizilla/ipfs-dns-deploy:latest | ||
environment: | ||
DOMAIN: docs-beta.ipfs.io | ||
BUILD_DIR: ./docs/.vuepress/dist | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: | ||
name: Deploy website to IPFS | ||
command: | | ||
pin_name="$DOMAIN build $CIRCLE_BUILD_NUMBER" | ||
hash=$(pin-to-cluster.sh "$pin_name" /tmp/workspace/$BUILD_DIR) | ||
echo "Website added to IPFS: https://ipfs.io/ipfs/$hash" | ||
# Update DNSlink for prod or dev domain | ||
if [ "$CIRCLE_BRANCH" == "master" ] ; then | ||
dnslink-dnsimple -d $DOMAIN -r _dnslink -l /ipfs/$hash | ||
fi | ||
workflows: | ||
version: 2 | ||
build-deploy: | ||
jobs: | ||
- build | ||
- deploy: | ||
context: ipfs-dns-deploy | ||
requires: | ||
- build |
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict' | ||
|
||
;(function() { | ||
var ipfsPathRegExp = /^(\/(?:ipfs|ipns)\/[^/]+)/ | ||
var ipfsPathPrefix = | ||
(window.location.pathname.match(ipfsPathRegExp) || [])[1] || '' | ||
|
||
__webpack_public_path__ = ipfsPathPrefix + '/' | ||
if (typeof window !== 'undefined') { | ||
window.__VUEPRESS_ROUTER_BASE__ = ipfsPathPrefix + '/' | ||
} | ||
})() |
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.
nice! this var is the secret ingredient, where did you find it?
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.
vuepress bootstrap code.
but
__webpack_public_path__ = ipfsPathPrefix + '/'
this one is even more important without it the router would even loadThere 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.
https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/client/app.js#L63
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.
I knew there was a
__webpack_public_path__
lurking about but I missed this one! Great work detective 🕵️♂️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.
yeah @satazor put me in the right direction with that one i just did the last mile
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.
the highest of fives to @satazor! It also makes me wonder if we could make a more generic IPFS plugin for webpack compiled apps using some of these framework config vars. we'd need to do detection for router logic but it doesn't seem impossible now... 🤔
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.
Thanks! I also thought about that in the past @cwaring and it’s doable. The route logic detection could also be pluggable, meaning we could have addons/plugins for typical frameworks such as Gatsby and Vue press.
I guess it would take some investment time but it would pay off 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.
nice, if we are delaying the adoption of origin isolation for a while then this might be a worthy endeavour to the community. I see this question crop up all the time.