fix(cli): Configure GLOBALS (#6061)

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6059.
This commit is contained in:
Donny/강동윤 2022-10-06 13:17:06 +09:00 committed by GitHub
parent 39874529e0
commit 6cdb5ed97f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -16,7 +16,9 @@ use swc_core::{
config::{Config, ConfigFile, Options},
try_with_handler, Compiler, HandlerOpts, TransformOutput,
},
common::{errors::ColorConfig, sync::Lazy, FileName, FilePathMapping, SourceFile, SourceMap},
common::{
errors::ColorConfig, sync::Lazy, FileName, FilePathMapping, SourceFile, SourceMap, GLOBALS,
},
trace_macro::swc_trace,
};
use walkdir::WalkDir;
@ -366,7 +368,11 @@ impl CompileOptions {
color: ColorConfig::Always,
skip_filename: false,
},
|handler| compiler.process_js_file(fm, handler, &options),
|handler| {
GLOBALS.set(&Default::default(), || {
compiler.process_js_file(fm, handler, &options)
})
},
)
};

View File

@ -18,10 +18,7 @@ function sleep(ms: number) {
console.log(`Latest commit message: ${latestCommitMessage}`);
if (
!latestCommitMessage.startsWith("test(") &&
!latestCommitMessage.startsWith("chore:")
) {
if (!latestCommitMessage.startsWith("chore:")) {
console.log(
`Auto rebase script cannot work because the latest commit may require a version bump`
);