How to use the @vuepress/shared-utils.path.join function in @vuepress/shared-utils

To help you get started, we’ve selected a few @vuepress/shared-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vuepress / packages / @vuepress / core / lib / node / dev / index.js View on Github external
handleUpdate (type, target) {
    logger.debug(type, target)
    if (!path.isAbsolute(target)) {
      target = path.join(this.context.sourceDir, target)
    }
    if (target.endsWith('.js')) {
      // Bust cache.
      delete require.cache[target]
    }
    this.emit('fileChanged', {
      type,
      target
    })
  }
github ulivz / vuepress-plugin-yuque / lib / index.js View on Github external
module.exports = (opts, ctx) => {
  return {
    name: PACKAGE_NAME,

    enhanceAppFiles: [
      path.join(__dirname, 'client.js')
    ],

    plugins: [
      ['@vuepress/medium-zoom', true],
    ],

    chainMarkdown(config) {
      if (opts.html) {
        return
      }
      // Disable `html` for now. Many yuque writers would write raw HTML in the markdown
      // But only these markups under inline code(`) will be transpiled successfully when
      // `html` is enabled.
      config
        .options
        .html(false)
github ustbhuangyi / better-scroll / packages / vuepress-docs / docs / .vuepress / plugins / extract-code.js View on Github external
function extractCodeFromVueSFC(md, options = {}) {
    const root = options.root || path.join(process.cwd(), '../')

    md.core.ruler.after('block', 'extract-code', function parser(state) {
        let tokens = state.tokens,
            tok, i;

        // modify html_block
        for (i = 0; i < tokens.length; i++) {
            tok = tokens[i];
            if (tok.type === 'html_block' && isDemoBlock(tok)) {
                const handledTokens = getHandledTokens(tok)
                if (handledTokens.length) {
                    tokens.splice(i, 1, ...handledTokens)
                    i += handledTokens.length - 1
                }
            }
        }
github vuejs / vuepress / packages / @vuepress / core / lib / dev.js View on Github external
const spawnUpdate = updateType => file => {
    const target = path.join(sourceDir, file)
    // Bust cache.
    delete require.cache[target]
    update(`${chalk.red(updateType)} ${chalk.cyan(file)}`)
  }
github vuejs / vuepress / scripts / bootstrap.js View on Github external
files.forEach(pkg => {
  if (pkg.charAt(0) === '.') return

  const isPlugin = /^plugin-/.test(pkg)
  const desc = isPlugin
    ? `${pkg.replace('plugin-', '')} plugin for vuepress`
    : `${pkg} for vuepress`

  const pkgPath = path.join(packagesDir, pkg, `package.json`)
  if (!fs.existsSync(pkgPath)) {
    const json = {
      'name': `@vuepress/${pkg}`,
      'version': baseVersion,
      'description': desc,
      'main': 'index.js',
      'publishConfig': {
        'access': 'public'
      },
      'repository': {
        'type': 'git',
        'url': 'git+https://github.com/vuejs/vuepress.git'
      },
      'keywords': [
        'documentation',
        'vue',
github vuejs / vuepress / packages / @vuepress / core / lib / node / App.js View on Github external
constructor (options = {}) {
    this.isProd = process.env.NODE_ENV === 'production'
    this.options = options
    this.sourceDir = this.options.sourceDir || path.join(__dirname, 'docs.fallback')
    logger.debug('sourceDir', this.sourceDir)
    if (!fs.existsSync(this.sourceDir)) {
      logger.warn(`Source directory doesn't exist: ${chalk.yellow(this.sourceDir)}`)
    }

    this.vuepressDir = path.resolve(this.sourceDir, '.vuepress')
    this.libDir = path.join(__dirname, '../')
  }
github vuejs / vuepress / scripts / bootstrap.js View on Github external
'documentation',
        'vue',
        'vuepress',
        'generator'
      ],
      'author': 'ULIVZ ',
      'license': 'MIT',
      'bugs': {
        'url': 'https://github.com/vuejs/vuepress/issues'
      },
      'homepage': `https://github.com/vuejs/vuepress/packages/@vuepress/${pkg}#readme`
    }
    fs.writeFileSync(pkgPath, JSON.stringify(json, null, 2))
  }

  const readmePath = path.join(packagesDir, pkg, `README.md`)
  if (!fs.existsSync(readmePath)) {
    fs.writeFileSync(readmePath, `# @vuepress/${pkg}\n\n> ${desc}`)
  }

  const npmIgnorePath = path.join(packagesDir, pkg, `.npmignore`)
  if (!fs.existsSync(npmIgnorePath)) {
    fs.writeFileSync(npmIgnorePath, `__tests__\n__mocks__`)
  }
})
github vuejs / vuepress / packages / @vuepress / core / lib / node / App.js View on Github external
getLibFilePath (relative) {
    return path.join(this.libDir, relative)
  }
github vuejs / vuepress / scripts / bootstrap.js View on Github external
'author': 'ULIVZ ',
      'license': 'MIT',
      'bugs': {
        'url': 'https://github.com/vuejs/vuepress/issues'
      },
      'homepage': `https://github.com/vuejs/vuepress/packages/@vuepress/${pkg}#readme`
    }
    fs.writeFileSync(pkgPath, JSON.stringify(json, null, 2))
  }

  const readmePath = path.join(packagesDir, pkg, `README.md`)
  if (!fs.existsSync(readmePath)) {
    fs.writeFileSync(readmePath, `# @vuepress/${pkg}\n\n> ${desc}`)
  }

  const npmIgnorePath = path.join(packagesDir, pkg, `.npmignore`)
  if (!fs.existsSync(npmIgnorePath)) {
    fs.writeFileSync(npmIgnorePath, `__tests__\n__mocks__`)
  }
})
github vuejs / vuepress / packages / @vuepress / core / lib / node / App.js View on Github external
constructor (options = {}) {
    this.isProd = process.env.NODE_ENV === 'production'
    this.options = options
    this.sourceDir = this.options.sourceDir || path.join(__dirname, 'docs.fallback')
    logger.debug('sourceDir', this.sourceDir)
    if (!fs.existsSync(this.sourceDir)) {
      logger.warn(`Source directory doesn't exist: ${chalk.yellow(this.sourceDir)}`)
    }

    this.vuepressDir = path.resolve(this.sourceDir, '.vuepress')
    this.libDir = path.join(__dirname, '../')
  }