File tree Expand file tree Collapse file tree 11 files changed +34
-28
lines changed Expand file tree Collapse file tree 11 files changed +34
-28
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44
55## [ 0.6.0] - WIP
66- allow for programmatic use
7+ - working ` > coderoad tutorials `
78
89## [ 0.5.0] - 2016-05-02
910- bug fixes
Original file line number Diff line number Diff line change @@ -41,14 +41,14 @@ else if (program.search) {
4141}
4242else if ( program . tutorials ) {
4343 process . stdout . write ( "List of tutorial packages in this directory..." ) ;
44- var tuts = tutorials_1 . default ( ) ;
44+ var tuts = tutorials_1 . default ( process . cwd ( ) ) ;
4545 if ( ! tuts ) {
4646 result_1 . fail ( ) ;
4747 }
4848 else {
49- process . stdout . write ( '\n\n ' ) ;
49+ process . stdout . write ( '\n' ) ;
5050 tuts . forEach ( function ( tut ) {
51- process . stdout . write ( " " + tut . name + " : " + tut . version + "\n" ) ;
51+ process . stdout . write ( " " + tut . name + " : " + tut . version + "\n" ) ;
5252 } ) ;
5353 }
5454}
Original file line number Diff line number Diff line change 11"use strict" ;
22var node_file_exists_1 = require ( 'node-file-exists' ) ;
33var fs_1 = require ( 'fs' ) ;
4- function getPackageJson ( ) {
5- var pathToPJ = './package.json' ;
4+ var path_1 = require ( 'path' ) ;
5+ function getPackageJson ( dir ) {
6+ var pathToPJ = path_1 . resolve ( dir , 'package.json' ) ;
67 if ( ! node_file_exists_1 . default ( pathToPJ ) ) {
78 return null ;
89 }
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ var path_1 = require('path');
33var fs_1 = require ( 'fs' ) ;
44var node_file_exists_1 = require ( 'node-file-exists' ) ;
55var is_tutorial_1 = require ( './is-tutorial' ) ;
6- var update_1 = require ( './update' ) ;
76function findTutorials ( dir , deps ) {
87 if ( ! ! deps && Object . keys ( deps ) . length > 0 ) {
98 return ( Object . keys ( deps )
@@ -22,7 +21,7 @@ function findTutorials(dir, deps) {
2221 return {
2322 name : name ,
2423 version : version ,
25- latest : ! ! update_1 . canUpdateTutorial ( name , version )
24+ latest : false
2625 } ;
2726 } ) ) ;
2827 }
Original file line number Diff line number Diff line change 22var chalk_1 = require ( 'chalk' ) ;
33var find_tutorials_1 = require ( './find-tutorials' ) ;
44var get_1 = require ( '../packageJson/get' ) ;
5- function tutorials ( ) {
6- var pj = get_1 . default ( ) ;
5+ function tutorials ( dir ) {
6+ var pj = get_1 . default ( dir ) ;
77 if ( ! pj ) {
88 console . log ( chalk_1 . red ( "No package.json available" ) ) ;
9- return false ;
9+ return null ;
1010 }
1111 return ( [ ]
12- . concat ( find_tutorials_1 . default ( process . cwd ( ) , pj . dependencies ) )
13- . concat ( find_tutorials_1 . default ( process . cwd ( ) , pj . devDependencies ) ) ) ;
12+ . concat ( find_tutorials_1 . default ( dir , pj . dependencies ) )
13+ . concat ( find_tutorials_1 . default ( dir , pj . devDependencies ) ) ) ;
1414}
1515Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1616exports . default = tutorials ;
Original file line number Diff line number Diff line change @@ -50,13 +50,13 @@ if (program.build) {
5050} else if ( program . tutorials ) {
5151 // run find tutorials
5252 process . stdout . write ( `List of tutorial packages in this directory...` ) ;
53- const tuts = tutorials ( ) ;
53+ const tuts = tutorials ( process . cwd ( ) ) ;
5454 if ( ! tuts ) {
5555 fail ( ) ;
5656 } else {
57- process . stdout . write ( '\n\n' )
57+ process . stdout . write ( '\n' ) ;
5858 tuts . forEach ( ( tut ) => {
59- process . stdout . write ( ` ${ tut . name } : ${ tut . version } \n` ) ;
59+ process . stdout . write ( ` ${ tut . name } : ${ tut . version } \n` ) ;
6060 } ) ;
6161 }
6262
Original file line number Diff line number Diff line change 11import fileExists from 'node-file-exists' ;
22import { readFileSync } from 'fs' ;
3+ import { resolve } from 'path' ;
34
4- export default function getPackageJson ( ) : PackageJson {
5- const pathToPJ = './ package.json';
5+ export default function getPackageJson ( dir : string ) : PackageJson {
6+ const pathToPJ = resolve ( dir , ' package.json') ;
67 if ( ! fileExists ( pathToPJ ) ) { return null ; }
78 const pj = readFileSync ( pathToPJ , 'utf8' ) ;
89 return JSON . parse ( pj ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import {join} from 'path';
22import { readFileSync } from 'fs' ;
33import fileExists from 'node-file-exists' ;
44import { isTutorial , tutorialError } from './is-tutorial' ;
5- import { canUpdateTutorial } from './update' ;
5+ // import {canUpdateTutorial} from './update';
66
77export default function findTutorials (
88 dir : string , deps : Object
@@ -33,7 +33,7 @@ export default function findTutorials(
3333 return {
3434 name,
3535 version,
36- latest : ! ! canUpdateTutorial ( name , version )
36+ latest : false // !!canUpdateTutorial(name, version)
3737 } ;
3838 } ) ) ;
3939 } else {
Original file line number Diff line number Diff line change 1- import { yellow , red } from 'chalk' ;
1+ import { red } from 'chalk' ;
22import findTutorials from './find-tutorials' ;
33import getPackageJson from '../packageJson/get' ;
44
5- export default function tutorials ( ) : string [ ] | boolean {
6- // console.log(yellow('This feature is not yet implemented'));
7-
8- const pj : PackageJson = getPackageJson ( ) ;
5+ export default function tutorials ( dir : string ) : string [ ] {
6+ const pj : PackageJson = getPackageJson ( dir ) ;
97
108 if ( ! pj ) {
11- console . log ( red ( `No package.json available` ) )
12- return false ;
9+ console . log ( red ( `No package.json available` ) ) ;
10+ return null ;
1311 }
1412
1513 return ( [ ]
16- . concat ( findTutorials ( process . cwd ( ) , pj . dependencies ) )
17- . concat ( findTutorials ( process . cwd ( ) , pj . devDependencies ) )
14+ . concat ( findTutorials ( dir , pj . dependencies ) )
15+ . concat ( findTutorials ( dir , pj . devDependencies ) )
1816 ) ;
1917}
Original file line number Diff line number Diff line change 1+ declare module 'atom-plugin-command-line' {
2+ export default function commandLine ( root : string , commands ?: string ) : Promise < string > ;
3+ }
You can’t perform that action at this time.
0 commit comments