@alfheim/generator-nef-index

Yeoman generator for basic NEF component index file

Usage no npm install needed!

<script type="module">
  import alfheimGeneratorNefIndex from 'https://cdn.skypack.dev/@alfheim/generator-nef-index';
</script>

README

@alfheim/generator-nef-index

Travis npm (scoped with tag) GitHub license PRs welcome

This package is part of the battery used to create new components for the Nasdaq Experience Framework. This package creates an index.tsx file, which contains the component.

Note: It is recommended that you install and use generator-nef-component rather than installing this package directly, unless you need to modify the individual file generators.

By default, a component named Test created using this generator looks as follows:

import React from "react";

import StyledTest from "./Test.styles";

export interface TestProps extends React.HTMLAttributes<HTMLElement> {}

const Test: React.FC<TestProps> = (props: TestProps) => (
  <StyledTest {...props} />
);

export default Test;

If you pass in the --class-component/-c flag while creating this component, it will instead look like the following:

import React, { Component } from "react";

import StyledTest from "./Test.styles";

export interface TestProps extends React.HTMLAttributes<HTMLElement> {} 

class Test extends Component<TestProps> {
  public render() {
    return <StyledTest {...this.props} />;
  }
}

export default Test;

Getting started

To install, simply run:

yarn add @alfheim/generator-nef-index --dev

or

npm install @alfheim/generator-nef-index --dev 

Contributing

We'd love to have your helping hand on alfheim! Go over to our issues section and see if there's anything we're looking for help with OR open up a PR if you have an idea for a way to improve the library.

License

Alfheim is open source software licensed as MIT.