Skip to content

Commit 52d04c4

Browse files
committed
update create
1 parent bf92cc8 commit 52d04c4

File tree

7 files changed

+21
-13
lines changed

7 files changed

+21
-13
lines changed

lib/create/create.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
"use strict";
22
var validate_1 = require('./validate');
33
var write_demo_1 = require('./write-demo');
4-
var readme_1 = require('../build/readme');
4+
var build_1 = require('../build/build');
55
function create(name) {
66
validate_1.validatePackageName(name);
77
console.log('Creating demo tutorial...');
88
write_demo_1.createPackageJson(name);
99
write_demo_1.createTutorialMd();
1010
write_demo_1.createTestFiles();
11-
readme_1.createReadme();
11+
var tutorial = 'tutorial/tutorial.md';
12+
var output = 'coderoad.json';
13+
build_1.default(tutorial, output);
1214
}
1315
Object.defineProperty(exports, "__esModule", { value: true });
1416
exports.default = create;

lib/tools/file.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ function fileExists(path) {
66
}
77
catch (e) {
88
if (e) {
9-
console.log(e);
9+
if (e.code !== 'ENOENT') {
10+
console.log(e);
11+
}
1012
return false;
1113
}
1214
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coderoad-cli",
3-
"version": "0.3.24",
3+
"version": "0.3.25",
44
"description": "Command line interface for CodeRoad. Build project files.",
55
"keywords": [
66
"coderoad"

setup/tutorial/1/01/page-one.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Try making your own basic functions.
2222
```
2323
// addOne
2424
function addOne(x) {
25-
return;
25+
return ::>;
2626
}
2727
```
2828
))
@@ -34,7 +34,7 @@ function addOne(x) {
3434
3535
// subtractOne
3636
function subtractOne(x) {
37-
return;
37+
return ::>;
3838
}
3939
```
4040
))

setup/tutorial/1/02/page-two.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We'll write two more basic functions, this time without any help.
1010
```
1111
// divideOne
1212
function divideOne(x) {
13-
return;
13+
return ::>;
1414
}
1515
```
1616
))
@@ -22,7 +22,7 @@ function divideOne(x) {
2222
2323
// multiplyOne
2424
function multiplyOne(x) {
25-
return;
25+
return ::>;
2626
}
2727
```
2828
))

src/create/create.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {validatePackageName} from './validate';
22
import {createPackageJson, createTutorialMd, createTestFiles} from './write-demo';
3-
import {createReadme} from '../build/readme';
3+
import build from '../build/build';
44

55
export default function create(name: string): void {
66
// check
@@ -15,7 +15,9 @@ export default function create(name: string): void {
1515
createTutorialMd();
1616
// tests folder with sample test
1717
createTestFiles();
18-
// readme with install instructions and overview
19-
createReadme();
18+
19+
const tutorial = 'tutorial/tutorial.md';
20+
const output = 'coderoad.json';
21+
build(tutorial, output);
2022

2123
}

src/tools/file.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import * as fs from 'fs';
22

33
export function fileExists(path: string): boolean {
44
try {
5-
fs.accessSync(path, fs.R_OK | fs.W_OK)
5+
fs.accessSync(path, fs.R_OK | fs.W_OK);
66
} catch (e) {
77
if (e) {
8-
console.log(e);
8+
if (e.code !== 'ENOENT') {
9+
console.log(e);
10+
}
911
return false;
1012
}
1113
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy