-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(js): adjust how to pass information down to swc cli (#8298)
- Loading branch information
Showing
11 changed files
with
149 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { readJsonFile, writeJsonFile } from '@nrwl/devkit'; | ||
import { unlinkSync } from 'fs'; | ||
import { join } from 'path'; | ||
import { NormalizedSwcExecutorOptions } from '../schema'; | ||
|
||
// TODO(chau): "exclude" is required here to exclude spec files as --ignore cli option is not working atm | ||
// Open issue: https://github.com/swc-project/cli/issues/20 | ||
export function addTempSwcrc(options: NormalizedSwcExecutorOptions) { | ||
const tmpPath = join( | ||
options.root, | ||
'tmp', | ||
options.projectRoot, | ||
'.swcrc.generated' | ||
); | ||
const swcrcJson = readJsonFile(join(options.projectRoot, '.swcrc')); | ||
|
||
process.on('exit', cleanUpSwcrc(tmpPath)); | ||
|
||
writeJsonFile(tmpPath, { | ||
...swcrcJson, | ||
exclude: options.swcExclude, | ||
}); | ||
|
||
return tmpPath; | ||
} | ||
|
||
function cleanUpSwcrc(tmpPath: string) { | ||
return () => { | ||
try { | ||
if (tmpPath) { | ||
unlinkSync(tmpPath); | ||
} | ||
} catch (e) {} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22c6ddb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: