Add typescript stuff

master
Garrett Mills 2 years ago
parent 0b89af10d3
commit 103ab3979a

@ -0,0 +1,4 @@
node_modules
lib
dist

@ -0,0 +1,114 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"indent": [
"error",
4
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": true
}
],
"semi": [
"error",
"never"
],
"no-console": "error",
"curly": "error",
"eqeqeq": "error",
"guard-for-in": "error",
"no-alert": "error",
"no-caller": "error",
"no-constructor-return": "error",
"no-eval": "error",
"no-implicit-coercion": "error",
"no-implied-eval": "error",
"no-invalid-this": "error",
"no-return-await": "error",
"no-throw-literal": "error",
"no-useless-call": "error",
"radix": "error",
"yoda": "error",
"@typescript-eslint/no-shadow": "error",
"brace-style": "error",
"camelcase": "error",
"comma-dangle": [
"error",
"always-multiline"
],
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error",
"last"
],
"computed-property-spacing": [
"error",
"never"
],
"eol-last": "error",
"func-call-spacing": [
"error",
"never"
],
"keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"lines-between-class-members": "error",
"max-params": [
"error",
4
],
"new-parens": [
"error",
"always"
],
"newline-per-chained-call": "error",
"no-trailing-spaces": "error",
"no-underscore-dangle": "error",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"object-property-newline": "error",
"prefer-exponentiation-operator": "error",
"prefer-object-spread": "error",
"spaced-comment": [
"error",
"always"
],
"prefer-const": "error",
"@typescript-eslint/no-explicit-any": "off"
}
}

272
.gitignore vendored

@ -9,9 +9,6 @@
.idea/**/dictionaries .idea/**/dictionaries
.idea/**/shelf .idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files # Generated files
.idea/**/contentModel.xml .idea/**/contentModel.xml
@ -74,155 +71,122 @@ fabric.properties
# Android studio 3.1+ serialized cache file # Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser .idea/caches/build_file_checksums.ser
# ---> Linux # ---> Node
*~ # Logs
logs
# temporary files which can be created if a process still has a handle open of a deleted file *.log
.fuse_hidden* npm-debug.log*
yarn-debug.log*
# KDE directory preferences yarn-error.log*
.directory lerna-debug.log*
# Linux trash folder which might appear on any partition or disk # Diagnostic reports (https://nodejs.org/api/report.html)
.Trash-* report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# .nfs files are created when an open file is removed but is still being accessed # Runtime data
.nfs* pids
*.pid
# ---> Windows *.seed
# Windows thumbnail cache files *.pid.lock
Thumbs.db
Thumbs.db:encryptable # Directory for instrumented libs generated by jscoverage/JSCover
ehthumbs.db lib-cov
ehthumbs_vista.db
# Coverage directory used by tools like istanbul
# Dump file coverage
*.stackdump *.lcov
# Folder config file # nyc test coverage
[Dd]esktop.ini .nyc_output
# Recycle Bin used on file shares # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
$RECYCLE.BIN/ .grunt
# Windows Installer files # Bower dependency directory (https://bower.io/)
*.cab bower_components
*.msi
*.msix # node-waf configuration
*.msm .lock-wscript
*.msp
# Compiled binary addons (https://nodejs.org/api/addons.html)
# Windows shortcuts build/Release
*.lnk
# Dependency directories
# ---> macOS node_modules/
# General jspm_packages/
.DS_Store
.AppleDouble # Snowpack dependency directory (https://snowpack.dev/)
.LSOverride web_modules/
# Icon must end with two \r # TypeScript cache
Icon *.tsbuildinfo
# Thumbnails # Optional npm cache directory
._* .npm
# Files that might appear in the root of a volume # Optional eslint cache
.DocumentRevisions-V100 .eslintcache
.fseventsd
.Spotlight-V100 # Microbundle cache
.TemporaryItems .rpt2_cache/
.Trashes .rts2_cache_cjs/
.VolumeIcon.icns .rts2_cache_es/
.com.apple.timemachine.donotpresent .rts2_cache_umd/
# Directories potentially created on remote AFP share # Optional REPL history
.AppleDB .node_repl_history
.AppleDesktop
Network Trash Folder # Output of 'npm pack'
Temporary Items *.tgz
.apdisk
# Yarn Integrity file
# ---> Vim .yarn-integrity
# Swap
[._]*.s[a-v][a-z] # dotenv environment variables file
!*.svg # comment out if you don't need vector files .env
[._]*.sw[a-p] .env.test
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z] # parcel-bundler cache (https://parceljs.org/)
[._]sw[a-p] .cache
.parcel-cache
# Session
Session.vim # Next.js build output
Sessionx.vim .next
out
# Temporary
.netrwhist # Nuxt.js build / generate output
*~ .nuxt
# Auto-generated tag files dist
tags
# Persistent undo # Gatsby files
[._]*.un~ .cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# ---> Emacs # https://nextjs.org/blog/next-9-1#public-directory-support
# -*- mode: gitignore; -*- # public
*~
\#*\# # vuepress build output
/.emacs.desktop .vuepress/dist
/.emacs.desktop.lock
*.elc # Serverless directories
auto-save-list .serverless/
tramp
.\#* # FuseBox cache
.fusebox/
# Org-mode
.org-id-locations # DynamoDB Local files
*_archive .dynamodb/
# flymake-mode # TernJS port file
*_flymake.* .tern-port
# eshell files # Stores VSCode versions used for testing VSCode extensions
/eshell/history .vscode-test
/eshell/lastdir
# yarn v2
# elpa packages .yarn/cache
/elpa/ .yarn/unplugged
.yarn/build-state.yml
# reftex files .yarn/install-state.gz
*.rel .pnp.*
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
/lib

@ -0,0 +1,43 @@
{
"name": "template-npm-typescript",
"version": "0.1.0",
"description": "A template for NPM packages built with TypeScript",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib"
},
"scripts": {
"build": "pnpm run lint && rimraf lib && tsc",
"app": "pnpm run build && node lib/index.js",
"prepare": "pnpm run build",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint --fix . --ext .ts"
},
"files": [
"lib/**/*"
],
"prepare": "pnpm run build",
"postversion": "git push && git push --tags",
"repository": {
"type": "git",
"url": "https://code.garrettmills.dev/garrettmills/template-npm-typescript"
},
"author": "Garrett Mills <shout@garrettmills.dev>",
"license": "MIT",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"eslint": "^8.2.0"
},
"dependencies": {
"@types/rimraf": "^3.0.2",
"@types/uuid": "^8.3.3",
"dotenv": "^10.0.0",
"mkdirp": "^1.0.4",
"rimraf": "^3.0.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.2",
"uuid": "^8.3.2"
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,3 @@
export const HELLO_WORLD = 'Hello, World!'

@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"declaration": true,
"outDir": "./lib",
"strict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true
},
"include": ["src"],
"exclude": ["node_modules"]
}
Loading…
Cancel
Save