success: function returnSuccess() {
   logger.info('Migration file successfully generated at `' + path.resolve(scope.rootPath, 'data', 'migrations', scope.connection) + '`.');
   logger.info('Seed file created at `' + path.resolve(scope.rootPath, 'data', 'seeds', scope.connection) + '`.');
   logger.warn('This migration has been automatically generated.');
   logger.warn('We strongly advise you to manually verify those information.');
   process.exit(0);
 }
Example #2
0
 .catch((err) => {
   if (err.sql) {
     logger.warn('Server connection has failed! Make sure your database server is running.');
   } else {
     logger.warn(`Database connection has failed! Make sure your "${scope.database.settings.database}" database exist.`);
   }
   error();
 });
Example #3
0
 defaultPlugins.forEach(defaultPlugin => {
   try {
     execSync(`node ${strapiBin} install ${defaultPlugin.name} ${scope.developerMode && defaultPlugin.core ? '--dev' : ''}`);
     logger.info(`The plugin ${defaultPlugin.name} has been successfully installed.`);
   } catch (error) {
     logger.error(`An error occurred during ${defaultPlugin.name} plugin installation.`);
     logger.error(error);
   }
 });
Example #4
0
module.exports = function (id, cliArguments) {
  // Build initial scope.
  const scope = {
    rootPath: process.cwd(),
    strapiRoot: path.resolve(__dirname, '..'),
    id: id,
    args: cliArguments,
    strapiPackageJSON: packageJSON
  };

  // Register the generator type.
  // It can be a controller, model, service, etc.
  scope.generatorType = process.argv[2].split(':')[1];

  // Check that we're in a valid Strapi project.
  if (scope.generatorType !== 'new' || scope.generatorType !== 'generator' || scope.generatorType !== 'hook') {
    if (!cli.isStrapiApp()) {
      return logger.error('This command can only be used inside a Strapi project.');
    }
  }

  // Show usage if no generator type is defined.
  if (!scope.generatorType) {
    return logger.error('Write `$ strapi generate:something` instead.');
  }

  // Return the scope and the response (`error` or `success`).
  return generate(scope, {

    // Log and exit the REPL in case there is an error
    // while we were trying to generate the requested generator.
    error: function returnError(msg) {
      logger.error(msg);
      process.exit(1);
    },

    // Log and exit the REPL in case of success
    // but first make sure we have all the info we need.
    success: function returnSuccess() {
      if (!scope.outputPath && scope.filename && scope.destDir) {
        scope.outputPath = scope.destDir + scope.filename;
      }

      if (scope.generatorType !== 'new') {
        logger.info('Generated a new ' + scope.generatorType + ' `' + scope.humanizeId + '` at ' + scope.humanizedPath + '.');
      }

      process.exit(0);
    }
  });
};
Example #5
0
    }, err => {
      if (err) {
        console.log();
        logger.warn('You should run `npm install` into your application before starting it.');
        console.log();
        logger.warn('Some dependencies could not be installed:');
        _.forEach(othersDependencies, value => logger.warn('• ' + value));
        console.log();

        return cb();
      }

      pluginsInstallation();
    });
Example #6
0
module.exports = function (name, cliArguments) {
  logger.info('Creating your application... It might take a few seconds.');

  const developerMode = cliArguments.dev !== undefined;

  // Build initial scope.
  const scope = {
    rootPath: process.cwd(),
    strapiRoot: path.resolve(__dirname, '..'),
    generatorType: 'new',
    name,
    strapiPackageJSON: packageJSON,
    developerMode
  };

  const dbArguments = ['dbclient', 'dbhost', 'dbport', 'dbname', 'dbusername', 'dbpassword'];
  const matchingDbArguments = _.intersection(_.keys(cliArguments), dbArguments);

  if (matchingDbArguments.length) {
    if (matchingDbArguments.length !== dbArguments.length) {
      logger.warn(`Some database arguments are missing. Required arguments list: ${dbArguments}`);
      return process.exit(1);
    }

    scope.database = {
      settings: {
        client: cliArguments.dbclient,
        host: cliArguments.dbhost,
        port: cliArguments.dbport,
        database: cliArguments.dbname,
        username: cliArguments.dbusername,
        password: cliArguments.dbpassword
      },
      options: {}
    };
  }

  // Return the scope and the response (`error` or `success`).
  return generate(scope, {

    // Log and exit the REPL in case there is an error
    // while we were trying to generate the new app.
    error: function returnError(err) {
      logger.error(err);
      process.exit(1);
    }
  });
};
Example #7
0
  redis.connect((err) => {
    redis.disconnect();

    if (err) {
      logger.warn('Database connection has failed! Make sure your database is running.');
      return error();
    }

    logger.info('The app has been connected to the database successfully!');

    execSync(`rm -r "${scope.tmpPath}"`);

    logger.info('Copying the dashboard...');

    success();
  });
Example #8
0
    knex.raw(scope.client.database === 'postgres' ? "SELECT tablename FROM pg_tables WHERE schemaname='public'" : 'SELECT * FROM information_schema.tables').then((tables) => {
      knex.destroy();

      const next = () => {
        execSync(`rm -r "${scope.tmpPath}"`);

        logger.info('Copying the dashboard...');

        success();
      };

      if (tables.rows && tables.rows.length !== 0) {
        logger.warn('It seems that your database is not empty. Be aware that Strapi is going to automatically creates tables & columns, and might update columns which can corrupt data or cause data loss.');

        inquirer.prompt([{
          type: 'confirm',
          prefix: '',
          name: 'confirm',
          message: `Are you sure you want to continue with the ${scope.database.settings.database} database:`,
        }])
        .then(({confirm}) => {
          if (confirm) {
            next();
          } else {
            error();
          }
        });
      } else {
        next();
      }
    });
Example #9
0
  Mongoose.connect(`mongodb://${ (scope.database.settings.username && scope.database.settings.password) ? `${scope.database.settings.username}:${scope.database.settings.password}@` : '' }${scope.database.settings.host}:${scope.database.settings.port}/${scope.database.settings.database}`, function (err) {
    if (err) {
      logger.warn('Database connection has failed! Make sure your database is running.');
      return error();
    }

    logger.info('The app has been connected to the database successfully!');

    Mongoose.connection.close();

    execSync(`rm -r ${scope.rootPath}`);

    logger.info('Copying the dashboard...');

    success();
  });
Example #10
0
module.exports = function () {
  logger.info('Creating your application... It might take a few seconds.');

  // Pass the original CLI arguments down to the generator
  // (but first, remove commander's extra argument).
  const cliArguments = Array.prototype.slice.call(arguments);
  cliArguments.pop();

  // Build initial scope.
  const scope = {
    rootPath: process.cwd(),
    strapiRoot: path.resolve(__dirname, '..'),
    generatorType: 'new',
    name: cliArguments[0],
    strapiPackageJSON: packageJSON
  };

  // Return the scope and the response (`error` or `success`).
  return generate(scope, {

    // Log and exit the REPL in case there is an error
    // while we were trying to generate the new app.
    error: function returnError(err) {
      logger.error(err);
      process.exit(1);
    }
  });
};
Example #11
0
      const next = () => {
        execSync(`rm -r "${scope.tmpPath}"`);

        logger.info('Copying the dashboard...');

        success();
      };
Example #12
0
module.exports = function (name, cliArguments) {
  logger.info('Creating your application... It might take a few seconds.');

  const developerMode = cliArguments.dev !== undefined;

  // Build initial scope.
  const scope = {
    rootPath: process.cwd(),
    strapiRoot: path.resolve(__dirname, '..'),
    generatorType: 'new',
    name,
    strapiPackageJSON: packageJSON,
    developerMode
  };

  // Return the scope and the response (`error` or `success`).
  return generate(scope, {

    // Log and exit the REPL in case there is an error
    // while we were trying to generate the new app.
    error: function returnError(err) {
      logger.error(err);
      process.exit(1);
    }
  });
};
Example #13
0
 .then(() => {
   try {
     require(path.join(`${scope.rootPath}`,`/node_modules/`,`${scope.client.connector}/lib/utils/connectivity.js`))(scope, cb.success, connectionValidation);
   } catch(err) {
     shell.rm('-r', scope.rootPath);
     logger.info('Copying the dashboard...');
     cb.success();
   }
 });
Example #14
0
 function throwIfModuleNotFoundError(error, module) {
   const isModuleNotFoundError = error && error.code === 'MODULE_NOT_FOUND' && error.message.match(new RegExp(module));
   if (!isModuleNotFoundError) {
     logger.error('Invalid `' + scope.generatorType + '` generator.');
     throw error;
   } else {
     return error;
   }
 }
Example #15
0
    success: function returnSuccess() {
      if (!scope.outputPath && scope.filename && scope.destDir) {
        scope.outputPath = scope.destDir + scope.filename;
      }

      if (scope.generatorType !== 'new') {
        logger.info('Generated a new ' + scope.generatorType + ' `' + scope.humanizeId + '` at ' + scope.humanizedPath + '.');
      }

      process.exit(0);
    }
Example #16
0
    repl.on('exit', err => {

      // Log and exit the REPL in case there is an error
      // while we were trying to open the REPL.
      if (err) {
        logger.error(err);
        process.exit(1);
      }

      process.exit(0);
    });
Example #17
0
    exec(`npm install ${pluginID}@alpha --ignore-scripts --no-save --prefix ${pluginPath}`, (err) => {
      if (err) {
        logger.error(`An error occurred during plugin installation. \nPlease make sure this plugin is available on npm: https://www.npmjs.com/package/${pluginID}`);
        process.exit(1);
      }

      // Debug message.
      logger.debug('Plugin successfully installed from npm registry.');

      try {
        // Debug message.
        logger.debug(`Moving the \`node_modules/${pluginID}\` folder to the \`./plugins\` folder.`);

        // Move the plugin from the `node_modules` folder to the `./plugins` folder.
        fs.copySync(`${pluginPath}/node_modules/${pluginID}`, pluginPath);

        // Copy .gitignore because the file is ignored during `npm publish`
        // and we need it to build the plugin.
        try {
          fs.accessSync(path.join(pluginPath, '.gitignore'))
        } catch (err) {
          if (err.code === 'ENOENT') {
            if (process.mainModule.filename.indexOf('yarn') !== -1) {
              fs.copySync(path.resolve(__dirname, '..', '..', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore'));
            } else {
              fs.copySync(path.resolve(__dirname, '..', 'node_modules', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore'));
            }
          }
        }

        // Success.
        logger.info('The plugin has been successfully installed.');
        process.exit(0);
      } catch (err) {
        logger.error('An error occurred during plugin installation.');
        process.exit(1);
      }
    });
Example #18
0
  strapi.start({}, err => {

    // Log and exit the REPL in case there is an error
    // while we were trying to start the server.
    if (err) {
      logger.error('Could not load the Strapi framework.');
      logger.error('Are you using the latest stable version?');
      process.exit(1);
    }

    // Open the Node.js REPL.
    const repl = REPL.start(strapi.config.name + ' > ' || 'strapi > ');
    repl.on('exit', err => {

      // Log and exit the REPL in case there is an error
      // while we were trying to open the REPL.
      if (err) {
        logger.error(err);
        process.exit(1);
      }

      process.exit(0);
    });
  });
Example #19
0
          .then(answers => {

            if (hasDatabaseConfig) {
              answers = _.omit(scope.database.settings, ['client'])
            }

            scope.database.settings.host = answers.host;
            scope.database.settings.port = answers.port;
            scope.database.settings.database = answers.database;
            scope.database.settings.username = answers.username;
            scope.database.settings.password = answers.password;

            logger.info('Testing database connection...');

            resolve();
          });
Example #20
0
          .then(answers => {
            if (hasDatabaseConfig) {
              answers = _.omit(scope.database.settings, ['client'])
            }

            scope.database.settings.host = answers.host;
            scope.database.settings.port = answers.port;
            scope.database.settings.database = answers.database;
            scope.database.settings.username = answers.username;
            scope.database.settings.password = answers.password;
            scope.database.options.authenticationDatabase = answers.authenticationDatabase;
            scope.database.options.ssl = _.toString(answers.ssl) === 'true';

            logger.info('Testing database connection...');

            resolve();
          });
Example #21
0
    availableDependencies.forEach(dependency => {
      logger.info(`Linking \`${dependency.key}\` dependency to the project...`);

      if (dependency.global) {
        try {
          fs.accessSync(dependency.path, fs.constants.R_OK | fs.constants.F_OK);
          fs.symlinkSync(dependency.path, path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      } else {
        try {
          fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), fs.constants.R_OK | fs.constants.F_OK);
          fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      }
    });
Example #22
0
module.exports = function (name, cliArguments) {
  logger.info('Creating your application... It might take a few seconds.');

  const developerMode = cliArguments.dev !== undefined;

  // Build initial scope.
  const scope = {
    rootPath: process.cwd(),
    strapiRoot: path.resolve(__dirname, '..'),
    generatorType: 'new',
    name,
    strapiPackageJSON: packageJSON,
    developerMode
  };

  if (_.values(_.omit(cliArguments, ['dev'])).length) {
    scope.database = {
      settings: {
        client: cliArguments.dbclient,
        host: cliArguments.dbhost,
        port: cliArguments.dbport,
        database: cliArguments.dbname,
        username: cliArguments.dbusername,
        password: cliArguments.dbpassword
      },
      options: {}
    }
  }

  // Return the scope and the response (`error` or `success`).
  return generate(scope, {

    // Log and exit the REPL in case there is an error
    // while we were trying to generate the new app.
    error: function returnError(err) {
      logger.error(err);
      process.exit(1);
    }
  });
};
Example #23
0
  // Install default plugins and link dependencies.
  function pluginsInstallation() {
    // Define the list of default plugins.
    const defaultPlugins = ['settings-manager', 'content-type-builder', 'content-manager', 'users-permissions', 'email'];

    // Install each plugin.
    defaultPlugins.forEach(defaultPlugin => {
      try {
        execSync(`node ${strapiBin} install ${defaultPlugin} ${scope.developerMode ? '--dev' : ''}`);
        logger.info(`The plugin ${defaultPlugin} has been successfully installed.`);
      } catch (error) {
        logger.error(`An error occurred during ${defaultPlugin} plugin installation.`);
        logger.error(error);
      }
    });

    // Link dependencies.
    availableDependencies.forEach(dependency => {
      logger.info(`Linking \`${dependency.key}\` dependency to the project...`);

      if (dependency.global) {
        try {
          fs.accessSync(dependency.path, fs.constants.W_OK | fs.constants.F_OK);
          fs.symlinkSync(dependency.path, path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      } else {
        try {
          fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), fs.constants.W_OK | fs.constants.F_OK);
          fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      }
    });

    logger.info('Your new application `' + scope.name + '` is ready at `' + scope.rootPath + '`.');

    cb();
  }
Example #24
0
module.exports = (scope, cb) => {
  cb = cb || {};
  cb = reportback.extend(cb, {
    error: cb.error,
    success: () => {},
    notStrapiApp: () => {},
    alreadyExists: () => {
      return cb.error();
    }
  });

  // Use configured module name for this `generatorType` if applicable.
  const module = 'strapi-generate-' + scope.generatorType;
  let generator;
  let requireError;

  function throwIfModuleNotFoundError(error, module) {
    const isModuleNotFoundError = error && error.code === 'MODULE_NOT_FOUND' && error.message.match(new RegExp(module));
    if (!isModuleNotFoundError) {
      logger.error('Invalid `' + scope.generatorType + '` generator.');
      throw error;
    } else {
      return error;
    }
  }

  // Try to require the module or throw if error.
  try {
    generator = require('../../' + module);
  } catch (error) {
    requireError = throwIfModuleNotFoundError(error, module);
  }

  if (!generator) {
    return logger.error('No generator called `' + scope.generatorType + '` found.');
  }

  generate(generator, scope, cb);
};
Example #25
0
 _.forEach(othersDependencies, value => logger.warn('• ' + value));
Example #26
0
 error: function returnError(err) {
   logger.error(err);
   process.exit(1);
 },
Example #27
0
module.exports = function (plugin, cliArguments) {
  // Define variables.
  const pluginPrefix = 'strapi-plugin-';
  const pluginID = `${pluginPrefix}${plugin}`;
  const pluginPath = `./plugins/${plugin}`;

  // Check that we're in a valid Strapi project.
  if (!cli.isStrapiApp()) {
    return logger.error('This command can only be used inside a Strapi project.');
  }

  // Check that the plugin is not installed yet.
  if (fs.existsSync(pluginPath)) {
    logger.error(`It looks like this plugin is already installed. Please check in \`${pluginPath}\`.`);
    process.exit(1);
  }

  // Progress message.
  logger.debug('Installation in progress...');

  if (cliArguments.dev) {
    try {
      fs.symlinkSync(path.resolve(__dirname, '..', '..', pluginID), path.resolve(process.cwd(), pluginPath), 'dir');

      logger.info('The plugin has been successfully installed.');
      process.exit(0);
    } catch (e) {
      logger.error('An error occurred during plugin installation.');
      process.exit(1);
    }
  } else {
    // Debug message.
    logger.debug('Installing the plugin from npm registry.');

    // Install the plugin from the npm registry.
    exec(`npm install ${pluginID}@alpha --ignore-scripts --no-save --prefix ${pluginPath}`, (err) => {
      if (err) {
        logger.error(`An error occurred during plugin installation. \nPlease make sure this plugin is available on npm: https://www.npmjs.com/package/${pluginID}`);
        process.exit(1);
      }

      // Debug message.
      logger.debug('Plugin successfully installed from npm registry.');

      try {
        // Debug message.
        logger.debug(`Moving the \`node_modules/${pluginID}\` folder to the \`./plugins\` folder.`);

        // Move the plugin from the `node_modules` folder to the `./plugins` folder.
        fs.copySync(`${pluginPath}/node_modules/${pluginID}`, pluginPath);

        // Copy .gitignore because the file is ignored during `npm publish`
        // and we need it to build the plugin.
        try {
          fs.accessSync(path.join(pluginPath, '.gitignore'))
        } catch (err) {
          if (err.code === 'ENOENT') {
            if (process.mainModule.filename.indexOf('yarn') !== -1) {
              fs.copySync(path.resolve(__dirname, '..', '..', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore'));
            } else {
              fs.copySync(path.resolve(__dirname, '..', 'node_modules', 'strapi-generate-plugin', 'templates', 'gitignore'), path.join(pluginPath, '.gitignore'));
            }
          }
        }

        // Success.
        logger.info('The plugin has been successfully installed.');
        process.exit(0);
      } catch (err) {
        logger.error('An error occurred during plugin installation.');
        process.exit(1);
      }
    });
  }
};
Example #28
0
 .then(function () {
   logger.info('Migration successfully made for the `' + scope.connection + '` connection!');
   process.exit(0);
 });
Example #29
0
module.exports = (scope, cb) => {
  const packageJSON = require(path.resolve(scope.rootPath, 'package.json'));
  // const strapiRootPath = path.resolve(scope.strapiRoot, '..');

  process.chdir(scope.rootPath);

  // Copy the default files.
  fs.copySync(path.resolve(__dirname, '..', 'files'), path.resolve(scope.rootPath));

  const availableDependencies = [];
  const dependencies = _.get(packageJSON, 'dependencies');
  const strapiDependencies = Object.keys(dependencies).filter(key => key.indexOf('strapi') !== -1);
  const othersDependencies = Object.keys(dependencies).filter(key => key.indexOf('strapi') === -1);
  const globalRootPath = execSync('npm root -g');

  // Verify if the dependencies are available into the global
  _.forEach(strapiDependencies, (key) => {
    try {
      fs.accessSync(path.resolve(_.trim(globalRootPath.toString()), key), fs.constants.R_OK | fs.constants.F_OK);

      availableDependencies.push({
        key,
        global: true,
        path: path.resolve(_.trim(globalRootPath.toString()), key)
      });
    } catch (e) {
      othersDependencies.push(key);
    }
  });

  logger.info('Installing dependencies...');
  if (!_.isEmpty(othersDependencies)) {
    npm.install({
      dir: scope.rootPath,
      dependencies: othersDependencies,
      loglevel: 'silent',
      production: true,
      'cache-min': 999999999
    }, err => {
      if (err) {
        console.log();
        logger.warn('You should run `npm install` into your application before starting it.');
        console.log();
        logger.warn('Some dependencies could not be installed:');
        _.forEach(othersDependencies, value => logger.warn('• ' + value));
        console.log();

        return cb();
      }

      pluginsInstallation();
    });
  } else {
    pluginsInstallation();
  }

  const strapiBin = path.join(scope.strapiRoot, scope.strapiPackageJSON.bin.strapi);

  // Install default plugins and link dependencies.
  function pluginsInstallation() {
    // Define the list of default plugins.
    const defaultPlugins = [{
      name: 'settings-manager',
      core: true
    }, {
      name: 'content-type-builder',
      core: true
    }, {
      name: 'content-manager',
      core: true
    }, {
      name: 'users-permissions',
      core: true
    }, {
      name: 'email',
      core: true
    },{
      name: 'upload',
      core: true
    },{
      name: 'explorer',
      core: true
    }];

    // Install each plugin.
    defaultPlugins.forEach(defaultPlugin => {
      try {
        execSync(`node ${strapiBin} install ${defaultPlugin.name} ${scope.developerMode && defaultPlugin.core ? '--dev' : ''}`);
        logger.info(`The plugin ${defaultPlugin.name} has been successfully installed.`);
      } catch (error) {
        logger.error(`An error occurred during ${defaultPlugin.name} plugin installation.`);
        logger.error(error);
      }
    });

    // Link dependencies.
    availableDependencies.forEach(dependency => {
      logger.info(`Linking \`${dependency.key}\` dependency to the project...`);

      if (dependency.global) {
        try {
          fs.accessSync(dependency.path, fs.constants.R_OK | fs.constants.F_OK);
          fs.symlinkSync(dependency.path, path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      } else {
        try {
          fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), fs.constants.R_OK | fs.constants.F_OK);
          fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      }
    });

    logger.info('Your new application `' + scope.name + '` is ready at `' + scope.rootPath + '`.');

    logger.info('We are almost there !!!');
    logger.info('cd ' + scope.name);
    logger.info('strapi start');
    logger.info('Open your browser to http://localhost:1337');
    logger.info('Enjoy your strapi project :)');

    cb();
  }
};
Example #30
0
  // Install default plugins and link dependencies.
  function pluginsInstallation() {
    // Define the list of default plugins.
    const defaultPlugins = [{
      name: 'settings-manager',
      core: true
    }, {
      name: 'content-type-builder',
      core: true
    }, {
      name: 'content-manager',
      core: true
    }, {
      name: 'users-permissions',
      core: true
    }, {
      name: 'email',
      core: true
    },{
      name: 'upload',
      core: true
    },{
      name: 'explorer',
      core: true
    }];

    // Install each plugin.
    defaultPlugins.forEach(defaultPlugin => {
      try {
        execSync(`node ${strapiBin} install ${defaultPlugin.name} ${scope.developerMode && defaultPlugin.core ? '--dev' : ''}`);
        logger.info(`The plugin ${defaultPlugin.name} has been successfully installed.`);
      } catch (error) {
        logger.error(`An error occurred during ${defaultPlugin.name} plugin installation.`);
        logger.error(error);
      }
    });

    // Link dependencies.
    availableDependencies.forEach(dependency => {
      logger.info(`Linking \`${dependency.key}\` dependency to the project...`);

      if (dependency.global) {
        try {
          fs.accessSync(dependency.path, fs.constants.R_OK | fs.constants.F_OK);
          fs.symlinkSync(dependency.path, path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      } else {
        try {
          fs.accessSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), fs.constants.R_OK | fs.constants.F_OK);
          fs.symlinkSync(path.resolve(scope.strapiRoot, 'node_modules', dependency.key), path.resolve(scope.rootPath, 'node_modules', dependency.key), 'dir');
        } catch (e) {
          // Silent.
        }
      }
    });

    logger.info('Your new application `' + scope.name + '` is ready at `' + scope.rootPath + '`.');

    logger.info('We are almost there !!!');
    logger.info('cd ' + scope.name);
    logger.info('strapi start');
    logger.info('Open your browser to http://localhost:1337');
    logger.info('Enjoy your strapi project :)');

    cb();
  }