81 captures
10 Feb 2016 - 16 Nov 2025
Nov DEC Jan
07
2020 2021 2022
success
fail

About this capture

COLLECTED BY

Organization: Archive Team

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

History is littered with hundreds of conflicts over the future of a community, group, location or business that were "resolved" when one of the parties stepped ahead and destroyed what was there. With the original point of contention destroyed, the debates would fall to the wayside. Archive Team believes that by duplicated condemned data, the conversation and debate can continue, as well as the richness and insight gained by keeping the materials. Our projects have ranged in size from a single volunteer downloading the data to a small-but-critical site, to over 100 volunteers stepping forward to acquire terabytes of user-created data to save for future generations.

The main site for Archive Team is at archiveteam.org and contains up to the date information on various projects, manifestos, plans and walkthroughs.

This collection contains the output of many Archive Team projects, both ongoing and completed. Thanks to the generous providing of disk space by the Internet Archive, multi-terabyte datasets can be made available, as well as in use by the Wayback Machine, providing a path back to lost websites and work.

Our collection has grown to the point of having sub-collections for the type of data we acquire. If you are seeking to browse the contents of these collections, the Wayback Machine is the best first stop. Otherwise, you are free to dig into the stacks to see what you may find.

The Archive Team Panic Downloads are full pulldowns of currently extant websites, meant to serve as emergency backups for needed sites that are in danger of closing, or which will be missed dearly if suddenly lost due to hard drive crashes or server failures.

Collection: ArchiveBot: The Archive Team Crowdsourced Crawler

ArchiveBot is an IRC bot designed to automate the archival of smaller websites (e.g. up to a few hundred thousand URLs). You give it a URL to start at, and it grabs all content under that URL, records it in a WARC, and then uploads that WARC to ArchiveTeam servers for eventual injection into the Internet Archive (or other archive sites).

To use ArchiveBot, drop by #archivebot on EFNet. To interact with ArchiveBot, you issue commands by typing it into the channel. Note you will need channel operator permissions in order to issue archiving jobs. The dashboard shows the sites being downloaded currently.

There is a dashboard running for the archivebot process at http://www.archivebot.com.

ArchiveBot's source code can be found at https://github.com/ArchiveTeam/ArchiveBot.

TIMESTAMPS
The Wayback Machine - http://web.archive.org/web/20211207160405/https://github.com/reactjs/react-docgen
Skip to content
Sign in
Sign up
  • Notifications
  • Star

  • Fork 268
  • A CLI and toolbox to extract information from React component files for documentation generation purposes.

    reactcommunity.org/react-docgen/
    MIT License
    3.1k stars 268 forks

    Star

    Notifications
    main
    Switch branches/tags
    7 branches 70 tags
    Code

    Latest commit

    renovate-bot chore(deps): update dependency eslint to v8.4.1
    1226e02 Dec 7, 2021
    chore(deps): update dependency eslint to v8.4.1
    1226e02

    Git stats

    Files

    Permalink
    Failed to load latest commit information.
    Type
    Name
    Latest commit message
    Commit time
    .github
    chore(deps): update jamesives/github-pages-deploy-action action to v4…
    Nov 26, 2021
    benchmark
    chore(deps): update dependency cli-table to v0.3.9
    Nov 26, 2021
    bin
    chore: Fix tests for TS 4.4
    Oct 31, 2021
    src
    chore: Fix code to support TypeScript 4.4
    Oct 31, 2021
    tests
    chore: Fix custom matcher for new jest version
    Nov 3, 2021
    website
    chore(deps): update dependency webpack to v5.65.0
    Dec 6, 2021
    .eslintignore
    feat: Migrate to TypeScript
    Oct 30, 2021
    .eslintrc.js
    feat: Migrate to TypeScript
    Oct 30, 2021
    .gitignore
    feat: Migrate to TypeScript
    Oct 30, 2021
    .prettierignore
    feat: Migrate to TypeScript
    Oct 30, 2021
    .prettierrc
    chore: Reformat for new prettier version
    Oct 31, 2021
    CONTRIBUTING.md
    Change license to MIT (#341)
    Apr 12, 2019
    LICENSE
    Change license to MIT (#341)
    Apr 12, 2019
    README.md
    chore: Fix website build and remove travis
    Oct 30, 2021
    jest.config.js
    feat: Migrate to TypeScript
    Oct 30, 2021
    package.json
    chore(deps): update dependency eslint to v8.4.1
    Dec 7, 2021
    renovate.json
    chore(renovate): Ensure benchmark and website are always chore
    Nov 19, 2021
    tsconfig.json
    feat: Migrate to TypeScript
    Oct 30, 2021
    yarn.lock
    chore(deps): update dependency eslint to v8.4.1
    Dec 7, 2021

    README.md

    react-docgen

    react-docgen is a CLI and toolbox to help extracting information from React components, and generate documentation from it.

    It uses ast-types and @babel/parser to parse the source into an AST and provides methods to process this AST to extract the desired information. The output / return value is a JSON blob / JavaScript object.

    It provides a default implementation for React components defined via React.createClass, ES2015 class definitions or functions (stateless components). These component definitions must follow certain guidelines in order to be analyzable (see below for more info).

    react-docgen is a low level tool to extract information about react components. If you are searching for a more high level styleguide with nice interface try react-styleguidist or any of the other tools listed in the wiki.

    Install

    Install the module with yarn or npm:

    yarn add react-docgen --dev
    
    npm install --save-dev react-docgen
    

    CLI

    Installing the module adds a react-docgen executable which allows you to convert a single file, multiple files or an input stream. We are trying to make the executable as versatile as possible so that it can be integrated into many workflows.

    Usage: react-docgen [path]... [options]
    
    path     A component file or directory. If no path is provided it reads from stdin.
    
    Options:
       -o FILE, --out FILE   store extracted information in FILE
       --pretty              pretty print JSON
       -x, --extension       File extensions to consider. Repeat to define multiple extensions. Default:  [js,jsx]
       -e, --exclude         Filename pattern to exclude. Default:  []
       -i, --ignore          Folders to ignore. Default:  [node_modules,__tests__,__mocks__]
       --resolver RESOLVER   Resolver name (findAllComponentDefinitions, findExportedComponentDefinition) or
          path to a module that exports a resolver.  [findExportedComponentDefinition]
    
    Extract meta information from React components.
    If a directory is passed, it is recursively traversed.
    

    By default, react-docgen will look for the exported component created through React.createClass, a class definition or a function (stateless component) in each file. You can change that behavior with the --resolver option, which either expects the name of a built-in resolver or a path to JavaScript module exporting a resolver function. Have a look below for more information about resolvers.

    Have a look at example/ for an example of how to use the result to generate a markdown version of the documentation.

    react-docgen will look for a babel configuration and use it if available. If no config file is found it will fallback to a default configuration, enabling all syntax extension of the babel-parser.

    API

    The tool can be used programmatically to extract component information and customize the extraction process:

    var reactDocs = require('react-docgen');
    var componentInfo = reactDocs.parse(src);

    As with the CLI, this will look for the exported component created through React.createClass or a class definition in the provided source. The whole process of analyzing the source code is separated into two parts:

    parse accepts more arguments with which this behavior can be customized.

    parse(source [, resolver [, handlers [, options]]])

    source

    Type: string | Buffer

    The source text that react-docgen will try to extract the documentation from.

    resolver

    Type: (ast: ASTNode, parser: { parse: (string) => ASTNode }) => (NodePath | Array<NodePath>)

    Given an AST and a reference to the parser, it returns an (array of) NodePath which represents the component definition.

    Built-in resolvers are available under the resolver property, e.g. reactDocs.parse(src, reactDocgen.resolver.findAllComponentDefinitions)

    handlers

    Type: Array<(documentation: Documentation, definition: NodePath, parser: { parse: (string) => ASTNode }) => void>

    Each function is called with a Documentation object, a reference to the component definition as returned by a resolver and a reference to the parser. Handlers extract relevant information from the definition and augment documentation.

    options

    ∙ filename

    Type: string

    The absolute path to the file associated with the code currently being parsed, if there is one. This is used to search for the correct babel config.

    This option is optional, but it is highly recommended to set it when integrating react-docgen.

    ∙ cwd

    Type: string Default: process.cwd()

    The working directory that babel configurations will be searched in.

    ∙ babelrc, babelrcRoots, root, rootMode, configFile, envName

    Type: boolean Default: true

    These options, will be passed directly to babel for locating and resolving a local config or babelrc. To see documentation for each option consult the babel website.

    ∙ parserOptions

    Type: BabelParserOptions

    This options will be directly supplied to @babel/parser. To see a list of supported options head over to the babel website and have a look.

    resolver

    The resolver's task is to extract those parts from the source code which the handlers can analyze. For example, the findExportedComponentDefinition resolver inspects the AST to find

    var Component = React.createClass(<def>);
    module.exports = Component;
    
    // or
    
    class Component extends React.Component {
      // ...
    }
    module.exports = Component;

    and returns the ObjectExpression to which <def> resolves to, or the class declaration itself.

    findAllComponentDefinitions works similarly, but finds all React.createClass calls and class definitions, not only the one that is exported.

    This makes it easy, together with the utility methods created to analyze the AST, to introduce new or custom resolver methods. For example, a resolver could look for plain ObjectExpressions with a render method.

    handlers

    Handlers do the actual work and extract the desired information from the result the resolver returned. Like the resolver, they try to delegate as much work as possible to the reusable utility functions.

    For example, while the propTypesHandler expects the prop types definition to be an ObjectExpression and be available as propTypes in the component definition, most of the work is actually performed by the getPropType utility function.

    There are some community created handlers available. Have a look at the wiki for a list: https://github.com/reactjs/react-docgen/wiki

    Guidelines for default resolvers and handlers

    PropTypes

    Example

    For the following component

    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    
    /**
     * General component description.
     */
    class MyComponent extends Component {
      render() {
        // ...
      }
    }
    
    MyComponent.propTypes = {
      /**
       * Description of prop "foo".
       */
      foo: PropTypes.number.isRequired,
      /**
       * Description of prop "bar" (a custom validation function).
       */
      bar: function(props, propName, componentName) {
        // ...
      },
      baz: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    };
    
    MyComponent.defaultProps = {
      bar: 21,
    };
    
    export default MyComponent;

    we are getting this output:

    {
      "props": {
        "foo": {
          "type": {
            "name": "number"
          },
          "required": true,
          "description": "Description of prop \"foo\"."
        },
        "bar": {
          "type": {
            "name": "custom"
          },
          "required": false,
          "description": "Description of prop \"bar\" (a custom validation function).",
          "defaultValue": {
            "value": "21",
            "computed": false
          }
        },
        "baz": {
          "type": {
            "name": "union",
            "value": [
              {
                "name": "number"
              },
              {
                "name": "string"
              }
            ]
          },
          "required": false,
          "description": ""
        }
      },
      "description": "General component description."
    }

    Flow and TypeScript support

    If you are using flowortypescript then react-docgen can also extract the type annotations. As flow and typescript have way more advanced and fine granular type systems, the returned types from react-docgen are different in comparison when using React.PropTypes.

    Note: react-docgen will not be able to grab the type definition if the type is imported or declared in a different file.

    Example

    For the following component with Flow types

    import React, { Component } from 'react';
    
    type Props = {
      /** Description of prop "foo". */
      primitive: number,
      /** Description of prop "bar". */
      literalsAndUnion: 'string' | 'otherstring' | number,
      arr: Array<any>,
      func?: (value: string) => void,
      noParameterName?: string => void,
      obj?: { subvalue: ?boolean },
    };
    
    /**
     * General component description.
     */
    export default class MyComponent extends Component<void, Props, void> {
      props: Props;
    
      render(): ?ReactElement {
        // ...
      }
    }

    we are getting this output:

    {
      "description": "General component description.",
      "props": {
        "primitive": {
          "flowType": { "name": "number" },
          "required": true,
          "description": "Description of prop \"foo\"."
        },
        "literalsAndUnion": {
          "flowType": {
            "name": "union",
            "raw": "'string' | 'otherstring' | number",
            "elements": [
              { "name": "literal", "value": "'string'" },
              { "name": "literal", "value": "'otherstring'" },
              { "name": "number" }
            ]
          },
          "required": true,
          "description": "Description of prop \"bar\"."
        },
        "arr": {
          "flowType": {
            "name": "Array",
            "elements": [{ "name": "any" }],
            "raw": "Array<any>"
          },
          "required": true
        },
        "func": {
          "flowType": {
            "name": "signature",
            "type": "function",
            "raw": "(value: string) => void",
            "signature": {
              "arguments": [{ "name": "value", "type": { "name": "string" } }],
              "return": { "name": "void" }
            }
          },
          "required": false
        },
        "noParameterName": {
          "flowType": {
            "name": "signature",
            "type": "function",
            "raw": "string => void",
            "signature": {
              "arguments": [{ "name": "", "type": { "name": "string" } }],
              "return": { "name": "void" }
            }
          },
          "required": false
        },
        "obj": {
          "flowType": {
            "name": "signature",
            "type": "object",
            "raw": "{ subvalue: ?boolean }",
            "signature": {
              "properties": [
                {
                  "key": "subvalue",
                  "value": {
                    "name": "boolean",
                    "nullable": true,
                    "required": true
                  }
                }
              ]
            }
          },
          "required": false
        }
      }
    }

    Types

    Here is a list of all the available types and its result structure.

    Name Examples Result
    Simple let x: string;
    let x: number;
    let x: boolean;
    let x: any;
    let x: void;
    let x: Object;
    let x: String;
    let x: MyClass;
    { "name": "<type>" }
    Literals let x: 'foo';
    let x: 1;
    let x: true;
    { "name": "literal", "value": "<rawvalue>" }
    Typed Classes let x: Array<foo>;
    let x: Class<foo>;
    let x: MyClass<bar>;
    { "name": "<type>", "elements": [{ <element-type> }, ...] }
    Object Signature let x: { foo: string, bar?: mixed };
    let x: { [key: string]: string, foo: number };
    { "name": "signature", "type": "object", "raw": "<raw-signature>", "signature": { "properties": [{ "key": "<property-name>"|{ <property-key-type> }, "value": { <property-type>, "required": <true/false> } }, ...] } }
    Function Signature let x: (x: string) => void; { "name": "signature", "type": "function", "raw": "<raw-signature>", "signature": { "arguments": [{ "name": "<argument-name>", "type": { <argument-type> } }, ...], "return": { <return-type> } } }
    Callable-Object/Function-Object Signature let x: { (x: string): void, prop: string }; { "name": "signature", "type": "object", "raw": "<raw-signature>", "signature": { "properties": [{ "key": "<property-name>"|{ <property-key-type> }, "value": { <property-type>, "required": <true/false> } }, ...], "constructor": { <function-signature> } } }
    Tuple let x: [foo, "value", number]; { "name": "tuple", "raw": "<raw-signature>", "elements": [{ <element-type> }, ...] }
    Union let x: number | string; { "name": "union", "raw": "<raw-signature>", "elements": [{ <element-type> }, ...] }
    Intersect let x: number & string; { "name": "intersect", "raw": "<raw-signature>", "elements": [{ <element-type> }, ...] }
    Nullable modifier let x: ?number; { "name": "number", "nullable": true }

    Result data structure

    The structure of the JSON blob / JavaScript object is as follows:

    {
      ["description": string,]
      ["props": {
        "<propName>": {
          "type": {
            "name": "<typeName>",
            ["value": <typeValue>]
            ["raw": string]
          },
          "flowType": <flowType>,
          "tsType": <tsType>,
          "required": boolean,
          "description": string,
          ["defaultValue": {
            "value": string,
            "computed": boolean
          }]
        },
        ...
      },]
      ["composes": <componentNames>]
    }
    

    ([...] means the property may not exist if such information was not found in the component definition)

    About

    A CLI and toolbox to extract information from React component files for documentation generation purposes.

    Topics

    react documentation json

    Resources

    Readme

    License

    MIT License

    Releases 66

    5.4.0 Latest
    May 8, 2021
    + 65 releases

    Sponsor this project

     
    Learn more about GitHub Sponsors

    Contributors 69

  • @fkling
  • @renovate-bot
  • @phated
  • @dependabot[bot]
  • @motiz88
  • @renovate[bot]
  • @ZauberNerd
  • @eps1lon
  • @jquense
  • @glebez
  • + 58 contributors

    Languages

  • Privacy
  • Security
  • Status
  • Docs