Skip to content

Commit 0e5a975

Browse files
committed
update create with improved file paths
1 parent d2c99f9 commit 0e5a975

File tree

21 files changed

+29
-221
lines changed

21 files changed

+29
-221
lines changed

lib/create/write-demo.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var path = require('path');
44
var file_1 = require('../tools/file');
55
function createFile(pathToFile) {
66
if (!file_1.fileExists(pathToFile)) {
7-
var inputPath = path.join(__dirname, 'setup', pathToFile);
7+
var inputPath = path.join(__dirname, '..', '..', 'setup', pathToFile);
88
var test = fs.readFileSync(inputPath, 'utf8');
99
fs.writeFileSync(pathToFile, test, 'utf8');
1010
}
@@ -16,17 +16,19 @@ function createFolder(pathToFolder) {
1616
}
1717
function createTutorialMd() {
1818
createFolder('tutorial');
19-
createFile('tutorial/tutorial.md');
20-
createFolder('tutorial/1');
21-
createFolder('tutorial/1/01');
22-
createFile('tutorial/1/01/page-one.md');
23-
createFolder('tutorial/1/02');
24-
createFile('tutorial/1/02/page-two.md');
19+
createFile(path.join('tutorial', 'tutorial.md'));
20+
createFolder(path.join('tutorial', '1'));
21+
createFolder(path.join('tutorial', '1', '01'));
22+
createFile(path.join('tutorial', '1', '01', 'page-one.md'));
23+
createFolder(path.join('tutorial', '1', '02'));
24+
createFile(path.join('tutorial', '1', '02', 'page-two.md'));
25+
createFolder(path.join('tutorial', 'common'));
26+
createFile(path.join('tutorial', 'common', 'loadJS.js'));
2527
}
2628
exports.createTutorialMd = createTutorialMd;
2729
function createPackageJson(name) {
2830
if (!file_1.fileExists('package.json')) {
29-
var inputPath = path.join(__dirname, './setup/package.json');
31+
var inputPath = path.join(__dirname, '..', '..', 'setup', 'package.json');
3032
var packageJson = JSON.parse(fs.readFileSync(inputPath, 'utf8'));
3133
packageJson.name = 'coderoad-' + name;
3234
var packageJsonString = JSON.stringify(packageJson, null, 2);
@@ -35,9 +37,9 @@ function createPackageJson(name) {
3537
}
3638
exports.createPackageJson = createPackageJson;
3739
function createTestFiles() {
38-
createFile('tutorial/1/01/01.spec.js');
39-
createFile('tutorial/1/01/02.spec.js');
40-
createFile('tutorial/1/02/01.spec.js');
41-
createFile('tutorial/1/02/02.spec.js');
40+
createFile(path.join('tutorial', '1', '01', '01.spec.js'));
41+
createFile(path.join('tutorial', '1', '01', '02.spec.js'));
42+
createFile(path.join('tutorial', '1', '02', '01.spec.js'));
43+
createFile(path.join('tutorial', '1', '02', '02.spec.js'));
4244
}
4345
exports.createTestFiles = createTestFiles;

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.21",
3+
"version": "0.3.22",
44
"description": "Command line interface for CodeRoad. Build project files.",
55
"keywords": [
66
"coderoad"
File renamed without changes.
File renamed without changes.

src/create/setup/package.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/create/setup/tutorial/1/01/01.spec.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/create/setup/tutorial/1/01/02.spec.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/create/setup/tutorial/1/02/01.spec.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/create/setup/tutorial/1/02/02.spec.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

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

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/create/setup/tutorial/common/loadJS.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/create/setup/tutorial/tutorial.md

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/create/write-demo.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {fileExists} from '../tools/file';
55

66
function createFile(pathToFile: string): void {
77
if (!fileExists(pathToFile)) {
8-
let inputPath = path.join(__dirname, 'setup', pathToFile);
8+
let inputPath = path.join(__dirname, '..', '..', 'setup', pathToFile);
99
let test = fs.readFileSync(inputPath, 'utf8');
1010
fs.writeFileSync(pathToFile, test, 'utf8');
1111
}
@@ -19,17 +19,19 @@ function createFolder(pathToFolder: string): void {
1919

2020
export function createTutorialMd(): void {
2121
createFolder('tutorial');
22-
createFile('tutorial/tutorial.md');
23-
createFolder('tutorial/1');
24-
createFolder('tutorial/1/01');
25-
createFile('tutorial/1/01/page-one.md');
26-
createFolder('tutorial/1/02');
27-
createFile('tutorial/1/02/page-two.md');
22+
createFile(path.join('tutorial', 'tutorial.md'));
23+
createFolder(path.join('tutorial', '1'));
24+
createFolder(path.join('tutorial', '1', '01'));
25+
createFile(path.join('tutorial', '1', '01', 'page-one.md'));
26+
createFolder(path.join('tutorial', '1', '02'));
27+
createFile(path.join('tutorial', '1', '02', 'page-two.md'));
28+
createFolder(path.join('tutorial', 'common'));
29+
createFile(path.join('tutorial', 'common', 'loadJS.js'));
2830
}
2931

3032
export function createPackageJson(name: string): void {
3133
if (!fileExists('package.json')) {
32-
let inputPath = path.join(__dirname, './setup/package.json');
34+
let inputPath = path.join(__dirname, '..', '..', 'setup', 'package.json');
3335
let packageJson = JSON.parse(fs.readFileSync(inputPath, 'utf8'));
3436
packageJson.name = 'coderoad-' + name
3537
let packageJsonString = JSON.stringify(packageJson, null, 2);
@@ -38,8 +40,8 @@ export function createPackageJson(name: string): void {
3840
}
3941

4042
export function createTestFiles():void {
41-
createFile('tutorial/1/01/01.spec.js');
42-
createFile('tutorial/1/01/02.spec.js');
43-
createFile('tutorial/1/02/01.spec.js');
44-
createFile('tutorial/1/02/02.spec.js');
43+
createFile(path.join('tutorial', '1', '01', '01.spec.js'));
44+
createFile(path.join('tutorial', '1', '01', '02.spec.js'));
45+
createFile(path.join('tutorial', '1', '02', '01.spec.js'));
46+
createFile(path.join('tutorial', '1', '02', '02.spec.js'));
4547
}

0 commit comments

Comments
 (0)