+21
-11
lines changedFilter options
+21
-11
lines changed Original file line number Diff line number Diff line change
@@ -53,21 +53,31 @@ const umdConfig = (input, output, name) => ({
53
53
],
54
54
})
55
55
56
-
const template = `{
57
-
"type": "module",
58
-
"main": "index.cjs",
59
-
"module": "index.js",
60
-
"typings": "index.d.ts"
61
-
}`
56
+
const template = umd =>
57
+
JSON.stringify(
58
+
{
59
+
type: 'module',
60
+
main: 'index.cjs',
61
+
module: 'index.js',
62
+
typings: 'index.d.ts',
63
+
unpkg: umd ? 'index.umd.js' : undefined,
64
+
},
65
+
null,
66
+
2
67
+
)
62
68
63
69
const pkgify = (input, output, name) => {
64
70
fs.mkdirSync(path.join(__dirname, output), { recursive: true })
65
-
fs.writeFileSync(path.join(__dirname, output, 'package.json'), template)
71
+
fs.writeFileSync(
72
+
path.join(__dirname, output, 'package.json'),
73
+
template(!!name)
74
+
)
66
75
return [
67
76
ecmaConfig(`${input}/index.js`, `${output}/index.js`),
68
-
name === 'commonjs'
69
-
? nodeConfig(`${input}/index.js`, `${output}/index.cjs`)
70
-
: umdConfig(`${input}/index.js`, `${output}/index.cjs`, name),
77
+
nodeConfig(`${input}/index.js`, `${output}/index.cjs`),
78
+
...(name
79
+
? [umdConfig(`${input}/index.js`, `${output}/index.umd.js`, name)]
80
+
: []),
71
81
]
72
82
}
73
83
@@ -76,6 +86,6 @@ export default [
76
86
nodeConfig('index.js', 'index.cjs'),
77
87
ecmaConfig('internal-apis.js', 'internal-apis.js'),
78
88
nodeConfig('internal-apis.js', 'internal-apis.cjs'),
79
-
...pkgify('http/node', 'http/node', 'commonjs'),
89
+
...pkgify('http/node', 'http/node'),
80
90
...pkgify('http/web', 'http/web', 'GitHttp'),
81
91
]
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4