quackage 1.0.21 → 1.0.24
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/package.json +5 -8
- package/source/Quackage-CLIProgram.js +13 -5
- package/source/commands/Quackage-Command-Build.js +26 -13
- package/source/commands/Quackage-Command-RunMochaTests.js +69 -0
- package/source/services/Quackage-Execute-Process.js +20 -3
- package/source/commands/Quackage-Command-CleanFolder.js +0 -0
- package/source/commands/Quackage-Command-CopyFileSet.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quackage",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"description": "Building. Testing. Quacking.",
|
|
5
5
|
"main": "source/Quackage.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,22 +50,19 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://github.com/stevenvelozo/quackage",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@babel/core": "^7.23.
|
|
54
|
-
"@babel/preset-env": "^7.
|
|
53
|
+
"@babel/core": "^7.23.2",
|
|
54
|
+
"@babel/preset-env": "^7.23.2",
|
|
55
55
|
"browserify": "^17.0.0",
|
|
56
56
|
"chai": "4.3.10",
|
|
57
|
-
"commander": "^11.0.0",
|
|
58
57
|
"gulp": "^4.0.2",
|
|
59
58
|
"gulp-babel": "^8.0.0",
|
|
60
59
|
"gulp-env": "^0.4.0",
|
|
61
60
|
"gulp-sourcemaps": "^3.0.0",
|
|
62
61
|
"gulp-terser": "^2.1.0",
|
|
63
62
|
"mocha": "10.2.0",
|
|
64
|
-
"npm-check-updates": "^16.14.
|
|
63
|
+
"npm-check-updates": "^16.14.6",
|
|
65
64
|
"nyc": "^15.1.0",
|
|
66
|
-
"pict-service-commandlineutility": "^1.0.
|
|
67
|
-
"resolve-package-path": "^4.0.3",
|
|
68
|
-
"resolve-pkg": "^2.0.0",
|
|
65
|
+
"pict-service-commandlineutility": "^1.0.9",
|
|
69
66
|
"vinyl-buffer": "^1.0.1",
|
|
70
67
|
"vinyl-source-stream": "^2.0.0"
|
|
71
68
|
},
|
|
@@ -16,19 +16,27 @@ let _Pict = new libCLIProgram(
|
|
|
16
16
|
AutoAddConfigurationExplanationCommand: true
|
|
17
17
|
},
|
|
18
18
|
[
|
|
19
|
+
// Management for package.json
|
|
19
20
|
require('./commands/Quackage-Command-UpdatePackage.js'),
|
|
20
21
|
require('./commands/Quackage-Command-Lint.js'),
|
|
22
|
+
|
|
23
|
+
// Mocha test execution
|
|
24
|
+
require('./commands/Quackage-Command-RunMochaTests.js'),
|
|
25
|
+
|
|
26
|
+
// Gulp build execution (for multiple build targets)
|
|
21
27
|
require('./commands/Quackage-Command-Build.js'),
|
|
28
|
+
|
|
29
|
+
// Template handling
|
|
22
30
|
require('./commands/Quackage-Command-Boilerplate.js'),
|
|
23
|
-
require('./commands/Quackage-Command-
|
|
24
|
-
require('./commands/Quackage-Command-
|
|
31
|
+
require('./commands/Quackage-Command-ListTemplates.js'),
|
|
32
|
+
require('./commands/Quackage-Command-BuildTemplates.js')
|
|
25
33
|
]);
|
|
26
34
|
|
|
27
35
|
// Instantiate the file persistence service
|
|
28
|
-
_Pict.
|
|
29
|
-
_Pict.
|
|
36
|
+
_Pict.instantiateServiceProvider('FilePersistence');
|
|
37
|
+
_Pict.instantiateServiceProvider('DataGeneration');
|
|
30
38
|
// Add the Quackage Process Management service
|
|
31
|
-
_Pict.
|
|
39
|
+
_Pict.addAndInstantiateServiceType('QuackageProcess', require('./services/Quackage-Execute-Process.js'));
|
|
32
40
|
|
|
33
41
|
// Grab the current working directory for the quackage
|
|
34
42
|
_Pict.AppData.CWD = _Pict.QuackageProcess.cwd();
|
|
@@ -77,23 +77,36 @@ class QuackageCommandBuild extends libCommandLineCommand
|
|
|
77
77
|
//libFS.writeFileSync(`${this.fable.AppData.CWD}/gulpfile.js`, this.fable.parseTemplateByHash('Gulpfile-QuackageBase', { AppData: this.fable.AppData, Record: pAction }));
|
|
78
78
|
|
|
79
79
|
// Now execute the gulpfile using our custom service provider!
|
|
80
|
-
// We are forcing the gulp to run from the node_modules folder of the package -- this allows you to run quackage globally
|
|
81
|
-
let
|
|
80
|
+
// We are forcing the gulp to run from the node_modules folder of the package -- this allows you to run quackage globally or from the root of a monorepo
|
|
81
|
+
let tmpCWDGulpLocation = `${this.fable.AppData.CWD}/node_modules/.bin/gulp`;
|
|
82
|
+
let tmpRelativePackageGulpLocation = `${__dirname}/../../../.bin/gulp`;
|
|
83
|
+
let tmpGitRepositoryGulpLocation = `${__dirname}/../../node_modules/.bin/gulp`;
|
|
84
|
+
let tmpGulpLocation = tmpCWDGulpLocation;
|
|
85
|
+
// Check that gulp exists here
|
|
86
|
+
if (!libFS.existsSync(tmpGulpLocation))
|
|
87
|
+
{
|
|
88
|
+
this.log.info(`CWD Location does not contain an installation of gulp at [${tmpCWDGulpLocation}]; checking relative to the quackage package...`);
|
|
89
|
+
// Try the folder relative to quackage (wherever this packages' node modules are)
|
|
90
|
+
tmpGulpLocation = tmpRelativePackageGulpLocation;
|
|
91
|
+
}
|
|
92
|
+
if (!libFS.existsSync(tmpGulpLocation))
|
|
93
|
+
{
|
|
94
|
+
this.log.info(`Relative Quackage Package Location does not contain an installation of gulp at [${tmpRelativePackageGulpLocation}]; checking if you're running from the direct git repository...`);
|
|
95
|
+
// Try the folder relative to quackage (wherever this packages' node modules are)
|
|
96
|
+
tmpGulpLocation = tmpGitRepositoryGulpLocation;
|
|
97
|
+
}
|
|
98
|
+
if (!libFS.existsSync(tmpGulpLocation))
|
|
99
|
+
{
|
|
100
|
+
let tmpErrorMessage = `Not even the git checkout location has an installation of gulp at [${tmpGulpLocation}]... building cannot commence. We also tried CWD [${tmpCWDGulpLocation}] and relative node_modules [${tmpRelativePackageGulpLocation}]. Sorry! Maybe you need to run "npm install" somewhere??`;
|
|
101
|
+
this.log.info(tmpErrorMessage)
|
|
102
|
+
return fActionCallback(new Error(tmpErrorMessage));
|
|
103
|
+
}
|
|
104
|
+
this.log.info(`Quackage found gulp at [${tmpGulpLocation}] ... executing build from there.`);
|
|
105
|
+
|
|
82
106
|
this.fable.QuackageProcess.execute(`${tmpGulpLocation}`, [`--gulpfile`, `${this.fable.AppData.CWD}/.gulpfile-quackage.js`], { cwd: this.fable.AppData.CWD }, fActionCallback);
|
|
83
107
|
},
|
|
84
108
|
(pError) =>
|
|
85
109
|
{
|
|
86
|
-
// Now process the CopyAfterBuild directives
|
|
87
|
-
if (this.pict.ProgramConfiguration.CopyAfterBuild.length > 0)
|
|
88
|
-
{
|
|
89
|
-
//this.log.info(`Copying the following files to :`, { Files: this.pict.ProgramConfiguration.CopyAfterBuild });
|
|
90
|
-
for (let i = 0; i < this.pict.ProgramConfiguration.CopyAfterBuild.length; i++)
|
|
91
|
-
{
|
|
92
|
-
// TODO: FilePersistence needs a copy recursive with globbing.
|
|
93
|
-
//libFS.copyFileSync(`${this.fable.AppData.CWD}/${this.pict.ProgramConfiguration.CopyAfterBuild[i]}`, `${this.fable.AppData.CWD}/dist/${this.pict.ProgramConfiguration.CopyAfterBuild[i]}`);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
110
|
return fCallback(pError);
|
|
98
111
|
});
|
|
99
112
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const libCommandLineCommand = require('pict-service-commandlineutility').ServiceCommandLineCommand;
|
|
2
|
+
const libFS = require('fs');
|
|
3
|
+
|
|
4
|
+
class QuackageCommandBuild extends libCommandLineCommand
|
|
5
|
+
{
|
|
6
|
+
constructor(pFable, pManifest, pServiceHash)
|
|
7
|
+
{
|
|
8
|
+
super(pFable, pManifest, pServiceHash);
|
|
9
|
+
|
|
10
|
+
this.options.CommandKeyword = 'run-mocha-tests';
|
|
11
|
+
this.options.Description = 'Run mocha tests in your tests/ folder.';
|
|
12
|
+
|
|
13
|
+
this.options.CommandOptions.push({ Name: '-g, --grep [search_expression]', Description: 'A grep search expression for the subset of tests you want to run.' });
|
|
14
|
+
|
|
15
|
+
this.options.Aliases.push('test');
|
|
16
|
+
|
|
17
|
+
// Auto add the command on initialization
|
|
18
|
+
this.addCommand();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onRunAsync(fCallback)
|
|
22
|
+
{
|
|
23
|
+
// See if the user passed in a filter for tests
|
|
24
|
+
let tmpTestGrepExpression = (typeof(this.CommandOptions.search_expression) === 'undefined') ? false : this.CommandOptions.search_expression;
|
|
25
|
+
|
|
26
|
+
let tmpCWDMochaLocation = `${this.fable.AppData.CWD}/node_modules/.bin/mocha`;
|
|
27
|
+
let tmpRelativePackageMochaLocation = `${__dirname}/../../../.bin/mocha`;
|
|
28
|
+
let tmpGitRepositoryMochaLocation = `${__dirname}/../../node_modules/.bin/mocha`;
|
|
29
|
+
|
|
30
|
+
let tmpMochaLocation = tmpCWDMochaLocation;
|
|
31
|
+
|
|
32
|
+
// Check that mocha exists here
|
|
33
|
+
if (!libFS.existsSync(tmpMochaLocation))
|
|
34
|
+
{
|
|
35
|
+
this.log.info(`CWD Location does not contain an installation of mocha at [${tmpCWDMochaLocation}]; checking relative to the quackage package...`);
|
|
36
|
+
// Try the folder relative to quackage (wherever this packages' node modules are)
|
|
37
|
+
tmpMochaLocation = tmpRelativePackageMochaLocation;
|
|
38
|
+
}
|
|
39
|
+
if (!libFS.existsSync(tmpMochaLocation))
|
|
40
|
+
{
|
|
41
|
+
this.log.info(`Relative Quackage Package Location does not contain an installation of mocha at [${tmpRelativePackageMochaLocation}]; checking if you're running from the direct git repository...`);
|
|
42
|
+
// Try the folder relative to quackage (wherever this packages' node modules are)
|
|
43
|
+
tmpMochaLocation = tmpGitRepositoryMochaLocation;
|
|
44
|
+
}
|
|
45
|
+
if (!libFS.existsSync(tmpMochaLocation))
|
|
46
|
+
{
|
|
47
|
+
let tmpErrorMessage = `Not even the git checkout location has an installation of mocha at [${tmpMochaLocation}]... building cannot commence. We also tried CWD [${tmpCWDMochaLocation}] and relative node_modules [${tmpRelativePackageMochaLocation}]. Sorry! Maybe you need to run "npm install" somewhere??`;
|
|
48
|
+
this.log.info(tmpErrorMessage)
|
|
49
|
+
return fActionCallback(new Error(tmpErrorMessage));
|
|
50
|
+
}
|
|
51
|
+
this.log.info(`Quackage found mocha at [${tmpMochaLocation}] ... executing build from there.`);
|
|
52
|
+
|
|
53
|
+
if (tmpTestGrepExpression)
|
|
54
|
+
{
|
|
55
|
+
this.log.info(`Running mocha tests filtered to grep expression [${tmpTestGrepExpression}]`);
|
|
56
|
+
// The standard mocha command we've been using for grep:
|
|
57
|
+
// npx mocha -u tdd --exit -R spec --grep
|
|
58
|
+
this.fable.QuackageProcess.execute(`${tmpMochaLocation}`, [`-u`, `tdd`, '--exit', '-R', 'spec', '--grep', tmpTestGrepExpression], { cwd: this.fable.AppData.CWD }, fCallback);
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
{
|
|
62
|
+
// The standard mocha command we've been using:
|
|
63
|
+
// npx mocha -u tdd -R spec
|
|
64
|
+
this.fable.QuackageProcess.execute(`${tmpMochaLocation}`, [`-u`, `tdd`, '-R', 'spec'], { cwd: this.fable.AppData.CWD }, fCallback);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
module.exports = QuackageCommandBuild;
|
|
@@ -9,6 +9,9 @@ class BaseQuackageProcessExecutionService extends libQuackageExecuteProcessBase
|
|
|
9
9
|
super(pFable, pManifest, pServiceHash);
|
|
10
10
|
|
|
11
11
|
this.serviceType = 'QuackageProcess';
|
|
12
|
+
|
|
13
|
+
this.LogToDirectConsole = true;
|
|
14
|
+
this.LogToFableLog = false;
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
cwd()
|
|
@@ -38,12 +41,26 @@ class BaseQuackageProcessExecutionService extends libQuackageExecuteProcessBase
|
|
|
38
41
|
tmpProcess.stdout.on('data',
|
|
39
42
|
(pConsoleOutput) =>
|
|
40
43
|
{
|
|
41
|
-
this.
|
|
44
|
+
if (this.LogToDirectConsole)
|
|
45
|
+
{
|
|
46
|
+
console.log(pConsoleOutput.toString());
|
|
47
|
+
}
|
|
48
|
+
if (this.LogToFableLog)
|
|
49
|
+
{
|
|
50
|
+
this.log.info(pConsoleOutput);
|
|
51
|
+
}
|
|
42
52
|
});
|
|
43
53
|
tmpProcess.stderr.on('data',
|
|
44
54
|
(pConsoleOutput) =>
|
|
45
55
|
{
|
|
46
|
-
this.
|
|
56
|
+
if (this.LogToDirectConsole)
|
|
57
|
+
{
|
|
58
|
+
console.log(pConsoleOutput.toString());
|
|
59
|
+
}
|
|
60
|
+
if (this.LogToFableLog)
|
|
61
|
+
{
|
|
62
|
+
this.log.error(pConsoleOutput);
|
|
63
|
+
}
|
|
47
64
|
});
|
|
48
65
|
|
|
49
66
|
tmpProcess.stderr.on('error',
|
|
@@ -56,7 +73,7 @@ class BaseQuackageProcessExecutionService extends libQuackageExecuteProcessBase
|
|
|
56
73
|
tmpProcess.stderr.on('close',
|
|
57
74
|
(pError) =>
|
|
58
75
|
{
|
|
59
|
-
this.log.info(`Process completed successfully
|
|
76
|
+
this.log.info(`Process completed successfully with a quack!`);
|
|
60
77
|
return fCallback(pError);
|
|
61
78
|
});
|
|
62
79
|
}
|
|
File without changes
|
|
File without changes
|