Skip to content
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

ci: set check_latest to true #363

Merged
merged 1 commit into from
May 31, 2021
Merged

ci: set check_latest to true #363

merged 1 commit into from
May 31, 2021

Conversation

erezrokah
Copy link

Follow up on #328

@erezrokah erezrokah requested a review from ehmicky May 30, 2021 16:08
@github-actions github-actions bot added the type: chore work needed to keep the product and development running smoothly label May 30, 2021
@erezrokah
Copy link
Author

erezrokah commented May 30, 2021

Windows tests are failing on Node.js 16, looking into the failures and it suggests the plugin is not compatible with Node.js 16 + Windows

@erezrokah erezrokah force-pushed the chore/fix_check_latest_flag branch from a8df756 to 502ec5e Compare May 30, 2021 18:37
@erezrokah erezrokah force-pushed the chore/fix_check_latest_flag branch from 502ec5e to 9916c61 Compare May 30, 2021 18:39
@@ -22,15 +22,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
const trackingFile = readFileSync(trackingFilePath, 'utf8')
const [trackedFunctions, trackedPublish] = trackingFile.split(TRACKING_FILE_SEPARATOR)
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
trackedFiles.forEach((file) => {
const filePath = join(dirPath, file.trim('\r'))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the original code. trim doesn't accept an argument. Also recursive: true is not supported for Node.js 10.
Finally I'm not sure why we need rmdirSync on Windows since removeSync does the same without failing on non existent files.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2021-05-31 at 2 47 40 AM

basically this work was trial and error on windows when i first did it. it was just to get a bandaid solution out so plugin users could even SORTOF use the CLI, in lieu of a CLI-based solution like having plugins build into a sep dir (instead of changing their src). if all the tests pass still with this diff then thats great!!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I should have been more clear. trim('\r') is the same as trim() as trim doesn't accept an argument.

@@ -22,15 +22,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
const trackingFile = readFileSync(trackingFilePath, 'utf8')
const [trackedFunctions, trackedPublish] = trackingFile.split(TRACKING_FILE_SEPARATOR)
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
trackedFiles.forEach((file) => {
const filePath = join(dirPath, file.trim('\r'))
if (file !== '') {
Copy link
Author

@erezrokah erezrokah May 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure but the intention here might be to check the trimmed version of file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trackingFile.split would sometimes insert '' into trackedFiles; this is just to skip that

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in these cases, with file === '', it removes the current dir

@erezrokah erezrokah requested a review from lindsaylevine May 30, 2021 18:44
if (process.platform === 'win32') {
rmdirSync(filePath, { recursive: true })
}
trackedFiles
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lindsaylevine can you approve this change?

@@ -22,15 +22,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
const trackingFile = readFileSync(trackingFilePath, 'utf8')
const [trackedFunctions, trackedPublish] = trackingFile.split(TRACKING_FILE_SEPARATOR)
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
trackedFiles.forEach((file) => {
const filePath = join(dirPath, file.trim('\r'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2021-05-31 at 2 47 40 AM

basically this work was trial and error on windows when i first did it. it was just to get a bandaid solution out so plugin users could even SORTOF use the CLI, in lieu of a CLI-based solution like having plugins build into a sep dir (instead of changing their src). if all the tests pass still with this diff then thats great!!

@@ -22,15 +22,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
const trackingFile = readFileSync(trackingFilePath, 'utf8')
const [trackedFunctions, trackedPublish] = trackingFile.split(TRACKING_FILE_SEPARATOR)
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
trackedFiles.forEach((file) => {
const filePath = join(dirPath, file.trim('\r'))
if (file !== '') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trackingFile.split would sometimes insert '' into trackedFiles; this is just to skip that

@@ -22,15 +22,13 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
const trackingFile = readFileSync(trackingFilePath, 'utf8')
const [trackedFunctions, trackedPublish] = trackingFile.split(TRACKING_FILE_SEPARATOR)
const cleanConfiguredFiles = (trackedFiles, dirPath) => {
trackedFiles.forEach((file) => {
const filePath = join(dirPath, file.trim('\r'))
if (file !== '') {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in these cases, with file === '', it removes the current dir

}
trackedFiles
.map((file) => file.trim())
.filter(Boolean)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this effectively the same thing as if (file !== '') ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the original code if (file !== '') is the original non trimmed value (trim doesn't mutate the string), so the check should be if (file.trim() !== '').
filter(Boolean) operates on the trimmed value.

@erezrokah
Copy link
Author

Thanks for the review @lindsaylevine

@erezrokah erezrokah merged commit e6a51fa into main May 31, 2021
@erezrokah erezrokah deleted the chore/fix_check_latest_flag branch May 31, 2021 08:30
serhalp pushed a commit that referenced this pull request Apr 5, 2024
* fix: import server in module scope

* chore: rmeove comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants