async prepare()

in packages/cli/src/runtime.ts [95:119]


  async prepare(artifactPlugin = true): Promise<void> {
    await this.prepareWorkspace();
    logger.info('preparing framework');
    const framework = await Framework.prepareFramework(this.pipelineMeta, this.workspace.frameworkDir, this.mirror, this.enableCache);
    logger.info('preparing scripts');
    this.scripts = await Script.prepareScript(this.pipelineMeta, this.scriptDir, this.enableCache, this.devMode);
    logger.info('preparing artifact plugins');
    if (artifactPlugin) {
      this.artifactPlugins = await Plugin.prepareArtifactPlugin(this.pipelineMeta, this.npmClient, this.registry);
    }
    this.costa = new Costa({
      workspace: this.workspace,
      framework
    });
    logger.info('initializing framework packages');
    await this.costa.initFramework(this.pipelineMeta.options);
    const modulePath = path.join(this.workspace.frameworkDir, constants.JSModuleDirName);
    const scriptModulePath = path.join(this.scriptDir, constants.JSModuleDirName);
    if (await fs.pathExists(modulePath) && !await fs.pathExists(scriptModulePath)) {
      // link node_module in framework to script directory
      await fs.ensureSymlink(modulePath, scriptModulePath);
    }
    // link @pipcook/core to node_module
    await Script.linkCoreToScript(scriptModulePath);
  }