Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesMessinger committed Jan 21, 2020
0 parents commit de642e5
Show file tree
Hide file tree
Showing 32 changed files with 1,029 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Editor config
# http://EditorConfig.org

# This EditorConfig overrides any parent EditorConfigs
root = true

# Default rules applied to all file types
[*]

# No trailing spaces, newline at EOF
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

# 2 space indentation
indent_style = space
indent_size = 2

# JavaScript-specific settings
[*.{js,ts}]
quote_type = double
continuation_indent_size = 2
curly_bracket_next_line = false
indent_brace_style = BSD
spaces_around_operators = true
spaces_around_brackets = none
25 changes: 25 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Git attributes
# https://git-scm.com/docs/gitattributes
# https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes

# Normalize line endings for all files that git determines to be text.
# https://git-scm.com/docs/gitattributes#gitattributes-Settostringvalueauto
* text=auto

# Normalize line endings to LF on checkin, and do NOT convert to CRLF when checking-out on Windows.
# https://git-scm.com/docs/gitattributes#gitattributes-Settostringvaluelf
*.txt text eol=lf
*.html text eol=lf
*.md text eol=lf
*.css text eol=lf
*.scss text eol=lf
*.map text eol=lf
*.js text eol=lf
*.jsx text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.xml text eol=lf
*.svg text eol=lf
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Git ignore
# https://git-scm.com/docs/gitignore

# Private files
.env

# Miscellaneous
*~
*#
.DS_STORE
Thumbs.db
.netbeans
nbproject
.node_history

# IDEs & Text Editors
.idea
.sublime-*
.vscode/settings.json
.netbeans
nbproject

# Temporary files
.tmp
.temp
.grunt
.lock-wscript

# Logs
/logs
*.log

# Runtime data
pids
*.pid
*.seed

# Dependencies
node_modules

# Build output
/lib

# Test output
/.nyc_output
/coverage
14 changes: 14 additions & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Mocha options
# https://mochajs.org/#configuring-mocha-nodejs
# https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml

spec:
# Test fixtures
- test/fixtures/**/*.js

# Test specs
- test/specs/**/*.spec.js

bail: true
recursive: true
require: source-map-support/register
10 changes: 10 additions & 0 deletions .nycrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# NYC config
# https://github.com/istanbuljs/nyc#configuration-files

extension:
- .js
- .ts

reporter:
- text
- lcov
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Travis CI config
# http://docs.travis-ci.com/user/languages/javascript-with-nodejs/
# https://docs.travis-ci.com/user/customizing-the-build/
# https://docs.travis-ci.com/user/migrating-from-legacy/

filter_secrets: false
language: node_js

node_js:
- 8
- 10
- 12

os:
- linux
- osx
- windows

before_script:
- npm run lint
- npm run build

script:
- npm run coverage

after_success:
# send code-coverage data to Coveralls
- cat ./coverage/lcov.info | coveralls

jobs:
include:
- stage: Deploy
name: Publish to npm
script: true
after_success: true
deploy:
provider: npm
email: $NPM_EMAIL
api_key: $NPM_API_KEY
skip_cleanup: true
on:
tags: true
branch: master
53 changes: 53 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// VSCode Launch Configuration
// https://code.visualstudio.com/docs/editor/debugging#_launch-configurations

// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Run Mocha",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"--timeout=60000",
"--retries=0",
],
"outFiles": [
"${workspaceFolder}/lib/**/*.js"
],
"smartStep": true,
"skipFiles": [
"<node_internals>/**/*.js"
],
},


{
"type": "node",
"request": "launch",
"name": "Run CLI",
"program": "${workspaceRoot}/bin/project-cli-name.js",
"args": [],
"env": {
"NODE_ENV": "development"
},
"outputCapture": "std",
"outFiles": [
"${workspaceFolder}/lib/**/*.js"
],
"smartStep": true,
"skipFiles": [
"<node_internals>/**/*.js"
],
}
]
}
37 changes: 37 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// VSCode Tasks
// https://code.visualstudio.com/docs/editor/tasks

// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process

{
"version": "2.0.0",
"command": "npm",
"tasks": [
{
"type": "npm",
"script": "build",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc"
},


{
"type": "npm",
"script": "test",
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": "$tslint5"
},
]
}
3 changes: 3 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
layout: 404
---
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 James Messinger

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Node.js TypeScript Template
===========================
This is a **template repo** for Node.js projects written in TypeScript. This template works for libraries and/or CLIs.



Step 1: Copy this repo
---------------------------------------------
Create a new git repo and copy the contents of this repo into it.



Step 2: Delete unneeded files
---------------------------------------------
If you **don't** need a CLI, then:
- Delete the following files and directories:
- `bin`
- `src/cli`
- `test/specs/cli.spec.js`
- `test/utils/project-cli-name.js`
- Delete the following fields in `package.json`:
- `bin`
- `files.bin`
- `devDependencies.chai-exec`
- `devDependencies.@types/command-line-args`
- `dependencies.command-line-args`
- Delete the `Run CLI` config from `.vscode/launch.json`



Step 3: Replace placeholders
---------------------------------------------
Replace all occurrences of the following placeholders in all files:

|Placeholder |Description
|:----------------------------------|:------------------------------------------------------------
|`project-package-name` |This is the name of the NPM package. It should also match the GitHub repo name. It should be kebab-cased.
|`project-cli-name` |The name of the CLI program for this project, if any.
|`projectExportName` |The name of the library's default export, if any. This should be a valid JavaScript identifier name.
|`Friendly Project Name` |This is the human friendly name of the project that is used in the ReadMe, descriptions, and docs pages
|`This is the project description` |A short, human friendly description of the project that is used in the ReadMe and package.json



Step 4: TODOs
---------------------------------------------
Find all "TODO" notes in the code and follow their instructions.



Step 5: ReadMe
---------------------------------------------
Delete this file and replace it with `README_md`.
Loading

0 comments on commit de642e5

Please sign in to comment.