Exemplo n.º 1
0
        //private List<BowerPackage> bowerPackages;

        /// <summary>
        /// Parses XML from WizardData and installs required npm packages
        /// </summary>
        /// <example>
        /// <![CDATA[
        /// <NodeJSRequirements requiresNpm="true">
        ///     <npm-package id="grunt"/>
        ///     <npm-package id="grunt-cli" />
        ///     <npm-package id="gulp" />
        ///     <npm-package id="bower" />
        /// </NodeJSRequirements>]]>
        /// </example>
        /// <param name="automationObject"></param>
        /// <param name="replacementsDictionary"></param>
        /// <param name="runKind"></param>
        /// <param name="customParams"></param>
        public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary,
                               WizardRunKind runKind, object[] customParams)
        {
            _dte = (DTE)automationObject;
            string   wizardData = replacementsDictionary["$wizarddata$"];
            XElement element    = XElement.Parse(wizardData);

            npmPackages =
                element.Descendants()
                .Where(x => x.Name.LocalName.EqualsIgnoreCase("npm-package"))
                .Select(x => new NpmPackage {
                Id = x.Attribute("id").Value
            })
                .ToList();

            if (NodePackageUtils.TryRegisterNpmFromDefaultLocation())
            {
                if (!NodePackageUtils.HasBowerOnPath())
                {
                    UpdateStatusMessage("Installing bower...");
                    NodePackageUtils.InstallNpmPackageGlobally("bower");
                }
            }

            //Not needed
            //bowerPackages =
            //    element.Descendants()
            //        .Where(x => x.Name.LocalName.EqualsIgnoreCase("bower-package"))
            //        .Select(x => new BowerPackage {Id = x.Attribute("id").Value})
            //        .ToList();
        }
Exemplo n.º 2
0
 public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
 {
     if (runKind == WizardRunKind.AsMultiProject)
     {
         if (!NodePackageUtils.TryRegisterNpmFromDefaultLocation())
         {
             var form = new NodeJSInstallationPrompt();
             form.ShowDialog();
             if (!form.NodeFoundOnPath)
             {
                 //Advise to restart VS and backout?
                 throw new WizardBackoutException("Node.js installation required");
             }
         }
     }
 }