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

Function main

build.js:38–87  ·  build.js::main
()

Source from the content-addressed store, hash-verified

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