aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jans.tuomi@gmail.com>2017-12-28 14:25:17 +0200
committerJan Tuomi <jans.tuomi@gmail.com>2017-12-28 14:25:17 +0200
commita370aa3783087d35db7c841479b93fd649e260a6 (patch)
tree0c91623469c757117e34539a8bd368cfcf9e7d49
parentaa520b5c8237abf832301907dc26b163b2fcb75f (diff)
Get version from package.json
-rw-r--r--package.json4
-rw-r--r--src/index.ts6
-rw-r--r--typings.d.ts4
3 files changed, 11 insertions, 3 deletions
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((<any> pkg).version)
.arguments('<name>')
.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