Skip to content

Instantly share code, notes, and snippets.

@thejohnfreeman
Last active June 24, 2018 16:18
Show Gist options
  • Save thejohnfreeman/bfd5d960c8baca3512ba3f68eca9e724 to your computer and use it in GitHub Desktop.
Save thejohnfreeman/bfd5d960c8baca3512ba3f68eca9e724 to your computer and use it in GitHub Desktop.
git init
yarn init

JavaScript

yarn add -D standard snazzy
// package.json
"test": "standard --verbose | snazzy"

TypeScript

yarn add -D typescript tslint tslint-config-standard
// package.json
"test": "tsc --noEmit && tslint --project tsconfig.json 'src/**/*.ts'"
// tsconfig.json
// http://www.typescriptlang.org/docs/handbook/compiler-options.html
{
  "compilerOptions": {
    // Enable a group of strictness checks.
    "strict": true,
    // Resolve dependencies like Node.js.
    "moduleResolution": "node",
    // Suppress noImplicitAny errors when indexing.
    "suppressImplicitAnyIndexErrors": true
  }
}
// tslint.json
{
  "extends": "tslint-config-standard"
}

Rollup

yarn add -D rollup rollup-plugin-typescript
// package.json
"build": "rollup --config"
// rollup.config.js
import typescript from 'rollup-plugin-typescript'

export default {
  input: 'src/index.ts',
  output: {
    file: 'index.js',
    format: 'cjs'
  },
  plugins: [typescript({
    // Pass our chosen version of the TypeScript compiler.
    typescript: require('typescript')
  })]
}

If you want your dependencies included in your bundle

rollup-plugin-node-resolve

yarn add -D rollup-plugin-node-resolve
// rollup.config.js
import resolve from 'rollup-plugin-node-resolve'

plugin: [resolve()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment