jiek 1.0.15 → 1.1.1
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/dist/cli.cjs +18 -8
- package/dist/cli.js +18 -8
- package/dist/cli.min.cjs +4 -4
- package/dist/cli.min.js +4 -4
- package/dist/rollup/index.cjs +14 -4
- package/dist/rollup/index.js +14 -4
- package/dist/rollup/index.min.cjs +4 -4
- package/dist/rollup/index.min.js +2 -2
- package/package.json +3 -4
- package/src/commands/build.ts +6 -2
- package/src/rollup/index.ts +4 -2
- package/src/utils/loadConfig.ts +17 -2
package/src/commands/build.ts
CHANGED
@@ -31,8 +31,13 @@ module.exports = require('jiek/rollup').template(${JSON.stringify(manifest, null
|
|
31
31
|
|
32
32
|
const require = createRequire(import.meta.url)
|
33
33
|
|
34
|
+
const description = `
|
35
|
+
Build the package according to the 'exports' field in the package.json.
|
36
|
+
`.trim()
|
37
|
+
|
34
38
|
program
|
35
39
|
.command('build')
|
40
|
+
.description(description)
|
36
41
|
.option('-s, --silent', "Don't display logs.")
|
37
42
|
.option('-e, --entries <ENTRIES>', "Specify the entries of the package.json's 'exports' field.(support glob)")
|
38
43
|
.option('-v, --verbose', 'Display debug logs.')
|
@@ -85,8 +90,7 @@ program
|
|
85
90
|
if (tsRegisterName) {
|
86
91
|
prefix = `node -r ${tsRegisterName} `
|
87
92
|
}
|
88
|
-
|
89
|
-
const command = `${prefix}${rollupBinaryPath} --silent -c ${configFile}`
|
93
|
+
const command = `${prefix}${rollupBinaryPath} -c ${configFile}`
|
90
94
|
const child = execaCommand(command, {
|
91
95
|
ipc: true,
|
92
96
|
cwd: dir,
|
package/src/rollup/index.ts
CHANGED
@@ -41,7 +41,9 @@ const COMMON_PLUGINS = [
|
|
41
41
|
json()
|
42
42
|
]
|
43
43
|
|
44
|
-
const config = loadConfig(
|
44
|
+
const config = loadConfig({
|
45
|
+
root: WORKSPACE_ROOT
|
46
|
+
}) ?? {}
|
45
47
|
const { build = {} } = config
|
46
48
|
const jsOutdir = `./${
|
47
49
|
relative(
|
@@ -115,7 +117,7 @@ const withMinify = (
|
|
115
117
|
// TODO resolve dts output file name
|
116
118
|
entryFileNames: chunkInfo =>
|
117
119
|
typeof output.entryFileNames === 'function'
|
118
|
-
? output.entryFileNames(chunkInfo)
|
120
|
+
? output.entryFileNames(chunkInfo).replace(/(\.[cm]?js)$/, '.min$1')
|
119
121
|
: (() => {
|
120
122
|
throw new Error('entryFileNames must be a function')
|
121
123
|
})(),
|
package/src/utils/loadConfig.ts
CHANGED
@@ -48,8 +48,23 @@ function getConfigPath(root: string, dir?: string) {
|
|
48
48
|
return path.resolve(root, configName)
|
49
49
|
}
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
interface LoadConfigOptions {
|
52
|
+
dir?: string
|
53
|
+
root?: string
|
54
|
+
}
|
55
|
+
|
56
|
+
export function loadConfig(options?: LoadConfigOptions): Config
|
57
|
+
export function loadConfig(dir?: string): Config
|
58
|
+
export function loadConfig(dirOrOptions?: string | LoadConfigOptions): Config {
|
59
|
+
let dir: string | undefined
|
60
|
+
let root: string
|
61
|
+
if (typeof dirOrOptions === 'object') {
|
62
|
+
dir = dirOrOptions.dir
|
63
|
+
root = dirOrOptions.root ?? getWD().wd
|
64
|
+
} else {
|
65
|
+
dir = dirOrOptions
|
66
|
+
root = getWD().wd
|
67
|
+
}
|
53
68
|
|
54
69
|
let configPath = program.getOptionValue('configPath')
|
55
70
|
|