itee-tasks 1.0.5 → 1.0.6

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # [v1.0.6](https://github.com/Itee/itee-tasks/compare/v1.0.5...v1.0.6) (2026-01-14)
2
+
3
+ ## 🐛 Bug Fixes
4
+ - [`53d9dac`](https://github.com/Itee/itee-tasks/commit/53d9dac) (utils) fix search config for different kind of config files (js, mjs and json)
5
+
1
6
  # [v1.0.5](https://github.com/Itee/itee-tasks/compare/v1.0.4...v1.0.5) (2026-01-14)
2
7
 
3
8
  ## 🐛 Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itee-tasks",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Allow to manage all commons itee gulp tasks into one place ",
5
5
  "keywords": [
6
6
  "itee",
@@ -13,6 +13,7 @@ import {
13
13
  writeFileSync
14
14
  } from 'node:fs'
15
15
  import {
16
+ basename,
16
17
  dirname,
17
18
  extname,
18
19
  join,
@@ -48,45 +49,71 @@ function getJsonFrom( path ) {
48
49
 
49
50
  }
50
51
 
51
- function getConfigurationPathFor( configurationLocation ) {
52
-
53
- const packageConfigurationPath = join( packageTasksConfigurationsDirectory, configurationLocation )
54
- const defaultConfigurationPath = join( iteePackageConfigurationsDirectory, configurationLocation )
52
+ function getTaskConfigurationPathFor( filename ) {
53
+
54
+ // Get relative path of the task between internal or user defined
55
+ let relativeTaskPath = filename.includes( iteePackageSourcesDirectory )
56
+ ? relative( iteePackageSourcesDirectory, filename )
57
+ : relative( packageTasksDirectory, filename )
58
+
59
+ // Generate all possible config file path depending on file extension and default or user defined
60
+ const terminalExtension = extname( relativeTaskPath )
61
+ const searchValue = `.task${ terminalExtension }`
62
+ const replaceValues = [
63
+ '.conf.json',
64
+ '.conf.js',
65
+ '.conf.mjs',
66
+ ]
67
+ const configurationPaths = []
68
+
69
+ for ( const replaceValue of replaceValues ) {
70
+ const configurationLocation = relativeTaskPath.replace( searchValue, replaceValue )
71
+ const packageConfigurationPath = join( packageTasksConfigurationsDirectory, configurationLocation )
72
+ const defaultConfigurationPath = join( iteePackageConfigurationsDirectory, configurationLocation )
73
+
74
+ configurationPaths.push(
75
+ packageConfigurationPath,
76
+ defaultConfigurationPath
77
+ )
78
+ }
55
79
 
80
+ // Looking for existing configuration file (care the user defined must be searched before the default !)
56
81
  let configurationPath
82
+ for ( const currentConfigurationPath of configurationPaths ) {
57
83
 
58
- if ( existsSync( packageConfigurationPath ) ) {
59
-
60
- configurationPath = packageConfigurationPath
61
-
62
- } else if ( existsSync( defaultConfigurationPath ) ) {
63
-
64
- configurationPath = defaultConfigurationPath
65
-
66
- } else {
84
+ if ( existsSync( currentConfigurationPath ) ) {
85
+ configurationPath = currentConfigurationPath
86
+ break
87
+ }
67
88
 
68
- throw new Error( `Unable to find configuration for path ${ packageConfigurationPath } or ${ defaultConfigurationPath }` )
89
+ }
69
90
 
91
+ if ( !configurationPath ) {
92
+ throw new Error( `Unable to find configuration in paths ${ configurationPaths.join( ', ' ) }.` )
70
93
  }
71
94
 
72
95
  return configurationPath
73
96
 
74
97
  }
75
98
 
76
- async function getConfigurationFrom( path ) {
99
+ async function getTaskConfigurationFor( filename ) {
100
+
101
+ const configurationFilePath = getTaskConfigurationPathFor( filename )
77
102
 
78
- let jsonData = null
103
+ log( `Loading configuration from ${ cyan( configurationFilePath ) }` )
104
+
105
+ let configuration = null
79
106
 
80
107
  try {
81
108
 
82
- if ( extname( path ) !== '.json' ) {
109
+ if ( extname( configurationFilePath ) === '.json' ) {
83
110
 
84
- const moduleData = await import(path)
85
- jsonData = moduleData.default
111
+ configuration = getJsonFrom( configurationFilePath )
86
112
 
87
113
  } else {
88
114
 
89
- jsonData = getJsonFrom( path )
115
+ const moduleData = await import( configurationFilePath )
116
+ configuration = moduleData.default
90
117
 
91
118
  }
92
119
 
@@ -96,7 +123,7 @@ async function getConfigurationFrom( path ) {
96
123
 
97
124
  }
98
125
 
99
- return jsonData
126
+ return configuration
100
127
 
101
128
  }
102
129
 
@@ -142,7 +169,7 @@ const iteePackageConfigurationsDirectory = join( iteePackageRootDirectory, 'conf
142
169
  const iteePackageNodeModulesDirectory = join( iteePackageRootDirectory, 'node_modules' )
143
170
  const iteePackageSourcesDirectory = join( iteePackageRootDirectory, 'sources' )
144
171
 
145
- const packageRootDirectory = iteePackageRootDirectory.includes('node_modules') ? join( iteePackageRootDirectory, '../../' ) : iteePackageRootDirectory
172
+ const packageRootDirectory = iteePackageRootDirectory.includes( 'node_modules' ) ? join( iteePackageRootDirectory, '../../' ) : iteePackageRootDirectory
146
173
  const packageTasksDirectory = join( packageRootDirectory, '.tasks' )
147
174
  const packageTasksConfigurationsDirectory = join( packageTasksDirectory, 'configs' )
148
175
  const packageNodeModulesDirectory = join( packageRootDirectory, 'node_modules' )
@@ -281,20 +308,12 @@ async function parallelizeTasksFrom( taskFiles = [] ) {
281
308
 
282
309
  ///
283
310
 
284
- function logLoadingTask( filename, task, configurationPath ) {
311
+ function logLoadingTask( filename ) {
285
312
 
286
313
  const taskPath = relative( packageRootDirectory, filename )
314
+ const taskName = basename( filename, '.task.mjs' )
287
315
 
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 )
316
+ log( `Loading ${ green( taskPath ) } with task ${ blue( taskName ) }` )
298
317
 
299
318
  }
300
319
 
@@ -344,8 +363,8 @@ class Indenter {
344
363
  export {
345
364
  createDirectoryIfNotExist,
346
365
  getJsonFrom,
347
- getConfigurationPathFor,
348
- getConfigurationFrom,
366
+ getTaskConfigurationPathFor,
367
+ getTaskConfigurationFor,
349
368
  createFile,
350
369
  getFilesFrom,
351
370
 
@@ -1,25 +1,24 @@
1
1
  import colors from 'ansi-colors'
2
2
  import log from 'fancy-log'
3
- import { join } from 'path'
3
+ import { basename } from 'node:path'
4
4
  import { rollup } from 'rollup'
5
5
  import {
6
- getConfigurationFrom,
7
- getConfigurationPathFor,
6
+ getTaskConfigurationFor,
8
7
  logLoadingTask
9
8
  } from '../_utils.mjs'
10
9
 
10
+ logLoadingTask( import.meta.filename )
11
+
11
12
  const {
12
13
  red,
13
14
  green,
14
15
  yellow,
15
16
  } = colors
16
17
 
17
- const configurationLocation = join( 'builds', 'build.conf.mjs' )
18
- const configurationPath = getConfigurationPathFor( configurationLocation )
19
-
20
18
  const buildTask = async ( done ) => {
21
19
 
22
- const configuration = await getConfigurationFrom( configurationPath )
20
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
21
+
23
22
  for ( let config of configuration ) {
24
23
 
25
24
  if ( config === undefined || config === null || config.length === 0 ) {
@@ -46,10 +45,8 @@ const buildTask = async ( done ) => {
46
45
  done()
47
46
 
48
47
  }
49
- buildTask.displayName = 'build'
48
+ buildTask.displayName = basename( import.meta.filename, '.task.mjs' )
50
49
  buildTask.description = 'Todo...'
51
50
  buildTask.flags = null
52
51
 
53
- logLoadingTask( import.meta.filename, buildTask, configurationPath )
54
-
55
52
  export { buildTask }
@@ -1,18 +1,16 @@
1
1
  import colors from 'ansi-colors'
2
2
  import { deleteAsync } from 'del'
3
3
  import log from 'fancy-log'
4
- import { join } from 'path'
4
+ import { basename } from 'node:path'
5
5
  import {
6
- getConfigurationFrom,
7
- getConfigurationPathFor,
6
+ getTaskConfigurationFor,
8
7
  logLoadingTask
9
8
  } from '../_utils.mjs'
10
9
 
11
- const { red } = colors
10
+ logLoadingTask( import.meta.filename )
12
11
 
13
- const configurationLocation = join( 'cleans', 'clean.conf.mjs' )
14
- const configurationPath = getConfigurationPathFor( configurationLocation )
15
- const configuration = await getConfigurationFrom( configurationPath )
12
+ const { red } = colors
13
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
16
14
 
17
15
  /**
18
16
  * @method npm run clean
@@ -27,10 +25,8 @@ const cleanTask = () => deleteAsync( configuration, {
27
25
  log( `Deleting [${ progress.deletedCount }/${ progress.totalCount }]<${ percent }%>${ spacer }:`, red( path ) )
28
26
  }
29
27
  } )
30
- cleanTask.displayName = 'clean'
28
+ cleanTask.displayName = basename( import.meta.filename, '.task.mjs' )
31
29
  cleanTask.description = 'Will delete builds and temporary folders'
32
30
  cleanTask.flags = null
33
31
 
34
- logLoadingTask( import.meta.filename, cleanTask, configurationPath )
35
-
36
32
  export { cleanTask }
@@ -1,19 +1,18 @@
1
1
  import colors from 'ansi-colors'
2
2
  import log from 'fancy-log'
3
3
  import child_process from 'node:child_process'
4
+ import { basename } from 'node:path'
4
5
  import { promisify } from 'node:util'
5
- import { join } from 'path'
6
6
  import {
7
- getConfigurationPathFor,
7
+ getTaskConfigurationPathFor,
8
8
  logLoadingTask
9
9
  } from '../_utils.mjs'
10
10
 
11
+ logLoadingTask( import.meta.filename )
12
+
11
13
  const execFile = promisify( child_process.execFile )
12
14
  const { red } = colors
13
15
 
14
- const configurationLocation = join( 'docs', 'doc.conf.json' )
15
- const configurationPath = getConfigurationPathFor( configurationLocation )
16
-
17
16
  /**
18
17
  * @method npm run doc
19
18
  * @global
@@ -23,6 +22,8 @@ const docTask = async ( done ) => {
23
22
 
24
23
  try {
25
24
 
25
+ const configurationPath = getTaskConfigurationPathFor( import.meta.filename )
26
+
26
27
  const { stdout } = await execFile(
27
28
  './node_modules/.bin/jsdoc',
28
29
  [
@@ -40,10 +41,8 @@ const docTask = async ( done ) => {
40
41
  }
41
42
 
42
43
  }
43
- docTask.displayName = 'doc'
44
+ docTask.displayName = basename( import.meta.filename, '.task.mjs' )
44
45
  docTask.description = 'Will generate this documentation.'
45
46
  docTask.flags = null
46
47
 
47
- logLoadingTask( import.meta.filename, docTask, configurationPath )
48
-
49
48
  export { docTask }
@@ -1,5 +1,6 @@
1
1
  import colors from 'ansi-colors'
2
2
  import log from 'fancy-log'
3
+ import { basename } from 'node:path'
3
4
  import {
4
5
  getPrettyNodeVersion,
5
6
  getPrettyNpmVersion,
@@ -9,6 +10,8 @@ import {
9
10
  logLoadingTask
10
11
  } from '../_utils.mjs'
11
12
 
13
+ logLoadingTask( import.meta.filename )
14
+
12
15
  const {
13
16
  red,
14
17
  green,
@@ -145,10 +148,8 @@ const helpTask = ( done ) => {
145
148
  done()
146
149
 
147
150
  }
148
- helpTask.displayName = 'help'
151
+ helpTask.displayName = basename( import.meta.filename, '.task.mjs' )
149
152
  helpTask.description = 'Display the package help'
150
153
  helpTask.flags = null
151
154
 
152
- logLoadingTask( import.meta.filename, helpTask )
153
-
154
155
  export { helpTask }
@@ -1,18 +1,17 @@
1
1
  import colors from 'ansi-colors'
2
2
  import log from 'fancy-log'
3
3
  import child_process from 'node:child_process'
4
+ import { basename } from 'node:path'
4
5
  import { promisify } from 'node:util'
5
- import { join } from 'path'
6
6
  import {
7
- getConfigurationPathFor,
7
+ getTaskConfigurationPathFor,
8
8
  logLoadingTask
9
9
  } from '../_utils.mjs'
10
10
 
11
- const execFile = promisify( child_process.execFile )
12
- const { red } = colors
11
+ logLoadingTask( import.meta.filename )
13
12
 
14
- const configurationLocation = join( 'lints', 'lint.conf.mjs' )
15
- const configurationPath = getConfigurationPathFor( configurationLocation )
13
+ const execFile = promisify( child_process.execFile )
14
+ const { red } = colors
16
15
 
17
16
  /**
18
17
  * @method npm run lint
@@ -23,6 +22,8 @@ const lintTask = async ( done ) => {
23
22
 
24
23
  try {
25
24
 
25
+ const configurationPath = getTaskConfigurationPathFor( import.meta.filename )
26
+
26
27
  const { stdout } = await execFile( 'npx', [ 'eslint', '--config', configurationPath, '--fix' ] )
27
28
  if ( stdout !== '' ) {
28
29
  log( stdout )
@@ -38,10 +39,8 @@ const lintTask = async ( done ) => {
38
39
  }
39
40
 
40
41
  }
41
- lintTask.displayName = 'lint'
42
+ lintTask.displayName = basename( import.meta.filename, '.task.mjs' )
42
43
  lintTask.description = 'Will lint the sources files and try to fix the style when possible.'
43
44
  lintTask.flags = null
44
45
 
45
- logLoadingTask( import.meta.filename, lintTask, configurationPath )
46
-
47
46
  export { lintTask }
@@ -7,9 +7,8 @@ import {
7
7
  relative
8
8
  } from 'path'
9
9
  import {
10
- getConfigurationFrom,
11
- getConfigurationPathFor,
12
10
  getFilesFrom,
11
+ getTaskConfigurationFor,
13
12
  iteePackageRootDirectory,
14
13
  iteePackageSourcesDirectory,
15
14
  packageNodeModulesDirectory,
@@ -22,8 +21,7 @@ const {
22
21
  yellow
23
22
  } = colors
24
23
 
25
- const configurationPath = getConfigurationPathFor( 'refresh.conf.mjs' )
26
- const configuration = await getConfigurationFrom( configurationPath )
24
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
27
25
 
28
26
  // Get and filter tasks to expose
29
27
  const defaultTaskPattern = join( iteePackageSourcesDirectory, '/{*.task.mjs,**/*.task.mjs,**/**/*.task.mjs}' )
@@ -88,7 +86,9 @@ for ( const taskFile of defaultTaskFiles ) {
88
86
  gulpfileContent += '\n'
89
87
 
90
88
  // Generate user tasks exports and append to gulpfile content
91
- gulpfileContent += '// User defined tasks\n'
89
+ if ( userTaskFiles.length > 0 ) {
90
+ gulpfileContent += '// User defined tasks\n'
91
+ }
92
92
  for ( const taskFile of userTaskFiles ) {
93
93
  const relativeTaskFile = relative( packageRootDirectory, taskFile )
94
94
  gulpfileContent += `export * from './${ relativeTaskFile }'\n`
@@ -1,4 +1,5 @@
1
1
  import { series } from 'gulp'
2
+ import { basename } from 'node:path'
2
3
  import { logLoadingTask } from '../_utils.mjs'
3
4
  import { buildTask } from '../builds/build.task.mjs'
4
5
  import { cleanTask } from '../cleans/clean.task.mjs'
@@ -8,6 +9,8 @@ import { computeBenchmarksTask } from '../tests/benchmarks/compute-benchmarks.ta
8
9
  import { runTestsTask } from '../tests/run-tests.task.mjs'
9
10
  import { computeUnitTestsTask } from '../tests/units/compute-unit-tests.task.mjs'
10
11
 
12
+ logLoadingTask( import.meta.filename )
13
+
11
14
  /**
12
15
  * @method npm run release
13
16
  * @global
@@ -22,10 +25,8 @@ const releaseTask = series(
22
25
  lintTask,
23
26
  docTask,
24
27
  )
25
- releaseTask.displayName = 'release'
28
+ releaseTask.displayName = basename( import.meta.filename, '.task.mjs' )
26
29
  releaseTask.description = 'Will perform a complete release of the library including \'clean\', \'lint\', \'doc\', \'test\' and finally \'build\'.'
27
30
  releaseTask.flags = null
28
31
 
29
- logLoadingTask( import.meta.filename, releaseTask )
30
-
31
32
  export { releaseTask }
@@ -13,8 +13,7 @@ import {
13
13
  import {
14
14
  createDirectoryIfNotExist,
15
15
  createFile,
16
- getConfigurationFrom,
17
- getConfigurationPathFor,
16
+ getTaskConfigurationFor,
18
17
  logLoadingTask,
19
18
  packageName,
20
19
  packageNodeModulesDirectory,
@@ -23,24 +22,22 @@ import {
23
22
  packageTestsDirectory
24
23
  } from '../../_utils.mjs'
25
24
 
25
+ logLoadingTask( import.meta.filename )
26
+
26
27
  const {
27
28
  red,
28
29
  yellow,
29
30
  } = colors
30
31
 
31
- const configurationLocation = join( 'tests', 'benchmarks', 'compute-benchmarks.conf.mjs' )
32
- const configurationPath = getConfigurationPathFor( configurationLocation )
33
- const configuration = await getConfigurationFrom( configurationPath )
34
-
35
32
  /**
36
33
  * @description Will generate benchmarks files from source code against provided alternatives
37
34
  */
38
- const computeBenchmarksTask = ( done ) => {
35
+ const computeBenchmarksTask = async ( done ) => {
39
36
 
40
37
  createDirectoryIfNotExist( packageTestsBenchmarksDirectory )
41
38
 
42
39
  // Get task configuration
43
- const filePathsToIgnore = configuration
40
+ const filePathsToIgnore = await getTaskConfigurationFor( import.meta.filename )
44
41
 
45
42
  // Get source files to process
46
43
  const pattern = join( packageSourcesDirectory, '**' )
@@ -232,10 +229,8 @@ const computeBenchmarksTask = ( done ) => {
232
229
  done()
233
230
 
234
231
  }
235
- computeBenchmarksTask.displayName = 'compute-benchmarks'
232
+ computeBenchmarksTask.displayName = basename( import.meta.filename, '.task.mjs' )
236
233
  computeBenchmarksTask.description = 'Will generate benchmarks files from source code against provided alternatives.'
237
234
  computeBenchmarksTask.flags = null
238
235
 
239
- logLoadingTask( import.meta.filename, computeBenchmarksTask, configurationPath )
240
-
241
236
  export { computeBenchmarksTask }
@@ -1,6 +1,7 @@
1
1
  import colors from 'ansi-colors'
2
2
  import log from 'fancy-log'
3
3
  import { existsSync } from 'fs'
4
+ import { basename } from 'node:path'
4
5
  import { join } from 'path'
5
6
  import {
6
7
  logLoadingTask,
@@ -8,6 +9,8 @@ import {
8
9
  packageTestsBenchmarksDirectory
9
10
  } from '../../_utils.mjs'
10
11
 
12
+ logLoadingTask( import.meta.filename )
13
+
11
14
  const {
12
15
  red,
13
16
  yellow
@@ -33,10 +36,8 @@ const runBenchmarksForBackendTask = async ( done ) => {
33
36
  }
34
37
 
35
38
  }
36
- runBenchmarksForBackendTask.displayName = 'run-benchmarks-for-backend'
39
+ runBenchmarksForBackendTask.displayName = basename( import.meta.filename, '.task.mjs' )
37
40
  runBenchmarksForBackendTask.description = 'Will run benchmarks with node'
38
41
  runBenchmarksForBackendTask.flags = null
39
42
 
40
- logLoadingTask( import.meta.filename, runBenchmarksForBackendTask )
41
-
42
43
  export { runBenchmarksForBackendTask }
@@ -1,16 +1,14 @@
1
1
  import { startTestRunner } from '@web/test-runner'
2
2
  import colors from 'ansi-colors'
3
- import { join } from 'path'
3
+ import { basename } from 'node:path'
4
4
  import {
5
- getConfigurationFrom,
6
- getConfigurationPathFor,
5
+ getTaskConfigurationFor,
7
6
  logLoadingTask
8
7
  } from '../../_utils.mjs'
9
8
 
10
- const { red } = colors
9
+ logLoadingTask( import.meta.filename )
11
10
 
12
- const configurationLocation = join( 'tests', 'benchmarks', 'run-benchmarks-for-frontend.conf.mjs' )
13
- const configurationPath = getConfigurationPathFor( configurationLocation )
11
+ const { red } = colors
14
12
 
15
13
  /**
16
14
  * @description Will run benchmarks with web-test-runner
@@ -18,7 +16,7 @@ const configurationPath = getConfigurationPathFor( configurationLocation )
18
16
  const runBenchmarksForFrontendTask = () => {
19
17
  return new Promise( async ( resolve, reject ) => {
20
18
 
21
- const configuration = await getConfigurationFrom( configurationPath )
19
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
22
20
  const testRunner = await startTestRunner( {
23
21
  config: configuration,
24
22
  readCliArgs: false,
@@ -43,10 +41,8 @@ const runBenchmarksForFrontendTask = () => {
43
41
 
44
42
  } )
45
43
  }
46
- runBenchmarksForFrontendTask.displayName = 'run-benchmarks-for-frontend'
44
+ runBenchmarksForFrontendTask.displayName = basename( import.meta.filename, '.task.mjs' )
47
45
  runBenchmarksForFrontendTask.description = 'Will run benchmarks with web-test-runner.'
48
46
  runBenchmarksForFrontendTask.flags = null
49
47
 
50
- logLoadingTask( import.meta.filename, runBenchmarksForFrontendTask, configurationPath )
51
-
52
48
  export { runBenchmarksForFrontendTask }
@@ -1,21 +1,16 @@
1
- import { join } from 'path'
1
+ import { basename } from 'node:path'
2
2
  import {
3
- getConfigurationFrom,
4
- getConfigurationPathFor,
3
+ getTaskConfigurationFor,
5
4
  logLoadingTask,
6
5
  serializeTasksFrom
7
- } from '../../_utils.mjs'
6
+ } from '../../_utils.mjs'
8
7
 
8
+ logLoadingTask( import.meta.filename )
9
9
 
10
- const configurationLocation = join( 'tests', 'benchmarks', 'run-benchmarks.conf.mjs' )
11
- const configurationPath = getConfigurationPathFor( configurationLocation )
12
- const configuration = await getConfigurationFrom( configurationPath )
13
-
10
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
14
11
  const runBenchmarksTestsTask = await serializeTasksFrom( configuration )
15
- runBenchmarksTestsTask.displayName = 'run-benchmarks'
12
+ runBenchmarksTestsTask.displayName = basename( import.meta.filename, '.task.mjs' )
16
13
  runBenchmarksTestsTask.description = 'Will run benchmarks in back and front environments.'
17
14
  runBenchmarksTestsTask.flags = null
18
15
 
19
- logLoadingTask( import.meta.filename, runBenchmarksTestsTask, configurationPath )
20
-
21
16
  export { runBenchmarksTestsTask }
@@ -14,26 +14,24 @@ import {
14
14
  } from 'path'
15
15
  import { rollup } from 'rollup'
16
16
  import {
17
- getConfigurationFrom,
18
- getConfigurationPathFor,
17
+ getTaskConfigurationFor,
19
18
  logLoadingTask,
20
19
  packageBuildsDirectory,
21
20
  packageName,
22
21
  packageTestsBundlesDirectory
23
22
  } from '../../_utils.mjs'
24
23
 
24
+ logLoadingTask( import.meta.filename )
25
+
25
26
  const {
26
27
  red,
27
28
  green,
28
29
  magenta,
29
30
  } = colors
30
31
 
31
- const configurationLocation = join( 'tests', 'bundlings', 'check-bundling-from-esm-build-import.conf.mjs' )
32
- const configurationPath = getConfigurationPathFor( configurationLocation )
33
-
34
32
  const checkBundlingFromEsmBuildImportTask = async ( done ) => {
35
33
 
36
- const configuration = await getConfigurationFrom( configurationPath )
34
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
37
35
 
38
36
  const buildFilePath = join( packageBuildsDirectory, `${ packageName }.esm.js` )
39
37
  if ( !existsSync( buildFilePath ) ) {
@@ -122,10 +120,8 @@ const checkBundlingFromEsmBuildImportTask = async ( done ) => {
122
120
  }
123
121
 
124
122
  }
125
- checkBundlingFromEsmBuildImportTask.displayName = 'check-bundling-from-esm-build-import'
123
+ checkBundlingFromEsmBuildImportTask.displayName = basename( import.meta.filename, '.task.mjs' )
126
124
  checkBundlingFromEsmBuildImportTask.description = 'Verify that the project esm build is correctly importable in third party esm files'
127
125
  checkBundlingFromEsmBuildImportTask.flags = null
128
126
 
129
- logLoadingTask( import.meta.filename, checkBundlingFromEsmBuildImportTask, configurationPath )
130
-
131
127
  export { checkBundlingFromEsmBuildImportTask }
@@ -11,25 +11,23 @@ import {
11
11
  extname,
12
12
  join,
13
13
  normalize
14
- } from 'path'
14
+ } from 'path'
15
15
  import { rollup } from 'rollup'
16
16
  import {
17
- getConfigurationFrom,
18
- getConfigurationPathFor,
17
+ getTaskConfigurationFor,
19
18
  logLoadingTask,
20
19
  packageSourcesDirectory,
21
20
  packageTestsBundlesDirectory
22
21
  } from '../../_utils.mjs'
23
22
 
23
+ logLoadingTask( import.meta.filename )
24
+
24
25
  const {
25
26
  red,
26
27
  green,
27
28
  magenta,
28
29
  } = colors
29
30
 
30
- const configurationLocation = join( 'tests', 'bundlings', 'check-bundling-from-esm-files-direct.conf.mjs' )
31
- const configurationPath = getConfigurationPathFor( configurationLocation )
32
-
33
31
  /**
34
32
  * @description In view to detect bundling side effects this task will
35
33
  * create intermediary file for each individual export from this package
@@ -44,7 +42,7 @@ const checkBundlingFromEsmFilesDirectTask = async ( done ) => {
44
42
  rmSync( outputDir, { recursive: true } )
45
43
  }
46
44
 
47
- const configuration = await getConfigurationFrom( configurationPath )
45
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
48
46
 
49
47
  // Get source files to process
50
48
  const pattern = join( packageSourcesDirectory, '**' )
@@ -89,10 +87,8 @@ const checkBundlingFromEsmFilesDirectTask = async ( done ) => {
89
87
  done()
90
88
 
91
89
  }
92
- checkBundlingFromEsmFilesDirectTask.displayName = 'check-bundling-from-esm-files-direct'
90
+ checkBundlingFromEsmFilesDirectTask.displayName = basename( import.meta.filename, '.task.mjs' )
93
91
  checkBundlingFromEsmFilesDirectTask.description = 'In view to detect bundling side effects this task will create intermediary file for each individual export from this package and then create rollup config for each of them and bundle'
94
92
  checkBundlingFromEsmFilesDirectTask.flags = null
95
93
 
96
- logLoadingTask( import.meta.filename, checkBundlingFromEsmFilesDirectTask, configurationPath )
97
-
98
94
  export { checkBundlingFromEsmFilesDirectTask }
@@ -17,8 +17,7 @@ import {
17
17
  } from 'path'
18
18
  import { rollup } from 'rollup'
19
19
  import {
20
- getConfigurationFrom,
21
- getConfigurationPathFor,
20
+ getTaskConfigurationFor,
22
21
  logLoadingTask,
23
22
  packageSourcesDirectory,
24
23
  packageTestsBundlesDirectory
@@ -30,9 +29,6 @@ const {
30
29
  magenta,
31
30
  } = colors
32
31
 
33
- const configurationLocation = join( 'tests', 'bundlings', 'check-bundling-from-esm-files-import.conf.mjs' )
34
- const configurationPath = getConfigurationPathFor( configurationLocation )
35
-
36
32
  const checkBundlingFromEsmFilesImportTask = async ( done ) => {
37
33
 
38
34
  const outputDir = join( packageTestsBundlesDirectory, 'from_files_import' )
@@ -43,7 +39,7 @@ const checkBundlingFromEsmFilesImportTask = async ( done ) => {
43
39
  rmSync( outputDir, { recursive: true } )
44
40
  }
45
41
 
46
- const configuration = await getConfigurationFrom( configurationPath )
42
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
47
43
 
48
44
  // Get source files to process
49
45
  const pattern = join( packageSourcesDirectory, '**' )
@@ -108,10 +104,10 @@ const checkBundlingFromEsmFilesImportTask = async ( done ) => {
108
104
  done()
109
105
 
110
106
  }
111
- checkBundlingFromEsmFilesImportTask.displayName = 'check-bundling-from-esm-files-import'
107
+ checkBundlingFromEsmFilesImportTask.displayName = basename( import.meta.filename, '.task.mjs' )
112
108
  checkBundlingFromEsmFilesImportTask.description = 'In view to detect bundling side effects this task will create intermediary file for each individual export from this package and then create rollup config for each of them and bundle'
113
109
  checkBundlingFromEsmFilesImportTask.flags = null
114
110
 
115
- logLoadingTask( import.meta.filename, checkBundlingFromEsmFilesImportTask, configurationPath )
111
+ logLoadingTask( import.meta.filename )
116
112
 
117
113
  export { checkBundlingFromEsmFilesImportTask }
@@ -1,9 +1,12 @@
1
1
  import { series } from 'gulp'
2
+ import { basename } from 'node:path'
2
3
  import { logLoadingTask } from '../../_utils.mjs'
3
4
  import { checkBundlingFromEsmBuildImportTask } from './check-bundling-from-esm-build-import.task.mjs'
4
5
  import { checkBundlingFromEsmFilesDirectTask } from './check-bundling-from-esm-files-direct.task.mjs'
5
6
  import { checkBundlingFromEsmFilesImportTask } from './check-bundling-from-esm-files-import.task.mjs'
6
7
 
8
+ logLoadingTask( import.meta.filename )
9
+
7
10
  /**
8
11
  * @description In view to detect bundling side effects this task will
9
12
  * create intermediary file for each individual export from this package
@@ -15,9 +18,7 @@ const checkBundlingTask = series(
15
18
  checkBundlingFromEsmBuildImportTask,
16
19
  checkBundlingFromEsmFilesDirectTask
17
20
  )
18
- checkBundlingTask.displayName = 'check-bundling'
21
+ checkBundlingTask.displayName = basename( import.meta.filename, '.task.mjs' )
19
22
  checkBundlingTask.description = 'In view to detect bundling side effects this task will create intermediary file for each individual export and then try to bundle them.'
20
23
 
21
- logLoadingTask( import.meta.filename, checkBundlingTask )
22
-
23
24
  export { checkBundlingTask }
@@ -1,8 +1,11 @@
1
1
  import { series } from 'gulp'
2
+ import { basename } from 'node:path'
2
3
  import { logLoadingTask } from '../_utils.mjs'
3
4
  import { runBenchmarksTestsTask } from './benchmarks/run-benchmarks.task.mjs'
4
5
  import { runUnitTestsTask } from './units/run-unit-tests.task.mjs'
5
6
 
7
+ logLoadingTask( import.meta.filename )
8
+
6
9
  /**
7
10
  * @method npm run test
8
11
  * @global
@@ -12,10 +15,8 @@ const runTestsTask = series(
12
15
  runBenchmarksTestsTask,
13
16
  runUnitTestsTask,
14
17
  )
15
- runTestsTask.displayName = 'run-tests'
18
+ runTestsTask.displayName = basename( import.meta.filename, '.task.mjs' )
16
19
  runTestsTask.description = 'Will run unit tests and benchmarks for backend (node) and frontend (web-test-runner) environments.'
17
20
  runTestsTask.flags = null
18
21
 
19
- logLoadingTask( import.meta.filename, runTestsTask )
20
-
21
22
  export { runTestsTask }
@@ -10,24 +10,21 @@ import {
10
10
  join,
11
11
  normalize,
12
12
  relative
13
- } from 'path'
13
+ } from 'path'
14
14
  import {
15
15
  createDirectoryIfNotExist,
16
16
  createFile,
17
- getConfigurationFrom,
18
- getConfigurationPathFor,
19
17
  getPrettyPackageName,
18
+ getTaskConfigurationFor,
20
19
  Indenter,
21
20
  logLoadingTask,
22
21
  packageName,
23
22
  packageNodeModulesDirectory,
24
23
  packageSourcesDirectory,
25
24
  packageTestsUnitsDirectory
26
- } from '../../_utils.mjs'
25
+ } from '../../_utils.mjs'
27
26
 
28
- const configurationLocation = join( 'tests', 'units', 'compute-unit-tests.conf.mjs' )
29
- const configurationPath = getConfigurationPathFor( configurationLocation )
30
- const configuration = await getConfigurationFrom( configurationPath )
27
+ logLoadingTask( import.meta.filename )
31
28
 
32
29
  const {
33
30
  red,
@@ -37,15 +34,15 @@ const {
37
34
  /**
38
35
  * @description Will generate unit test files from source code using type inference from comments
39
36
  */
40
- const computeUnitTestsTask = ( done ) => {
37
+ const computeUnitTestsTask = async ( done ) => {
41
38
 
42
39
  createDirectoryIfNotExist( packageTestsUnitsDirectory )
43
40
 
44
41
  // Get task configuration
45
- const filePathsToIgnore = configuration
42
+ const filePathsToIgnore = await getTaskConfigurationFor( import.meta.filename )
46
43
 
47
44
  // Get source files to process
48
- const pattern = join( packageSourcesDirectory, '**' )
45
+ const pattern = join( packageSourcesDirectory, '**' )
49
46
  const sourceFiles = glob.sync( pattern )
50
47
  .map( filePath => normalize( filePath ) )
51
48
  .filter( filePath => {
@@ -543,10 +540,8 @@ const computeUnitTestsTask = ( done ) => {
543
540
  done()
544
541
 
545
542
  }
546
- computeUnitTestsTask.displayName = 'compute-unit-tests'
543
+ computeUnitTestsTask.displayName = basename( import.meta.filename, '.task.mjs' )
547
544
  computeUnitTestsTask.description = 'Will generate unit test files from source code using type inference from comments'
548
545
  computeUnitTestsTask.flags = null
549
546
 
550
- logLoadingTask( import.meta.filename, computeUnitTestsTask, configurationPath )
551
-
552
547
  export { computeUnitTestsTask }
@@ -2,6 +2,7 @@ import colors from 'ansi-colors'
2
2
  import { spawn } from 'child_process'
3
3
  import log from 'fancy-log'
4
4
  import { existsSync } from 'fs'
5
+ import { basename } from 'node:path'
5
6
  import { join } from 'path'
6
7
  import {
7
8
  logLoadingTask,
@@ -10,6 +11,8 @@ import {
10
11
  packageTestsUnitsDirectory
11
12
  } from '../../_utils.mjs'
12
13
 
14
+ logLoadingTask( import.meta.filename )
15
+
13
16
  const {
14
17
  red,
15
18
  yellow,
@@ -38,10 +41,8 @@ const runUnitTestsForBackendTask = ( done ) => {
38
41
  } )
39
42
 
40
43
  }
41
- runUnitTestsForBackendTask.displayName = 'run-unit-tests-for-backend'
44
+ runUnitTestsForBackendTask.displayName = basename( import.meta.filename, '.task.mjs' )
42
45
  runUnitTestsForBackendTask.description = 'Will run unit tests with node'
43
46
  runUnitTestsForBackendTask.flags = null
44
47
 
45
- logLoadingTask( import.meta.filename, runUnitTestsForBackendTask )
46
-
47
48
  export { runUnitTestsForBackendTask }
@@ -1,16 +1,14 @@
1
1
  import { startTestRunner } from '@web/test-runner'
2
2
  import colors from 'ansi-colors'
3
- import { join } from 'path'
3
+ import { basename } from 'node:path'
4
4
  import {
5
- getConfigurationFrom,
6
- getConfigurationPathFor,
5
+ getTaskConfigurationFor,
7
6
  logLoadingTask
8
7
  } from '../../_utils.mjs'
9
8
 
10
- const { red } = colors
9
+ logLoadingTask( import.meta.filename )
11
10
 
12
- const configurationLocation = join( 'tests', 'units', 'run-unit-tests-for-frontend.conf.mjs' )
13
- const configurationPath = getConfigurationPathFor( configurationLocation )
11
+ const { red } = colors
14
12
 
15
13
  /**
16
14
  * @description Will run unit tests with web-test-runner
@@ -18,7 +16,7 @@ const configurationPath = getConfigurationPathFor( configurationLocation )
18
16
  const runUnitTestsForFrontendTask = () => {
19
17
  return new Promise( async ( resolve, reject ) => {
20
18
 
21
- const configuration = await getConfigurationFrom( configurationPath )
19
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
22
20
  const testRunner = await startTestRunner( {
23
21
  config: configuration,
24
22
  readCliArgs: false,
@@ -43,10 +41,8 @@ const runUnitTestsForFrontendTask = () => {
43
41
 
44
42
  } )
45
43
  }
46
- runUnitTestsForFrontendTask.displayName = 'run-unit-tests-for-frontend'
44
+ runUnitTestsForFrontendTask.displayName = basename( import.meta.filename, '.task.mjs' )
47
45
  runUnitTestsForFrontendTask.description = 'Will run unit tests with web-test-runner'
48
46
  runUnitTestsForFrontendTask.flags = null
49
47
 
50
- logLoadingTask( import.meta.filename, runUnitTestsForFrontendTask, configurationPath )
51
-
52
48
  export { runUnitTestsForFrontendTask }
@@ -1,21 +1,16 @@
1
- import { join } from 'path'
1
+ import { basename } from 'node:path'
2
2
  import {
3
- getConfigurationFrom,
4
- getConfigurationPathFor,
3
+ getTaskConfigurationFor,
5
4
  logLoadingTask,
6
5
  serializeTasksFrom
7
- } from '../../_utils.mjs'
6
+ } from '../../_utils.mjs'
8
7
 
8
+ logLoadingTask( import.meta.filename )
9
9
 
10
- const configurationLocation = join( 'tests', 'units', 'run-unit-tests.conf.mjs' )
11
- const configurationPath = getConfigurationPathFor( configurationLocation )
12
- const configuration = await getConfigurationFrom( configurationPath )
13
-
10
+ const configuration = await getTaskConfigurationFor( import.meta.filename )
14
11
  const runUnitTestsTask = await serializeTasksFrom( configuration )
15
- runUnitTestsTask.displayName = 'run-unit-tests'
12
+ runUnitTestsTask.displayName = basename( import.meta.filename, '.task.mjs' )
16
13
  runUnitTestsTask.description = 'Will run unit tests in back and front environments.'
17
14
  runUnitTestsTask.flags = null
18
15
 
19
- logLoadingTask( import.meta.filename, runUnitTestsTask, configurationPath )
20
-
21
16
  export { runUnitTestsTask }