Exemplo n.º 1
0
        public RootPackage(
            string fullPathToRootDirectory,
            bool showMissingDevOptionalSubPackages,
            Dictionary <string, ModuleInfo> allModules = null,
            int depth = 0)
        {
            Path = fullPathToRootDirectory;
            var packageJsonFile = System.IO.Path.Combine(fullPathToRootDirectory, "package.json");

            try {
                if (packageJsonFile.Length < 260)
                {
                    PackageJson = PackageJsonFactory.Create(new DirectoryPackageJsonSource(fullPathToRootDirectory));
                }
            } catch (RuntimeBinderException rbe) {
                throw new PackageJsonException(
                          string.Format(@"Error processing package.json at '{0}'. The file was successfully read, and may be valid JSON, but the objects may not match the expected form for a package.json file.

The following error was reported:

{1}",
                                        packageJsonFile,
                                        rbe.Message),
                          rbe);
            }

            try {
                Modules = new NodeModules(this, showMissingDevOptionalSubPackages, allModules, depth);
            }  catch (PathTooLongException) {
                // otherwise we fail to create it completely...
            }
        }
Exemplo n.º 2
0
        public RootPackage(
            string fullPathToRootDirectory,
            bool showMissingDevOptionalSubPackages) {
            Path = fullPathToRootDirectory;
            var packageJsonFile = System.IO.Path.Combine(fullPathToRootDirectory, "package.json");
            try {
                if (packageJsonFile.Length < 260) {
                    PackageJson = PackageJsonFactory.Create(new DirectoryPackageJsonSource(fullPathToRootDirectory));
                }
            } catch (RuntimeBinderException rbe) {
                throw new PackageJsonException(
                    string.Format(@"Error processing package.json at '{0}'. The file was successfully read, and may be valid JSON, but the objects may not match the expected form for a package.json file.

The following error was reported:

{1}",
                    packageJsonFile,
                    rbe.Message),
                    rbe);
            }

            try {
                Modules = new NodeModules(this, showMissingDevOptionalSubPackages);
            }  catch (PathTooLongException) {
                // otherwise we fail to create it completely...
            }
        }