binhend 1.5.10 → 1.5.12
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/commands/build-project.js +8 -0
- package/bin/commands/create-frontend.js +2 -2
- package/bin/commands/start-server.js +8 -0
- package/bin/commands/test-project.js +10 -0
- package/bin/index.js +4 -4
- package/bin/utils/cmdRun.js +1 -2
- package/bin/utils/cwdJoin.js +11 -0
- package/package.json +1 -1
- package/bin/commands/start-frontend.js +0 -11
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const cwdJoin = require('../utils/cwdJoin');
|
|
4
5
|
|
|
5
6
|
module.exports = (args) => {
|
|
6
7
|
try {
|
|
7
|
-
var
|
|
8
|
-
destinationPath = path.join(currentDirectory, args[0] || 'frontend'),
|
|
8
|
+
var destinationPath = cwdJoin(args[0] || 'frontend'),
|
|
9
9
|
sourcePath = path.join(__dirname, '../templates/frontend');
|
|
10
10
|
|
|
11
11
|
console.log('[BINHEND][CLI] Generate front-end structure:', destinationPath);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
const runCommand = require('../utils/cmdRun');
|
|
3
|
+
const cwdJoin = require('../utils/cwdJoin');
|
|
4
|
+
|
|
5
|
+
module.exports = (args) => {
|
|
6
|
+
// var projectFolder = args.shift() || './';
|
|
7
|
+
// var scriptPath = cwdJoin(projectFolder, 'test/test.js');
|
|
8
|
+
var testFolder = cwdJoin(projectFolder, 'test');
|
|
9
|
+
runCommand(`cd ${testFolder} & node test.js`);
|
|
10
|
+
};
|
package/bin/index.js
CHANGED
|
@@ -5,13 +5,13 @@ const commandMap = {
|
|
|
5
5
|
backend: () => require('./commands/create-backend'),
|
|
6
6
|
frontend: () => require('./commands/create-frontend'),
|
|
7
7
|
},
|
|
8
|
-
start:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
start: () => require('./commands/start-server'),
|
|
9
|
+
build: () => require('./commands/build-project'),
|
|
10
|
+
test: () => require('./commands/test-project'),
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
var command = commandMap,
|
|
14
|
-
args = process.argv.slice(2); // remove first 2 args in list: <path-to-nodejs> and <path-to-this-CLI-
|
|
14
|
+
args = process.argv.slice(2); // remove first 2 args in list: <path-to-nodejs> and <path-to-this-CLI-script-file>
|
|
15
15
|
|
|
16
16
|
while (args.length) {
|
|
17
17
|
var arg = args[0];
|
package/bin/utils/cmdRun.js
CHANGED
|
@@ -11,8 +11,7 @@ function printErr(fullCommand, error) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
module.exports = function() {
|
|
14
|
-
const command = arguments[0],
|
|
15
|
-
args = arguments[1],
|
|
14
|
+
const command = arguments[0], args = arguments[1] || [],
|
|
16
15
|
fullCommand = `${command} ${args.join(' ')}`,
|
|
17
16
|
|
|
18
17
|
printError = printErr.bind(null, fullCommand),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
module.exports = function() {
|
|
6
|
+
const args = Array.from(arguments),
|
|
7
|
+
currentWorkingDirectory = process.cwd(), // directory path where the command is executed
|
|
8
|
+
destinationPath = path.join.apply(null, [currentWorkingDirectory].concat(args));
|
|
9
|
+
|
|
10
|
+
return destinationPath;
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const path = require('path');
|
|
3
|
-
|
|
4
|
-
const runCommand = require('../utils/cmdRun');
|
|
5
|
-
|
|
6
|
-
module.exports = (args) => {
|
|
7
|
-
var currentDirectory = process.cwd(), // directory path where the command is executed
|
|
8
|
-
destinationPath = path.join(currentDirectory, args[0] || 'frontend', 'server.js');
|
|
9
|
-
|
|
10
|
-
runCommand('node', [destinationPath]);
|
|
11
|
-
};
|