-
-
Notifications
You must be signed in to change notification settings - Fork 7
Sync #44
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
Open
yeqbfgxjiq
wants to merge
19
commits into
master
Choose a base branch
from
sync
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sync #44
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
072e431
created bug-bounty.md
yeqbfgxjiq c2b9ff5
setup basic sync scripts
yeqbfgxjiq 05d0d9f
added dependencies to package.json
yeqbfgxjiq d8b3c0a
removed extra package.json in root dir
yeqbfgxjiq 930472e
Merge pull request #45 from 1Hive/removing-extra-package.json
lkngtn 0f7ec53
fixed broken links in dandelion org overview
lkngtn 3f22ad3
Revive dead links in "Roles and Responsibilities"
onbjerg 515aba2
Merge pull request #49 from 1Hive/fix-dead-links
lkngtn 5fe9419
Merge pull request #47 from 1Hive/lkngtn
lkngtn 8c7b5b8
Changing the url for publishing is not necessary
lkngtn 2ae4ce9
Merge pull request #43 from 1Hive/bug-bounty
lkngtn 5abfeec
Fix broken link to "Projects and Tasks"
onbjerg e8303ed
Fix broken "Learn more" link
onbjerg 779811b
Merge pull request #51 from 1Hive/broken-learn-more
yeqbfgxjiq 17aca1a
Merge pull request #50 from 1Hive/project-tasks-broken-link
yeqbfgxjiq b5ec35d
Merge branch 'sync' of https://github.com/1Hive/website into sync
yeqbfgxjiq 0ab751c
works on my machine! lol
yeqbfgxjiq c6224ea
updated clean script to force remove the sync directory so that we do…
yeqbfgxjiq 01f84ff
added yarn-error.log to .gitignore
yeqbfgxjiq 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
Empty file.
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 |
|---|---|---|
| @@ -1,14 +1,23 @@ | ||
| { | ||
| "scripts": { | ||
| "examples": "docusaurus-examples", | ||
| "start": "docusaurus-start", | ||
| "build": "docusaurus-build", | ||
| "clean:docs": "rm -r ../docs/sync/*", | ||
| "sync:dandelion-apps": "node ./scripts/sync-dandelion-apps.js", | ||
| "generate": "npm run clean:docs && npm run sync:dandelion-apps", | ||
| "start": "npm run generate && docusaurus-start", | ||
| "build": "npm run generate && docusaurus-build", | ||
| "publish-gh-pages": "docusaurus-publish", | ||
| "write-translations": "docusaurus-write-translations", | ||
| "version": "docusaurus-version", | ||
| "rename-version": "docusaurus-rename-version" | ||
| }, | ||
| "devDependencies": { | ||
| "docusaurus": "^1.9.0" | ||
| "docusaurus": "^1.9.0", | ||
| "@aragon/docusaurus": "^1.7.3", | ||
| "node-fetch": "^2.3.0", | ||
| "opn": "^5.3.0", | ||
| "prettier": "1.16.4", | ||
| "glob": "^7.1.4", | ||
| "react-docgen": "^4.1.1" | ||
| } | ||
| } | ||
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,28 @@ | ||
| const { syncPages } = require('./sync-util') | ||
|
|
||
| const GIT_REF = 'master' | ||
yeqbfgxjiq marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const REPO = '1hive/redemptions-app' | ||
|
|
||
| /* | ||
| NOTE! | ||
| - the contentLocation fields are CASE SENSITIVE | ||
| - there needs to be placeholder content in the sync directory before you can run the sync scripts (because the way they're written they overwrite old versions of the docs in that location) | ||
| - you need to tell package.json to clear out the old sync directory and run the sync scripts to add new content | ||
| - you need to link to the synced docs in sidebars.js | ||
| */ | ||
|
|
||
| const pages = [ | ||
|
|
||
| /* Redemptions Overview */ | ||
| { | ||
| destination: 'docs/sync/dandelion/redemptions-overview.md', | ||
| id: 'redemptions-overview', | ||
| sidebarLabel: 'Redemptions', | ||
| title: '1Hive Redemptions App', | ||
| contentLocation: 'docs/overview.md', | ||
| } | ||
| ] | ||
|
|
||
| const locationReferenceMap = {} | ||
|
|
||
| syncPages(pages, locationReferenceMap, GIT_REF, REPO) | ||
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,55 @@ | ||
| const fetch = require('node-fetch') | ||
| const fs = require('fs') | ||
|
|
||
| async function syncPages(pages, locationReferenceMap, gitRef, repo) { | ||
| Promise.all( | ||
| pages.map(page => syncPage(page, locationReferenceMap, gitRef, repo)) | ||
| ) | ||
| } | ||
|
|
||
| async function syncPage(page, locationReferenceMap, gitRef, repo) { | ||
| const { | ||
| id, | ||
| title, | ||
| hideTitle, | ||
| sidebarLabel, | ||
| contentLocation, | ||
| destination, | ||
| } = page | ||
|
|
||
| const contentURL = `https://raw.githubusercontent.com/${repo}/${gitRef}/${contentLocation}` | ||
| const editURL = `https://github.com/${repo}/blob/${gitRef}/${contentLocation}` | ||
|
|
||
| const response = await fetch(contentURL) | ||
| let remoteText = await response.text() | ||
| // Fix the links | ||
| if ( | ||
| locationReferenceMap && | ||
| Object.keys(locationReferenceMap).length !== 0 && | ||
| locationReferenceMap.constructor === Object | ||
| ) { | ||
| remoteText = replaceAll(remoteText, locationReferenceMap) | ||
| } | ||
|
|
||
| const header = `--- | ||
| id: ${id} | ||
| title: ${title} | ||
| custom_edit_url: ${editURL} | ||
| sidebar_label: ${sidebarLabel} | ||
| hide_title: ${hideTitle || false} | ||
| --- | ||
| <!-- This file is generated by /website/scripts/sync-util.js - changes will be overwritten! --> | ||
| ` | ||
| const result = header.concat('\n').concat(remoteText) | ||
| // this script will be run from the website directory => we need to go up one level | ||
| fs.writeFileSync(`../${destination}`, result) | ||
| } | ||
|
|
||
| function replaceAll(string, mapObject) { | ||
| const regex = new RegExp(Object.keys(mapObject).join('|'), 'gi') | ||
| return string.replace(regex, matched => mapObject[matched]) | ||
| } | ||
|
|
||
| module.exports = { | ||
| syncPages, | ||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.