Skip to content

Commit d02b4cd

Browse files
committed
demo assumes index.md file
1 parent 72d6245 commit d02b4cd

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

lib/build/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ function build(dir, filePath, output) {
2828
}
2929
var lines = fs_1.readFileSync(filePath, 'utf8').split('\n');
3030
var result = cleanup_1.cleanup(parseAndBuild(dir, lines));
31-
console.log('result', result);
3231
if (!result) {
3332
return false;
3433
}

lib/build/parser/import.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ var settings_1 = require('./settings');
77
function loadImport(dir, lines, pathToMd) {
88
pathToMd = cleanup_1.trimQuotes(pathToMd);
99
if (!pathToMd.match(/\.md$/)) {
10-
pathToMd = pathToMd.concat('.md');
10+
if (node_file_exists_1.default(path_1.join(dir, settings_1.tutorialDir, pathToMd.concat('.md')))) {
11+
pathToMd = pathToMd.concat('.md');
12+
}
13+
else {
14+
pathToMd = path_1.join(pathToMd, 'index.md');
15+
}
1116
}
1217
var realPath = path_1.join(dir, settings_1.tutorialDir, pathToMd);
1318
if (!node_file_exists_1.default(realPath)) {

lib/build/readme.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ var fs_1 = require('fs');
33
var node_file_exists_1 = require('node-file-exists');
44
var chalk_1 = require('chalk');
55
function createReadme() {
6-
if (!node_file_exists_1.default('./README.md')) {
7-
}
86
if (!node_file_exists_1.default('./coderoad.json')) {
97
console.log(chalk_1.red('No coderoad.json file found'));
108
return false;

lib/create/write-demo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ var folders = function (dir) { return [
3333
var files = [
3434
path_1.join('.gitignore'),
3535
path_1.join('tutorial', 'tutorial.md'),
36-
path_1.join('tutorial', '01', 'page-one.md'),
36+
path_1.join('tutorial', '01', 'index.md'),
3737
path_1.join('tutorial', '01', '01.spec.js'),
3838
path_1.join('tutorial', '01', '02.spec.js'),
39-
path_1.join('tutorial', '02', 'page-two.md'),
39+
path_1.join('tutorial', '02', 'index.md'),
4040
path_1.join('tutorial', '02', '01.spec.js'),
4141
path_1.join('tutorial', '02', '02.spec.js')
4242
];
File renamed without changes.
File renamed without changes.

setup/tutorial/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Project Title
22
Project description.
33

4-
@import('01/page-one')
5-
@import('02/page-two')
4+
@import('01')
5+
@import('02')

src/build/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export default function build(dir: string, filePath: string, output = './coderoa
3535
// build coeroad.json
3636
const result = cleanup(parseAndBuild(dir, lines));
3737

38-
console.log('result', result);
39-
4038
// error parsing or building coderoad.json
4139
if (!result) { return false; }
4240

src/build/parser/import.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ export function loadImport(dir: string, lines: string[], pathToMd: string): stri
88
// add .md suffix
99
pathToMd = trimQuotes(pathToMd);
1010
if (!pathToMd.match(/\.md$/)) {
11-
pathToMd = pathToMd.concat('.md');
11+
if (fileExists(join(dir, tutorialDir, pathToMd.concat('.md')))) {
12+
pathToMd = pathToMd.concat('.md');
13+
} else {
14+
pathToMd = join(pathToMd, 'index.md');
15+
}
1216
}
1317
// get path to imports
1418
let realPath: string = join(dir, tutorialDir, pathToMd);

src/build/readme.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ import fileExists from 'node-file-exists';
33
import {red} from 'chalk';
44

55
export function createReadme(): boolean {
6-
if (!fileExists('./README.md')) {
7-
// prompt.start();
8-
// prompt.get(['overwriteReadme'], function (err, result) {
9-
// console.log(result);
10-
// });
11-
}
6+
// if (!fileExists('./README.md')) {
7+
// }
128
if (!fileExists('./coderoad.json')) {
139
console.log(red('No coderoad.json file found'));
1410
return false;

src/create/write-demo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ const folders = dir => [
3434
const files = [
3535
join('.gitignore'),
3636
join('tutorial', 'tutorial.md'),
37-
join('tutorial', '01', 'page-one.md'),
37+
join('tutorial', '01', 'index.md'),
3838
join('tutorial', '01', '01.spec.js'),
3939
join('tutorial', '01', '02.spec.js'),
40-
join('tutorial', '02', 'page-two.md'),
40+
join('tutorial', '02', 'index.md'),
4141
join('tutorial', '02', '01.spec.js'),
4242
join('tutorial', '02', '02.spec.js')
4343
];

0 commit comments

Comments
 (0)