MCPcopy Create free account
hub / github.com/M-cheng-web/web-tracing / updatePackageJSON

Function updatePackageJSON

scripts/utils.ts:106–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

104 * 更改每个子包的 packages
105 */
106export async function updatePackageJSON() {
107 const { version } = await fs.readJSON('package.json')
108
109 for (const {
110 name,
111 description,
112 author,
113 iife,
114 keywords,
115 moduleJs
116 } of packages) {
117 const packageDir = join(DIR_SRC, name)
118 const packageJSONPath = join(packageDir, 'package.json')
119 const packageJSON = await fs.readJSON(packageJSONPath)
120
121 packageJSON.version = version
122 packageJSON.description = description || packageJSON.description
123 packageJSON.author =
124 author || 'M-cheng-web <https://github.com/M-cheng-web>'
125 packageJSON.bugs = {
126 url: 'https://github.com/M-cheng-web/web-tracing/issues'
127 }
128 packageJSON.homepage = 'https://github.com/M-cheng-web/web-tracing#readme'
129 packageJSON.repository = {
130 type: 'git',
131 url: 'git+https://github.com/M-cheng-web/web-tracing.git',
132 directory: `packages/${name}`
133 }
134 packageJSON.types = './dist/index.d.ts'
135 packageJSON.main = moduleJs ? './dist/index.mjs' : './dist/index.cjs'
136 packageJSON.module = './dist/index.mjs'
137 if (iife !== false) {
138 packageJSON.unpkg = './dist/index.iife.min.js'
139 packageJSON.jsdelivr = './dist/index.iife.min.js'
140 }
141 packageJSON.exports = {
142 ...packageJSON.exports,
143 '.': {
144 import: './dist/index.mjs',
145 require: './dist/index.cjs',
146 types: './dist/index.d.ts'
147 },
148 './*': './*'
149 }
150 if (keywords) {
151 packageJSON.keywords = [...keywords]
152 }
153
154 await fs.writeJSON(packageJSONPath, packageJSON, { spaces: 2 })
155 }
156}
157
158export function isValidKey(
159 key: string | number | symbol,

Callers 1

runFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected