@vamship/build-utils 1.6.1 → 2.0.0-1
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +40 -40
- package/src/directory.js +20 -24
- package/src/index.js +5 -17
- package/src/project.js +160 -433
- package/src/schema/project-definition.js +137 -0
- package/src/task-builder.js +100 -0
- package/src/task-builders/build-js-task-builder.js +57 -0
- package/src/task-builders/build-task-builder.js +78 -0
- package/src/task-builders/build-ts-task-builder.js +63 -0
- package/src/task-builders/build-ui-task-builder.js +45 -0
- package/src/task-builders/clean-task-builder.js +39 -0
- package/src/task-builders/copy-files-task-builder.js +78 -0
- package/src/task-builders/docs-js-task-builder.js +74 -0
- package/src/task-builders/docs-task-builder.js +74 -0
- package/src/task-builders/docs-ts-task-builder.js +52 -0
- package/src/task-builders/format-task-builder.js +61 -0
- package/src/task-builders/index.js +21 -17
- package/src/task-builders/lint-fix-task-builder.js +61 -0
- package/src/task-builders/lint-task-builder.js +56 -0
- package/src/task-builders/not-supported-task-builder.js +48 -0
- package/src/task-builders/package-aws-task-builder.js +105 -0
- package/src/task-builders/package-container-task-builder.js +132 -0
- package/src/task-builders/package-npm-task-builder.js +83 -0
- package/src/task-builders/package-task-builder.js +101 -0
- package/src/task-builders/publish-aws-task-builder.js +111 -0
- package/src/task-builders/publish-container-task-builder.js +103 -0
- package/src/task-builders/publish-npm-task-builder.js +60 -0
- package/src/task-builders/publish-task-builder.js +98 -0
- package/src/task-builders/test-task-builder.js +85 -0
- package/src/task-builders/test-ui-task-builder.js +65 -0
- package/src/task-builders/watch-task-builder.js +109 -0
- package/src/task-factories/api-task-factory.js +67 -0
- package/src/task-factories/aws-microservice-task-factory.js +53 -0
- package/src/task-factories/cli-task-factory.js +68 -0
- package/src/task-factories/container-task-factory.js +64 -0
- package/src/task-factories/index.js +8 -0
- package/src/task-factories/lib-task-factory.js +52 -0
- package/src/task-factories/ui-task-factory.js +48 -0
- package/src/task-factory.js +52 -0
- package/src/utils/semver-utils.js +29 -0
- package/src/utils/task-factory-utils.js +70 -0
- package/src/task-builders/build/build-js.js +0 -66
- package/src/task-builders/build/build-ts.js +0 -70
- package/src/task-builders/build/build-types.js +0 -47
- package/src/task-builders/build/build-ui.js +0 -67
- package/src/task-builders/build/index.js +0 -60
- package/src/task-builders/clean.js +0 -57
- package/src/task-builders/docs/docs-js.js +0 -41
- package/src/task-builders/docs/docs-ts.js +0 -40
- package/src/task-builders/docs/index.js +0 -32
- package/src/task-builders/format.js +0 -58
- package/src/task-builders/lint.js +0 -56
- package/src/task-builders/package/index.js +0 -50
- package/src/task-builders/package/package-aws.js +0 -58
- package/src/task-builders/package/package-docker.js +0 -128
- package/src/task-builders/package/package-npm.js +0 -25
- package/src/task-builders/package/package-types.js +0 -54
- package/src/task-builders/package/utils.js +0 -50
- package/src/task-builders/publish/index.js +0 -50
- package/src/task-builders/publish/publish-aws.js +0 -62
- package/src/task-builders/publish/publish-docker.js +0 -79
- package/src/task-builders/publish/publish-npm.js +0 -36
- package/src/task-builders/publish/publish-types.js +0 -36
- package/src/task-builders/test/index.js +0 -39
- package/src/task-builders/test/test-ui.js +0 -39
- package/src/task-builders/test/test.js +0 -67
package/package.json
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vamship/build-utils",
|
3
|
-
"version": "
|
3
|
+
"version": "2.0.0-1",
|
4
4
|
"description": "Utility library for build tooling",
|
5
|
+
"type": "module",
|
5
6
|
"main": "src/index.js",
|
6
7
|
"scripts": {
|
7
|
-
"clean": "rm -rf .nyc_output coverage",
|
8
|
-
"
|
9
|
-
"test": "
|
8
|
+
"clean": "rm -rf .nyc_output .coverage",
|
9
|
+
"watch:test": "NODE_OPTIONS=\"--experimental-vm-modules\" c8 mocha --watch",
|
10
|
+
"test": "NODE_OPTIONS=\"--experimental-vm-modules\" c8 mocha",
|
10
11
|
"lint": "eslint src/**/*.js test/**/*.js",
|
11
12
|
"format": "prettier --write \"{{src,test}/**/*.js,README.md}\"",
|
12
13
|
"docs": "jsdoc --readme README.md --package package.json --template node_modules/docdash --destination docs --recurse src",
|
13
14
|
"all": "npm run format && npm run lint && npm run test && npm run clean"
|
14
15
|
},
|
16
|
+
"engines": {
|
17
|
+
"node": ">= 20.11.0",
|
18
|
+
"npm": ">= 10.2.4"
|
19
|
+
},
|
15
20
|
"files": [
|
16
21
|
"package.json",
|
17
22
|
"LICENSE",
|
@@ -41,56 +46,51 @@
|
|
41
46
|
},
|
42
47
|
"homepage": "https://github.com/vamship/build-utils#readme",
|
43
48
|
"devDependencies": {
|
44
|
-
"
|
45
|
-
"chai
|
46
|
-
"
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
50
|
-
"
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"
|
49
|
+
"c8": "^9.1.0",
|
50
|
+
"chai": "^4.4.1",
|
51
|
+
"dot-prop": "^8.0.2",
|
52
|
+
"eslint": "^8.56.0",
|
53
|
+
"esmock": "^2.6.5",
|
54
|
+
"gulp-eslint-new": "^2.0.0",
|
55
|
+
"jsdoc": "^4.0.3",
|
56
|
+
"mocha": "^10.4.0",
|
57
|
+
"nodemon": "^3.1.0",
|
58
|
+
"prettier": "^3.2.5",
|
59
|
+
"rewire": "^7.0.0",
|
60
|
+
"sinon": "^17.0.2",
|
54
61
|
"sinon-chai": "^3.7.0"
|
55
62
|
},
|
56
63
|
"dependencies": {
|
57
|
-
"
|
64
|
+
"ajv": "^8.13.0",
|
65
|
+
"ansi-colors": "^4.1.3",
|
66
|
+
"change-case": "^5.4.4",
|
58
67
|
"delete": "^1.1.0",
|
59
|
-
"docdash": "^2.0.
|
60
|
-
"dotenv": "^16.
|
61
|
-
"dotenv-expand": "^
|
62
|
-
"execa": "^
|
63
|
-
"fancy-log": "
|
68
|
+
"docdash": "^2.0.2",
|
69
|
+
"dotenv": "^16.4.5",
|
70
|
+
"dotenv-expand": "^11.0.6",
|
71
|
+
"execa": "^9.0.1",
|
72
|
+
"fancy-log": ">=2.0.0",
|
64
73
|
"mkdirp": "^3.0.1",
|
65
|
-
"semver": "^7.
|
74
|
+
"semver": "^7.6.2"
|
66
75
|
},
|
67
76
|
"peerDependencies": {
|
68
77
|
"@typescript-eslint/eslint-plugin": ">= 5.1.0",
|
69
78
|
"@typescript-eslint/parser": ">= 5.1.0",
|
70
|
-
"
|
71
|
-
"
|
79
|
+
"c8": ">= 7.12.0",
|
80
|
+
"eslint": ">= 8.56.0",
|
81
|
+
"fancy-log": ">=2.0.0",
|
72
82
|
"gulp": ">= 4.0.2",
|
73
|
-
"gulp-eslint": ">= 6.0.0",
|
74
83
|
"gulp-prettier": ">= 4.0.0",
|
75
|
-
"gulp-typedoc": ">= 3.0.1",
|
76
84
|
"gulp-typescript": ">= 5.0.1",
|
77
85
|
"gulp-zip": ">= 5.1.0",
|
78
|
-
"jsdoc": ">=
|
79
|
-
"mocha": ">=
|
80
|
-
"
|
81
|
-
"
|
86
|
+
"jsdoc": ">= 3.6.7",
|
87
|
+
"mocha": ">= 9.1.2",
|
88
|
+
"prettier": ">= 2.4.1",
|
89
|
+
"typedoc": ">= 0.24.8"
|
82
90
|
},
|
83
91
|
"optionalDependencies": {
|
84
|
-
"
|
85
|
-
"
|
86
|
-
|
87
|
-
"overrides": {
|
88
|
-
"glob-parent": "^6.0.2",
|
89
|
-
"jsdoc": "^4.0.2",
|
90
|
-
"sanitize-html": "^2.10.0"
|
91
|
-
},
|
92
|
-
"engines": {
|
93
|
-
"node": ">= 14.18.1",
|
94
|
-
"npm": ">= 8.1.0"
|
92
|
+
"gulp-jsdoc3": "= 3.0.0",
|
93
|
+
"typedoc": ">=0.25.13",
|
94
|
+
"typescript": ">=5.4.5"
|
95
95
|
}
|
96
96
|
}
|
package/src/directory.js
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
const _path = require('path');
|
1
|
+
import _path from 'path';
|
4
2
|
|
5
3
|
const _sepRegexp = new RegExp(_path.sep.replace(/\\/g, '\\\\'), 'g');
|
6
4
|
|
@@ -8,13 +6,13 @@ const _sepRegexp = new RegExp(_path.sep.replace(/\\/g, '\\\\'), 'g');
|
|
8
6
|
* Abstract representation of a directory, with methods for traversal and
|
9
7
|
* glob pattern generation.
|
10
8
|
*/
|
11
|
-
class Directory {
|
9
|
+
export class Directory {
|
12
10
|
/**
|
13
11
|
* @param {String} path The path represented by this directory.
|
14
12
|
*/
|
15
13
|
constructor(path) {
|
16
14
|
if (typeof path !== 'string') {
|
17
|
-
throw new Error('Invalid path
|
15
|
+
throw new Error('Invalid path (arg #1)');
|
18
16
|
}
|
19
17
|
|
20
18
|
let relativePath = path.replace(process.cwd(), '');
|
@@ -39,10 +37,10 @@ class Directory {
|
|
39
37
|
*/
|
40
38
|
static createTree(rootPath, tree) {
|
41
39
|
if (typeof rootPath !== 'string') {
|
42
|
-
throw new Error('Invalid rootPath
|
40
|
+
throw new Error('Invalid rootPath (arg #1)');
|
43
41
|
}
|
44
42
|
if (!tree || tree instanceof Array || typeof tree !== 'object') {
|
45
|
-
throw new Error('Invalid tree
|
43
|
+
throw new Error('Invalid tree (arg #2)');
|
46
44
|
}
|
47
45
|
|
48
46
|
function createRecursive(parent, tree) {
|
@@ -72,10 +70,10 @@ class Directory {
|
|
72
70
|
*/
|
73
71
|
static traverseTree(root, callback) {
|
74
72
|
if (!(root instanceof Directory)) {
|
75
|
-
throw new Error('Invalid root directory
|
73
|
+
throw new Error('Invalid root directory (arg #1)');
|
76
74
|
}
|
77
75
|
if (typeof callback !== 'function') {
|
78
|
-
throw new Error('Invalid callback function
|
76
|
+
throw new Error('Invalid callback function (arg #2)');
|
79
77
|
}
|
80
78
|
function traverseRecursive(parent, level) {
|
81
79
|
callback(parent, level);
|
@@ -129,11 +127,11 @@ class Directory {
|
|
129
127
|
*/
|
130
128
|
addChild(name) {
|
131
129
|
if (typeof name !== 'string' || name.length <= 0) {
|
132
|
-
throw new Error('Invalid directory name
|
130
|
+
throw new Error('Invalid directory name (arg #1)');
|
133
131
|
}
|
134
132
|
if (name.match(/[\\/:]/)) {
|
135
133
|
throw new Error(
|
136
|
-
'Directory name cannot include path separators (:, \\ or /)'
|
134
|
+
'Directory name cannot include path separators (:, \\ or /)',
|
137
135
|
);
|
138
136
|
}
|
139
137
|
const child = new Directory(_path.join(this.path, name));
|
@@ -142,6 +140,16 @@ class Directory {
|
|
142
140
|
return child;
|
143
141
|
}
|
144
142
|
|
143
|
+
/**
|
144
|
+
* Returns an array containing all first level children of the current
|
145
|
+
* directory.
|
146
|
+
*
|
147
|
+
* @return {Directory[]} An array of first level children for the directory.
|
148
|
+
*/
|
149
|
+
getChildren() {
|
150
|
+
return this._children.slice();
|
151
|
+
}
|
152
|
+
|
145
153
|
/**
|
146
154
|
* Retrieves a child directory object by recursively searching through the
|
147
155
|
* current directory's child tree.
|
@@ -154,7 +162,7 @@ class Directory {
|
|
154
162
|
*/
|
155
163
|
getChild(path) {
|
156
164
|
if (typeof path !== 'string' || path.length <= 0) {
|
157
|
-
throw new Error('Invalid
|
165
|
+
throw new Error('Invalid childPath (arg #1)');
|
158
166
|
}
|
159
167
|
const tokens = path.split('/');
|
160
168
|
const child = tokens.reduce((result, name) => {
|
@@ -171,16 +179,6 @@ class Directory {
|
|
171
179
|
return child;
|
172
180
|
}
|
173
181
|
|
174
|
-
/**
|
175
|
-
* Returns an array containing all first level children of the current
|
176
|
-
* directory.
|
177
|
-
*
|
178
|
-
* @return {Directory[]} An array of first level children for the directory.
|
179
|
-
*/
|
180
|
-
getChildren() {
|
181
|
-
return this._children.slice();
|
182
|
-
}
|
183
|
-
|
184
182
|
/**
|
185
183
|
* Returns the path to a file within the current directory. This file
|
186
184
|
* does not have to actually exist on the file system, and can also be the
|
@@ -246,5 +244,3 @@ class Directory {
|
|
246
244
|
return `${this.globPath}**/${extension}`;
|
247
245
|
}
|
248
246
|
}
|
249
|
-
|
250
|
-
module.exports = Directory;
|
package/src/index.js
CHANGED
@@ -3,20 +3,8 @@
|
|
3
3
|
/**
|
4
4
|
* Utility library that can be used to create development tooling.
|
5
5
|
*/
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
/**
|
13
|
-
* Represents a specific project configuration.
|
14
|
-
*/
|
15
|
-
Project: require('./project'),
|
16
|
-
|
17
|
-
/**
|
18
|
-
* A collection of task builder functions that can be used to generate
|
19
|
-
* commonly used gulp files for projects.
|
20
|
-
*/
|
21
|
-
taskBuilders: require('./task-builders'),
|
22
|
-
};
|
6
|
+
export * from './directory.js';
|
7
|
+
export * from './project.js';
|
8
|
+
export * from './task-builders/index.js';
|
9
|
+
export * from './task-factories/index.js';
|
10
|
+
export { getTaskFactory } from './utils/task-factory-utils.js';
|