-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[APM] Make typescript optimization process compatible with NP #58984
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
{ | ||
"extends": "../../../apm.tsconfig.json", | ||
"include": [ | ||
"./**/*", | ||
"../../../plugins/apm/**/*", | ||
"../../../typings/**/*" | ||
"./plugins/apm/**/*", | ||
"./legacy/plugins/apm/**/*", | ||
"./typings/**/*" | ||
], | ||
"exclude": [ | ||
"**/__fixtures__/**/*", | ||
"./e2e/cypress/**/*" | ||
"./legacy/plugins/apm/e2e/cypress/**/*" | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,32 +5,21 @@ | |
*/ | ||
/* eslint-disable import/no-extraneous-dependencies */ | ||
|
||
const path = require('path'); | ||
const execa = require('execa'); | ||
const fs = require('fs'); | ||
const promisify = require('util').promisify; | ||
const removeFile = promisify(fs.unlink); | ||
const exists = promisify(fs.exists); | ||
|
||
const { apmRoot, filesToIgnore } = require('./paths'); | ||
const { filesToIgnore } = require('./paths'); | ||
|
||
async function unoptimizeTsConfig() { | ||
for (const filename of filesToIgnore) { | ||
await execa('git', ['update-index', '--no-skip-worktree', filename]); | ||
await execa('git', ['checkout', filename]); | ||
} | ||
|
||
const apmTsConfig = path.join(apmRoot, 'tsconfig.json'); | ||
if (await exists(apmTsConfig)) { | ||
await removeFile(apmTsConfig); | ||
} | ||
} | ||
|
||
module.exports = { | ||
unoptimizeTsConfig: () => { | ||
return unoptimizeTsConfig().then(() => { | ||
// eslint-disable-next-line no-console | ||
console.log('Removed APM TypeScript optimizations'); | ||
}); | ||
unoptimizeTsConfig: async () => { | ||
await unoptimizeTsConfig(); | ||
// eslint-disable-next-line no-console | ||
console.log('Removed APM TypeScript optimizations'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should go to stderr too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not an error though, am I misunderstanding what you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
https://www.jstorimer.com/blogs/workingwithcode/7766119-when-to-use-stderr-instead-of-stdout it's probably a controversial point though against "console.error is for errors" so either way I guess. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got that, but you might have commented in the wrong file? Did you meant to comment on |
||
} | ||
}; |
This file was deleted.
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.
If you do
console.error
here will ESLint not complain? You would want this on stderr anyway I presume.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.
good point, I'll move it to console.error (regardless of whether it will complain)