Example #1
0
        private void EnumerateDirectories(DirectoryInfo pathDirectory)
        {
            foreach (var subDirectory in pathDirectory.GetDirectories())
            {
                if (subDirectory.Name.StartsWith("@"))
                {
                    EnumerateDirectories(subDirectory);
                }

                if (NpmPackage.HasPackage(subDirectory.FullName))
                {
                    this.Packages.Add(new NpmPackage(subDirectory.FullName));
                }
            }
        }
Example #2
0
        public void Update()
        {
            var pathDirectory = new DirectoryInfo(this.NodeModulesPath);

            foreach (var subDirectory in pathDirectory.GetDirectories().Where(d => !this.Packages.Any(p => p.PackagePath.AsCaseless() != d.FullName)))
            {
                if (subDirectory.Name.StartsWith("@"))
                {
                    EnumerateDirectories(subDirectory);
                }

                if (NpmPackage.HasPackage(subDirectory.FullName))
                {
                    this.Packages.Add(new NpmPackage(subDirectory.FullName));
                }
            }
        }
Example #3
0
        private static void TestPeerExists()
        {
            var            name                        = "@ionic/angular";
            var            folderRoot                  = Environment.CurrentDirectory;
            var            packageNodeModulesPath      = Path.GetFullPath(Path.Combine(folderRoot, @"..\..\TestOutput\AngularProject\node_modules"));
            var            packageNodeModulesDirectory = new DirectoryInfo(packageNodeModulesPath);
            var            cacheRoot                   = Environment.ExpandEnvironmentVariables(@"%APPDATA%\hydra\cache");
            var            cacheRootDirectory          = new DirectoryInfo(cacheRoot);
            NpmNodeModules npmPackageModules           = null;

            if (packageNodeModulesDirectory.Exists)
            {
                var packagePath = Path.Combine(packageNodeModulesPath, name.BackSlashes());

                npmPackageModules = new NpmNodeModules(packageNodeModulesPath);
            }

            if (cacheRootDirectory.Exists)
            {
                var npmCacheModules = new NpmNodeModules(cacheRoot);
                var cachePath       = Path.Combine(cacheRoot, name.BackSlashes());
                var cacheDirectory  = new DirectoryInfo(cachePath);

                if (cacheDirectory.Exists)
                {
                    if (NpmPackage.HasPackage(cachePath))
                    {
                        var  npmCachePackage = new NpmPackage(cachePath);
                        bool packagePeerExists;
                        bool cachePeerExists;

                        npmCachePackage.Load();

                        if (npmPackageModules != null)
                        {
                            packagePeerExists = npmCachePackage.PeerDependencies.PeerExists(npmPackageModules);
                        }

                        cachePeerExists = npmCachePackage.PeerDependencies.PeerExists(npmCacheModules);
                    }
                }
            }
        }