itee-validators 5.6.0 → 6.0.0

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 (131) hide show
  1. package/.github/workflows/node.js.yml +2 -2
  2. package/.releaserc.mjs +94 -0
  3. package/.tasks/.builds/build-benchmarks.task.mjs +16 -0
  4. package/.tasks/.builds/build-tests.task.mjs +18 -0
  5. package/.tasks/.builds/build-unit-tests.task.mjs +16 -0
  6. package/.tasks/.builds/build.task.mjs +46 -0
  7. package/.tasks/.cleans/clean.task.mjs +23 -0
  8. package/.tasks/.docs/doc.task.mjs +35 -0
  9. package/.tasks/.helps/help.task.mjs +151 -0
  10. package/.tasks/.lints/lint.task.mjs +37 -0
  11. package/.tasks/.patches/patch.task.mjs +13 -0
  12. package/.tasks/.releases/release.task.mjs +26 -0
  13. package/.tasks/.tests/benchmarks/build-benchmarks-backend.task.mjs +42 -0
  14. package/.tasks/{tests/benchmarks/compute-benchmarks.mjs → .tests/benchmarks/compute-benchmarks.task.mjs} +46 -51
  15. package/.tasks/.tests/benchmarks/run-benchmarks-for-backend.task.mjs +39 -0
  16. package/.tasks/.tests/benchmarks/run-benchmarks-for-frontend.task.mjs +41 -0
  17. package/.tasks/.tests/benchmarks/run-benchmarks.task.mjs +18 -0
  18. package/.tasks/{tests/bundling/check-bundling-from-esm-build-import.mjs → .tests/bundling/check-bundling-from-esm-build-import.task.mjs} +31 -75
  19. package/.tasks/.tests/bundling/check-bundling-from-esm-files-direct.task.mjs +77 -0
  20. package/.tasks/.tests/bundling/check-bundling-from-esm-files-import.task.mjs +95 -0
  21. package/.tasks/.tests/bundling/check-bundling.task.mjs +20 -0
  22. package/.tasks/.tests/run-tests.task.mjs +18 -0
  23. package/.tasks/.tests/unit-tests/build-unit-tests-backend.task.mjs +42 -0
  24. package/.tasks/{tests/unit-tests/compute-unit-tests.mjs → .tests/unit-tests/compute-unit-tests.task.mjs} +152 -193
  25. package/.tasks/.tests/unit-tests/run-unit-tests-for-backend.task.mjs +44 -0
  26. package/.tasks/.tests/unit-tests/run-unit-tests-for-frontend.task.mjs +41 -0
  27. package/.tasks/.tests/unit-tests/run-unit-tests.task.mjs +18 -0
  28. package/.tasks/_refresh-gulpfile.task.mjs +65 -0
  29. package/.tasks/_utils.mjs +159 -33
  30. package/.tasks/configs/benchmarks.conf.mjs +57 -0
  31. package/.tasks/configs/build-benchmarks-backend.conf.mjs +51 -0
  32. package/.tasks/configs/build-unit-tests-backend.conf.mjs +46 -0
  33. package/.tasks/configs/build.conf.mjs +354 -0
  34. package/.tasks/configs/check-bundling.conf.mjs +26 -0
  35. package/.tasks/configs/clean.conf.mjs +9 -0
  36. package/.tasks/configs/compute-benchmarks.conf.mjs +28 -0
  37. package/.tasks/configs/compute-unit-tests.conf.mjs +27 -0
  38. package/.tasks/configs/doc.conf.json +50 -0
  39. package/.tasks/configs/eslint.conf.mjs +121 -0
  40. package/.tasks/configs/units.conf.mjs +27 -0
  41. package/.tasks/itee-benchmarks-framework.js +186 -0
  42. package/.tasks/itee-reporter.mjs +217 -0
  43. package/CHANGELOG.md +12 -0
  44. package/builds/itee-validators.cjs.js +53 -15
  45. package/builds/itee-validators.cjs.js.map +1 -1
  46. package/builds/itee-validators.cjs.min.js +36 -35
  47. package/builds/itee-validators.esm.js +25 -2
  48. package/builds/itee-validators.esm.js.map +1 -1
  49. package/builds/itee-validators.esm.min.js +3 -3
  50. package/builds/itee-validators.iife.js +25 -4
  51. package/builds/itee-validators.iife.js.map +1 -1
  52. package/builds/itee-validators.iife.min.js +10 -10
  53. package/package.json +49 -41
  54. package/sources/cores/_cores.js +10 -10
  55. package/sources/cores/arrays/_arrays.js +12 -12
  56. package/sources/cores/arrays/isArrayOfArray.js +2 -2
  57. package/sources/cores/arrays/isArrayOfBoolean.js +3 -3
  58. package/sources/cores/arrays/isArrayOfFunction.js +3 -3
  59. package/sources/cores/arrays/isArrayOfMultiElement.js +1 -1
  60. package/sources/cores/arrays/isArrayOfNull.js +3 -3
  61. package/sources/cores/arrays/isArrayOfNumber.js +3 -3
  62. package/sources/cores/arrays/isArrayOfObject.js +3 -3
  63. package/sources/cores/arrays/isArrayOfSingleElement.js +1 -1
  64. package/sources/cores/arrays/isArrayOfString.js +3 -3
  65. package/sources/cores/arrays/isArrayOfUndefined.js +3 -3
  66. package/sources/cores/arrays/isEmptyArray.js +1 -1
  67. package/sources/cores/booleans/_booleans.js +2 -2
  68. package/sources/cores/booleans/isTrue.js +1 -1
  69. package/sources/cores/cores.js +8 -8
  70. package/sources/cores/functions/_functions.js +1 -1
  71. package/sources/cores/numbers/_numbers.js +6 -6
  72. package/sources/cores/numbers/isNumber.js +3 -3
  73. package/sources/cores/objects/_objects.js +2 -2
  74. package/sources/cores/objects/isEmptyObject.js +1 -1
  75. package/sources/cores/objects/isObject.js +1 -1
  76. package/sources/cores/strings/_strings.js +3 -3
  77. package/sources/cores/strings/isBlankString.js +2 -2
  78. package/sources/cores/strings/isEmptyString.js +1 -1
  79. package/sources/cores/symbols/_symbols.js +1 -1
  80. package/sources/cores/tests/isTestUnitGenerator.js +5 -6
  81. package/sources/cores/typed-arrays/_typedArrays.js +12 -12
  82. package/sources/cores/voids/_voids.js +4 -4
  83. package/sources/cores/voids/isEmpty.js +4 -4
  84. package/sources/file-system/_file-system.js +9 -9
  85. package/sources/file-system/block-devices/_blockDevices.js +3 -3
  86. package/sources/file-system/block-devices/isBlockDevicePath.js +3 -3
  87. package/sources/file-system/block-devices/isValidBlockDevicePath.js +2 -2
  88. package/sources/file-system/character-devices/_characterDevices.js +3 -3
  89. package/sources/file-system/character-devices/isCharacterDevicePath.js +3 -3
  90. package/sources/file-system/character-devices/isValidCharacterDevicePath.js +2 -2
  91. package/sources/file-system/directories/_directories.js +4 -4
  92. package/sources/file-system/directories/isDirectoryPath.js +3 -3
  93. package/sources/file-system/directories/isEmptyDirectory.js +2 -2
  94. package/sources/file-system/directories/isValidDirectoryPath.js +2 -2
  95. package/sources/file-system/fifo-pipes/_fifoPipes.js +3 -3
  96. package/sources/file-system/fifo-pipes/isFIFOPath.js +3 -3
  97. package/sources/file-system/fifo-pipes/isValidFIFOPath.js +2 -2
  98. package/sources/file-system/files/_files.js +4 -4
  99. package/sources/file-system/files/isEmptyFile.js +3 -3
  100. package/sources/file-system/files/isFilePath.js +3 -3
  101. package/sources/file-system/files/isValidFilePath.js +2 -2
  102. package/sources/file-system/paths/_paths.js +2 -2
  103. package/sources/file-system/paths/isValidPath.js +1 -1
  104. package/sources/file-system/sockets/_sockets.js +3 -3
  105. package/sources/file-system/sockets/isSocketPath.js +3 -3
  106. package/sources/file-system/sockets/isValidSocketPath.js +2 -2
  107. package/sources/file-system/symbolic-links/_symbolicLinks.js +3 -3
  108. package/sources/file-system/symbolic-links/isSymbolicLinkPath.js +3 -3
  109. package/sources/file-system/symbolic-links/isValidSymbolicLinkPath.js +2 -2
  110. package/sources/itee-validators.js +4 -4
  111. package/sources/maths/_maths.js +1 -1
  112. package/sources/physics/_physics.js +2 -2
  113. package/sources/physics/temperatures/_temperatures.js +5 -5
  114. package/sources/physics/temperatures/isCelsius.js +2 -2
  115. package/sources/physics/temperatures/isFahrenheit.js +2 -2
  116. package/sources/physics/temperatures/isKelvin.js +2 -2
  117. package/sources/physics/temperatures/isTemperature.js +3 -3
  118. package/.tasks/builds/build.mjs +0 -65
  119. package/.tasks/cleans/clean.mjs +0 -20
  120. package/.tasks/docs/doc.mjs +0 -37
  121. package/.tasks/helps/help.mjs +0 -195
  122. package/.tasks/lints/lint.mjs +0 -33
  123. package/.tasks/patches/patch.mjs +0 -9
  124. package/.tasks/tests/benchmarks/bundle-benchmarks.mjs +0 -33
  125. package/.tasks/tests/benchmarks/run-benchmarks-for-backend.mjs +0 -24
  126. package/.tasks/tests/benchmarks/run-benchmarks-for-frontend.mjs +0 -38
  127. package/.tasks/tests/bundling/check-bundling-from-esm-files-direct.mjs +0 -129
  128. package/.tasks/tests/bundling/check-bundling-from-esm-files-import.mjs +0 -149
  129. package/.tasks/tests/unit-tests/bundle-unit-tests.mjs +0 -33
  130. package/.tasks/tests/unit-tests/run-unit-tests-for-backend.mjs +0 -25
  131. package/.tasks/tests/unit-tests/run-unit-tests-for-frontend.mjs +0 -41
@@ -16,7 +16,7 @@ jobs:
16
16
  MOZ_HEADLESS: 1
17
17
  strategy:
18
18
  matrix:
19
- node-version: [ 18.x, 20.x, 22.x ]
19
+ node-version: [ 20.x, 22.x, 24.x ]
20
20
  firefox: [ 'latest' ]
21
21
  steps:
22
22
  - name: Use Node.js ${{ matrix.node-version }}
@@ -32,7 +32,7 @@ jobs:
32
32
  - name: Install dependencies
33
33
  run: npm ci
34
34
  - name: Release
35
- run: npm run lint && npm run build && npm run build-test && npm run test
35
+ run: npm run build && npm run tests:build && npm run lint && npm run tests:run
36
36
 
37
37
  publish:
38
38
  needs: build
package/.releaserc.mjs ADDED
@@ -0,0 +1,94 @@
1
+ import { execSync } from 'node:child_process'
2
+
3
+ // Git utils
4
+
5
+ function getLocalRepoUrl() {
6
+ const topLevelDir = execSync( 'git rev-parse --show-toplevel' )
7
+ .toString()
8
+ .trim()
9
+
10
+ return `file://${ topLevelDir }/.git`
11
+ }
12
+
13
+ function getCurrentBranch() {
14
+ return execSync( 'git rev-parse --abbrev-ref HEAD' )
15
+ .toString()
16
+ .trim()
17
+ }
18
+
19
+ // Plugins sub-configs
20
+
21
+ function getGitmojiPlugin() {
22
+ return [
23
+ 'semantic-release-gitmoji', {
24
+ 'releaseRules': {
25
+ 'major': [
26
+ ':boom:'
27
+ ],
28
+ 'minor': [
29
+ ':sparkles:'
30
+ ],
31
+ 'patch': [
32
+ ':art:', ':zap:', ':fire:', ':bug:', ':ambulance:', ':pencil:', ':rocket:', ':lipstick:', ':white_check_mark:', ':lock:', ':apple:', ':penguin:', ':checkered_flag:', ':robot:',
33
+ ':green_apple:', ':rotating_light:', ':green_heart:', ':arrow_down:', ':pushpin:', ':construction_worker:', ':chart_with_upwards_trend:', ':recycle:', ':whale:',
34
+ ':heavy_plus_sign:', ':heavy_minus_sign:', ':wrench:', ':globe_with_meridians:', ':pencil2:', ':poop:', ':rewind:', ':package:', ':alien:', ':truck:', ':page_facing_up:',
35
+ ':bento:', ':ok_hand:', ':wheelchair:', ':bulb:', ':beers:', ':speech_balloon:', ':card_file_box:', ':loud_sound:', ':mute:', ':busts_in_silhouette:', ':children_crossing:',
36
+ ':building_construction:', ':iphone:', ':clown_face:', ':see_no_evil:', ':camera_flash:', ':alembic:', ':mag:', ':wheel_of_dharma:', ':label:', ':seedling:', ':dizzy:',
37
+ ':wastebasket:', ':passport_control:', ':adhesive_bandage:', ':monocle_face:', ':coffin:', ':test_tube:', ':necktie:', ':stethoscope:', ':bricks:', ':technologist:'
38
+ ]
39
+ }
40
+ }
41
+ ]
42
+ }
43
+
44
+ function getChangelogPlugin() {
45
+ return '@semantic-release/changelog'
46
+ }
47
+
48
+ function getNpmPlugin() {
49
+ return '@semantic-release/npm'
50
+ }
51
+
52
+ function getGithubPlugin() {
53
+ return '@semantic-release/github'
54
+ }
55
+
56
+ function getGitPlugin() {
57
+ return [
58
+ '@semantic-release/git', {
59
+ 'assets': [
60
+ 'builds/**', 'docs/**', 'package.json', 'CHANGELOG.md'
61
+ ],
62
+ 'message': 'chore(release): v${nextRelease.version}'
63
+ }
64
+ ]
65
+ }
66
+
67
+ // Configuration selection
68
+
69
+ function isDryRun() {
70
+ return process.argv.includes( '--dry-run' )
71
+ }
72
+
73
+ function getDryRunConfig() {
74
+ return {
75
+ repositoryUrl: getLocalRepoUrl(),
76
+ branches: getCurrentBranch(),
77
+ plugins: [
78
+ getGitmojiPlugin()
79
+ ],
80
+ }
81
+ }
82
+
83
+ function getCIConfig() {
84
+ return {
85
+ branch: 'master',
86
+ plugins: [
87
+ getGitmojiPlugin(), getChangelogPlugin(), getNpmPlugin(), getGithubPlugin(), getGitPlugin()
88
+ ]
89
+ }
90
+ }
91
+
92
+ // Module
93
+
94
+ export default isDryRun() ? getDryRunConfig() : getCIConfig()
@@ -0,0 +1,16 @@
1
+ import { series } from 'gulp'
2
+ import { buildBenchmarksBackendTask } from '../.tests/benchmarks/build-benchmarks-backend.task.mjs'
3
+ import { computeBenchmarksTask } from '../.tests/benchmarks/compute-benchmarks.task.mjs'
4
+
5
+ /**
6
+ * @description Will compute and generate bundle for benchmarks
7
+ */
8
+ const buildBenchmarksTask = series(
9
+ computeBenchmarksTask,
10
+ buildBenchmarksBackendTask,
11
+ )
12
+ buildBenchmarksTask.displayName = 'build-benchmarks'
13
+ buildBenchmarksTask.description = 'Will compute and generate bundle for benchmarks.'
14
+ buildBenchmarksTask.flags = null
15
+
16
+ export { buildBenchmarksTask }
@@ -0,0 +1,18 @@
1
+ import { series } from 'gulp'
2
+ import { buildBenchmarksTask } from './build-benchmarks.task.mjs'
3
+ import { buildUnitTestsTask } from './build-unit-tests.task.mjs'
4
+
5
+ /**
6
+ * @method npm run build-test
7
+ * @global
8
+ * @description Will build all tests.
9
+ */
10
+ const buildTestsTask = series(
11
+ buildBenchmarksTask,
12
+ buildUnitTestsTask,
13
+ )
14
+ buildTestsTask.displayName = 'build-tests'
15
+ buildTestsTask.description = 'Will build all tests.'
16
+ buildTestsTask.flags = null
17
+
18
+ export { buildTestsTask }
@@ -0,0 +1,16 @@
1
+ import { series } from 'gulp'
2
+ import { buildUnitTestsBackendTask } from '../.tests/unit-tests/build-unit-tests-backend.task.mjs'
3
+ import { computeUnitTestsTask } from '../.tests/unit-tests/compute-unit-tests.task.mjs'
4
+
5
+ /**
6
+ * @description Will compute and generate bundle for unit tests
7
+ */
8
+ const buildUnitTestsTask = series(
9
+ computeUnitTestsTask,
10
+ buildUnitTestsBackendTask,
11
+ )
12
+ buildUnitTestsTask.displayName = 'build-unit-tests'
13
+ buildUnitTestsTask.description = 'Will compute and generate bundle for unit tests.'
14
+ buildUnitTestsTask.flags = null
15
+
16
+ export { buildUnitTestsTask }
@@ -0,0 +1,46 @@
1
+ import colors from 'ansi-colors'
2
+ import log from 'fancy-log'
3
+ import { rollup } from 'rollup'
4
+ import { getRollupConfigurationFor } from '../configs/build.conf.mjs'
5
+
6
+ const {
7
+ red,
8
+ green,
9
+ yellow
10
+ } = colors
11
+
12
+ const buildTask = async ( done ) => {
13
+
14
+ const configs = getRollupConfigurationFor( 'build' )
15
+
16
+ for ( let config of configs ) {
17
+
18
+ if ( config === undefined || config === null || config.length === 0 ) {
19
+ log( yellow( 'Empty configuration object... Skip it!' ) )
20
+ continue
21
+ }
22
+
23
+ log( 'Building', green( config.output.file ) )
24
+
25
+ try {
26
+
27
+ const bundle = await rollup( config )
28
+ await bundle.write( config.output )
29
+
30
+ } catch ( error ) {
31
+
32
+ done( red( error.message ) )
33
+ return
34
+
35
+ }
36
+
37
+ }
38
+
39
+ done()
40
+
41
+ }
42
+ buildTask.displayName = 'build'
43
+ buildTask.description = 'Todo...'
44
+ buildTask.flags = null
45
+
46
+ export { buildTask }
@@ -0,0 +1,23 @@
1
+ import colors from 'ansi-colors'
2
+ import { deleteAsync } from 'del'
3
+ import log from 'fancy-log'
4
+ import { cleanConf } from '../configs/clean.conf.mjs'
5
+
6
+ const red = colors.red
7
+
8
+ /**
9
+ * @method npm run clean
10
+ * @global
11
+ * @description Will delete builds and temporary folders
12
+ */
13
+ const cleanTask = () => deleteAsync( cleanConf, {
14
+ onProgress: progress => {
15
+ const path = progress.path || 'Nothing to clean...'
16
+ log( `Delete [${ progress.deletedCount }/${ progress.totalCount }] (${ Math.round( progress.percent * 100 ) }%):`, red( path ) )
17
+ }
18
+ } )
19
+ cleanTask.displayName = 'clean'
20
+ cleanTask.description = 'Will delete builds and temporary folders'
21
+ cleanTask.flags = null
22
+
23
+ export { cleanTask }
@@ -0,0 +1,35 @@
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
+
6
+ const execFile = promisify( child_process.execFile )
7
+ const red = colors.red
8
+
9
+ /**
10
+ * @method npm run doc
11
+ * @global
12
+ * @description Will generate this documentation
13
+ */
14
+ const docTask = async ( done ) => {
15
+
16
+ try {
17
+ const { stdout } = await execFile(
18
+ './node_modules/.bin/jsdoc',
19
+ [
20
+ '--configure', './.tasks/configs/doc.conf.json',
21
+ '--destination', './docs'
22
+ ]
23
+ )
24
+ log( stdout )
25
+ done()
26
+ } catch ( error ) {
27
+ done( red( error.message ) )
28
+ }
29
+
30
+ }
31
+ docTask.displayName = 'doc'
32
+ docTask.description = 'Will generate this documentation.'
33
+ docTask.flags = null
34
+
35
+ export { docTask }
@@ -0,0 +1,151 @@
1
+ import colors from 'ansi-colors'
2
+ import log from 'fancy-log'
3
+ import {
4
+ getPrettyNodeVersion,
5
+ getPrettyNpmVersion,
6
+ getPrettyPackageName,
7
+ getPrettyPackageVersion,
8
+ Indenter
9
+ } from '../_utils.mjs'
10
+
11
+ const {
12
+ red,
13
+ green,
14
+ blue,
15
+ cyan,
16
+ yellow,
17
+ magenta,
18
+ unstyle
19
+ } = colors
20
+
21
+ function alignTextCenter( text, width ) {
22
+
23
+ const unstyledText = unstyle( text.repeat( 1 ) )
24
+ const marginLength = ( width - unstyledText.length ) / 2
25
+
26
+ let leftMargin, rightMargin
27
+ if ( Number.isInteger( marginLength ) ) {
28
+ leftMargin = marginLength
29
+ rightMargin = marginLength
30
+ } else {
31
+ const flooredMargin = Math.floor( marginLength )
32
+ leftMargin = flooredMargin
33
+ rightMargin = flooredMargin + 1
34
+ }
35
+
36
+ return ' '.repeat( leftMargin ) + text + ' '.repeat( rightMargin )
37
+
38
+ }
39
+
40
+ function alignTextLeft( text, width ) {
41
+
42
+ const unstyledText = unstyle( text.repeat( 1 ) )
43
+ let repeatTime = width - unstyledText.length
44
+ repeatTime = ( repeatTime > 0 ) ? repeatTime : 0
45
+
46
+ return text + ' '.repeat( repeatTime )
47
+
48
+ }
49
+
50
+ function alignTextRight( text, width ) {
51
+
52
+ const unstyledText = unstyle( text.repeat( 1 ) )
53
+ let repeatTime = width - unstyledText.length
54
+ repeatTime = ( repeatTime > 0 ) ? repeatTime : 0
55
+
56
+ return ' '.repeat( repeatTime ) + text
57
+
58
+ }
59
+
60
+ /**
61
+ * @method npm run help ( default )
62
+ * @global
63
+ * @description Will display the help in console
64
+ */
65
+ const helpTask = ( done ) => {
66
+
67
+ const bannerWidth = 70
68
+ const prettyPackageName = getPrettyPackageName()
69
+ const prettyPackageVersion = getPrettyPackageVersion()
70
+ const prettyNodeVersion = getPrettyNodeVersion()
71
+ const prettyNpmVersion = getPrettyNpmVersion()
72
+
73
+ const tableCharset = {
74
+ topLeftCorner: '┏',
75
+ topRightCorner: '┓',
76
+ bottomRightCorner: '┛',
77
+ bottomLeftCorner: '┗',
78
+ horizontalBorder: '━',
79
+ horizontalSeparator: '─',
80
+ leftJoinSeparator: '┠',
81
+ rightJoinSeparator: '┨',
82
+ verticalBorder: '┃',
83
+ verticalSeparator: '',
84
+ }
85
+
86
+ const mainBorder = tableCharset.horizontalBorder.repeat( bannerWidth )
87
+ const thinBorder = tableCharset.horizontalSeparator.repeat( bannerWidth )
88
+ const tableTop = `${ tableCharset.topLeftCorner }${ mainBorder }${ tableCharset.topRightCorner }`
89
+ const tableSeparator = `${ tableCharset.leftJoinSeparator }${ thinBorder }${ tableCharset.rightJoinSeparator }`
90
+ const tableBottom = `${ tableCharset.bottomLeftCorner }${ mainBorder }${ tableCharset.bottomRightCorner }`
91
+ const tableLine = ( innerText ) => `${ tableCharset.verticalBorder }${ innerText }${ tableCharset.verticalBorder }`
92
+
93
+ const {
94
+ I_,
95
+ I__,
96
+ I___,
97
+ I____,
98
+ } = new Indenter( '\t', 4 )
99
+
100
+ const npmRun = blue( 'npm run' )
101
+
102
+ log( '' )
103
+ log( tableTop )
104
+ log( tableLine( alignTextCenter( 'HELP', bannerWidth ) ) )
105
+ log( tableLine( alignTextCenter( prettyPackageName, bannerWidth ) ) )
106
+ log( tableLine( alignTextCenter( prettyPackageVersion, bannerWidth ) ) )
107
+ log( tableSeparator )
108
+ log( tableLine( alignTextLeft( prettyNodeVersion, bannerWidth ) ) )
109
+ log( tableLine( alignTextLeft( prettyNpmVersion, bannerWidth ) ) )
110
+ log( tableBottom )
111
+ log( I_, 'Available commands are:' )
112
+ log( I__, npmRun, cyan( 'help' ), '- Display this help.' )
113
+ log( I__, npmRun, cyan( 'patch' ), '- Will apply some patch/replacements in dependencies.', red( '(Apply only once after run "npm install")' ) )
114
+ log( I__, npmRun, cyan( 'clean' ), '- Will delete builds and temporary folders.' )
115
+ log( I__, npmRun, cyan( 'lint' ), '- Will run the eslint in pedantic mode with auto fix when possible.' )
116
+ log( I__, npmRun, cyan( 'doc' ), '- Will run jsdoc, and create documentation under `documentation` folder, using the docdash theme' )
117
+ log( I__, npmRun, cyan( 'test' ), '- Will run the test framworks (unit and bench), and create reports under `documentation/report` folder, using the mochawesome theme' )
118
+ log( I__, npmRun, cyan( 'unit' ), '- Will run the karma server for unit tests.' )
119
+ log( I__, npmRun, cyan( 'bench' ), '- Will run the karma server for benchmarks.' )
120
+ log( I__, npmRun, cyan( 'build' ), yellow( '--' ), green( '<options>' ), '- Will build the application for development and/or production environments.' )
121
+ log( I___, yellow( 'Note: The two dash are only required if you provide options !' ) )
122
+ log( I___, 'The available', green( '<options>' ), 'are:' )
123
+ log( I____, green( '-i' ), 'or', green( '--input' ), '- The main file path to build', cyan( '[Default: "sources/main.js"]' ), '.' )
124
+ log( I____, green( '-o' ), 'or', green( '--output' ), '- The folder where output the build', cyan( '[Default: "builds"]' ), '.' )
125
+ log(
126
+ I____,
127
+ green( '-f:' ),
128
+ magenta( '<format>' ),
129
+ 'or',
130
+ green( '--format:' ),
131
+ magenta( '<format>' ),
132
+ ' - to specify the output build type. Where format could be any of:', magenta( 'cjs, esm, iife, umd' ), '.'
133
+ )
134
+ log( I____, green( '-e:' ), magenta( '<env>' ), 'or', green( '--env:' ), magenta( '<env>' ), ' - to specify the build environment. Where env could be any of:', magenta(
135
+ 'dev' ), magenta( 'prod' ), cyan( '[Default: "dev"]' ), '.' )
136
+ log( I____, green( '-s' ), 'or', green( '--sourcemap' ), ' - to build with related source map', cyan( '[Default: true]' ), '.' )
137
+ log( I____, green( '-t' ), 'or', green( '--treeshake' ), ' - allow to perform treeshaking when building', cyan( '[Default: true]' ), '.' )
138
+ log( I__, npmRun, cyan( 'release' ), '- Will run all the lint, test stuff, and if succeed will build the application.' )
139
+ log( '' )
140
+ log( I_, 'In case you have', blue( 'gulp' ), 'installed globally, you could use also:' )
141
+ log( I__, blue( 'gulp' ), cyan( 'command' ), '- It will perform the command like using "npm run" but with less characters to type... Because you\'re a developer, right ?' )
142
+ log( '' )
143
+
144
+ done()
145
+
146
+ }
147
+ helpTask.displayName = 'help'
148
+ helpTask.description = 'Display the package help'
149
+ helpTask.flags = null
150
+
151
+ export { helpTask }
@@ -0,0 +1,37 @@
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
+
6
+ const execFile = promisify( child_process.execFile )
7
+ const red = colors.red
8
+
9
+ /**
10
+ * @method npm run lint
11
+ * @global
12
+ * @description Will lint the sources files and try to fix the style when possible
13
+ */
14
+ const lintTask = async ( done ) => {
15
+
16
+ try {
17
+
18
+ const { stdout } = await execFile( 'npx', [ 'eslint', '--config', './.tasks/configs/eslint.conf.mjs', '--fix' ] )
19
+ if ( stdout !== '' ) {
20
+ log( stdout )
21
+ }
22
+
23
+ done()
24
+
25
+ } catch ( error ) {
26
+
27
+ log( error.stdout )
28
+ done( red( error.message ) )
29
+
30
+ }
31
+
32
+ }
33
+ lintTask.displayName = 'lint'
34
+ lintTask.description = 'Will lint the sources files and try to fix the style when possible.'
35
+ lintTask.flags = null
36
+
37
+ export { lintTask }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @method npm run patch
3
+ * @global
4
+ * @description Will apply some patch/replacements in dependencies
5
+ */
6
+ const patchTask = ( done ) => {
7
+ done()
8
+ }
9
+ patchTask.displayName = 'patch'
10
+ patchTask.description = 'Will apply some patch/replacements in dependencies'
11
+ patchTask.flags = null
12
+
13
+ export { patchTask }
@@ -0,0 +1,26 @@
1
+ import { series } from 'gulp'
2
+ import { buildTestsTask } from '../.builds/build-tests.task.mjs'
3
+ import { buildTask } from '../.builds/build.task.mjs'
4
+ import { cleanTask } from '../.cleans/clean.task.mjs'
5
+ import { docTask } from '../.docs/doc.task.mjs'
6
+ import { lintTask } from '../.lints/lint.task.mjs'
7
+ import { runTestsTask } from '../.tests/run-tests.task.mjs'
8
+
9
+ const releaseTask = series(
10
+ cleanTask,
11
+ buildTask,
12
+ buildTestsTask,
13
+ lintTask,
14
+ runTestsTask,
15
+ docTask,
16
+ )
17
+ releaseTask.displayName = 'release'
18
+ releaseTask.description = 'Will perform a complete release of the library including \'clean\', \'lint\', \'doc\', \'build-tests\', \'test\' and finally \'build\'.'
19
+ releaseTask.flags = null
20
+
21
+ /**
22
+ * @method npm run release
23
+ * @global
24
+ * @description Will perform a complete release of the library including 'clean', 'lint', 'doc', 'build-tests', 'test' and finally 'build'.
25
+ */
26
+ export { releaseTask }
@@ -0,0 +1,42 @@
1
+ import colors from 'ansi-colors'
2
+ import log from 'fancy-log'
3
+ import { rollup } from 'rollup'
4
+ import { buildBenchmarksBackendConfig as config } from '../../configs/build-benchmarks-backend.conf.mjs'
5
+
6
+ const {
7
+ red,
8
+ green
9
+ } = colors
10
+
11
+ /**
12
+ * @description Will generate benchmarks bundles based on provided configs
13
+ */
14
+ const buildBenchmarksBackendTask = async ( done ) => {
15
+
16
+ if ( config === undefined || config === null || config.length === 0 ) {
17
+ done( red( 'Empty configuration!' ) )
18
+ return
19
+ }
20
+
21
+ log( 'Building', green( config.output.file ) )
22
+
23
+ try {
24
+
25
+ const bundle = await rollup( config )
26
+ await bundle.write( config.output )
27
+
28
+ } catch ( error ) {
29
+
30
+ done( red( error.message ) )
31
+ return
32
+
33
+ }
34
+
35
+ done()
36
+
37
+ }
38
+ buildBenchmarksBackendTask.displayName = 'build-benchmarks-backend'
39
+ buildBenchmarksBackendTask.description = 'Will apply some patch/replacements in dependencies'
40
+ buildBenchmarksBackendTask.flags = null
41
+
42
+ export { buildBenchmarksBackendTask }