From b02b429e35e2002d5062a86594183a750051edfe Mon Sep 17 00:00:00 2001 From: Saran Tanpituckpong Date: Wed, 24 May 2017 22:01:54 +0700 Subject: [PATCH] :art: Build as Node module --- .eslintignore | 1 + .gitignore | 3 +++ .vscode/tasks.json | 10 ++++++++++ package.json | 8 +++++++- index.ts => src/index.ts | 4 ++-- {utils => src/utils}/is-prod.ts | 0 tsconfig.json | 12 ++++++++++++ 7 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .eslintignore create mode 100644 .vscode/tasks.json rename index.ts => src/index.ts (65%) rename {utils => src/utils}/is-prod.ts (100%) create mode 100644 tsconfig.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +dist/ diff --git a/.gitignore b/.gitignore index b509272..c4a3ce1 100644 --- a/.gitignore +++ b/.gitignore @@ -99,3 +99,6 @@ $RECYCLE.BIN/ *.lnk # End of https://www.gitignore.io/api/node,linux,windows + +# Dist files +dist/ diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..6aaaf67 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,10 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "0.1.0", + "command": "tsc", + "isShellCommand": true, + "args": ["-p", "."], + "showOutput": "silent", + "problemMatcher": "$tsc" +} \ No newline at end of file diff --git a/package.json b/package.json index be72e2b..60049ac 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,14 @@ "name": "tslint-config-gluons", "version": "1.0.2", "description": "Gluons' personal TSLint shareable config.", - "main": "./index.ts", + "main": "./dist/index.js", + "files": [ + "dist" + ], "scripts": { + "build": "tsc -p .", + "lint": "tslint -p . --type-check", + "prepublishOnly": "npm run build", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/index.ts b/src/index.ts similarity index 65% rename from index.ts rename to src/index.ts index 916c910..4ae2c97 100644 --- a/index.ts +++ b/src/index.ts @@ -1,8 +1,8 @@ import isProd from './utils/is-prod'; -const config = require('./tslint.json'); +const config = require('../tslint.json'); config.rules['no-console'] = [isProd()]; config.rules['no-debugger'] = isProd(); -export default config; +export = config; diff --git a/utils/is-prod.ts b/src/utils/is-prod.ts similarity index 100% rename from utils/is-prod.ts rename to src/utils/is-prod.ts diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..ef2aae7 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "strict": true, + "removeComments": true, + "outDir": "./dist" + }, + "include": [ + "./src/**/*.ts" + ] +}