Skip to content

Commit

Permalink
feat(CLI): Add CLI basic feature to handle project creation
Browse files Browse the repository at this point in the history
  • Loading branch information
emyann committed Jul 20, 2017
1 parent e788c72 commit 95fec55
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# create-ts-lib

This package includes the global command for [scaffolding your TypeScript Library](https://github.com/emyann/typescript-webpack-starter).<br>
Please refer to its documentation:

* [Getting Started](https://github.com/emyann/typescript-webpack-starter/blob/master/README.md) – How to create a new lib.
24 changes: 24 additions & 0 deletions packages/cli/createTsLib.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const validateProjectName = require('validate-npm-package-name');
const chalk = require('chalk');
const commander = require('commander');
const fs = require('fs-extra');
const path = require('path');

const packageJson = require('./package.json');

let projectName;

const program = new commander.Command(packageJson.name)
.version(packageJson.version)
.arguments('<project-directory>')
.usage(`${chalk.green('<project-directory>')}`)
.action(name => {
projectName = name;
})
.on('--help', () => {
console.log(` Only ${chalk.green('<project-directory>')} is required.`);
console.log();
})
.parse(process.argv);
1 change: 1 addition & 0 deletions packages/cli/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require('./createTsLib');
40 changes: 40 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "create-ts-lib",
"version": "0.0.1",
"description": "Create your TypeScript module with no nuild configuration",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emyann/typescript-webpack-starter.git"
},
"keywords": [
"webpack",
"javascript",
"typescript",
"nodejs",
"es2015",
"es6",
"npm",
"npm-package",
"webpack-server",
"karma",
"karma-jasmine",
"jasmine",
"unit-test"
],
"author": "emyann",
"license": "MIT",
"bugs": {
"url": "https://github.com/emyann/typescript-webpack-starter/issues"
},
"homepage": "https://github.com/emyann/typescript-webpack-starter#readme",
"dependencies": {
"chalk": "^2.0.1",
"commander": "^2.11.0",
"semver": "^5.3.0",
"validate-npm-package-name": "^3.0.0"
}
}

0 comments on commit 95fec55

Please sign in to comment.