@itee/tasks 1.3.1 → 1.3.2

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.
Files changed (66) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/docs/cleans_clean.task.mjs.html +10 -11
  3. package/docs/global.html +14 -170
  4. package/docs/helps_help.task.mjs.html +24 -22
  5. package/docs/index.html +4 -4
  6. package/docs/lints_lint.task.mjs.html +14 -12
  7. package/docs/patches_patch.task.mjs.html +13 -5
  8. package/docs/quicksearch.html +1 -1
  9. package/docs/releases_release.task.mjs.html +5 -5
  10. package/docs/tests_benchmarks_compute-benchmarks.task.mjs.html +35 -38
  11. package/docs/tests_benchmarks_run-benchmarks-for-backend.task.mjs.html +20 -18
  12. package/docs/tests_benchmarks_run-benchmarks-for-frontend.task.mjs.html +10 -14
  13. package/docs/tests_bundlings_check-bundling-from-esm-files-direct.task.mjs.html +22 -34
  14. package/docs/tests_bundlings_check-bundling.task.mjs.html +5 -5
  15. package/docs/tests_run-tests.task.mjs.html +5 -5
  16. package/docs/tests_units_compute-unit-tests.task.mjs.html +40 -42
  17. package/docs/tests_units_run-unit-tests-for-backend.task.mjs.html +21 -19
  18. package/docs/tests_units_run-unit-tests-for-frontend.task.mjs.html +9 -13
  19. package/package.json +4 -4
  20. package/{sources → scripts}/refresh.mjs +10 -12
  21. package/sources/builds/build.conf.mjs +3 -0
  22. package/sources/builds/build.task.mjs +12 -14
  23. package/{configs → sources}/cleans/clean.conf.mjs +1 -1
  24. package/sources/cleans/clean.task.mjs +6 -7
  25. package/{configs → sources}/docs/doc.conf.mjs +8 -7
  26. package/sources/docs/doc.task.mjs +7 -8
  27. package/sources/helps/help.task.mjs +19 -17
  28. package/{configs → sources}/lints/lint.conf.mjs +18 -18
  29. package/sources/lints/lint.task.mjs +10 -8
  30. package/sources/patches/patch.task.mjs +9 -1
  31. package/sources/releases/release.task.mjs +1 -1
  32. package/sources/{index.mjs → tasks.js} +7 -2
  33. package/sources/tests/benchmarks/compute-benchmarks.conf.mjs +5 -0
  34. package/sources/tests/benchmarks/compute-benchmarks.task.mjs +31 -34
  35. package/sources/tests/benchmarks/run-benchmarks-for-backend.task.mjs +16 -14
  36. package/{configs → sources}/tests/benchmarks/run-benchmarks-for-frontend.conf.mjs +6 -6
  37. package/sources/tests/benchmarks/run-benchmarks-for-frontend.task.mjs +6 -10
  38. package/{configs → sources}/tests/benchmarks/run-benchmarks.conf.mjs +2 -2
  39. package/sources/tests/benchmarks/run-benchmarks.task.mjs +3 -3
  40. package/{configs → sources}/tests/bundlings/check-bundling-from-esm-build-import.conf.mjs +12 -10
  41. package/sources/tests/bundlings/check-bundling-from-esm-build-import.task.mjs +17 -17
  42. package/{configs → sources}/tests/bundlings/check-bundling-from-esm-files-direct.conf.mjs +20 -14
  43. package/sources/tests/bundlings/check-bundling-from-esm-files-direct.task.mjs +17 -29
  44. package/{configs → sources}/tests/bundlings/check-bundling-from-esm-files-import.conf.mjs +15 -13
  45. package/sources/tests/bundlings/check-bundling-from-esm-files-import.task.mjs +17 -29
  46. package/sources/tests/bundlings/check-bundling.task.mjs +1 -1
  47. package/sources/tests/run-tests.task.mjs +1 -1
  48. package/sources/tests/units/compute-unit-tests.conf.mjs +5 -0
  49. package/sources/tests/units/compute-unit-tests.task.mjs +36 -38
  50. package/sources/tests/units/run-unit-tests-for-backend.task.mjs +17 -15
  51. package/{configs → sources}/tests/units/run-unit-tests-for-frontend.conf.mjs +1 -1
  52. package/sources/tests/units/run-unit-tests-for-frontend.task.mjs +5 -9
  53. package/{configs → sources}/tests/units/run-unit-tests.conf.mjs +2 -2
  54. package/sources/tests/units/run-unit-tests.task.mjs +3 -3
  55. package/sources/utils/builds.mjs +238 -0
  56. package/sources/utils/colors.mjs +19 -0
  57. package/sources/utils/files.mjs +70 -0
  58. package/sources/utils/loggings.mjs +33 -0
  59. package/sources/utils/packages.mjs +172 -0
  60. package/sources/utils/tasks.mjs +170 -0
  61. package/sources/utils/texts.mjs +98 -0
  62. package/configs/builds/build.conf.mjs +0 -3
  63. package/configs/tests/benchmarks/compute-benchmarks.conf.mjs +0 -5
  64. package/configs/tests/units/compute-unit-tests.conf.mjs +0 -5
  65. package/sources/_utils.mjs +0 -692
  66. /package/{configs → scripts}/refresh.conf.mjs +0 -0
@@ -1,692 +0,0 @@
1
- import commonjs from '@rollup/plugin-commonjs'
2
- import nodeResolve from '@rollup/plugin-node-resolve'
3
- import terser from '@rollup/plugin-terser'
4
- import colors from 'ansi-colors'
5
- import childProcess from 'child_process'
6
- import log from 'fancy-log'
7
- import figlet from 'figlet'
8
- import { glob } from 'glob'
9
- import {
10
- parallel,
11
- series
12
- } from 'gulp'
13
- import {
14
- existsSync,
15
- mkdirSync,
16
- readFileSync,
17
- writeFileSync
18
- } from 'node:fs'
19
- import {
20
- basename,
21
- dirname,
22
- extname,
23
- join,
24
- normalize,
25
- relative,
26
- } from 'node:path'
27
- import { fileURLToPath } from 'node:url'
28
- import replace from 'rollup-plugin-re'
29
-
30
- const {
31
- red,
32
- green,
33
- yellow,
34
- blue,
35
- magenta,
36
- cyan,
37
- unstyle
38
- } = colors
39
-
40
- /// Debugging
41
- /* global process */
42
- const isDebugging = ( process && process.env && process.env.RUNNER_DEBUG && process.env.RUNNER_DEBUG === '1' )
43
-
44
- /// Package paths and data
45
-
46
- function _getPackageRootDirectory() {
47
-
48
- let __dirname
49
-
50
- if ( import.meta.dirname ) {
51
- __dirname = import.meta.dirname
52
- } else if ( import.meta.filename ) {
53
- __dirname = dirname( import.meta.filename )
54
- } else if ( import.meta.url ) {
55
- const __filename = fileURLToPath( import.meta.url )
56
- __dirname = dirname( __filename )
57
- } else {
58
- throw new Error( 'Unable to retrieve module dirname.' )
59
- }
60
-
61
- return join( __dirname, '..' )
62
-
63
- }
64
-
65
- const iteePackageRootDirectory = _getPackageRootDirectory()
66
- const iteePackageJsonPath = join( iteePackageRootDirectory, 'package.json' )
67
- const iteePackageConfigurationsDirectory = join( iteePackageRootDirectory, 'configs' )
68
- const iteePackageNodeModulesDirectory = join( iteePackageRootDirectory, 'node_modules' )
69
- const iteePackageSourcesDirectory = join( iteePackageRootDirectory, 'sources' )
70
-
71
- const packageRootDirectory = iteePackageRootDirectory.includes( 'node_modules' ) ? join( iteePackageRootDirectory, '../../../' ) : iteePackageRootDirectory
72
- const packageTasksDirectory = join( packageRootDirectory, '.tasks' )
73
- const packageTasksConfigurationsDirectory = join( packageTasksDirectory, 'configs' )
74
- const packageNodeModulesDirectory = join( packageRootDirectory, 'node_modules' )
75
- const packageBuildsDirectory = join( packageRootDirectory, 'builds' )
76
- const packageSourcesDirectory = join( packageRootDirectory, 'sources' )
77
- const packageSourcesBackendDirectory = join( packageSourcesDirectory, 'backend' )
78
- const packageSourcesCommonDirectory = join( packageSourcesDirectory, 'common' )
79
- const packageSourcesFrontendDirectory = join( packageSourcesDirectory, 'frontend' )
80
- const packageTestsDirectory = join( packageRootDirectory, 'tests' )
81
- const packageTestsBenchmarksDirectory = join( packageTestsDirectory, 'benchmarks' )
82
- const packageTestsBundlesDirectory = join( packageTestsDirectory, 'bundles' )
83
- const packageTestsUnitsDirectory = join( packageTestsDirectory, 'units' )
84
- const packageDocsDirectory = join( packageRootDirectory, 'docs' )
85
- const packageTutorialsDirectory = join( packageRootDirectory, 'tutorials' )
86
- const packageJsonPath = join( packageRootDirectory, 'package.json' )
87
-
88
- ///
89
-
90
- const packageJson = getJsonFrom( packageJsonPath )
91
- const packageName = packageJson.name
92
- const packageVersion = packageJson.version
93
- const packageDescription = packageJson.description
94
- const packageAuthor = packageJson.author
95
- const packageLicense = packageJson.license
96
-
97
- function getPrettyPackageName( separator = ' ' ) {
98
-
99
- let prettyPackageName = ''
100
-
101
- const nameSplits = packageName.split( '-' )
102
- for ( const nameSplit of nameSplits ) {
103
- prettyPackageName += nameSplit.charAt( 0 ).toUpperCase() + nameSplit.slice( 1 ) + separator
104
- }
105
- prettyPackageName = prettyPackageName.slice( 0, -1 )
106
-
107
- return prettyPackageName
108
-
109
- }
110
-
111
- function getPrettyPackageVersion() {
112
-
113
- return 'v' + packageVersion
114
-
115
- }
116
-
117
- function getPrettyNodeVersion() {
118
-
119
- let nodeVersion = 'vX.x.ₓ'
120
-
121
- try {
122
- nodeVersion = childProcess.execFileSync( 'node', [ '--version' ] )
123
- .toString()
124
- .replace( /(\r\n|\n|\r)/gm, '' )
125
- } catch ( e ) {
126
- log( red( e ) )
127
-
128
- if ( e.message.includes( 'ENOENT' ) ) {
129
- nodeVersion += yellow( ' Not seems to be accessible from the path environment.' )
130
- }
131
- }
132
-
133
- return ' node: ' + nodeVersion
134
-
135
- }
136
-
137
- function getPrettyNpmVersion() {
138
-
139
- let npmVersion = 'X.x.ₓ'
140
-
141
- try {
142
- npmVersion = childProcess.execFileSync( 'npm', [ '--version' ] )
143
- .toString()
144
- .replace( /(\r\n|\n|\r)/gm, '' )
145
- } catch ( e ) {
146
- log( red( e ) )
147
-
148
- if ( e.message.includes( 'ENOENT' ) ) {
149
- npmVersion += yellow( ' Not seems to be accessible from the path environment.' )
150
- }
151
- }
152
-
153
- return ' npm: v' + npmVersion
154
-
155
- }
156
-
157
- /// File system Management
158
-
159
- function createDirectoryIfNotExist( directoryPath ) {
160
-
161
- if ( !existsSync( directoryPath ) ) {
162
- log( 'Creating', green( directoryPath ) )
163
- mkdirSync( directoryPath, { recursive: true } )
164
- }
165
-
166
- }
167
-
168
- function getJsonFrom( path ) {
169
-
170
- const buffer = readFileSync( path )
171
- return JSON.parse( buffer.toString() )
172
-
173
- }
174
-
175
- function createFile( filePath, fileContent ) {
176
-
177
- log( 'Creating', green( filePath ) )
178
- writeFileSync( filePath, fileContent )
179
-
180
- }
181
-
182
- function getFilesFrom( globPattern, filter = ( /*any*/ ) => true ) {
183
-
184
- return glob.sync( globPattern )
185
- .map( filePath => normalize( filePath ) )
186
- .filter( filter )
187
-
188
- }
189
-
190
- /// Task Management
191
-
192
- async function getTasksFrom( taskFiles = [] ) {
193
-
194
- const tasks = []
195
- for ( const taskFile of taskFiles ) {
196
- const relativeTaskFile = relative( packageRootDirectory, taskFile )
197
-
198
- try {
199
-
200
- const module = await import(taskFile)
201
-
202
- const exportStrings = []
203
- for ( const moduleKey in module ) {
204
- const task = module[ moduleKey ]
205
- tasks.push( task )
206
-
207
- const name = task.name ?? null
208
- const displayName = task.displayName ?? null
209
- const fullName = ( moduleKey !== name ) ? `${ blue( moduleKey ) }( ${ magenta( name ) } )` : `${ blue( name ) }`
210
- const exportAs = ( displayName ) ? ` as ${ cyan( displayName ) }` : ''
211
- const exportString = fullName + exportAs
212
- exportStrings.push( exportString )
213
- }
214
-
215
- //log( 'Process ', green( relativeTaskFile ), `with task${ ( exportStrings.length > 1 ) ? 's' : '' }`, exportStrings.join( ', ' ) )
216
-
217
- } catch ( error ) {
218
-
219
- log( 'Error ', red( relativeTaskFile ), error.message )
220
-
221
- }
222
-
223
- }
224
-
225
- return tasks
226
-
227
- }
228
-
229
- async function serializeTasksFrom( taskFiles = [] ) {
230
-
231
- const tasks = await getTasksFrom( taskFiles )
232
- return series( ...tasks )
233
-
234
- }
235
-
236
- async function parallelizeTasksFrom( taskFiles = [] ) {
237
-
238
- const tasks = await getTasksFrom( taskFiles )
239
- return parallel( ...tasks )
240
-
241
- }
242
-
243
- /// Task configuration management
244
-
245
- function getTaskConfigurationPathFor( filename ) {
246
-
247
- // Get relative path of the task between internal or user defined
248
- let relativeTaskPath = filename.includes( iteePackageSourcesDirectory )
249
- ? relative( iteePackageSourcesDirectory, filename )
250
- : relative( packageTasksDirectory, filename )
251
-
252
- // Generate all possible config file path depending on file extension and default or user defined
253
- const terminalExtension = extname( relativeTaskPath )
254
- const searchValue = relativeTaskPath.includes( '.task.' ) ? `.task${ terminalExtension }` : terminalExtension
255
- const replaceValues = [
256
- '.conf.json',
257
- '.conf.js',
258
- '.conf.cjs',
259
- '.conf.mjs',
260
- ]
261
-
262
- const packageConfigurationPaths = []
263
- const defaultConfigurationPaths = []
264
-
265
- for ( const replaceValue of replaceValues ) {
266
- const configurationLocation = relativeTaskPath.replace( searchValue, replaceValue )
267
- const packageConfigurationPath = join( packageTasksConfigurationsDirectory, configurationLocation )
268
- const defaultConfigurationPath = join( iteePackageConfigurationsDirectory, configurationLocation )
269
-
270
- packageConfigurationPaths.push( packageConfigurationPath )
271
- defaultConfigurationPaths.push( defaultConfigurationPath )
272
- }
273
-
274
- // Take care of the configuration search order (package first then default !)
275
- const configurationPaths = [ ...packageConfigurationPaths, ...defaultConfigurationPaths ]
276
- let configurationPath = undefined
277
-
278
- // Looking for existing configuration file
279
- for ( const packageConfigurationPath of configurationPaths ) {
280
-
281
- if ( existsSync( packageConfigurationPath ) ) {
282
- configurationPath = packageConfigurationPath
283
- break
284
- }
285
-
286
- }
287
-
288
- // Else throw an error
289
- if ( !configurationPath ) {
290
- throw new Error( `Unable to find configuration in package configuration paths ${ configurationPaths.join( ', ' ) }.` )
291
- }
292
-
293
- return configurationPath
294
-
295
- }
296
-
297
- async function getTaskConfigurationFor( filename ) {
298
-
299
- const configurationFilePath = getTaskConfigurationPathFor( filename )
300
-
301
- log( `Loading configuration from ${ cyan( configurationFilePath ) }` )
302
-
303
- let configuration = null
304
-
305
- try {
306
-
307
- if ( extname( configurationFilePath ) === '.json' ) {
308
-
309
- configuration = getJsonFrom( configurationFilePath )
310
-
311
- } else {
312
-
313
- const moduleData = await import( configurationFilePath )
314
- configuration = moduleData.default
315
-
316
- }
317
-
318
- } catch ( e ) {
319
-
320
- log( red( e ) )
321
-
322
- }
323
-
324
- return configuration
325
-
326
- }
327
-
328
- /// Build management
329
-
330
- function getPrettyFormatForBanner( format ) {
331
-
332
- let prettyFormat = ''
333
-
334
- switch ( format ) {
335
-
336
- case 'cjs':
337
- prettyFormat = 'CommonJs'
338
- break
339
-
340
- case 'esm':
341
- prettyFormat = 'EsModule'
342
- break
343
-
344
- case 'iife':
345
- prettyFormat = 'Standalone'
346
- break
347
-
348
- case 'umd':
349
- prettyFormat = 'Universal'
350
- break
351
-
352
- default:
353
- throw new RangeError( `Invalid switch parameter: ${ format }` )
354
-
355
- }
356
-
357
- return prettyFormat
358
-
359
- }
360
-
361
- function convertBannerIntoComment( banner ) {
362
-
363
- let bannerCommented = '/**\n'
364
- bannerCommented += ' * '
365
- bannerCommented += banner.replaceAll( '\n', '\n * ' )
366
- bannerCommented += '\n'
367
- bannerCommented += ` * @desc ${ packageDescription }\n`
368
- bannerCommented += ' * @author [Tristan Valcke]{@link https://github.com/Itee}\n'
369
- bannerCommented += ' * @license [BSD-3-Clause]{@link https://opensource.org/licenses/BSD-3-Clause}\n'
370
- bannerCommented += ' * \n'
371
- bannerCommented += ' */'
372
-
373
- return bannerCommented
374
-
375
- }
376
-
377
- function computeBannerFor( format ) {
378
-
379
- const packageName = getPrettyPackageName( '.' )
380
- const packageVersion = getPrettyPackageVersion()
381
- const prettyFormat = getPrettyFormatForBanner( format )
382
-
383
- const figText = figlet.textSync(
384
- `${ packageName } ${ packageVersion } - ${ prettyFormat }`,
385
- {
386
- font: 'Tmplr',
387
- horizontalLayout: 'default',
388
- verticalLayout: 'default',
389
- whitespaceBreak: true,
390
- }
391
- )
392
-
393
- return convertBannerIntoComment( figText )
394
-
395
- }
396
-
397
- function computeIntroFor( requestPackages = [] ) {
398
-
399
- let intro = ''
400
-
401
- for ( const requestPackage of requestPackages ) {
402
- intro += `if( ${ requestPackage } === undefined ) { throw new Error('${ getPrettyPackageName() } need ${ requestPackage } to be defined first. Please check your scripts loading order.') }` + '\n'
403
- }
404
-
405
- return intro
406
-
407
- }
408
-
409
- function getOutputFileExtensionBasedOnFileFormat( format ) {
410
-
411
- let extension
412
-
413
- if ( format === 'cjs' ) {
414
- extension = 'cjs'
415
- } else if ( format === 'esm' ) {
416
- extension = 'mjs'
417
- } else {
418
- extension = 'js'
419
- }
420
-
421
- return extension
422
-
423
- }
424
-
425
- /**
426
- * Will create an appropriate configuration object for rollup, related to the given arguments.
427
- *
428
- * @generator
429
- * @param options
430
- * @return {Array.<json>} An array of rollup configuration
431
- */
432
- function createRollupConfigs( options = undefined ) {
433
-
434
- const _options = options ? options : {
435
- input: join( packageSourcesDirectory, `${ packageName }.js` ),
436
- output: packageBuildsDirectory,
437
- formats: [ 'esm', 'cjs', 'iife' ],
438
- envs: [ 'dev', 'prod' ],
439
- treeshake: true
440
- }
441
-
442
- const {
443
- input,
444
- output,
445
- formats,
446
- envs,
447
- treeshake
448
- } = _options
449
- const name = getPrettyPackageName( '.' )
450
- const fileName = basename( input, '.js' )
451
-
452
- const configs = []
453
-
454
- for ( let formatIndex = 0, numberOfFormats = formats.length ; formatIndex < numberOfFormats ; ++formatIndex ) {
455
-
456
- for ( let envIndex = 0, numberOfEnvs = envs.length ; envIndex < numberOfEnvs ; envIndex++ ) {
457
-
458
- const env = envs[ envIndex ]
459
- const isProd = ( env.includes( 'prod' ) )
460
- const format = formats[ formatIndex ]
461
- const extension = getOutputFileExtensionBasedOnFileFormat( format )
462
- const outputPath = ( isProd ) ? join( output, `${ fileName }.min.${ extension }` ) : join( output, `${ fileName }.${ extension }` )
463
-
464
- configs.push( {
465
- input: input,
466
- external: ( format === 'cjs' ) ? [
467
- 'fs'
468
- ] : [],
469
- plugins: [
470
- replace( {
471
- defines: {
472
- IS_REMOVE_ON_BUILD: false,
473
- IS_BACKEND_SPECIFIC: ( format === 'cjs' )
474
- }
475
- } ),
476
- commonjs( {
477
- include: 'node_modules/**'
478
- } ),
479
- nodeResolve( {
480
- preferBuiltins: true
481
- } ),
482
- isProd && terser()
483
- ],
484
- onwarn: ( {
485
- loc,
486
- frame,
487
- message
488
- } ) => {
489
-
490
- // Ignore some errors
491
- if ( message.includes( 'Circular dependency' ) ) { return }
492
- if ( message.includes( 'plugin uglify is deprecated' ) ) { return }
493
-
494
- let errorMessage = ( loc )
495
- ? `/!\\ ${ loc.file } (${ loc.line }:${ loc.column }) ${ frame } ${ message }\n`
496
- : `/!\\ ${ message }\n`
497
-
498
- log( red( errorMessage ) )
499
-
500
- },
501
- treeshake: treeshake,
502
- output: {
503
- // core options
504
- file: outputPath,
505
- format: format,
506
- name: name,
507
- globals: {},
508
-
509
- // advanced options
510
- paths: {},
511
- banner: ( isProd ) ? '' : computeBannerFor( format ),
512
- footer: '',
513
- intro: ( !isProd && format === 'iife' ) ? computeIntroFor() : '',
514
- outro: '',
515
- sourcemap: !isProd,
516
- interop: 'auto',
517
-
518
- // danger zone
519
- exports: 'auto',
520
- amd: {},
521
- indent: '\t',
522
- strict: true
523
- }
524
- } )
525
-
526
- }
527
-
528
- }
529
-
530
- return configs
531
-
532
- }
533
-
534
- /// Log Management
535
-
536
- function logLoadingTask( filename ) {
537
-
538
- if ( !isDebugging ) {
539
- return
540
- }
541
-
542
- const taskPath = relative( packageRootDirectory, filename )
543
- const taskName = basename( filename, '.task.mjs' )
544
-
545
- log( `Loading ${ green( taskPath ) } with task ${ blue( taskName ) }` )
546
-
547
- }
548
-
549
- /// Text Management
550
-
551
-
552
- function alignTextCenter( text, width ) {
553
-
554
- const unstyledText = unstyle( text.repeat( 1 ) )
555
- const marginLength = ( width - unstyledText.length ) / 2
556
-
557
- let leftMargin, rightMargin
558
- if ( Number.isInteger( marginLength ) ) {
559
- leftMargin = marginLength
560
- rightMargin = marginLength
561
- } else {
562
- const flooredMargin = Math.floor( marginLength )
563
- leftMargin = flooredMargin
564
- rightMargin = flooredMargin + 1
565
- }
566
-
567
- return ' '.repeat( leftMargin ) + text + ' '.repeat( rightMargin )
568
-
569
- }
570
-
571
- function alignTextLeft( text, width ) {
572
-
573
- const unstyledText = unstyle( text.repeat( 1 ) )
574
- let repeatTime = width - unstyledText.length
575
- repeatTime = ( repeatTime > 0 ) ? repeatTime : 0
576
-
577
- return text + ' '.repeat( repeatTime )
578
-
579
- }
580
-
581
- function alignTextRight( text, width ) {
582
-
583
- const unstyledText = unstyle( text.repeat( 1 ) )
584
- let repeatTime = width - unstyledText.length
585
- repeatTime = ( repeatTime > 0 ) ? repeatTime : 0
586
-
587
- return ' '.repeat( repeatTime ) + text
588
-
589
- }
590
-
591
- function IndenterFactory( indentationChar = '\t', indentationLevel = 5 ) {
592
-
593
- const indentationLevels = {}
594
- let currentProperty = 'I_'
595
- for ( let currentIndentationLevel = 1 ; currentIndentationLevel <= indentationLevel ; currentIndentationLevel++ ) {
596
- indentationLevels[ currentProperty ] = indentationChar.repeat( currentIndentationLevel )
597
- currentProperty += '_'
598
- }
599
-
600
- return {
601
- I: new Indenter( indentationChar ),
602
- ...indentationLevels
603
- }
604
-
605
- }
606
-
607
- class Indenter {
608
-
609
- constructor( indentationChar = '\t' ) {
610
-
611
- this.indentationChar = indentationChar
612
- this.currentIndentationLevel = 0
613
-
614
- }
615
-
616
- _( indentationLevel = null ) {
617
- return this.indentationChar.repeat( indentationLevel ?? this.currentIndentationLevel )
618
- }
619
-
620
- deeper( level = 1 ) {
621
- this.currentIndentationLevel += level
622
- }
623
-
624
- shallower( level = 1 ) {
625
- this.currentIndentationLevel -= level
626
- }
627
-
628
- }
629
-
630
- ///
631
-
632
- export {
633
- iteePackageRootDirectory,
634
- iteePackageJsonPath,
635
- iteePackageConfigurationsDirectory,
636
- iteePackageNodeModulesDirectory,
637
- iteePackageSourcesDirectory,
638
-
639
- packageRootDirectory,
640
- packageTasksDirectory,
641
- packageTasksConfigurationsDirectory,
642
- packageNodeModulesDirectory,
643
- packageBuildsDirectory,
644
- packageSourcesDirectory,
645
- packageSourcesBackendDirectory,
646
- packageSourcesCommonDirectory,
647
- packageSourcesFrontendDirectory,
648
- packageTestsDirectory,
649
- packageTestsBenchmarksDirectory,
650
- packageTestsBundlesDirectory,
651
- packageTestsUnitsDirectory,
652
- packageDocsDirectory,
653
- packageTutorialsDirectory,
654
- packageJsonPath,
655
-
656
- packageJson,
657
- packageName,
658
- packageVersion,
659
- packageDescription,
660
- packageAuthor,
661
- packageLicense,
662
- getPrettyPackageName,
663
- getPrettyPackageVersion,
664
- getPrettyNodeVersion,
665
- getPrettyNpmVersion,
666
-
667
-
668
- createDirectoryIfNotExist,
669
- getJsonFrom,
670
- createFile,
671
- getFilesFrom,
672
-
673
- getTasksFrom,
674
- serializeTasksFrom,
675
- parallelizeTasksFrom,
676
-
677
- getTaskConfigurationPathFor,
678
- getTaskConfigurationFor,
679
-
680
- getPrettyFormatForBanner,
681
- convertBannerIntoComment,
682
- computeBannerFor,
683
- computeIntroFor,
684
- createRollupConfigs,
685
-
686
- logLoadingTask,
687
-
688
- alignTextCenter,
689
- alignTextLeft,
690
- alignTextRight,
691
- IndenterFactory as Indenter
692
- }
File without changes