From a370aa3783087d35db7c841479b93fd649e260a6 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Thu, 28 Dec 2017 14:25:17 +0200 Subject: Get version from package.json --- package.json | 4 ++-- src/index.ts | 6 +++++- typings.d.ts | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 typings.d.ts diff --git a/package.json b/package.json index e0d9dba..9b190c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-riot-component", - "version": "1.0.1", + "version": "1.0.2", "description": "Create ES6 riot.js component", "main": "dist/index.js", "bin": { @@ -16,7 +16,7 @@ "build": "tsc --outDir dist", "prepublish": "npm run build" }, - "types": "dist/index.d.ts", + "types": "typings.d.ts", "dependencies": { "@types/es6-promise": "^0.0.33", "commander": "^2.12.2", diff --git a/src/index.ts b/src/index.ts index 2a2834b..e081fbc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import * as program from 'commander'; import tag from './tag/tag'; import scss from './tag/scss'; import index from './tag/index'; +import * as pkg from '../package.json'; async function main(tagName: string) { const name = tagName.toLocaleLowerCase(); @@ -17,10 +18,13 @@ async function main(tagName: string) { }; program - .version('1.0.0') + .version(( pkg).version) .arguments('') .action(name => { main(name); }) + .action(() => { + console.log('No component name specified.'); + }) .usage('create-riot-component [name]') .parse(process.argv); \ No newline at end of file diff --git a/typings.d.ts b/typings.d.ts new file mode 100644 index 0000000..09eae41 --- /dev/null +++ b/typings.d.ts @@ -0,0 +1,4 @@ +declare module "*.json" { + const value: any; + export default value; +} \ No newline at end of file -- cgit v1.3