Skip to content

Commit 2860709

Browse files
committed
🐛 (builds) fix build tasks and config to be defined locally
1 parent 6851008 commit 2860709

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

.tasks/builds/build.mjs

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
1-
import { join } from 'path'
21
import rollupConfigurator from '../../configs/rollup.conf.js'
3-
import parseArgs from 'minimist'
4-
import { getDirname } from '../_utils.mjs'
5-
import { packageInfos } from '../_utils.mjs'
62
import { rollup } from 'rollup'
73
import log from 'fancy-log'
4+
import { getGulpConfigForTask } from '../../configs/gulp.conf.mjs'
85

96
function build( done ) {
107

11-
const __dirname = getDirname()
12-
13-
const options = parseArgs( process.argv, {
14-
string: [ 'n', 'i', 'f', 'e' ],
15-
boolean: [ 's', 't' ],
16-
default: {
17-
i: join( __dirname, 'sources', `${ packageInfos.name }.js` ),
18-
o: join( __dirname, 'builds' ),
19-
f: [ 'esm', 'cjs', 'iife' ],
20-
e: [ 'dev', 'prod' ],
21-
s: true,
22-
t: true
23-
},
24-
alias: {
25-
i: 'input',
26-
o: 'output',
27-
f: 'formats',
28-
e: 'envs',
29-
s: 'sourcemap',
30-
t: 'treeshake'
31-
}
32-
} )
33-
8+
const options = getGulpConfigForTask('builds')
349
const configs = rollupConfigurator( options )
3510

3611
nextBuild()

configs/gulp.conf.mjs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
import { readFileSync } from 'fs'
1+
import { readFileSync } from 'fs'
2+
import {
3+
dirname,
4+
join
5+
} from 'path'
6+
import { fileURLToPath } from 'url'
7+
28

39
const packageInfos = JSON.parse( readFileSync(
410
new URL( '../package.json', import.meta.url )
511
) )
12+
const __filename = fileURLToPath( import.meta.url )
13+
const __dirname = dirname( __filename )
614

715
const config = {
816
'clean': [
@@ -39,7 +47,15 @@ const config = {
3947
`${ packageInfos.name }.js`,
4048
'isTestUnitGenerator.js',
4149
'cores.js'
42-
]
50+
],
51+
'builds': {
52+
input: join( __dirname, '../sources', `${ packageInfos.name }.js` ),
53+
output: join( __dirname, '../builds' ),
54+
formats: [ 'esm', 'cjs' ],
55+
envs: [ 'dev', 'prod' ],
56+
sourcemap: true,
57+
treeshake: true
58+
}
4359
}
4460

4561
function getGulpConfigForTask( taskName ) {

0 commit comments

Comments
 (0)