Skip to content
Permalink
Browse files

fix($core): changing repoUrl under dev doesn't take effect

  • Loading branch information...
ulivz committed Feb 8, 2019
1 parent 0640c22 commit 93e0c060e9aaa07bf1bd9a084b2e6a26023be779
Showing with 18 additions and 18 deletions.
  1. +18 −18 lib/index.js
@@ -16,24 +16,6 @@ const debug = require('debug')(PACKAGE_NAME)
*/

module.exports = (opts, ctx) => {
let { repoId, repoUrl, authToken, source } = opts
const useMarkdown = source === 'markdown'

if (repoId) {
assert(
typeof repoId === 'string' ||
typeof repoId === 'number',
`[${PACKAGE_NAME}] repoId should be string or number, but got ${repoId}`
)
} else if (repoUrl) {
assert(
typeof repoUrl === 'string',
`[${PACKAGE_NAME}] repoUrl should be string, but got ${repoId}`
)
} else {
throw new Error(`Expected repoId or repoUrl`)
}

return {
name: PACKAGE_NAME,

@@ -54,6 +36,24 @@ module.exports = (opts, ctx) => {
},

async ready() {
let { repoId, repoUrl, authToken, source } = opts
const useMarkdown = source === 'markdown'

if (repoId) {
assert(
typeof repoId === 'string' ||
typeof repoId === 'number',
`[${PACKAGE_NAME}] repoId should be string or number, but got ${repoId}`
)
} else if (repoUrl) {
assert(
typeof repoUrl === 'string',
`[${PACKAGE_NAME}] repoUrl should be string, but got ${repoId}`
)
} else {
throw new Error(`Expected repoId or repoUrl`)
}

if (repoUrl) {
const targetRepo = await Yuque.inferRepoByUrl(repoUrl)
repoId = targetRepo.id

0 comments on commit 93e0c06

Please sign in to comment.
You can’t perform that action at this time.