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

@sparksi/frontend-tooling

v1.0.16

Published

Sparks Interactive frontend-tooling. A central place for opens source packages and tools.

Downloads

11

Readme

Sparks Interactive Project Template and Tooling

What is this?

This is the the Sparks Interactive Project template tooling hub with opensource packages and tools. Currently the tools / packages are linters like Eslint, StyleLint, Prettier and pre-commit hooks, with recommended extensions for realtime linting as you save your work and push to version control. We've added on Playwright for Frontend testing.

Setup locally

When starting a new project, these files can be used as a base, in the root of your project folder. This works outside of and a precursor to any other theme/folder like in Drupal web/themes, where you might have other packages. See further instructions on how to use these settings, to extend your themes' settings.

Requirements

  • Git
  • Recommend using PNPM Globally.

Installation:

To Install PNPM Globally: https://pnpm.io/installation#using-npm

  • npm install -g pnpm Or
  • brew install pnpm
git clone [email protected]:sparksi/project-template.git
cd project-template
pnpm i

If you are adding this to an existing project

  • Copy files to the root (or copy and paste parts that make sense)
  • Run pnpm i
  • Run pnpm prepare if the above command didn't do so already. This will install the "husky hook" with lint-staged command.

Then extend your configs, for example, from a drupal theme: web/themes/custom/yourtheme, in your https://github.com/sparksi/sector-distribution/blob/10.0.x/themes/sector_starter/.stylelintrc.json

// .stylelintrc.json file
{
  "extends": "/absolute/path/to/project-template/packages/stylelint" // this might need to be "../../../../../../packages/stylelint/index.js" if working in Sector web profiles, themes sector_starter
}

Folder Structure

  • packages/
    • ui/src: UI components (if we were to use storybook)
    • eslint: EsLint config for extending your coding workspace - currently not used.
    • stylelint: Stylelint config for extending your coding workspace.
    • prettier: Prettier config for extending your coding workspace.
    • tests: Playwright silent functional and e2e style tests
      • see more examples https://playwright.dev/docs/writing-tests

Contribute to this template.

  • git checkout -b feat/your-change
  • Make your changes.
  • Update Changelog.
  • Commit changes and open a pull request.

Tests

  • Tests and examples are in the packages/tests folder

TO FIRST START USING TESTS, RUN:

  • pnpm dlx playwright install

Then:

  • run pnpm exec playwright test (headless)
  • run pnpm exec playwright testui (in a chromium UI)

Read more about Playwright

Extending the config

Simply add a "rules" key to your config, then add your overrides and additions there.

For example, to change the at-rule-no-unknown rule to use its ignoreAtRules option, change the indentation to spaces, turn off the number-leading-zero rule, and add the unit-whitelist rule:

{
  // theme .stylelintrc.json
  "extends": "../../../../packages/stylelint/index.js",
  "rules": {
    "at-rule-no-unknown": [ true, {
      "ignoreAtRules": [
        "extends",
        "ignores"
      ]
    }],
    "number-leading-zero": null,
    "unit-whitelist": ["em", "rem", "s"]
  }
}

Plugins

Plugins are rules or sets of rules built by the community that support methodologies, toolsets, non-standard CSS features, or very specific use cases. See documentation for more information.

IDE Extensions

  • VSCODE
      Name: Stylelint
      Id: stylelint.vscode-stylelint
      Description: Official Stylelint extension for Visual Studio Code
      Version: 1.2.4
      Publisher: Stylelint
      VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
    
      Name: Prettier - Code formatter
      Id: esbenp.prettier-vscode
      Description: Code formatter using prettier
      Version: 9.19.0
      Publisher: Prettier
      VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode

** Read the Extension's help text to show you how to update your user settings. E.g. Setting which code languages you'd like Stylelint to work with and whether to auto format on save etc.

** Example - VSCode settings - with Sparks project-template cloned locally, setting Prettier to be defaultFormatter":

User Settings: press CMD + P then > user Open user settings JSON.

  "css.validate": false,
  "less.validate": false,
  "scss.validate": false,
  "[scss]": {
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "editor.defaultFormatter": "esbenp.prettier-vscode",
  },
  • PHPSTORM https://www.jetbrains.com/help/phpstorm/using-stylelint-code-quality-tool.html

  • Other IDEs: https://stylelint.io/user-guide/integrations/editor

  • General info: https://stylelint.io/

To publish this as a package to NPM:

@sparksi/sparksi-frontend-tooling Package

  • see https://www.freecodecamp.org/news/how-to-create-and-publish-your-first-npm-package/
  • Run:
  • npm login - You'll need to authenticate.
  • npm pubish - You'll need to authenticate again.

Updating package.

License