How to use cpy - 8 common examples

To help you get started, we’ve selected a few cpy 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 zeit / next.js / packages / create-next-app / create-app.ts View on Github external
fs.writeFileSync(
      path.join(root, 'package.json'),
      JSON.stringify(packageJson, null, 2) + os.EOL
    )

    console.log(
      `Installing ${chalk.cyan('react')}, ${chalk.cyan(
        'react-dom'
      )}, and ${chalk.cyan('next')} using ${displayedCommand}...`
    )
    console.log()

    await install(root, ['react', 'react-dom', 'next'], { useYarn, isOnline })
    console.log()

    await cpy('**', root, {
      parents: true,
      cwd: path.join(__dirname, 'templates', 'default'),
      rename: name => {
        switch (name) {
          case 'gitignore': {
            return '.'.concat(name)
          }
          default: {
            return name
          }
        }
      },
    })
  }

  if (tryGitInit(root)) {
github fleur-js / fleur / packages / create-fleur-next-app / src / index.ts View on Github external
}

  const appPath = path.resolve(appName)

  if (existsSync(appPath)) {
    console.log()
    console.log(chalk.red(`Project directory \`${appName}\` already exists`))
    console.log(
      chalk.red('Please remove it or specify another project-directpry'),
    )
    console.log()

    process.exit(1)
  }

  await cpy('**', appPath, {
    parents: true,
    cwd: path.join(__dirname, '../template'),
    rename: name => {
      if (name === 'gitignore') return '.gitignore'
      return name
    },
  })

  const packageJsonPath = path.join(appPath, 'package.json')
  const appPackageJson = require(packageJsonPath)
  appPackageJson.name = appName
  writeFileSync(packageJsonPath, JSON.stringify(appPackageJson, null, '  '))

  {
    const packageCommands: [string, string[]][] = program.useNpm
      ? [
github fluidtrends / chunky / src / extended / generators / templates.js View on Github external
      const copyImages = () => cpy(bundleImages, assetsDir)
      const copyText = () => cpy(bundleText, assetsTextDir)
github adonisjs / assembler / src / Compiler / index.ts View on Github external
public async copyFiles (files: string[], outDir: string) {
    await copyfiles(files, outDir, { cwd: this.appRoot, parents: true })
  }
github skidding / jobs-done / tools / build.js View on Github external
async function copyStatics() {
  return cpy('**/*', '../build', {
    cwd: STATIC_PATH,
    parents: true
  });
}
github react-cosmos / react-cosmos / scripts / build.ts View on Github external
async function copyStaticAssets(pkgName: string) {
  if (pkgName === 'react-cosmos') {
    await cpy(`src/${STATIC_PATH}/**`, `dist/${STATIC_PATH}`, {
      cwd: path.join(__dirname, `../packages/react-cosmos`),
      parents: false
    });
  }
}
github react-cosmos / react-cosmos / scripts / build.js View on Github external
async function copyFlowDefs(pkgName) {
  return cpy('**/*.js.flow', `../dist`, {
    cwd: join(__dirname, `../packages/${pkgName}/src`),
    parents: true
  });
}
github skidding / react-mock / scripts / build.js View on Github external
async function copyFlowDefs(pkg) {
  return cpy('**/*.js.flow', '../dist', {
    cwd: join(ROOT_PATH, `packages/${pkg}/src`),
    parents: true
  });
}

cpy

Copy files

MIT
Latest version published 2 months ago

Package Health Score

80 / 100
Full package analysis

Popular cpy functions