binhend 1.5.13 → 1.5.15
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/create-frontend.js +2 -0
- package/bin/commands/test-project.js +12 -4
- package/bin/templates/frontend/build.js +1 -1
- package/bin/templates/frontend/{config.js → config/config.js} +1 -1
- package/bin/templates/frontend/test/karma.conf.js +4 -4
- package/bin/templates/frontend/test/package.json +2 -2
- package/bin/utils/cmdRun.js +21 -16
- package/package.json +1 -1
- /package/bin/templates/frontend/{.env → config/default.env} +0 -0
|
@@ -10,6 +10,8 @@ module.exports = (args) => {
|
|
|
10
10
|
|
|
11
11
|
console.log('[BINHEND][CLI] Generate front-end structure:', destinationPath);
|
|
12
12
|
fs.cpSync(sourcePath, destinationPath, {recursive: true});
|
|
13
|
+
|
|
14
|
+
// TODO logic adding excluded directories to .gitignore
|
|
13
15
|
}
|
|
14
16
|
catch (error) {
|
|
15
17
|
console.error('[BINHEND][CLI] Error generating front-end structure!');
|
|
@@ -3,8 +3,16 @@ const runCommand = require('../utils/cmdRun');
|
|
|
3
3
|
const cwdJoin = require('../utils/cwdJoin');
|
|
4
4
|
|
|
5
5
|
module.exports = (args) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
var projectFolder = args.shift() || './',
|
|
7
|
+
|
|
8
|
+
testFolder = cwdJoin(projectFolder, 'test'),
|
|
9
|
+
|
|
10
|
+
options = { cwd: testFolder },
|
|
11
|
+
|
|
12
|
+
npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
13
|
+
|
|
14
|
+
runCommand(npm, ['install'], options)
|
|
15
|
+
.then(() => {
|
|
16
|
+
runCommand('node', ['test.js'].concat(args), options)
|
|
17
|
+
});
|
|
10
18
|
};
|
|
@@ -2,7 +2,7 @@ const { Binh } = require('binhend');
|
|
|
2
2
|
|
|
3
3
|
const app = new Binh();
|
|
4
4
|
|
|
5
|
-
app.config('config.js', afterLoadedConfigs); // import module from path './config.js' to run and load configs
|
|
5
|
+
app.config('config/config.js', afterLoadedConfigs); // import module from path './config/config.js' to run and load configs
|
|
6
6
|
|
|
7
7
|
function afterLoadedConfigs(configs) {
|
|
8
8
|
const options = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = function(config) {
|
|
2
|
-
|
|
3
|
-
const SCRIPT_INCLUDED_PATTERN =
|
|
2
|
+
const BUILD_PATH = 'build/web';
|
|
3
|
+
const SCRIPT_INCLUDED_PATTERN = `${BUILD_PATH}/**/*.js`;
|
|
4
4
|
const TEST_INCLUDED_PATTERN = '../src/**/*.test.js';
|
|
5
|
-
const TEST_EXCLUDED_PATTERN =
|
|
5
|
+
const TEST_EXCLUDED_PATTERN = `${BUILD_PATH}/**/*.test.js`;
|
|
6
6
|
|
|
7
7
|
config.set({
|
|
8
8
|
frameworks: ['mocha', 'chai'], // Use Mocha and Chai for testing
|
|
@@ -30,7 +30,7 @@ module.exports = function(config) {
|
|
|
30
30
|
require('./binhend-preprocessor')
|
|
31
31
|
],
|
|
32
32
|
binhend: {
|
|
33
|
-
rootPath: require('path').resolve(__dirname,
|
|
33
|
+
rootPath: require('path').resolve(__dirname, BUILD_PATH).replace(/\\/g, '/')
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
mochaReporter: { // Configure Mocha reporter options
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
|
-
"main": "
|
|
7
|
+
"main": "test.js",
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"chai": "^4.3.7",
|
|
10
10
|
"karma": "^6.4.3",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"npm": ">=8.15.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
|
-
"test": "npm i & node
|
|
23
|
+
"test": "npm i & node test.js"
|
|
24
24
|
}
|
|
25
25
|
}
|
package/bin/utils/cmdRun.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
|
|
2
2
|
const { spawn } = require('child_process');
|
|
3
3
|
|
|
4
|
-
function
|
|
4
|
+
function printOut(data) {
|
|
5
5
|
process.stdout.write(`${data}`);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
function printErr(
|
|
9
|
-
process.stdout.write(`[BINHEND][CLI] Error executing command: ${fullCommand}\n`);
|
|
8
|
+
function printErr(ref, error) {
|
|
9
|
+
process.stdout.write(`[BINHEND][CLI] Error executing command: ${ref.fullCommand}\n`);
|
|
10
10
|
process.stdout.write(`${error}`);
|
|
11
|
+
ref.reject(error);
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
module.exports = function() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const command = arguments[0], args = arguments[1] || [],
|
|
17
|
+
fullCommand = `${command} ${args.join(' ')}`,
|
|
18
|
+
|
|
19
|
+
printError = printErr.bind(null, { fullCommand, reject }),
|
|
20
|
+
|
|
21
|
+
child = spawn.apply(null, arguments);
|
|
22
|
+
|
|
23
|
+
child.stdout.on('data', printOut);
|
|
24
|
+
|
|
25
|
+
child.stderr.on('data', printError);
|
|
26
|
+
|
|
27
|
+
child.on('error', printError);
|
|
28
|
+
|
|
29
|
+
child.on('close', resolve);
|
|
30
|
+
});
|
|
31
|
+
};
|
package/package.json
CHANGED
|
File without changes
|