Check for duplicates
Description
We are using gulp to invoke closure-compiler and do some other tasks related to building, like renaming some files. However, this has a few problems:
- gulp is barely maintained
- our gulp scripts are difficult to reason about/modify
- nx may or may not actually be cacheing the build output correctly or efficiently
- the google-closure-compiler gulp plugin we're using is updated frequently but doesn't seem to be officially supported by google, and nobody can answer questions about it apparently. it also breaks every ~month or so requiring us to update to the newest version which has no appreciable new features or value to us other than unborking CI. unfortunately this may or may not be solved by this move because it's the same npm package we'd be using, but we'd switch to the plain node implementation instead of the gulp plugin.
We can remove gulp from the build_tasks with the following replacements:
- a bunch of functions that are already async or just doing some work and calling gulp's
done at the end: just regular functions, stay the same / drop the done callback
stripApacheLicense: currently using gulp-replace stream that modifies the files in-stream so this intermediate step isn't written anywhere. we can modify the tsc output in place instead (and write to disk)
- note that we currently call this on the advanced_compilation_test's source files, but we don't need to because who cares if those test files still have the apache header instead of 4 newlines? so it's okay for this to move out of the current place and just act on the tsc outputs instead of everything that's passed to cc.
compile uses the google-closure-compiler gulp plugin. instead, we can just use the native node API. we may need to add our own error handling to make a closure compiler exit the script with error, instead of relying on the gulp plugin to cause a stream error.
- gulp-sourcemaps plugin: remove and just pass the sourcemap flags to closure compiler directly.
buildCompiled is the complicated step. it currently has 6 stages:
stripApacheLicense: discussed above, rewrite in place
sourcemaps.init(): discussed above, just drop this
compile: discussed above
rename to add _compressed to filenames: just rename the files on disk afterwards, then update the names in the sourcemaps after they're generated
sourcemaps.write: discussed above, handled by passing the --create-source-map flag to cc. since this would be generated in step 3 now, need to handle renaming the files to compressed in the sourcemaps as well.
gulp.dest is where all of this is finally written to disk, instead we'd be doing it as we go
advancedCompilationTest: similar to the steps above, but no need to strip the license and not sure if we need to generate source maps or not?
To verify this work is correct we should do a diff of the build output including the sourcemaps to make sure they're identical.
Reproduction steps
Priority
No response
Stack trace
Screenshots
No response
Browsers
No response
Check for duplicates
Description
We are using gulp to invoke closure-compiler and do some other tasks related to building, like renaming some files. However, this has a few problems:
We can remove gulp from the build_tasks with the following replacements:
doneat the end: just regular functions, stay the same / drop thedonecallbackstripApacheLicense: currently using gulp-replace stream that modifies the files in-stream so this intermediate step isn't written anywhere. we can modify the tsc output in place instead (and write to disk)compileuses the google-closure-compiler gulp plugin. instead, we can just use the native node API. we may need to add our own error handling to make a closure compiler exit the script with error, instead of relying on the gulp plugin to cause a stream error.buildCompiledis the complicated step. it currently has 6 stages:stripApacheLicense: discussed above, rewrite in placesourcemaps.init(): discussed above, just drop thiscompile: discussed aboverenameto add_compressedto filenames: just rename the files on disk afterwards, then update the names in the sourcemaps after they're generatedsourcemaps.write: discussed above, handled by passing the--create-source-mapflag to cc. since this would be generated in step 3 now, need to handle renaming the files to compressed in the sourcemaps as well.gulp.destis where all of this is finally written to disk, instead we'd be doing it as we goadvancedCompilationTest: similar to the steps above, but no need to strip the license and not sure if we need to generate source maps or not?To verify this work is correct we should do a diff of the build output including the sourcemaps to make sure they're identical.
Reproduction steps
Priority
No response
Stack trace
Screenshots
No response
Browsers
No response