How to use the flex-dev-utils/dist/fs.copyTemplateDir function in flex-dev-utils

To help you get started, we’ve selected a few flex-dev-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 twilio / flex-plugin-builder / packages / create-flex-plugin / src / lib / create-flex-plugin.ts View on Github external
config,
    );

    // Get src directory from template URL if provided
    let srcPath = templateJsPath;
    if (config.typescript) {
      srcPath = templateTsPath;
    }
    if (config.template) {
      dirObject = tmpDirSync();
      await downloadFromGitHub(config.template, dirObject.name);
      srcPath = dirObject.name;
    }

    // This copies the src/ directory
    await copyTemplateDir(
      srcPath,
      config.targetDirectory,
      config,
    );

    // Rename plugins
    if (!dirObject) {
      const ext = config.typescript ? 'tsx' : 'js';

      fs.renameSync(
        join(config.targetDirectory, `src/DemoPlugin.${ext}`),
        join(config.targetDirectory, `src/${config.pluginClassName}.${ext}`),
      );
    }

    return true;
github twilio / flex-plugin-builder / packages / create-flex-plugin / src / lib / create-flex-plugin.ts View on Github external
const promise = progress('Creating project directory', async () => {
    // This copies the core such as public/ and craco config.
    await copyTemplateDir(
      templateCorePath,
      config.targetDirectory,
      config,
    );

    // Get src directory from template URL if provided
    let srcPath = templateJsPath;
    if (config.typescript) {
      srcPath = templateTsPath;
    }
    if (config.template) {
      dirObject = tmpDirSync();
      await downloadFromGitHub(config.template, dirObject.name);
      srcPath = dirObject.name;
    }