sinto 1.8.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 +3 -2
- package/gents/{tsPackageContent.js → contents/tsPackageContent.js} +2 -0
- package/gents/generators/genTsBsconfig.js +13 -0
- package/gents/generators/genTsGulpfile.js +26 -6
- package/gents/generators/genTsWeb.js +44 -0
- package/gents/gents.js +4 -13
- package/genweb/genweb.js +20 -52
- package/package.json +1 -1
- package/sin.js +1 -1
- package/tools/tools.js +34 -0
- /package/gents/{tsconfigContent.js → contents/tsconfigContent.js} +0 -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
|
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
const tsGulfileContent = `
|
|
3
|
-
import {src, dest,
|
|
3
|
+
import {src, dest, series} from 'gulp';
|
|
4
4
|
import cleanCss from 'gulp-clean-css';
|
|
5
5
|
import replace from 'gulp-replace';
|
|
6
6
|
import concat from 'gulp-concat'
|
|
7
7
|
import ts from 'gulp-typescript';
|
|
8
8
|
import uglify from 'gulp-uglify';
|
|
9
|
+
import minify from 'gulp-minify';
|
|
9
10
|
|
|
10
11
|
import {create as bsCreate} from 'browser-sync';
|
|
11
12
|
const browserSync = bsCreate();
|
|
12
13
|
|
|
13
14
|
function genHTML(cb) {
|
|
14
|
-
src('
|
|
15
|
-
.pipe(dest('
|
|
15
|
+
src('app/**/*.html')
|
|
16
|
+
.pipe(dest('dist'))
|
|
16
17
|
cb();
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -25,17 +26,36 @@ function streamTs(cb) {
|
|
|
25
26
|
cb();
|
|
26
27
|
}
|
|
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
|
+
|
|
28
42
|
function minifyCSS(cb) {
|
|
29
43
|
src([
|
|
30
|
-
'
|
|
44
|
+
'app/**/*.css',
|
|
31
45
|
'node_modules/bootstrap/dist/css/bootstrap.css'])
|
|
32
46
|
.pipe(cleanCss())
|
|
33
|
-
.pipe(dest('
|
|
47
|
+
.pipe(dest('dist'));
|
|
48
|
+
cb();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function copyImages(cb) {
|
|
52
|
+
src('app/assets/**/*')
|
|
53
|
+
.pipe(dest('dist/assets'));
|
|
34
54
|
cb();
|
|
35
55
|
}
|
|
36
56
|
|
|
37
57
|
function build(cb) {
|
|
38
|
-
|
|
58
|
+
series(genHTML, streamTs, minifyJS, minifyCSS, copyImages)(cb);
|
|
39
59
|
}
|
|
40
60
|
|
|
41
61
|
export default build
|
|
@@ -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,15 +1,14 @@
|
|
|
1
1
|
const {debug} = require('../config.json');
|
|
2
|
-
const tsconfigContent = require('./tsconfigContent.js');
|
|
2
|
+
const tsconfigContent = require('./contents/tsconfigContent.js');
|
|
3
3
|
const { createFile } = require('../tools/tools.js');
|
|
4
4
|
const jsonfile = require('jsonfile');
|
|
5
5
|
const { addDevDep, addScript } = require('../tools/dep.js');
|
|
6
6
|
const fs = require('fs');
|
|
7
|
-
const {
|
|
8
|
-
const defaultTsPackageContent = require('./tsPackageContent.js');
|
|
7
|
+
const { createTsWeb } = require('./generators/genTsWeb.js');
|
|
8
|
+
const defaultTsPackageContent = require('./contents/tsPackageContent.js');
|
|
9
9
|
|
|
10
10
|
const initTypescriptProject = async () => {
|
|
11
|
-
|
|
12
|
-
createPackageJsonFile(process.cwd());
|
|
11
|
+
createTsWeb();
|
|
13
12
|
writeConfigFile();
|
|
14
13
|
showMsg();
|
|
15
14
|
}
|
|
@@ -28,12 +27,4 @@ pnpm install
|
|
|
28
27
|
`);
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
const createPackageJsonFile = (dir) => {
|
|
32
|
-
const packageJsonPath = `${dir}/package.json`;
|
|
33
|
-
jsonfile.writeFileSync(packageJsonPath, defaultTsPackageContent, { spaces: 2 });
|
|
34
|
-
if(debug) {
|
|
35
|
-
console.log('package.json file created.');
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
30
|
module.exports.initTypescriptProject = initTypescriptProject;
|
package/genweb/genweb.js
CHANGED
|
@@ -1,79 +1,47 @@
|
|
|
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');
|
|
6
5
|
const defaultHtmlContent = require('../genweb/generators/genHtml');
|
|
7
6
|
const defaultGulpfileContent = require('../genweb/generators/genGulpfile');
|
|
8
|
-
const defaultTsGulpfileContent = require('../gents/generators/genTsGulpfile');
|
|
9
7
|
const defaultBsconfigContent = require('../genweb/generators/genBsconfig');
|
|
10
8
|
|
|
11
|
-
|
|
12
9
|
const {
|
|
13
10
|
createDirectory,
|
|
14
|
-
createFile
|
|
11
|
+
createFile,
|
|
12
|
+
createGulpfileJsFile,
|
|
13
|
+
createBsconfigFile,
|
|
14
|
+
createIndexHtmlFile,
|
|
15
|
+
createPackageJsonFile
|
|
15
16
|
} = require('../tools/tools');
|
|
16
17
|
|
|
17
|
-
const createWeb = (
|
|
18
|
-
const
|
|
18
|
+
const createWeb = () => {
|
|
19
|
+
const dir = process.cwd();
|
|
19
20
|
|
|
20
|
-
createDirectory(`${
|
|
21
|
-
createDirectory(`${
|
|
21
|
+
createDirectory(`${dir}/src`);
|
|
22
|
+
createDirectory(`${dir}/src/assets`);
|
|
22
23
|
|
|
23
|
-
createFile(`${
|
|
24
|
+
createFile(`${dir}/src/style.css`, '');
|
|
25
|
+
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
if(type === 'ts') {
|
|
27
|
-
createFile(`${currentDirectory}/src/app.ts`, '');
|
|
28
|
-
content = defaultTsGulpfileContent;
|
|
29
|
-
}else {
|
|
30
|
-
createFile(`${currentDirectory}/src/app.js`, '');
|
|
31
|
-
content = defaultGulpfileContent;
|
|
32
|
-
}
|
|
27
|
+
createFile(`${dir}/src/app.js`, '');
|
|
33
28
|
|
|
34
|
-
createFile(`${
|
|
29
|
+
createFile(`${dir}/README.md`, '# Sinto Project');
|
|
35
30
|
|
|
36
|
-
createPackageJsonFile(
|
|
37
|
-
createIndexHtmlFile(
|
|
38
|
-
createGulpfileJsFile(
|
|
39
|
-
createBsconfigFile(
|
|
31
|
+
createPackageJsonFile(dir, defaultPackageContent);
|
|
32
|
+
createIndexHtmlFile(dir, 'src', defaultHtmlContent);
|
|
33
|
+
createGulpfileJsFile(dir, defaultGulpfileContent);
|
|
34
|
+
createBsconfigFile(dir, defaultBsconfigContent);
|
|
40
35
|
|
|
41
36
|
console.log('Base directories and files created.');
|
|
42
37
|
};
|
|
43
38
|
|
|
44
|
-
const createPackageJsonFile = (directory) => {
|
|
45
|
-
const packageJsonPath = `${directory}/package.json`;
|
|
46
|
-
jsonfile.writeFileSync(packageJsonPath, defaultPackageContent, { spaces: 2 });
|
|
47
|
-
if(debug) {
|
|
48
|
-
console.log('package.json file created.');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const createIndexHtmlFile = (directory) => {
|
|
53
|
-
const indexHtmlPath = `${directory}/src/index.html`;
|
|
54
|
-
fsExtra.writeFileSync(indexHtmlPath, defaultHtmlContent);
|
|
55
|
-
if(debug)
|
|
56
|
-
console.log('index.html file created');
|
|
57
|
-
}
|
|
58
39
|
|
|
59
|
-
const createGulpfileJsFile = (directory, content) => {
|
|
60
|
-
const gulpfileJsPath = `${directory}/gulpfile.js`;
|
|
61
|
-
fsExtra.writeFileSync(gulpfileJsPath, content);
|
|
62
|
-
if(debug)
|
|
63
|
-
console.log('gulpfile.js file created.');
|
|
64
|
-
}
|
|
65
40
|
|
|
66
41
|
|
|
67
42
|
|
|
68
|
-
const createBsconfigFile = (directory) => {
|
|
69
|
-
const bsconfigPath = `${directory}/bs-config.json`;
|
|
70
|
-
jsonfile.writeFileSync(bsconfigPath, defaultBsconfigContent, { spaces: 2 });
|
|
71
|
-
if(debug)
|
|
72
|
-
console.log('bs-config.json file created.');
|
|
73
|
-
}
|
|
74
43
|
|
|
75
44
|
module.exports.createWeb = createWeb;
|
|
76
|
-
module.exports.createPackageJsonFile = createPackageJsonFile;
|
|
77
|
-
module.exports.
|
|
78
|
-
module.exports.
|
|
79
|
-
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
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;
|
|
File without changes
|