opentutorial
Advanced tools
| const download = require('download-git-repo'); | ||
| const chalk = require('chalk'); | ||
| /** | ||
| * Download from Github repository | ||
| * https://github.com/flipxfx/download-git-repo | ||
| * @param repoInfo : github:owner/name or simply owner/name | ||
| * @param path : local path (default current working directory) | ||
| * @param clone : use git clone | ||
| */ | ||
| module.exports.github = function (repoInfo, path, clone){ | ||
| // exception handling | ||
| return new Promise(function(resolve, reject){ | ||
| download(repoInfo, path || process.cwd(), { clone: clone }, function(err){ | ||
| if(err){ | ||
| console.log(chalk.red(err)); | ||
| reject(); | ||
| } | ||
| else { | ||
| resolve(); | ||
| } | ||
| }) | ||
| }); | ||
| } |
| { | ||
| "egoing-nodejs" : "egoing/server_side_javascript_tutorials", | ||
| "egoing-webapp" : "codingeverybody/makewebapp", | ||
| "test" : "haegul/tipStudy" | ||
| } |
+41
-6
@@ -0,8 +1,43 @@ | ||
| const path = require('path'); | ||
| const program = require('commander'); | ||
| const download = require('download-git-repo'); | ||
| const chalk = require('chalk'); | ||
| program.arguments('<name>') | ||
| .action(function (name) { | ||
| console.log('args', name); | ||
| }) | ||
| .parse(process.argv); | ||
| const downloader = require('./downloader'); | ||
| const repository = require('./../tutorials/repositorys.json'); | ||
| /** | ||
| * Usage | ||
| */ | ||
| program | ||
| .version(require('../package').version) | ||
| .usage('<tutorial>') | ||
| .command('tutorial', 'generate tutorial in current working directory'); | ||
| /** | ||
| * commands | ||
| */ | ||
| program | ||
| .arguments('<boilerplate>') | ||
| .option('-d, --directory [path]', 'setup directory') | ||
| .option('-c, --clone', 'use git clone(SSH)') | ||
| .action(function (boilerplate) { | ||
| var repositoryInfo = repository[boilerplate]; | ||
| var setupPath = program.directory && path.resolve(process.cwd(), program.directory) || process.cwd(); | ||
| // validation | ||
| if(repositoryInfo === undefined){ | ||
| console.log(chalk.red('Error:', 'Invalid boilerplate. please check the name.')); | ||
| return; | ||
| } | ||
| // show plate informantion | ||
| console.log(chalk.green('[opentutorial]', 'Setup boilerplate')); | ||
| console.log(chalk.white('- tutorial name :', boilerplate)); | ||
| console.log(chalk.white('- setup path :', setupPath)); | ||
| console.log(chalk.green('[opentutorial]', 'downloading...')); | ||
| downloader.github(repositoryInfo, setupPath, program.clone || false).then(function(){ | ||
| console.log(chalk.green('[opentutorial]', 'setup finished')); | ||
| }) | ||
| }) | ||
| .parse(process.argv); |
+7
-8
| { | ||
| "name": "opentutorial", | ||
| "version": "0.0.1", | ||
| "version": "0.0.2", | ||
| "description": "Open Tutorial Sample using CLI", | ||
| "main": "index.js", | ||
| "main": "lib/index.js", | ||
| "bin": { | ||
| "opentutorial": "index.js" | ||
| "opentutorial": "bin/index.js" | ||
| }, | ||
| "directories": { | ||
| "test": "test" | ||
| }, | ||
| "keywords": ["nodejs", "tutorial"], | ||
| "repository": { | ||
@@ -16,4 +14,4 @@ "type": "git", | ||
| }, | ||
| "author": "", | ||
| "license": "ISC", | ||
| "author": "Haegul Pyun", | ||
| "license": "MIT", | ||
| "bugs": { | ||
@@ -24,2 +22,3 @@ "url": "https://github.com/haegul/opentutorial/issues" | ||
| "dependencies": { | ||
| "chalk": "^1.1.3", | ||
| "commander": "^2.10.0", | ||
@@ -26,0 +25,0 @@ "download-git-repo": "^1.0.1" |
+37
-1
| # opentutorial | ||
| Open Tutorial Sample using CLI | ||
| 간단한 명령어를 사용해서 다양한 튜토리얼 프로젝트를 쉽게 다운받을 수 있습니다. | ||
| ## Installation | ||
| 이 CLI는 nodejs를 사용합니다. 따라서 설치되어 있지 않으신 분은 다음 링크를 통해 nodejs를 먼저 설치해주세요. | ||
| [노드 설치하기](https://nodejs.org/en/) | ||
| nodejs를 설치한 후에 terminal을 열고 다음 명령어를 실행합니다. | ||
| ``` | ||
| $ npm install -g opentutorial | ||
| ``` | ||
| ## Usage | ||
| terminal을 열고 튜토리얼을 설치할 폴더로 이동한 후 다음 명령어를 실행 시킵니다. | ||
| ``` | ||
| $ opentutorial <tutorial_name> | ||
| ``` | ||
| 다음 옵션을 사용하여 디렉토리를 지정할 수 있습니다. | ||
| ``` | ||
| $ opentutorial <tutorial_name> --directory [path] | ||
| ``` | ||
| #### example | ||
| 다음은 실제 사용 예 입니다. | ||
| ``` | ||
| $ mkdir tutorial-sample && cd tutorial-sample | ||
| $ opentutorial egoing-nodejs | ||
| ``` | ||
| ## Tutorial List | ||
| 현재 사용할 수 있는 튜토리얼 리스트 입니다. | ||
| - [egoing-nodejs](https://opentutorials.org/course/2136) | ||
| - [egoing-webapp](https://opentutorials.org/course/1688) | ||
| ## Contribution | ||
| 이 프로젝트에는 누구나 자유롭게 기여할 수 있습니다. 새로운 아이디어 및 개선점은 Issue 등록 및 Pull Request을 보내주세요. |
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Mixed license
LicensePackage contains multiple licenses.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
5518
163.39%8
33.33%0
-100%64
814.29%2
-33.33%38
1166.67%0
-100%3
50%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added