npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-wercker-component

v0.1.0

Published

Scaffold out a Wercker component in no time!

Downloads

4

Readme

wercker-component-generator

Scaffold out a Wercker component in no time!

Installation

This is a Yeoman generator so Yeoman needs to be installed globally to run it. With Yarn installed run:

yarn global add yo

Create a project directory

mkdir <name of your component> && cd "$_"

Now you're ready to install the generator. This can be done globally (with the global flag) or within the project.

yarn add wercker-component-generator

With the generator installed you should be able to run it:

yo wercker-component

Once completed the files are scaffolded out and the component is ready to be developed.

Requirements

The generator required Node.js 6 or later.

Developing a component

Once the component has been generated start dev mode with yarn dev. Open up localhost:3000 to see the result. This sets up a webpack dev server that watches the files and rebuilds things as needed.

In order to present multiple states of a component an example page is created in src/example/page.js. Update this page, passing in various props to your component, to showcase the different ways the component can be used. When you start dev mode this page is rendered for you to see.

Generated files

| path | what is it? | |-------------------------|-------------------------------------------------------------------| | .git/ | Empty git repository set up | | node_modules/ | Dependencies from package.json | | src/ | Component source | | src/__snapshots__/ | Jest snapshots | | src/example/index.js | Setup stuff for the example page | | src/example/page.js | The contents of the example page (update this page) | | src/component.js | Component implementation | | src/component.test.js | Jest unit tests for component | | src/index.js | Component exports | | src/styles.css | Component CSS | | .babelrc | Confiugration for Babel | | .eslintrc.js | Configuration for ESlint | | .flowconfig | Configuration for Flow | | .gitignore | Sensible default ignores | | .stylelintrc | Configuration for Stylelint | | LICENSE | Apache 2 license | | package.json | Dependencies for component build | | README.md | Component readme | | webpack.config.dev.js | Webpack config for development time | | webpack.config.js | Webpack config for building building distributable components | | wercker.yml | Default Wercker build configuration | | yarn.lock | Lockfile for Yarn. This locks dependencies to a certain version |

Scripts in generated component

Run with yarn run <script name>

| script | purpose | |-----------------|----------------------------------------------------------------------------| | lint-css | Checks CSS for stylisting errors and warnings with Stylelint | | lint-js | Checks Javascript for common errors and style with ESLint | | flow | Runs Flow type checker | | lint | Runs css and js linters + flow type checker | | prettier | Runs Prettier on all javascript and css to format the code | | stylefmt | Runs [Styleflmt] on all css sort declarations | | format | Formats javascript (prettier) and css (stylefmt) | | test | Runs Jest unit tests | | test-coverage | Runs Jest unit tests with code coverage enabled (written in coverage/) | | check-eslint | Checks that there are no conflicting ESlint rules with Prettier |

CSS modules

The CSS is scoped to the component itself so the class name can be written in a human-friendly way, rather than being worried that it will clash with other classes. A class name such as button, title, background or similar is perfectly fine (and encouraged).

Prettier

Prettier is used to format all javascript and css source code. This removes all discussion about style (similar to gofmt).

The default configuration is modified slightly:

--single-quote
--parser flow
--trailing-comma es5

You probably want to integrate this in your editor but if not you can use yarn prettier to format the code. Code that is not formatted with prettier will break the build.

Stylefmt