Skip to content

best way to share custom components #90

Description

@nakednous

Since I finished my p5.js component I was wondering if there's a standard way to share it?

Activity

  1. loreanvictor commented on Dec 17, 2020

    @loreanvictor
    Contributor

    yes, writing a codedoc plugin for easy consumption of the component, and publishing it on NPM. I guess we should also add a page to the docs somewhere for community plugins now, so would appreciate if you would mention the final plugin here as well.

  2. added
    enhancementNew feature or request
    questionFurther information is requested
    and removed
    enhancementNew feature or request
    on Dec 17, 2020
  3. nakednous commented on Jan 10, 2021

    @nakednous
    Author

    I managed to merge the code of the component with that of the plugin into the p5-plugin, i.e., I just added the plugin export function p5Plugin(): ConfigOverride to the index.tsx component file. It works as expected by:

    1. Copy the p5-plugin dir contents into .codedoc.
    2. Import the plugin into config.ts:
      import { p5Plugin } from './p5-plugin/index';
      export const config = configuration({
       //...
       plugins: [p5Plugin],
      });

    Since this is my first node package I have several questions:

    1. Should I use a scoped package? If so, should it go inside @codedoc/ or @connectv/?
    2. Will import { p5Plugin } from './p5-plugin/index'; still be the line to import the plugin into config.ts once the package is created, published and installed? Or how should it be imported?
    3. Is there any naming convention to be followed for the plugins, e.g., p5-codedoc-plugin?
  4. loreanvictor commented on Jan 13, 2021

    @loreanvictor
    Contributor
    1. Should I use a scoped package? If so, should it go inside @codedoc/ or @connectv/?

    no. scoped packages are for organizational packages. since you are the primary maintainer of this package and not @codedoc or @connectv organizations, I suspect a better naming scheme would be codedoc-p5-plugin or something.

    1. Will import { p5Plugin } from './p5-plugin/index'; still be the line to import the plugin into config.ts once the package is created, published and installed? Or how should it be imported?

    nope, it will be something like import { p5Plugin } from 'codedoc-p5-plugin';.

    p.s. publishing a typescript-based package can have some nuances, so I would also recommend taking a look at this plugin, specifically package.json and conf/typescript folders if you run into issues for proper exports (this is the template that I use for all typescript packages I publish).

  5. locked and limited conversation to collaborators on Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions