-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fc5622b
Showing
32 changed files
with
6,075 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:node/recommended", | ||
"plugin:jest/recommended", | ||
"prettier" | ||
], | ||
"rules": { | ||
"no-console": "off", | ||
"no-unused-vars": "warn", | ||
"no-constant-condition": "warn", | ||
"no-use-before-define": "error" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": ["*.test.js"], | ||
"plugins": [ | ||
"jest" | ||
], | ||
"rules": { | ||
"no-unused-expressions": "off", | ||
"node/no-unpublished-require": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## OS-specific | ||
.DS_Store | ||
|
||
## Git | ||
!.keep | ||
|
||
## IDE-specific | ||
/.vscode/ | ||
|
||
## Node-specific | ||
/node_modules/ | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
## Testing | ||
/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package.json | ||
.eslintrc.json | ||
.prettierrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"arrowParens": "always", | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"semi": true, | ||
"useTabs": false, | ||
"jsxBracketSameLine": false, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# `ts-build-tools` | ||
|
||
A command-line toolkit to manage a Node.js package written in TypeScript. | ||
|
||
Includes build, clean, lint, test, dev, and prepublish scripts out-of-the box. | ||
|
||
Intended to work with [`zmey-gorynych`](https://www.npmjs.com/package/zmey-gorynych), a Node.js package versioning and publishing tool. | ||
|
||
## Usage | ||
|
||
Initialize a new Node.js package and install the toolkit with [`npm`](https://docs.npmjs.com/cli/init): | ||
|
||
``` | ||
cd your-package | ||
npm init -y | ||
npm i -D @sompylasar/ts-build-tools | ||
``` | ||
|
||
or with [`yarn`](https://yarnpkg.com/lang/en/docs/cli/init/): | ||
|
||
``` | ||
cd your-package | ||
yarn init -y | ||
yarn add --dev @sompylasar/ts-build-tools | ||
``` | ||
|
||
## Commands | ||
|
||
### `init` | ||
|
||
Scaffold the package file structure and update the `package.json` to include the necessary file references, dependencies, and scripts. | ||
|
||
### `build` | ||
|
||
Produce JavaScript in the `lib` directory via `tsc`. | ||
|
||
### `clean` | ||
|
||
Removes the `lib` and `coverage` directories. | ||
|
||
### `lint` | ||
|
||
Runs `tslint`. | ||
|
||
### `test` | ||
|
||
Run the tests via `nyc`, `mocha`, and `ts-node`. | ||
|
||
### `dev` | ||
|
||
Run the application in the source code watch and hot reload mode via `tsc --watch`. | ||
|
||
## Known limitations | ||
|
||
- The toolkit in some aspects relies on the `node_modules` structure, so it may not work with `node_modules`-less setups like Yarn PnP and NPM Tink. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env node | ||
|
||
const script = process.argv[2]; | ||
const args = process.argv.slice(3); | ||
|
||
require('../src/index').cli(script, args); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"name": "@sompylasar/ts-build-tools", | ||
"version": "1.0.0", | ||
"description": "A command-line toolkit to manage a Node.js package written in TypeScript.", | ||
"keywords": ["packages", "typescript"], | ||
"author": "Ivan Babak <babak.john@gmail.com>", | ||
"license": "MIT", | ||
"repository": "github:sompylasar/ts-build-tools", | ||
"main": "./src/index.js", | ||
"types": "./src/index.d.ts", | ||
"files": [ | ||
"bin", | ||
"scaffolding", | ||
"src" | ||
], | ||
"bin": { | ||
"ts-build-tools": "./bin/cli.js" | ||
}, | ||
"engines": { | ||
"node": "^8.15.0" | ||
}, | ||
"dependencies": { | ||
"@types/chai": "4.0.4", | ||
"@types/debug": "0.0.30", | ||
"@types/mocha": "2.2.43", | ||
"@types/node": "8.0.46", | ||
"@types/sinon": "2.3.6", | ||
"chai": "4.1.2", | ||
"chalk": "2.3.0", | ||
"cross-env": "5.1.0", | ||
"custom-tslint-formatters": "2.1.1", | ||
"debug": "3.1.0", | ||
"fs-extra": "4.0.2", | ||
"mocha": "4.0.1", | ||
"npm-run-all": "4.1.1", | ||
"npm-which": "3.0.1", | ||
"nyc": "11.2.1", | ||
"rimraf": "2.6.2", | ||
"sinon": "4.0.1", | ||
"ts-node": "3.3.0", | ||
"tslint": "5.8.0", | ||
"typescript": "2.5.3" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^5.10.0", | ||
"eslint-config-prettier": "^3.3.0", | ||
"eslint-plugin-jest": "^22.1.2", | ||
"eslint-plugin-node": "^8.0.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"jest": "^23.6.0", | ||
"jest-date-mock": "^1.0.6", | ||
"prettier": "^1.15.3" | ||
}, | ||
"jest": { | ||
"setupFiles": [ | ||
"jest-date-mock" | ||
] | ||
}, | ||
"scripts": { | ||
"lint": "eslint ./src", | ||
"test": "jest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## OS-specific | ||
.DS_Store | ||
|
||
## Git | ||
!.keep | ||
|
||
## IDE-specific | ||
/.vscode/ | ||
|
||
## Node-specific | ||
/node_modules/ | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
## Build | ||
/build/ | ||
|
||
## Testing | ||
/coverage/ | ||
/.nyc_output/ | ||
|
||
# ---------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export function main(): number { | ||
// Congrats with a new package! Now let's make it work. | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package.json | ||
.eslintrc.json | ||
.prettierrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"arrowParens": "always", | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"semi": true, | ||
"useTabs": false, | ||
"jsxBracketSameLine": false, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { assert } from '@sompylasar/ts-build-tools'; | ||
|
||
import { main } from '../src/index'; | ||
|
||
describe(require('../package.json').name, () => { | ||
it('works', () => { | ||
assert.strictEqual(0, main(), 'main returns 0'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../lib/test" | ||
}, | ||
"include": [ | ||
"../test/**/*.ts", | ||
"../typings/**/*.d.ts", | ||
"../node_modules/@sompylasar/ts-build-tools/scaffolding/typings/**/*.d.ts" | ||
], | ||
"exclude": [ | ||
"../node_modules" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"lib": [ "es5", "es6" ], | ||
"module": "commonjs", | ||
"outDir": "./lib", | ||
"sourceMap": true, | ||
"listFiles": false, | ||
"listEmittedFiles": false, | ||
"pretty": true, | ||
"traceResolution": false, | ||
"declaration": true, | ||
"alwaysStrict": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"strictNullChecks": true, | ||
"typeRoots": [ | ||
"./node_modules/@sompylasar/ts-build-tools/node_modules/@types", | ||
"./node_modules/@types" | ||
] | ||
}, | ||
"include": [ | ||
"./src/**/*.ts", | ||
"./typings/**/*.d.ts", | ||
"./node_modules/@sompylasar/ts-build-tools/scaffolding/typings/**/*.d.ts" | ||
], | ||
"exclude": [ | ||
"./node_modules" | ||
] | ||
} |
Oops, something went wrong.