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

hello-ts-lib-starter

v1.5.0

Published

A sample project for TypeScript Library Starter.

Downloads

4

Readme

Hello TypeScript Library Starter

A sample project for TypeScript Library Starter.

Build Status Coverage Status Greenkeeper badge

Docs published to: https://tonysneed.github.io/hello-ts-lib-starter

Source

Using: typescript-library-starter

Customization

  • Linting:

    • Copy tslint.json from angular project.
    • Install packages.
    npm i --save-dev codelyzer @angular/compiler@^2.3.1 @angular/core@^2.3.1 zone.js@^0.7.2
    • Remove Prettier (conflicts with TSLint) by removing precommit, lint-staged from package.json
    • Update lint script in package.json to include --type-check.
    "lint": "tslint --type-check -p tsconfig.json codeFrame 'src/**/*.ts' 'test/**/*.ts'"
  • Exports:

    • Add ts file with same name as project
    • Add exports for modules
    export { HelloWorld } from './hello-world';
    export { ItalianHelloWorld } from './italian-hello-world';
  • TypeScript:

    • Target es2015 in tsconfig.json.
    • Remove target with dest: pkg.main in rollup.config.js.
    • Remove main section in package.json.
    • Remove es5 suffix in module in package.json
  • Update .gitignore from an Angular project.

    • Remove .vscode entry
  • Debugging:

    • Add launch.json to *.vscode folder for debugging Jest tests.
    {
      "version": "0.2.0",
      "configurations": [
        {
          "name": "Tests",
          "type": "node",
          "request": "launch",
          "program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
          "sourceMaps": true,
          "runtimeArgs": [
            "-i"
          ],
          "env": {
            "NODE_ENV": "development"
          },
          "outFiles": [
            "${workspaceRoot}/dist/**/*"
          ],
          "cwd": "${workspaceRoot}"
        }
      ]
    }
  • Tasks:

    • Add tasks.json to .vscode folder for binding to keyboard shortcuts for build, test and lint tasks.
    {
      // See https://go.microsoft.com/fwlink/?LinkId=733558
      // for the documentation about the tasks.json format
      "version": "2.0.0",
      "tasks": [
          {
              "label": "build",
              "type": "npm",
              "script": "build",
              "presentation": {
                  "reveal": "always"
              },
              "group": {
                  "kind": "build",
                  "isDefault": true
              },
              "problemMatcher": [
                  "$tsc"
              ]
          },
          {
              "label": "test",
              "type": "npm",
              "script": "test:watch",
              "presentation": {
                  "reveal": "always"
              },
              "group": {
                  "kind": "test",
                  "isDefault": true
              }
          },
          {
              "taskName": "lint",
              "type": "shell",
              "command": "npm run lint",
              "problemMatcher": [
                  "$tsc"
              ]
          }
      ]
    }

Setup

  • Open repo in GitHub Desktop and publish repo to GitHub.

    • Open in GitHub, copy the clone url.
    • Paste into the url property of repository in package.json.
  • Link repo to Travis CI account.

  • Copy markdown for Build Status badge into README.md.
  • Link repo to Coveralls account.

    • Copy markdown for Coverage Status into README.md.
  • Link repo to Greenkeeper account.

    • Merge PR created by the Greenkeeper bot.
    • Add markdown for Greenkeeper badge to README.md.

Docs

  • Push or merge PR to master to publish docs.

  • To locate generated docs, open repo on GitHub

    • Go to Settings for the repo, GitHub Pages section
    • Uses TypeDoc: http://typedoc.org
  • Configure project to exclude tests from docs.

    • Update build script to add: --exclude '**/*.spec.ts'
  • Use JavaDoc tags to document classes, methods, etc.

    • See http://typedoc.org/guides/doccomments/
    • Use jsdoc comments extension for VS Code: https://marketplace.visualstudio.com/items?itemName=stevencl.addDocComments
    • Example:
    /**
    * Class representing a greeter.
    */
    export class HelloWorld {
      /**
      * Greet someone by name.
      * @param  {string} name
      * @returns A friendly greeting.
      */
      greet(name: string): string {
        return `Hello ${name}`;
      }
    }

Workflow

  • Create develop branch and push to origin

    • Leave master as the default branch
  • Create feature branch: @feature/my-new-feature.

    • Push branch to origin - husky will run prepush (tests, bundling, docs, etc)
    • PR into develop
    • Travis will kick off a CI build.
    • Coveralls will perform a code coverage check.
  • When code review has completed, squash into one commit and force push feature branch.

    • Force push feature branch: git push -f origin
  • On GitHub, rebase PR into develop with “Rebase and merge” button

    • Travis CI will kick off a build
  • When ready for release, merge develop into master

    • Create a release branch: @release/v1.0.0-beta1
    • Include issues/PR's in the release notes
    • Create or update CHANGELOG.md
    • Update the version in package.json
    • Publish to NPM: npm publish --tag beta1 (omit tag for non-prerelease version)