itee-tasks 1.0.3
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/.czrc +6 -0
- package/.github/workflows/node.js.yml +56 -0
- package/.releaserc.mjs +94 -0
- package/CHANGELOG.md +25 -0
- package/README.md +1 -0
- package/configs/builds/build.conf.mjs +1 -0
- package/configs/cleans/clean.conf.mjs +1 -0
- package/configs/docs/doc.conf.json +1 -0
- package/configs/lints/lint.conf.mjs +91 -0
- package/configs/refresh.conf.mjs +1 -0
- package/configs/tests/benchmarks/compute-benchmarks.conf.mjs +25 -0
- package/configs/tests/benchmarks/run-benchmarks-for-frontend.conf.mjs +41 -0
- package/configs/tests/benchmarks/run-benchmarks.conf.mjs +7 -0
- package/configs/tests/bundlings/check-bundling-from-esm-build-import.conf.mjs +45 -0
- package/configs/tests/bundlings/check-bundling-from-esm-files-direct.conf.mjs +45 -0
- package/configs/tests/bundlings/check-bundling-from-esm-files-import.conf.mjs +42 -0
- package/configs/tests/bundlings/check-bundling.conf.mjs +25 -0
- package/configs/tests/units/compute-unit-tests.conf.mjs +25 -0
- package/configs/tests/units/run-unit-tests-for-frontend.conf.mjs +15 -0
- package/configs/tests/units/run-unit-tests.conf.mjs +7 -0
- package/gulpfile.mjs +28 -0
- package/package.json +91 -0
- package/sources/_utils.mjs +389 -0
- package/sources/builds/build.task.mjs +55 -0
- package/sources/cleans/clean.task.mjs +36 -0
- package/sources/docs/doc.task.mjs +49 -0
- package/sources/helps/help.task.mjs +154 -0
- package/sources/index.mjs +21 -0
- package/sources/lints/lint.task.mjs +47 -0
- package/sources/refresh.mjs +100 -0
- package/sources/releases/release.task.mjs +31 -0
- package/sources/tests/benchmarks/compute-benchmarks.task.mjs +224 -0
- package/sources/tests/benchmarks/run-benchmarks-for-backend.task.mjs +42 -0
- package/sources/tests/benchmarks/run-benchmarks-for-frontend.task.mjs +52 -0
- package/sources/tests/benchmarks/run-benchmarks.task.mjs +21 -0
- package/sources/tests/bundlings/check-bundling-from-esm-build-import.task.mjs +131 -0
- package/sources/tests/bundlings/check-bundling-from-esm-files-direct.task.mjs +88 -0
- package/sources/tests/bundlings/check-bundling-from-esm-files-import.task.mjs +106 -0
- package/sources/tests/bundlings/check-bundling.task.mjs +23 -0
- package/sources/tests/run-tests.task.mjs +21 -0
- package/sources/tests/units/compute-unit-tests.task.mjs +535 -0
- package/sources/tests/units/run-unit-tests-for-backend.task.mjs +47 -0
- package/sources/tests/units/run-unit-tests-for-frontend.task.mjs +52 -0
- package/sources/tests/units/run-unit-tests.task.mjs +21 -0
- package/tests/benchmarks/default/default.bench.js +1 -0
- package/tests/benchmarks/itee-tasks.benchmarks.js +8 -0
- package/tests/units/default/default.unit.mjs +1 -0
- package/tests/units/itee-tasks.units.mjs +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "itee-tasks",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Allow to manage all commons itee gulp tasks into one place ",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"itee",
|
|
7
|
+
"gulp",
|
|
8
|
+
"tasks"
|
|
9
|
+
],
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Itee (Tristan Valcke)",
|
|
12
|
+
"url": "https://github.com/Itee"
|
|
13
|
+
},
|
|
14
|
+
"contributors": [],
|
|
15
|
+
"license": "BSD-3-Clause",
|
|
16
|
+
"private": false,
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Itee/itee-tasks.git"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "sources/index.mjs",
|
|
23
|
+
"homepage": "https://github.com/Itee/itee-tasks#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/Itee/itee-tasks/issues"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"default": "gulp --tasks",
|
|
29
|
+
"refresh": "node ./sources/refresh.mjs",
|
|
30
|
+
"help": "gulp help",
|
|
31
|
+
"patch": "gulp patch",
|
|
32
|
+
"clean": "gulp clean",
|
|
33
|
+
"lint": "gulp lint",
|
|
34
|
+
"doc": "gulp doc",
|
|
35
|
+
"build": "gulp build",
|
|
36
|
+
"tests:run": "gulp run-tests",
|
|
37
|
+
"tests:bundling": "gulp check-bundling",
|
|
38
|
+
"tests:bundling:build-import": "gulp check-bundling-from-esm-build-import",
|
|
39
|
+
"tests:bundling:files-import": "gulp check-bundling-from-esm-files-import",
|
|
40
|
+
"tests:bundling:files-direct": "gulp check-bundling-from-esm-files-direct",
|
|
41
|
+
"tests:benches:compute": "gulp compute-benchmarks",
|
|
42
|
+
"tests:benches:run": "gulp run-benchmarks",
|
|
43
|
+
"tests:benches:run:back": "gulp run-benchmarks-for-backend",
|
|
44
|
+
"tests:benches:run:front": "gulp run-benchmarks-for-frontend",
|
|
45
|
+
"tests:units:compute": "gulp compute-unit-tests",
|
|
46
|
+
"tests:units:run": "gulp run-unit-tests",
|
|
47
|
+
"tests:units:run:back": "gulp run-unit-tests-for-backend",
|
|
48
|
+
"tests:units:run:front": "gulp run-unit-tests-for-frontend",
|
|
49
|
+
"release": "gulp release",
|
|
50
|
+
"semantic-release": "semantic-release --dry-run --no-ci",
|
|
51
|
+
"postversion": "gulp build"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"cz-emoji": "^1.3.2-canary.2",
|
|
55
|
+
"semantic-release": "^24.2.9",
|
|
56
|
+
"semantic-release-gitmoji": "^1.6.8"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@eslint/js": "^9.39.2",
|
|
60
|
+
"@itee/benchmarks-framework": "^1.0.0",
|
|
61
|
+
"@itee/json-reporter": "^1.0.2",
|
|
62
|
+
"@rollup/plugin-commonjs": "^28.0.9",
|
|
63
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
64
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
65
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
66
|
+
"@semantic-release/git": "^10.0.1",
|
|
67
|
+
"@semantic-release/github": "^11.0.6",
|
|
68
|
+
"@semantic-release/npm": "^12.0.2",
|
|
69
|
+
"@web/test-runner": "^0.20.2",
|
|
70
|
+
"@web/test-runner-playwright": "^0.11.1",
|
|
71
|
+
"ansi-colors": "^4.1.3",
|
|
72
|
+
"benchmark": "^2.1.4",
|
|
73
|
+
"del": "^8.0.1",
|
|
74
|
+
"eslint": "^9.39.2",
|
|
75
|
+
"eslint-plugin-mocha": "^11.2.0",
|
|
76
|
+
"fancy-log": "^2.0.0",
|
|
77
|
+
"figlet": "^1.9.4",
|
|
78
|
+
"glob": "^13.0.0",
|
|
79
|
+
"globals": "^16.5.0",
|
|
80
|
+
"gulp": "^5.0.1",
|
|
81
|
+
"ink-docstrap": "^1.3.2",
|
|
82
|
+
"itee-validators": "^6.0.0",
|
|
83
|
+
"jsdoc": "^4.0.5",
|
|
84
|
+
"lodash": "^4.17.21",
|
|
85
|
+
"mochawesome": "^7.1.4",
|
|
86
|
+
"platform": "^1.3.6",
|
|
87
|
+
"rollup": "^4.55.1",
|
|
88
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
89
|
+
"rollup-plugin-re": "^1.0.7"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import colors from 'ansi-colors'
|
|
2
|
+
import childProcess from 'child_process'
|
|
3
|
+
import log from 'fancy-log'
|
|
4
|
+
import { glob } from 'glob'
|
|
5
|
+
import {
|
|
6
|
+
parallel,
|
|
7
|
+
series
|
|
8
|
+
} from 'gulp'
|
|
9
|
+
import {
|
|
10
|
+
existsSync,
|
|
11
|
+
mkdirSync,
|
|
12
|
+
readFileSync,
|
|
13
|
+
writeFileSync
|
|
14
|
+
} from 'node:fs'
|
|
15
|
+
import {
|
|
16
|
+
dirname,
|
|
17
|
+
extname,
|
|
18
|
+
join,
|
|
19
|
+
normalize,
|
|
20
|
+
relative,
|
|
21
|
+
} from 'node:path'
|
|
22
|
+
import { fileURLToPath } from 'node:url'
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
red,
|
|
26
|
+
green,
|
|
27
|
+
yellow,
|
|
28
|
+
blue,
|
|
29
|
+
magenta,
|
|
30
|
+
cyan
|
|
31
|
+
} = colors
|
|
32
|
+
|
|
33
|
+
///
|
|
34
|
+
|
|
35
|
+
function createDirectoryIfNotExist( directoryPath ) {
|
|
36
|
+
|
|
37
|
+
if ( !existsSync( directoryPath ) ) {
|
|
38
|
+
log( 'Creating', green( directoryPath ) )
|
|
39
|
+
mkdirSync( directoryPath, { recursive: true } )
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getJsonFrom( path ) {
|
|
45
|
+
|
|
46
|
+
const buffer = readFileSync( path )
|
|
47
|
+
return JSON.parse( buffer.toString() )
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getConfigurationPathFor( configurationLocation ) {
|
|
52
|
+
|
|
53
|
+
const packageConfigurationPath = join( packageTasksConfigurationsDirectory, configurationLocation )
|
|
54
|
+
const defaultConfigurationPath = join( iteePackageConfigurationsDirectory, configurationLocation )
|
|
55
|
+
|
|
56
|
+
let configurationPath
|
|
57
|
+
|
|
58
|
+
if ( existsSync( packageConfigurationPath ) ) {
|
|
59
|
+
|
|
60
|
+
configurationPath = packageConfigurationPath
|
|
61
|
+
|
|
62
|
+
} else if ( existsSync( defaultConfigurationPath ) ) {
|
|
63
|
+
|
|
64
|
+
configurationPath = defaultConfigurationPath
|
|
65
|
+
|
|
66
|
+
} else {
|
|
67
|
+
|
|
68
|
+
throw new Error( `Unable to find configuration for path ${ packageConfigurationPath } or ${ defaultConfigurationPath }` )
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return configurationPath
|
|
73
|
+
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function getConfigurationFrom( path ) {
|
|
77
|
+
|
|
78
|
+
let jsonData = null
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
|
|
82
|
+
if ( extname( path ) !== '.json' ) {
|
|
83
|
+
|
|
84
|
+
const moduleData = await import(path)
|
|
85
|
+
jsonData = moduleData.default
|
|
86
|
+
|
|
87
|
+
} else {
|
|
88
|
+
|
|
89
|
+
jsonData = getJsonFrom( path )
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
} catch ( e ) {
|
|
94
|
+
|
|
95
|
+
log( red( e ) )
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return jsonData
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function createFile( filePath, fileContent ) {
|
|
104
|
+
|
|
105
|
+
log( 'Creating', green( filePath ) )
|
|
106
|
+
writeFileSync( filePath, fileContent )
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function getFilesFrom( globPattern, filter = ( any ) => true ) {
|
|
111
|
+
|
|
112
|
+
return glob.sync( globPattern )
|
|
113
|
+
.map( filePath => normalize( filePath ) )
|
|
114
|
+
.filter( filter )
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
///
|
|
119
|
+
|
|
120
|
+
function getPackageRootDirectory() {
|
|
121
|
+
|
|
122
|
+
let __dirname
|
|
123
|
+
|
|
124
|
+
if ( import.meta.dirname ) {
|
|
125
|
+
__dirname = import.meta.dirname
|
|
126
|
+
} else if ( import.meta.filename ) {
|
|
127
|
+
__dirname = dirname( import.meta.filename )
|
|
128
|
+
} else if ( import.meta.url ) {
|
|
129
|
+
const __filename = fileURLToPath( import.meta.url )
|
|
130
|
+
__dirname = dirname( __filename )
|
|
131
|
+
} else {
|
|
132
|
+
throw new Error( 'Unable to retrieve module dirname.' )
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return join( __dirname, '..' )
|
|
136
|
+
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const iteePackageRootDirectory = getPackageRootDirectory()
|
|
140
|
+
const iteePackageJsonPath = join( iteePackageRootDirectory, 'package.json' )
|
|
141
|
+
const iteePackageConfigurationsDirectory = join( iteePackageRootDirectory, 'configs' )
|
|
142
|
+
const iteePackageNodeModulesDirectory = join( iteePackageRootDirectory, 'node_modules' )
|
|
143
|
+
const iteePackageSourcesDirectory = join( iteePackageRootDirectory, 'sources' )
|
|
144
|
+
|
|
145
|
+
const packageRootDirectory = iteePackageRootDirectory.includes('node_modules') ? join( iteePackageRootDirectory, '../../' ) : iteePackageRootDirectory
|
|
146
|
+
const packageTasksDirectory = join( packageRootDirectory, '.tasks' )
|
|
147
|
+
const packageTasksConfigurationsDirectory = join( packageTasksDirectory, 'configs' )
|
|
148
|
+
const packageNodeModulesDirectory = join( packageRootDirectory, 'node_modules' )
|
|
149
|
+
const packageBuildsDirectory = join( packageRootDirectory, 'builds' )
|
|
150
|
+
const packageSourcesDirectory = join( packageRootDirectory, 'sources' )
|
|
151
|
+
const packageSourcesBackendDirectory = join( packageSourcesDirectory, 'backend' )
|
|
152
|
+
const packageSourcesCommonDirectory = join( packageSourcesDirectory, 'common' )
|
|
153
|
+
const packageSourcesFrontendDirectory = join( packageSourcesDirectory, 'frontend' )
|
|
154
|
+
const packageTestsDirectory = join( packageRootDirectory, 'tests' )
|
|
155
|
+
const packageTestsBenchmarksDirectory = join( packageTestsDirectory, 'benchmarks' )
|
|
156
|
+
const packageTestsBundlesDirectory = join( packageTestsDirectory, 'bundles' )
|
|
157
|
+
const packageTestsUnitsDirectory = join( packageTestsDirectory, 'units' )
|
|
158
|
+
const packageDocsDirectory = join( packageRootDirectory, 'docs' )
|
|
159
|
+
const packageTutorialsDirectory = join( packageRootDirectory, 'tutorials' )
|
|
160
|
+
const packageJsonPath = join( packageRootDirectory, 'package.json' )
|
|
161
|
+
|
|
162
|
+
///
|
|
163
|
+
|
|
164
|
+
const packageJson = getJsonFrom( packageJsonPath )
|
|
165
|
+
const packageName = packageJson.name
|
|
166
|
+
const packageVersion = packageJson.version
|
|
167
|
+
const packageDescription = packageJson.description
|
|
168
|
+
|
|
169
|
+
function getPrettyPackageName( separator = ' ' ) {
|
|
170
|
+
|
|
171
|
+
let prettyPackageName = ''
|
|
172
|
+
|
|
173
|
+
const nameSplits = packageName.split( '-' )
|
|
174
|
+
for ( const nameSplit of nameSplits ) {
|
|
175
|
+
prettyPackageName += nameSplit.charAt( 0 ).toUpperCase() + nameSplit.slice( 1 ) + separator
|
|
176
|
+
}
|
|
177
|
+
prettyPackageName = prettyPackageName.slice( 0, -1 )
|
|
178
|
+
|
|
179
|
+
return prettyPackageName
|
|
180
|
+
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function getPrettyPackageVersion() {
|
|
184
|
+
|
|
185
|
+
return 'v' + packageVersion
|
|
186
|
+
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function getPrettyNodeVersion() {
|
|
190
|
+
|
|
191
|
+
let nodeVersion = 'vX.x.ₓ'
|
|
192
|
+
|
|
193
|
+
try {
|
|
194
|
+
nodeVersion = childProcess.execFileSync( 'node', [ '--version' ] )
|
|
195
|
+
.toString()
|
|
196
|
+
.replace( /(\r\n|\n|\r)/gm, '' )
|
|
197
|
+
} catch ( e ) {
|
|
198
|
+
log( red( e ) )
|
|
199
|
+
|
|
200
|
+
if ( e.message.includes( 'ENOENT' ) ) {
|
|
201
|
+
nodeVersion += yellow( ' Not seems to be accessible from the path environment.' )
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return ' node: ' + nodeVersion
|
|
206
|
+
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function getPrettyNpmVersion() {
|
|
210
|
+
|
|
211
|
+
let npmVersion = 'X.x.ₓ'
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
npmVersion = childProcess.execFileSync( 'npm', [ '--version' ] )
|
|
215
|
+
.toString()
|
|
216
|
+
.replace( /(\r\n|\n|\r)/gm, '' )
|
|
217
|
+
} catch ( e ) {
|
|
218
|
+
log( red( e ) )
|
|
219
|
+
|
|
220
|
+
if ( e.message.includes( 'ENOENT' ) ) {
|
|
221
|
+
npmVersion += yellow( ' Not seems to be accessible from the path environment.' )
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return ' npm: v' + npmVersion
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
///
|
|
230
|
+
|
|
231
|
+
async function getTasksFrom( taskFiles = [] ) {
|
|
232
|
+
|
|
233
|
+
const tasks = []
|
|
234
|
+
for ( const taskFile of taskFiles ) {
|
|
235
|
+
const relativeTaskFile = relative( packageRootDirectory, taskFile )
|
|
236
|
+
|
|
237
|
+
try {
|
|
238
|
+
|
|
239
|
+
const module = await import(taskFile)
|
|
240
|
+
|
|
241
|
+
const exportStrings = []
|
|
242
|
+
for ( const moduleKey in module ) {
|
|
243
|
+
const task = module[ moduleKey ]
|
|
244
|
+
tasks.push( task )
|
|
245
|
+
|
|
246
|
+
const name = task.name ?? null
|
|
247
|
+
const displayName = task.displayName ?? null
|
|
248
|
+
const fullName = ( moduleKey !== name ) ? `${ blue( moduleKey ) }( ${ magenta( name ) } )` : `${ blue( name ) }`
|
|
249
|
+
const exportAs = ( displayName ) ? ` as ${ cyan( displayName ) }` : ''
|
|
250
|
+
const exportString = fullName + exportAs
|
|
251
|
+
exportStrings.push( exportString )
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
//log( 'Process ', green( relativeTaskFile ), `with task${ ( exportStrings.length > 1 ) ? 's' : '' }`, exportStrings.join( ', ' ) )
|
|
255
|
+
|
|
256
|
+
} catch ( error ) {
|
|
257
|
+
|
|
258
|
+
log( 'Error ', red( relativeTaskFile ), error.message )
|
|
259
|
+
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return tasks
|
|
265
|
+
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
async function serializeTasksFrom( taskFiles = [] ) {
|
|
269
|
+
|
|
270
|
+
const tasks = await getTasksFrom( taskFiles )
|
|
271
|
+
return series( ...tasks )
|
|
272
|
+
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async function parallelizeTasksFrom( taskFiles = [] ) {
|
|
276
|
+
|
|
277
|
+
const tasks = await getTasksFrom( taskFiles )
|
|
278
|
+
return parallel( ...tasks )
|
|
279
|
+
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
///
|
|
283
|
+
|
|
284
|
+
function logLoadingTask( filename, task, configurationPath ) {
|
|
285
|
+
|
|
286
|
+
const taskPath = relative( packageRootDirectory, filename )
|
|
287
|
+
|
|
288
|
+
let logValue = `Loading ${ green( taskPath ) } with task ${ blue( task.displayName ) }`
|
|
289
|
+
|
|
290
|
+
if ( configurationPath ) {
|
|
291
|
+
|
|
292
|
+
const relativeConfigurationPath = relative( packageRootDirectory, configurationPath )
|
|
293
|
+
logValue += ` and configuration from ${ cyan( relativeConfigurationPath ) }`
|
|
294
|
+
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
log( logValue )
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
///
|
|
302
|
+
|
|
303
|
+
function IndenterFactory( indentationChar = '\t', indentationLevel = 5 ) {
|
|
304
|
+
|
|
305
|
+
const indentationLevels = {}
|
|
306
|
+
let currentProperty = 'I_'
|
|
307
|
+
for ( let currentIndentationLevel = 1 ; currentIndentationLevel <= indentationLevel ; currentIndentationLevel++ ) {
|
|
308
|
+
indentationLevels[ currentProperty ] = indentationChar.repeat( currentIndentationLevel )
|
|
309
|
+
currentProperty += '_'
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return {
|
|
313
|
+
I: new Indenter( indentationChar ),
|
|
314
|
+
...indentationLevels
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
class Indenter {
|
|
320
|
+
|
|
321
|
+
constructor( indentationChar = '\t' ) {
|
|
322
|
+
|
|
323
|
+
this.indentationChar = indentationChar
|
|
324
|
+
this.currentIndentationLevel = 0
|
|
325
|
+
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
_( indentationLevel = null ) {
|
|
329
|
+
return this.indentationChar.repeat( indentationLevel ?? this.currentIndentationLevel )
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
deeper( level = 1 ) {
|
|
333
|
+
this.currentIndentationLevel += level
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
shallower( level = 1 ) {
|
|
337
|
+
this.currentIndentationLevel -= level
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
///
|
|
343
|
+
|
|
344
|
+
export {
|
|
345
|
+
createDirectoryIfNotExist,
|
|
346
|
+
getJsonFrom,
|
|
347
|
+
getConfigurationPathFor,
|
|
348
|
+
getConfigurationFrom,
|
|
349
|
+
createFile,
|
|
350
|
+
getFilesFrom,
|
|
351
|
+
|
|
352
|
+
iteePackageRootDirectory,
|
|
353
|
+
iteePackageJsonPath,
|
|
354
|
+
iteePackageConfigurationsDirectory,
|
|
355
|
+
iteePackageNodeModulesDirectory,
|
|
356
|
+
iteePackageSourcesDirectory,
|
|
357
|
+
|
|
358
|
+
packageRootDirectory,
|
|
359
|
+
packageTasksDirectory,
|
|
360
|
+
packageTasksConfigurationsDirectory,
|
|
361
|
+
packageNodeModulesDirectory,
|
|
362
|
+
packageBuildsDirectory,
|
|
363
|
+
packageSourcesDirectory,
|
|
364
|
+
packageSourcesBackendDirectory,
|
|
365
|
+
packageSourcesCommonDirectory,
|
|
366
|
+
packageSourcesFrontendDirectory,
|
|
367
|
+
packageTestsDirectory,
|
|
368
|
+
packageTestsBenchmarksDirectory,
|
|
369
|
+
packageTestsBundlesDirectory,
|
|
370
|
+
packageTestsUnitsDirectory,
|
|
371
|
+
packageDocsDirectory,
|
|
372
|
+
packageTutorialsDirectory,
|
|
373
|
+
packageJsonPath,
|
|
374
|
+
packageJson,
|
|
375
|
+
packageName,
|
|
376
|
+
packageVersion,
|
|
377
|
+
packageDescription,
|
|
378
|
+
getPrettyPackageName,
|
|
379
|
+
getPrettyPackageVersion,
|
|
380
|
+
getPrettyNodeVersion,
|
|
381
|
+
getPrettyNpmVersion,
|
|
382
|
+
|
|
383
|
+
getTasksFrom,
|
|
384
|
+
serializeTasksFrom,
|
|
385
|
+
parallelizeTasksFrom,
|
|
386
|
+
logLoadingTask,
|
|
387
|
+
|
|
388
|
+
IndenterFactory as Indenter
|
|
389
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import colors from 'ansi-colors'
|
|
2
|
+
import log from 'fancy-log'
|
|
3
|
+
import { join } from 'path'
|
|
4
|
+
import { rollup } from 'rollup'
|
|
5
|
+
import {
|
|
6
|
+
getConfigurationFrom,
|
|
7
|
+
getConfigurationPathFor,
|
|
8
|
+
logLoadingTask
|
|
9
|
+
} from '../_utils.mjs'
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
red,
|
|
13
|
+
green,
|
|
14
|
+
yellow,
|
|
15
|
+
} = colors
|
|
16
|
+
|
|
17
|
+
const configurationLocation = join( 'builds', 'build.conf.mjs' )
|
|
18
|
+
const configurationPath = getConfigurationPathFor( configurationLocation )
|
|
19
|
+
|
|
20
|
+
const buildTask = async ( done ) => {
|
|
21
|
+
|
|
22
|
+
const configuration = await getConfigurationFrom( configurationPath )
|
|
23
|
+
for ( let config of configuration ) {
|
|
24
|
+
|
|
25
|
+
if ( config === undefined || config === null || config.length === 0 ) {
|
|
26
|
+
log( yellow( 'Empty configuration object... Skip it!' ) )
|
|
27
|
+
continue
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
log( 'Building', green( config.output.file ) )
|
|
31
|
+
|
|
32
|
+
try {
|
|
33
|
+
|
|
34
|
+
const bundle = await rollup( config )
|
|
35
|
+
await bundle.write( config.output )
|
|
36
|
+
|
|
37
|
+
} catch ( error ) {
|
|
38
|
+
|
|
39
|
+
done( red( error.message ) )
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
done()
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
buildTask.displayName = 'build'
|
|
50
|
+
buildTask.description = 'Todo...'
|
|
51
|
+
buildTask.flags = null
|
|
52
|
+
|
|
53
|
+
logLoadingTask( import.meta.filename, buildTask, configurationPath )
|
|
54
|
+
|
|
55
|
+
export { buildTask }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import colors from 'ansi-colors'
|
|
2
|
+
import { deleteAsync } from 'del'
|
|
3
|
+
import log from 'fancy-log'
|
|
4
|
+
import { join } from 'path'
|
|
5
|
+
import {
|
|
6
|
+
getConfigurationFrom,
|
|
7
|
+
getConfigurationPathFor,
|
|
8
|
+
logLoadingTask
|
|
9
|
+
} from '../_utils.mjs'
|
|
10
|
+
|
|
11
|
+
const { red } = colors
|
|
12
|
+
|
|
13
|
+
const configurationLocation = join( 'cleans', 'clean.conf.mjs' )
|
|
14
|
+
const configurationPath = getConfigurationPathFor( configurationLocation )
|
|
15
|
+
const configuration = await getConfigurationFrom( configurationPath )
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @method npm run clean
|
|
19
|
+
* @global
|
|
20
|
+
* @description Will delete builds and temporary folders
|
|
21
|
+
*/
|
|
22
|
+
const cleanTask = () => deleteAsync( configuration, {
|
|
23
|
+
onProgress: progress => {
|
|
24
|
+
const path = progress.path || 'Nothing to clean...'
|
|
25
|
+
const percent = Math.round( progress.percent * 100 )
|
|
26
|
+
const spacer = percent === 100 ? '' : ' '
|
|
27
|
+
log( `Deleting [${ progress.deletedCount }/${ progress.totalCount }]<${ percent }%>${ spacer }:`, red( path ) )
|
|
28
|
+
}
|
|
29
|
+
} )
|
|
30
|
+
cleanTask.displayName = 'clean'
|
|
31
|
+
cleanTask.description = 'Will delete builds and temporary folders'
|
|
32
|
+
cleanTask.flags = null
|
|
33
|
+
|
|
34
|
+
logLoadingTask( import.meta.filename, cleanTask, configurationPath )
|
|
35
|
+
|
|
36
|
+
export { cleanTask }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import colors from 'ansi-colors'
|
|
2
|
+
import log from 'fancy-log'
|
|
3
|
+
import child_process from 'node:child_process'
|
|
4
|
+
import { promisify } from 'node:util'
|
|
5
|
+
import { join } from 'path'
|
|
6
|
+
import {
|
|
7
|
+
getConfigurationPathFor,
|
|
8
|
+
logLoadingTask
|
|
9
|
+
} from '../_utils.mjs'
|
|
10
|
+
|
|
11
|
+
const execFile = promisify( child_process.execFile )
|
|
12
|
+
const { red } = colors
|
|
13
|
+
|
|
14
|
+
const configurationLocation = join( 'docs', 'doc.conf.json' )
|
|
15
|
+
const configurationPath = getConfigurationPathFor( configurationLocation )
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @method npm run doc
|
|
19
|
+
* @global
|
|
20
|
+
* @description Will generate this documentation
|
|
21
|
+
*/
|
|
22
|
+
const docTask = async ( done ) => {
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
|
|
26
|
+
const { stdout } = await execFile(
|
|
27
|
+
'./node_modules/.bin/jsdoc',
|
|
28
|
+
[
|
|
29
|
+
'--configure', configurationPath,
|
|
30
|
+
'--destination', './docs'
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
log( stdout )
|
|
34
|
+
done()
|
|
35
|
+
|
|
36
|
+
} catch ( error ) {
|
|
37
|
+
|
|
38
|
+
done( red( error.message ) )
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
docTask.displayName = 'doc'
|
|
44
|
+
docTask.description = 'Will generate this documentation.'
|
|
45
|
+
docTask.flags = null
|
|
46
|
+
|
|
47
|
+
logLoadingTask( import.meta.filename, docTask, configurationPath )
|
|
48
|
+
|
|
49
|
+
export { docTask }
|