MCPcopy Index your code
hub / github.com/tinyplex/tinybase / copyPackageFiles

Function copyPackageFiles

gulpfile.mjs:183–241  ·  view source on GitHub ↗
(forProd = false)

Source from the content-addressed store, hash-verified

181 );
182
183const copyPackageFiles = async (forProd = false) => {
184 const mins = forProd ? [null, 'min'] : [null];
185 const schemas = [null, 'with-schemas'];
186
187 const json = JSON.parse(await promises.readFile('package.json', UTF8));
188 delete json.private;
189 delete json.scripts;
190 delete json.devEngines;
191 delete json.devDependencies;
192
193 json.main = './index.js';
194 json.types = './@types/index.d.ts';
195
196 json.typesVersions = {'*': {}};
197 json.exports = {};
198 mins.forEach((min) => {
199 ALL_MODULES.forEach((module) => {
200 schemas.forEach((withSchemas) => {
201 const pathWithoutSchemas = [min, module]
202 .filter((part) => part)
203 .join('/');
204 const codePathWithoutSchemas =
205 (pathWithoutSchemas ? '/' : '') + pathWithoutSchemas;
206
207 const pathWithSchemas = [min, module, withSchemas]
208 .filter((part) => part)
209 .join('/');
210 const codePathWithSchemas =
211 (pathWithSchemas ? '/' : '') + pathWithSchemas;
212
213 const typesPath = ['.', '@types', module, withSchemas, 'index.d.']
214 .filter((part) => part)
215 .join('/');
216 json.typesVersions['*'][pathWithSchemas ? pathWithSchemas : '.'] = [
217 typesPath + 'ts',
218 ];
219
220 json.exports['.' + codePathWithSchemas] = {
221 default: {
222 types: typesPath + 'ts',
223 default: '.' + codePathWithoutSchemas + '/index.js',
224 },
225 };
226 });
227 });
228 });
229
230 await promises.writeFile(
231 join(DIST_DIR, 'package.json'),
232 JSON.stringify(json, undefined, 2),
233 UTF8,
234 );
235
236 await promises.copyFile('LICENSE', join(DIST_DIR, 'LICENSE'));
237 await promises.copyFile('readme.md', join(DIST_DIR, 'readme.md'));
238 await promises.copyFile('releases.md', join(DIST_DIR, 'releases.md'));
239 await promises.copyFile('site/guides/18_agents.md', 'agents.md');
240 await promises.copyFile('agents.md', join(DIST_DIR, 'agents.md'));

Callers 2

compileModulesForProdFunction · 0.85
compileForTestFunction · 0.85

Calls 1

joinFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…