express-generator-typescript 1.9.9 → 1.10.2
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/bin/cli.js +33 -33
- package/lib/express-generator-typescript.js +6 -4
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -11,38 +11,38 @@ const expressGenTs = require('../lib/express-generator-typescript');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
(() => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
14
|
+
console.log('Setting up new Express/TypeScript project...');
|
|
15
|
+
// const opts = processOptions(process.argv.slice(2));
|
|
16
|
+
// Process options
|
|
17
|
+
let destination = 'express-gen-ts';
|
|
18
|
+
let withAuth = false;
|
|
19
|
+
let useYarn = false;
|
|
20
|
+
let useSocketIo = false;
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
let idx = -1;
|
|
23
|
+
idx = args.indexOf('--with-auth');
|
|
24
|
+
if (idx > -1) {
|
|
25
|
+
withAuth = true;
|
|
26
|
+
args.splice(idx, 1);
|
|
27
|
+
}
|
|
28
|
+
idx = args.indexOf('--use-yarn');
|
|
29
|
+
if (idx > -1) {
|
|
30
|
+
useYarn = true;
|
|
31
|
+
args.splice(idx, 1);
|
|
32
|
+
}
|
|
33
|
+
idx = args.indexOf('--socket-io');
|
|
34
|
+
if (idx > -1) {
|
|
35
|
+
useSocketIo = true;
|
|
36
|
+
withAuth = true;
|
|
37
|
+
args.splice(idx, 1);
|
|
38
|
+
}
|
|
39
|
+
if (args.length > 0) {
|
|
40
|
+
destination = args[0];
|
|
41
|
+
}
|
|
42
|
+
destination = path.join(process.cwd(), destination);
|
|
43
|
+
// Creating new project finished
|
|
44
|
+
expressGenTs(destination, withAuth, useYarn, useSocketIo).then(() => {
|
|
45
|
+
console.log('Project setup complete!');
|
|
46
|
+
});
|
|
47
47
|
})();
|
|
48
48
|
|
|
@@ -14,7 +14,9 @@ const fs = require('fs');
|
|
|
14
14
|
// **** Variables **** //
|
|
15
15
|
|
|
16
16
|
const ncpOpts = {
|
|
17
|
-
filter:
|
|
17
|
+
filter: (fileName) => {
|
|
18
|
+
return !(fileName === 'package-lock.json' || fileName === 'node_modules');
|
|
19
|
+
},
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
|
|
@@ -27,7 +29,7 @@ async function expressGenTs(destination, withAuth, useYarn, useSocketIo) {
|
|
|
27
29
|
try {
|
|
28
30
|
await copyProjectFiles(destination, withAuth, useSocketIo);
|
|
29
31
|
updatePackageJson(destination);
|
|
30
|
-
await
|
|
32
|
+
await renameGitigoreFile(destination);
|
|
31
33
|
const depStrings = getDepStrings(withAuth, useSocketIo);
|
|
32
34
|
downloadNodeModules(destination, depStrings, useYarn);
|
|
33
35
|
} catch (err) {
|
|
@@ -49,7 +51,7 @@ function copyProjectFiles(destination, withAuth, useSocketIo) {
|
|
|
49
51
|
// Return
|
|
50
52
|
return new Promise((res, rej) => {
|
|
51
53
|
ncp.limit = 16;
|
|
52
|
-
ncp(source, destination, ncpOpts, (err) => {
|
|
54
|
+
return ncp(source, destination, ncpOpts, (err) => {
|
|
53
55
|
return (!!err ? rej(err) : res());
|
|
54
56
|
});
|
|
55
57
|
});
|
|
@@ -70,7 +72,7 @@ function updatePackageJson(destination) {
|
|
|
70
72
|
/**
|
|
71
73
|
* Because npm does not allow .gitignore to be published.
|
|
72
74
|
*/
|
|
73
|
-
function
|
|
75
|
+
function renameGitigoreFile(destination) {
|
|
74
76
|
return new Promise((res, rej) => {
|
|
75
77
|
fs.rename(destination + '/gitignore', destination + '/.gitignore', (err) => {
|
|
76
78
|
return (!!err ? rej(err) : res());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.2",
|
|
4
4
|
"description": "Generate new Express applications similar to express-generate which but sets it up to use TypeScript instead",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"express-generator-typescript": "node bin/cli.js",
|