hello-ts-lib-starter
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

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

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)

Readme

Keywords

none

Package Sidebar

Install

npm i hello-ts-lib-starter

Weekly Downloads

1

Version

1.5.0

License

MIT

Last publish

Collaborators

  • tonysneed