Пример #1
0
        private static void Pack(DirectoryInfo[] dirs)
        {
            int numOfPackagesToPack = dirs.Count();

            if (numOfPackagesToPack == 0)
            {
                return;
            }
            mNumOfPackedPackages += numOfPackagesToPack;

            var myDirUtils = new DirUtils();

            System.Diagnostics.Process          process   = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WorkingDirectory = mPackModulesDest;
            startInfo.WindowStyle      = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.FileName         = "cmd.exe";

            StringBuilder listOfModules = new StringBuilder();

            foreach (var d in dirs)
            {
                listOfModules.Append(d.FullName + " ");
                Console.WriteLine("packing " + d.FullName);
            }

            startInfo.Arguments = "/C npm pack " + listOfModules;
            process.StartInfo   = startInfo;
            process.Start();
            process.WaitForExit();
        }
Пример #2
0
        private static void ExecuteCommand(string nodeModulesSrc, Command cmd)
        {
            mNumOfPackedPackages = 0;
            var           myDirUtil = new DirUtils();
            DirectoryInfo di        = new DirectoryInfo(nodeModulesSrc);

            Console.WriteLine("start packing ...");

            myDirUtil.Walk(di, cmd, "node_modules");

            Console.WriteLine("packing ended, packed " + mNumOfPackedPackages + " packages");
        }