MCPcopy
hub / github.com/sequelize/sequelize / main

Function main

build.js:38–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36}
37
38async function main() {
39 console.log('Compiling sequelize...');
40 const [declarationFiles, filesToCompile] = await Promise.all([
41 // Find all .d.ts files from types/
42 glob('./types/**/*.d.ts', { onlyFiles: true, absolute: false }),
43 // Find all .js and .ts files from lib/
44 glob('./lib/**/*.[tj]s', { onlyFiles: true, absolute: false }),
45 // Delete dist/ for a full rebuild.
46 rmDistDir()
47 ]);
48
49 // copy .d.ts files prior to generating them from the .ts files
50 // so the .ts files in lib/ will take priority..
51 await copyFiles(
52 // The last path in the list is the output directory
53 declarationFiles.concat(outdir),
54 { up: 1 }
55 );
56
57 await Promise.all([
58 build({
59 // Adds source mapping
60 sourcemap: true,
61 // The compiled code should be usable in node v12.22
62 target: 'node12.22',
63 // The source code's format is commonjs.
64 format: 'cjs',
65
66 outdir,
67 entryPoints: filesToCompile
68 .concat('./index.js')
69 .map(file => path.resolve(file))
70 }),
71
72 // not passed to "build" because we need this file to stay as ESM instead of CJS
73 copyFile('./index.mjs', path.resolve(outdir, './index.mjs')),
74
75 exec('tsc', {
76 env: {
77 // binaries installed from modules have symlinks in
78 // <pkg root>/node_modules/.bin.
79 PATH: `${process.env.PATH || ''}:${path.join(
80 rootDir,
81 'node_modules/.bin'
82 )}`
83 },
84 cwd: rootDir
85 })
86 ]);
87}
88
89main().catch(console.error).finally(process.exit);
90

Callers 1

build.jsFile · 0.85

Calls 4

rmDistDirFunction · 0.85
buildFunction · 0.85
logMethod · 0.80
allMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…