Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Setup TypeScript project
Browse files Browse the repository at this point in the history
  • Loading branch information
timkendall committed Dec 14, 2020
1 parent dfeb28e commit aad0c7c
Show file tree
Hide file tree
Showing 11 changed files with 3,951 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.15.0
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
Empty file added __tests__/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions bin/index
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env node
require('../dist/Cli.js')
14 changes: 14 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const pack = require('./package');

module.exports = {
name: pack.name,
displayName: pack.name,
transform: {
'^.+\\.(t|j)sx?$': ['@swc-node/jest'],
},
testEnvironment: "node",
moduleDirectories: ['node_modules', 'resource', 'src', '__tests__'],
testPathIgnorePatterns: ['build'],
testRegex: "(/(__tests__|src)/.*(\\.|/)(test|spec))\\.(ts|tsx)$",
moduleDirectories: ['node_modules', 'resource', 'src', '__tests__']
}
7 changes: 7 additions & 0 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pre-commit:
parallel: true
commands:
formatter:
files: git diff --name-only @{push}
glob: "*.{ts}"
run: yarn format {files}
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "@timkendall/tsgql",
"private": true,
"version": "1.0.0",
"description": "Write GraphQL queries in TypeScript.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"graphql-fluent": "bin/index"
},
"files": [
"dist",
"bin"
],
"scripts": {
"build": "tsc -b",
"clean": "rm -rf ./node_modules dist",
"dev": "tsc -b -w",
"prepush": "yarn test",
"postpublish": "rm -r ./dist",
"test": "jest",
"format": "prettier --write"
},
"license": "MIT",
"dependencies": {
"fs-extra": "^9.0.1",
"node-fetch": "^2.6.1",
"prettier": "^2.1.2",
"yargs": "^16.1.0"
},
"devDependencies": {
"@arkweid/lefthook": "^0.7.2",
"@types/fs-extra": "^9.0.2",
"@types/node": "^14.6.2",
"@types/node-fetch": "^2.5.7",
"@types/prettier": "^2.1.5",
"@types/yargs": "^15.0.9",
"graphql": "^15.3.0",
"jest": "^26.6.3",
"ts-node": "^9.0.0",
"typescript": "^4.1.3"
},
"peerDependencies": {
"graphql": "^15.3.0"
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('Hello world')
22 changes: 22 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"strict": true,
"rootDir": "src",
"outDir": "dist",
"sourceMap": true,
"target": "ES2019",
"module": "commonjs",
"noUnusedLocals": false,
"allowJs": false,
"declaration": true,
"declarationMap": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"moduleResolution": "node",
"strictPropertyInitialization": false,
"skipLibCheck": true,
"incremental": true,
"lib": ["ES2019"]
}
}
Loading

0 comments on commit aad0c7c

Please # to comment.