sinto 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -5
- package/addts/addts.js +43 -0
- package/addts/tsconfigContent.js +13 -0
- package/gents/contents/tsPackageContent.js +29 -0
- package/gents/{tsconfigContent.js → contents/tsconfigContent.js} +2 -2
- package/gents/generators/genTsBsconfig.js +13 -0
- package/gents/generators/genTsGulpfile.js +65 -0
- package/gents/generators/genTsWeb.js +44 -0
- package/gents/gents.js +13 -19
- package/genweb/genweb.js +22 -41
- package/package.json +1 -1
- package/sin.js +13 -4
- package/tools/dep.js +3 -1
- package/tools/tools.js +34 -0
package/README.md
CHANGED
|
@@ -55,11 +55,12 @@ This command is generate public directory from src directory.
|
|
|
55
55
|
* sin init - Initilalize the project
|
|
56
56
|
* sin serve - Start development server
|
|
57
57
|
* sin build - Start public generation
|
|
58
|
+
* sin rmno - Delete node_modules directory
|
|
58
59
|
* sin api - Generate fake REST API with hai-server
|
|
59
60
|
* sin webpack - Generate Webpack project
|
|
60
61
|
* sin pup - Generate Puppeteer test with Mocha
|
|
61
|
-
* sin
|
|
62
|
-
* sin ts -
|
|
62
|
+
* sin addts - Generate tsconfig.json and add dependencies
|
|
63
|
+
* sin ts - Initialize TypeScript Node.js project
|
|
63
64
|
* sin web - Generate HTML and empty CSS files
|
|
64
65
|
* sin esbuild - Generate esbuild project
|
|
65
66
|
|
|
@@ -157,20 +158,49 @@ Write the tests in test directory and run the tests:
|
|
|
157
158
|
npm test
|
|
158
159
|
```
|
|
159
160
|
|
|
160
|
-
## TypeScript
|
|
161
|
+
## TypeScript
|
|
162
|
+
|
|
163
|
+
### TypeScript config and dependencies
|
|
161
164
|
|
|
162
|
-
The **sin
|
|
165
|
+
The **sin addts** command generate a tsconfig.json and add dependencies to package.json.
|
|
163
166
|
|
|
164
|
-
The **sin
|
|
167
|
+
The **sin addts** command does not install the dependencies, it just writes them into the package.json file. Install the dependencies with the **npm i** or **pnpm i** command.
|
|
165
168
|
|
|
166
169
|
Using:
|
|
167
170
|
|
|
168
171
|
```cmd
|
|
169
172
|
sin init
|
|
173
|
+
sin addts
|
|
174
|
+
npm i
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### TypeScript Node.js project
|
|
178
|
+
|
|
179
|
+
The **sin ts** command generate a TypeScript Node.js project.
|
|
180
|
+
|
|
181
|
+
Using:
|
|
182
|
+
|
|
183
|
+
```cmd
|
|
170
184
|
sin ts
|
|
171
185
|
npm i
|
|
172
186
|
```
|
|
173
187
|
|
|
188
|
+
Generated directories and files:
|
|
189
|
+
|
|
190
|
+
```txt
|
|
191
|
+
app01/
|
|
192
|
+
|-src/
|
|
193
|
+
| |-assets/
|
|
194
|
+
| |-app.ts
|
|
195
|
+
| |-index.html
|
|
196
|
+
| `-style.css
|
|
197
|
+
|-bs-config.json
|
|
198
|
+
|-gulpfile.js
|
|
199
|
+
|-package.json
|
|
200
|
+
|-README.md
|
|
201
|
+
`-tsconfig.json
|
|
202
|
+
```
|
|
203
|
+
|
|
174
204
|
## ESBuild project generator
|
|
175
205
|
|
|
176
206
|
The sin esbuild command generate a esbuild project.
|
package/addts/addts.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const tsconfigContent = require('./tsconfigContent.js');
|
|
2
|
+
const { createFile } = require('../tools/tools.js');
|
|
3
|
+
const jsonfile = require('jsonfile');
|
|
4
|
+
const { addDevDep } = require('../tools/dep.js');
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
|
|
8
|
+
const supplementTypescript = () => {
|
|
9
|
+
writeConfigFile();
|
|
10
|
+
showMsg();
|
|
11
|
+
addDependencies();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const writeConfigFile = () => {
|
|
15
|
+
const dir = process.cwd();
|
|
16
|
+
const path = `${dir}/tsconfig.json`;
|
|
17
|
+
jsonfile.writeFileSync(path, tsconfigContent, { spaces: 2 });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const showMsg = () => {
|
|
21
|
+
console.log(`
|
|
22
|
+
Install dependencies with npm or pnpm command:
|
|
23
|
+
|
|
24
|
+
pnpm install
|
|
25
|
+
`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const addDependencies = () => {
|
|
29
|
+
|
|
30
|
+
const dir = process.cwd();
|
|
31
|
+
const path = `${dir}/package.json`;
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(path)) {
|
|
34
|
+
console.log('package.json file does not exist.');
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
addDevDep(path, ['typescript']);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports.supplementTypescript = supplementTypescript;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
const packageTsContent =
|
|
3
|
+
{
|
|
4
|
+
name: 'sinto-project',
|
|
5
|
+
version: '0.0.1',
|
|
6
|
+
description: 'A project created by the Sinto command',
|
|
7
|
+
scripts: {
|
|
8
|
+
'start': 'browser-sync start --config bs-config.json',
|
|
9
|
+
'build': 'gulp',
|
|
10
|
+
'ts': 'tsc'
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"bootstrap": "^5.3.3"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"browser-sync": "^3.0.2",
|
|
17
|
+
"gulp": "^5.0.0",
|
|
18
|
+
"gulp-clean-css": "^4.3.0",
|
|
19
|
+
"gulp-concat": "^2.6.1",
|
|
20
|
+
"gulp-image": "^6.3.1",
|
|
21
|
+
"gulp-minify": "^3.1.0",
|
|
22
|
+
"gulp-uglify": "^3.0.2",
|
|
23
|
+
"gulp-replace": "^1.1.4",
|
|
24
|
+
"gulp-typescript": "6.0.0-alpha.1"
|
|
25
|
+
},
|
|
26
|
+
"type": "module"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = packageTsContent;
|
|
@@ -3,7 +3,7 @@ const tsconfigContent =
|
|
|
3
3
|
{
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"target": "ES6",
|
|
6
|
-
"module": "
|
|
6
|
+
"module": "ES6",
|
|
7
7
|
"outDir": "./app",
|
|
8
8
|
"strict": true,
|
|
9
9
|
"esModuleInterop": true
|
|
@@ -11,4 +11,4 @@ const tsconfigContent =
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
module.exports = tsconfigContent;
|
|
14
|
+
module.exports = tsconfigContent;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
|
|
2
|
+
const tsGulfileContent = `
|
|
3
|
+
import {src, dest, series} from 'gulp';
|
|
4
|
+
import cleanCss from 'gulp-clean-css';
|
|
5
|
+
import replace from 'gulp-replace';
|
|
6
|
+
import concat from 'gulp-concat'
|
|
7
|
+
import ts from 'gulp-typescript';
|
|
8
|
+
import uglify from 'gulp-uglify';
|
|
9
|
+
import minify from 'gulp-minify';
|
|
10
|
+
|
|
11
|
+
import {create as bsCreate} from 'browser-sync';
|
|
12
|
+
const browserSync = bsCreate();
|
|
13
|
+
|
|
14
|
+
function genHTML(cb) {
|
|
15
|
+
src('app/**/*.html')
|
|
16
|
+
.pipe(dest('dist'))
|
|
17
|
+
cb();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
function streamTs(cb) {
|
|
22
|
+
src('src/**/*.ts')
|
|
23
|
+
.pipe(ts())
|
|
24
|
+
.pipe(uglify())
|
|
25
|
+
.pipe(dest('public'));
|
|
26
|
+
cb();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function minifyJS(cb) {
|
|
30
|
+
src([
|
|
31
|
+
'public/**/*.js',
|
|
32
|
+
'node_modules/bootstrap/dist/js/bootstrap.js'
|
|
33
|
+
])
|
|
34
|
+
.pipe(replace(/import .*/g, ''))
|
|
35
|
+
.pipe(replace(/export .*/g, ''))
|
|
36
|
+
.pipe(concat('app.js'))
|
|
37
|
+
.pipe(minify())
|
|
38
|
+
.pipe(dest('dist'));
|
|
39
|
+
cb();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function minifyCSS(cb) {
|
|
43
|
+
src([
|
|
44
|
+
'app/**/*.css',
|
|
45
|
+
'node_modules/bootstrap/dist/css/bootstrap.css'])
|
|
46
|
+
.pipe(cleanCss())
|
|
47
|
+
.pipe(dest('dist'));
|
|
48
|
+
cb();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function copyImages(cb) {
|
|
52
|
+
src('app/assets/**/*')
|
|
53
|
+
.pipe(dest('dist/assets'));
|
|
54
|
+
cb();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function build(cb) {
|
|
58
|
+
series(genHTML, streamTs, minifyJS, minifyCSS, copyImages)(cb);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default build
|
|
62
|
+
|
|
63
|
+
`;
|
|
64
|
+
|
|
65
|
+
module.exports = tsGulfileContent;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const {debug} = require('../../config.json');
|
|
2
|
+
const fsExtra = require('fs-extra');
|
|
3
|
+
|
|
4
|
+
const defaultTsGulpfileContent = require('./genTsGulpfile');
|
|
5
|
+
const defaultHtmlContent = require('../../genweb/generators/genHtml');
|
|
6
|
+
const defaultTsBsconfigContent = require('./genTsBsconfig');
|
|
7
|
+
const defaultTsPackageContent = require('../contents/tsPackageContent');
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
createDirectory,
|
|
11
|
+
createFile,
|
|
12
|
+
createGulpfileJsFile,
|
|
13
|
+
createBsconfigFile,
|
|
14
|
+
createIndexHtmlFile,
|
|
15
|
+
createPackageJsonFile
|
|
16
|
+
} = require('../../tools/tools');
|
|
17
|
+
|
|
18
|
+
const outputDir = 'app';
|
|
19
|
+
|
|
20
|
+
const createTsWeb = () => {
|
|
21
|
+
const dir = process.cwd();
|
|
22
|
+
|
|
23
|
+
createDirectory(`${dir}/src`);
|
|
24
|
+
createDirectory(`${dir}/${outputDir}`);
|
|
25
|
+
createDirectory(`${dir}/${outputDir}/assets`);
|
|
26
|
+
|
|
27
|
+
createFile(`${dir}/${outputDir}/style.css`, '');
|
|
28
|
+
|
|
29
|
+
createFile(`${dir}/src/app.ts`, '');
|
|
30
|
+
|
|
31
|
+
createFile(`${dir}/README.md`, '# Sinto Project');
|
|
32
|
+
|
|
33
|
+
createPackageJsonFile(dir, defaultTsPackageContent);
|
|
34
|
+
createIndexHtmlFile(dir, outputDir, defaultHtmlContent);
|
|
35
|
+
createGulpfileJsFile(dir, defaultTsGulpfileContent);
|
|
36
|
+
createBsconfigFile(dir, defaultTsBsconfigContent);
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
console.log('Base directories and files created.');
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
module.exports.createTsWeb = createTsWeb
|
package/gents/gents.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
const
|
|
1
|
+
const {debug} = require('../config.json');
|
|
2
|
+
const tsconfigContent = require('./contents/tsconfigContent.js');
|
|
2
3
|
const { createFile } = require('../tools/tools.js');
|
|
3
4
|
const jsonfile = require('jsonfile');
|
|
4
|
-
const { addDevDep } = require('../tools/dep.js');
|
|
5
|
+
const { addDevDep, addScript } = require('../tools/dep.js');
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const { createTsWeb } = require('./generators/genTsWeb.js');
|
|
8
|
+
const defaultTsPackageContent = require('./contents/tsPackageContent.js');
|
|
5
9
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
const initTypescriptProject = async () => {
|
|
11
|
+
createTsWeb();
|
|
12
|
+
writeConfigFile();
|
|
13
|
+
showMsg();
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
const writeConfigFile = () => {
|
|
@@ -16,21 +20,11 @@ const writeConfigFile = () => {
|
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
const showMsg = () => {
|
|
19
|
-
console.log(`
|
|
20
|
-
|
|
21
|
-
In the tsconfig.json file, leave the module value
|
|
22
|
-
at commonjs for a NodeJS project. In the case of
|
|
23
|
-
an ES project, rewrite it to, for example, ES6.
|
|
23
|
+
console.log(`TypeScript project initialized.
|
|
24
|
+
Install dependencies with npm or pnpm command:
|
|
24
25
|
|
|
25
|
-
Install dependencies:
|
|
26
26
|
pnpm install
|
|
27
27
|
`);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
const dir = process.cwd();
|
|
32
|
-
const path = `${dir}/package.json`;
|
|
33
|
-
addDevDep(path, ['typescript']);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
module.exports.supplementTypescript = supplementTypescript;
|
|
30
|
+
module.exports.initTypescriptProject = initTypescriptProject;
|
package/genweb/genweb.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const {debug} = require('../config.json');
|
|
2
|
-
const jsonfile = require('jsonfile');
|
|
3
2
|
const fsExtra = require('fs-extra');
|
|
4
3
|
|
|
5
4
|
const defaultPackageContent = require('../genweb/generators/genPackage');
|
|
@@ -9,58 +8,40 @@ const defaultBsconfigContent = require('../genweb/generators/genBsconfig');
|
|
|
9
8
|
|
|
10
9
|
const {
|
|
11
10
|
createDirectory,
|
|
12
|
-
createFile
|
|
11
|
+
createFile,
|
|
12
|
+
createGulpfileJsFile,
|
|
13
|
+
createBsconfigFile,
|
|
14
|
+
createIndexHtmlFile,
|
|
15
|
+
createPackageJsonFile
|
|
13
16
|
} = require('../tools/tools');
|
|
14
17
|
|
|
15
18
|
const createWeb = () => {
|
|
16
|
-
const
|
|
19
|
+
const dir = process.cwd();
|
|
17
20
|
|
|
18
|
-
createDirectory(`${
|
|
19
|
-
createDirectory(`${
|
|
21
|
+
createDirectory(`${dir}/src`);
|
|
22
|
+
createDirectory(`${dir}/src/assets`);
|
|
20
23
|
|
|
21
|
-
createFile(`${
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
createFile(`${dir}/src/style.css`, '');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
createFile(`${dir}/src/app.js`, '');
|
|
28
|
+
|
|
29
|
+
createFile(`${dir}/README.md`, '# Sinto Project');
|
|
24
30
|
|
|
25
|
-
createPackageJsonFile(
|
|
26
|
-
createIndexHtmlFile(
|
|
27
|
-
createGulpfileJsFile(
|
|
28
|
-
createBsconfigFile(
|
|
31
|
+
createPackageJsonFile(dir, defaultPackageContent);
|
|
32
|
+
createIndexHtmlFile(dir, 'src', defaultHtmlContent);
|
|
33
|
+
createGulpfileJsFile(dir, defaultGulpfileContent);
|
|
34
|
+
createBsconfigFile(dir, defaultBsconfigContent);
|
|
29
35
|
|
|
30
36
|
console.log('Base directories and files created.');
|
|
31
37
|
};
|
|
32
38
|
|
|
33
|
-
const createPackageJsonFile = (directory) => {
|
|
34
|
-
const packageJsonPath = `${directory}/package.json`;
|
|
35
|
-
jsonfile.writeFileSync(packageJsonPath, defaultPackageContent, { spaces: 2 });
|
|
36
|
-
if(debug) {
|
|
37
|
-
console.log('package.json file created.');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
39
|
|
|
41
|
-
const createIndexHtmlFile = (directory) => {
|
|
42
|
-
const indexHtmlPath = `${directory}/src/index.html`;
|
|
43
|
-
fsExtra.writeFileSync(indexHtmlPath, defaultHtmlContent);
|
|
44
|
-
if(debug)
|
|
45
|
-
console.log('index.html file created');
|
|
46
|
-
}
|
|
47
40
|
|
|
48
|
-
const createGulpfileJsFile = (directory) => {
|
|
49
|
-
const gulpfileJsPath = `${directory}/gulpfile.js`;
|
|
50
|
-
fsExtra.writeFileSync(gulpfileJsPath, defaultGulpfileContent);
|
|
51
|
-
if(debug)
|
|
52
|
-
console.log('gulpfile.js file created.');
|
|
53
|
-
}
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
const bsconfigPath = `${directory}/bs-config.json`;
|
|
57
|
-
jsonfile.writeFileSync(bsconfigPath, defaultBsconfigContent, { spaces: 2 });
|
|
58
|
-
if(debug)
|
|
59
|
-
console.log('bs-config.json file created.');
|
|
60
|
-
}
|
|
42
|
+
|
|
61
43
|
|
|
62
44
|
module.exports.createWeb = createWeb;
|
|
63
|
-
module.exports.createPackageJsonFile = createPackageJsonFile;
|
|
64
|
-
module.exports.
|
|
65
|
-
module.exports.
|
|
66
|
-
module.exports.createBsconfigFile = createBsconfigFile;
|
|
45
|
+
// module.exports.createPackageJsonFile = createPackageJsonFile;
|
|
46
|
+
// module.exports.createGulpfileJsFile = createGulpfileJsFile;
|
|
47
|
+
// module.exports.createBsconfigFile = createBsconfigFile;
|
package/package.json
CHANGED
package/sin.js
CHANGED
|
@@ -9,7 +9,8 @@ const { createApi } = require('./haiserver/apigen');
|
|
|
9
9
|
const { createWebpack } = require('./webpack/generate');
|
|
10
10
|
const { createEsbuildProject } = require('./esbuild/generate');
|
|
11
11
|
const { createPuppeteerTest } = require('./gentest/generate');
|
|
12
|
-
const { supplementTypescript } = require('./
|
|
12
|
+
const { supplementTypescript } = require('./addts/addts');
|
|
13
|
+
const { initTypescriptProject } = require('./gents/gents');
|
|
13
14
|
const { createIndexHtmlCssFile } = require('./htmlcss/htmlcss');
|
|
14
15
|
|
|
15
16
|
const program = new Command();
|
|
@@ -17,11 +18,11 @@ const program = new Command();
|
|
|
17
18
|
program
|
|
18
19
|
.name('sin')
|
|
19
20
|
.description('Project handler')
|
|
20
|
-
.version('1.
|
|
21
|
+
.version('1.8.1');
|
|
21
22
|
|
|
22
23
|
program
|
|
23
24
|
.command('init')
|
|
24
|
-
.description('Initialize the web project')
|
|
25
|
+
.description('Initialize the Node.js web project')
|
|
25
26
|
.action(() => {
|
|
26
27
|
createWeb();
|
|
27
28
|
});
|
|
@@ -70,12 +71,20 @@ program
|
|
|
70
71
|
})
|
|
71
72
|
|
|
72
73
|
program
|
|
73
|
-
.command('
|
|
74
|
+
.command('addts')
|
|
74
75
|
.description('Supplement with TypeScript')
|
|
75
76
|
.action(() => {
|
|
76
77
|
supplementTypescript();
|
|
77
78
|
})
|
|
78
79
|
|
|
80
|
+
program
|
|
81
|
+
.command('ts')
|
|
82
|
+
.description('Initialize TypeScript Node.js project')
|
|
83
|
+
.action(() => {
|
|
84
|
+
initTypescriptProject();
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
|
|
79
88
|
program
|
|
80
89
|
.command('web')
|
|
81
90
|
.description('HTML és üres CSS fájl')
|
package/tools/dep.js
CHANGED
|
@@ -31,6 +31,7 @@ async function readJsonFile(filePath) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
async function addDependencies(obj, packageNames, devDep) {
|
|
34
|
+
console.log(`Adding dependencies...`);
|
|
34
35
|
for(const packageName of packageNames) {
|
|
35
36
|
try {
|
|
36
37
|
const newDependency = await getPackageInfo(packageName);
|
|
@@ -65,7 +66,8 @@ async function writeJsonFile(path, obj) {
|
|
|
65
66
|
try {
|
|
66
67
|
await jsonfile.writeFile(path, obj, { spaces: 2});
|
|
67
68
|
if(debug) {
|
|
68
|
-
console.log(`
|
|
69
|
+
console.log(`Written new JSON file: ${path}`);
|
|
70
|
+
console.log(obj);
|
|
69
71
|
}
|
|
70
72
|
} catch (err) {
|
|
71
73
|
console.error('Error! Failed to write package.json:');
|
package/tools/tools.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const {debug} = require('../config.json');
|
|
2
2
|
const fsExtra = require('fs-extra');
|
|
3
|
+
const jsonfile = require('jsonfile');
|
|
3
4
|
|
|
4
5
|
const createDirectory = (path) => {
|
|
5
6
|
if (!fsExtra.existsSync(path)) {
|
|
@@ -13,5 +14,38 @@ const createFile = (path, content) => {
|
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
const createGulpfileJsFile = (dir, content) => {
|
|
18
|
+
const gulpfileJsPath = `${dir}/gulpfile.js`;
|
|
19
|
+
fsExtra.writeFileSync(gulpfileJsPath, content);
|
|
20
|
+
if(debug)
|
|
21
|
+
console.log('gulpfile.js file created.');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const createBsconfigFile = (directory, content) => {
|
|
25
|
+
const bsconfigPath = `${directory}/bs-config.json`;
|
|
26
|
+
jsonfile.writeFileSync(bsconfigPath, content, { spaces: 2 });
|
|
27
|
+
if(debug)
|
|
28
|
+
console.log('bs-config.json file created.');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const createIndexHtmlFile = (dir, outputDir, content) => {
|
|
32
|
+
const indexHtmlPath = `${dir}/${outputDir}/index.html`;
|
|
33
|
+
fsExtra.writeFileSync(indexHtmlPath, content);
|
|
34
|
+
if(debug)
|
|
35
|
+
console.log('index.html file created');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const createPackageJsonFile = (directory, content) => {
|
|
39
|
+
const packageJsonPath = `${directory}/package.json`;
|
|
40
|
+
jsonfile.writeFileSync(packageJsonPath, content, { spaces: 2 });
|
|
41
|
+
if(debug) {
|
|
42
|
+
console.log('package.json file created.');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
16
46
|
module.exports.createDirectory = createDirectory;
|
|
17
47
|
module.exports.createFile = createFile;
|
|
48
|
+
module.exports.createGulpfileJsFile = createGulpfileJsFile;
|
|
49
|
+
module.exports.createBsconfigFile = createBsconfigFile;
|
|
50
|
+
module.exports.createIndexHtmlFile = createIndexHtmlFile;
|
|
51
|
+
module.exports.createPackageJsonFile = createPackageJsonFile;
|