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/).
4
4
5
5
## [ 0.6.0] - WIP
6
6
- allow for programmatic use
7
+ - working ` > coderoad tutorials `
7
8
8
9
## [ 0.5.0] - 2016-05-02
9
10
- bug fixes
Original file line number Diff line number Diff line change @@ -41,14 +41,14 @@ else if (program.search) {
41
41
}
42
42
else if ( program . tutorials ) {
43
43
process . stdout . write ( "List of tutorial packages in this directory..." ) ;
44
- var tuts = tutorials_1 . default ( ) ;
44
+ var tuts = tutorials_1 . default ( process . cwd ( ) ) ;
45
45
if ( ! tuts ) {
46
46
result_1 . fail ( ) ;
47
47
}
48
48
else {
49
- process . stdout . write ( '\n\n ' ) ;
49
+ process . stdout . write ( '\n' ) ;
50
50
tuts . forEach ( function ( tut ) {
51
- process . stdout . write ( " " + tut . name + " : " + tut . version + "\n" ) ;
51
+ process . stdout . write ( " " + tut . name + " : " + tut . version + "\n" ) ;
52
52
} ) ;
53
53
}
54
54
}
Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
var node_file_exists_1 = require ( 'node-file-exists' ) ;
3
3
var 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' ) ;
6
7
if ( ! node_file_exists_1 . default ( pathToPJ ) ) {
7
8
return null ;
8
9
}
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ var path_1 = require('path');
3
3
var fs_1 = require ( 'fs' ) ;
4
4
var node_file_exists_1 = require ( 'node-file-exists' ) ;
5
5
var is_tutorial_1 = require ( './is-tutorial' ) ;
6
- var update_1 = require ( './update' ) ;
7
6
function findTutorials ( dir , deps ) {
8
7
if ( ! ! deps && Object . keys ( deps ) . length > 0 ) {
9
8
return ( Object . keys ( deps )
@@ -22,7 +21,7 @@ function findTutorials(dir, deps) {
22
21
return {
23
22
name : name ,
24
23
version : version ,
25
- latest : ! ! update_1 . canUpdateTutorial ( name , version )
24
+ latest : false
26
25
} ;
27
26
} ) ) ;
28
27
}
Original file line number Diff line number Diff line change 2
2
var chalk_1 = require ( 'chalk' ) ;
3
3
var find_tutorials_1 = require ( './find-tutorials' ) ;
4
4
var 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 ) ;
7
7
if ( ! pj ) {
8
8
console . log ( chalk_1 . red ( "No package.json available" ) ) ;
9
- return false ;
9
+ return null ;
10
10
}
11
11
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 ) ) ) ;
14
14
}
15
15
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
16
16
exports . default = tutorials ;
Original file line number Diff line number Diff line change @@ -50,13 +50,13 @@ if (program.build) {
50
50
} else if ( program . tutorials ) {
51
51
// run find tutorials
52
52
process . stdout . write ( `List of tutorial packages in this directory...` ) ;
53
- const tuts = tutorials ( ) ;
53
+ const tuts = tutorials ( process . cwd ( ) ) ;
54
54
if ( ! tuts ) {
55
55
fail ( ) ;
56
56
} else {
57
- process . stdout . write ( '\n\n' )
57
+ process . stdout . write ( '\n' ) ;
58
58
tuts . forEach ( ( tut ) => {
59
- process . stdout . write ( ` ${ tut . name } : ${ tut . version } \n` ) ;
59
+ process . stdout . write ( ` ${ tut . name } : ${ tut . version } \n` ) ;
60
60
} ) ;
61
61
}
62
62
Original file line number Diff line number Diff line change 1
1
import fileExists from 'node-file-exists' ;
2
2
import { readFileSync } from 'fs' ;
3
+ import { resolve } from 'path' ;
3
4
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') ;
6
7
if ( ! fileExists ( pathToPJ ) ) { return null ; }
7
8
const pj = readFileSync ( pathToPJ , 'utf8' ) ;
8
9
return JSON . parse ( pj ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import {join} from 'path';
2
2
import { readFileSync } from 'fs' ;
3
3
import fileExists from 'node-file-exists' ;
4
4
import { isTutorial , tutorialError } from './is-tutorial' ;
5
- import { canUpdateTutorial } from './update' ;
5
+ // import {canUpdateTutorial} from './update';
6
6
7
7
export default function findTutorials (
8
8
dir : string , deps : Object
@@ -33,7 +33,7 @@ export default function findTutorials(
33
33
return {
34
34
name,
35
35
version,
36
- latest : ! ! canUpdateTutorial ( name , version )
36
+ latest : false // !!canUpdateTutorial(name, version)
37
37
} ;
38
38
} ) ) ;
39
39
} else {
Original file line number Diff line number Diff line change 1
- import { yellow , red } from 'chalk' ;
1
+ import { red } from 'chalk' ;
2
2
import findTutorials from './find-tutorials' ;
3
3
import getPackageJson from '../packageJson/get' ;
4
4
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 ) ;
9
7
10
8
if ( ! pj ) {
11
- console . log ( red ( `No package.json available` ) )
12
- return false ;
9
+ console . log ( red ( `No package.json available` ) ) ;
10
+ return null ;
13
11
}
14
12
15
13
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 ) )
18
16
) ;
19
17
}
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
+ }
Original file line number Diff line number Diff line change
1
+ declare module 'node-file-exists' {
2
+ export default function fileExists ( path : string ) : boolean ;
3
+ }
You can’t perform that action at this time.
0 commit comments