|
1 | 1 | "use strict"; |
2 | | -var fs = require('fs'); |
3 | | -var path = require('path'); |
| 2 | +var fs_1 = require('fs'); |
| 3 | +var path_1 = require('path'); |
4 | 4 | var file_1 = require('../tools/file'); |
5 | 5 | function createFile(pathToFile) { |
6 | 6 | if (!file_1.fileExists(pathToFile)) { |
7 | | - var inputPath = path.join(__dirname, '..', '..', 'setup', pathToFile); |
8 | | - var test = fs.readFileSync(inputPath, 'utf8'); |
9 | | - fs.writeFileSync(pathToFile, test, 'utf8'); |
| 7 | + var inputPath = path_1.join(__dirname, '..', '..', 'setup', pathToFile); |
| 8 | + var test = fs_1.readFileSync(inputPath, 'utf8'); |
| 9 | + fs_1.writeFileSync(pathToFile, test, 'utf8'); |
10 | 10 | } |
11 | 11 | } |
12 | 12 | function createFolder(pathToFolder) { |
13 | 13 | if (!file_1.fileExists(pathToFolder)) { |
14 | | - fs.mkdirSync(pathToFolder); |
| 14 | + fs_1.mkdirSync(pathToFolder); |
15 | 15 | } |
16 | 16 | } |
17 | 17 | function createTutorialMd() { |
18 | 18 | createFolder('tutorial'); |
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')); |
| 19 | + createFile(path_1.join('tutorial', 'tutorial.md')); |
| 20 | + createFolder(path_1.join('tutorial', '1')); |
| 21 | + createFolder(path_1.join('tutorial', '1', '01')); |
| 22 | + createFile(path_1.join('tutorial', '1', '01', 'page-one.md')); |
| 23 | + createFolder(path_1.join('tutorial', '1', '02')); |
| 24 | + createFile(path_1.join('tutorial', '1', '02', 'page-two.md')); |
| 25 | + createFolder(path_1.join('tutorial', 'common')); |
| 26 | + createFile(path_1.join('tutorial', 'common', 'loadJS.js')); |
27 | 27 | } |
28 | 28 | exports.createTutorialMd = createTutorialMd; |
29 | 29 | function createPackageJson(name) { |
30 | 30 | if (!file_1.fileExists('package.json')) { |
31 | | - console.log(__dirname); |
32 | | - var inputPath = path.join(__dirname, '..', '..', 'setup', 'package.json'); |
33 | | - var packageJson = JSON.parse(fs.readFileSync(inputPath, 'utf8')); |
| 31 | + var inputPath = path_1.join(__dirname, '..', '..', 'setup', 'package.json'); |
| 32 | + var packageJson = JSON.parse(fs_1.readFileSync(inputPath, 'utf8')); |
34 | 33 | packageJson.name = 'coderoad-' + name; |
35 | 34 | var packageJsonString = JSON.stringify(packageJson, null, 2); |
36 | | - fs.writeFileSync('package.json', packageJsonString, 'utf8'); |
| 35 | + fs_1.writeFileSync('package.json', packageJsonString, 'utf8'); |
37 | 36 | } |
38 | 37 | } |
39 | 38 | exports.createPackageJson = createPackageJson; |
40 | 39 | function createTestFiles() { |
41 | | - createFile(path.join('tutorial', '1', '01', '01.spec.js')); |
42 | | - createFile(path.join('tutorial', '1', '01', '02.spec.js')); |
43 | | - createFile(path.join('tutorial', '1', '02', '01.spec.js')); |
44 | | - createFile(path.join('tutorial', '1', '02', '02.spec.js')); |
| 40 | + createFile(path_1.join('tutorial', '1', '01', '01.spec.js')); |
| 41 | + createFile(path_1.join('tutorial', '1', '01', '02.spec.js')); |
| 42 | + createFile(path_1.join('tutorial', '1', '02', '01.spec.js')); |
| 43 | + createFile(path_1.join('tutorial', '1', '02', '02.spec.js')); |
45 | 44 | } |
46 | 45 | exports.createTestFiles = createTestFiles; |
0 commit comments