Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions tracker/compiler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ const ALL_VARIANTS = variantsFile.legacyVariants.concat(
variantsFile.manualVariants
)

function shouldCompileVariant(variant) {
const IS_CE = ['ce', 'ce_test', 'ce_dev'].includes(process.env.MIX_ENV)
const shouldCompileVariant = IS_CE && variant.ee_only ? false : true
return shouldCompileVariant
}

export async function compileAll(options = {}) {
if (process.env.NODE_ENV === 'dev' && canSkipCompile()) {
console.info(
Expand All @@ -46,16 +52,17 @@ export async function compileAll(options = {}) {
const bundledCode = await bundleCode()

const startTime = Date.now()
console.log(`Starting compilation of ${ALL_VARIANTS.length} variants...`)
const variantsToCompile = ALL_VARIANTS.filter(shouldCompileVariant)
console.log(`Starting compilation of ${variantsToCompile.length} variants...`)

const bar = new progress.SingleBar(
{ clearOnComplete: true },
progress.Presets.shades_classic
)
bar.start(ALL_VARIANTS.length, 0)
bar.start(variantsToCompile.length, 0)

const workerPool = Pool(() => spawn(new Worker('./worker-thread.js')))
ALL_VARIANTS.forEach((variant) => {
variantsToCompile.forEach((variant) => {
workerPool.queue(async (worker) => {
await worker.compileFile(variant, { ...options, bundledCode })
bar.increment()
Expand All @@ -67,7 +74,7 @@ export async function compileAll(options = {}) {
bar.stop()

console.log(
`Completed compilation of ${ALL_VARIANTS.length} variants in ${((Date.now() - startTime) / 1000).toFixed(2)}s`
`Completed compilation of ${variantsToCompile.length} variants in ${((Date.now() - startTime) / 1000).toFixed(2)}s`
)
}

Expand Down
2 changes: 2 additions & 0 deletions tracker/compiler/variants.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
"npm_package": "esm"
},
{
"ee_only": true,
"name": "detector.js",
"entry_point": "installation_support/detector.js",
"output_path": "priv/tracker/installation_support/detector.js",
"globals": {}
},
{
"ee_only": true,
"name": "verifier.js",
"entry_point": "installation_support/verifier.js",
"output_path": "priv/tracker/installation_support/verifier.js",
Expand Down
Loading