Skip to content

Instantly share code, notes, and snippets.

@Graham42
Created November 8, 2019 17:03
Show Gist options
  • Save Graham42/f3e5130ff270666575d448d022867ae2 to your computer and use it in GitHub Desktop.
Save Graham42/f3e5130ff270666575d448d022867ae2 to your computer and use it in GitHub Desktop.
rough idea how to start a ts project
#!/usr/bin/env bash
set -e;
npm init -y
node -e "const pkg = require('./package.json');
pkg.version = '0.0.0-dev'
pkg.license = 'MIT';
pkg.scripts = pkg.scripts || {};
pkg.scripts['lint:eslint'] = 'eslint --ext .ts,.js . ';
pkg.scripts['fix:eslint'] = 'eslint --fix --ext .ts,.js . ';
require('fs').writeFileSync('package.json', JSON.stringify (pkg, null, 2), 'utf8');
"
npx @graham42/prettier-config
npm install -D \
eslint \
eslint-config-prettier \
eslint-plugin-import \
eslint-plugin-node \
typescript \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser
cat <<EOF > .eslintrc.js
module.exports = {
// TODO
};
EOF
cat <<EOF > .gitattributes
package-lock.json -diff
EOF
npx gitignore node
npm run format
git init
git add .
git commit -m "initial commit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment