Skip to content

ci: set check_latest to true #363

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

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
check-latest: '*'
check-latest: true
- run: npm ci
- name: Linting
run: npm run format:ci
Expand Down
16 changes: 7 additions & 9 deletions src/lib/helpers/handleFileTracking.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { join } = require('path')

const findCacheDir = require('find-cache-dir')
const { existsSync, readdirSync, readFileSync, rmdirSync, removeSync, writeFileSync } = require('fs-extra')
const { existsSync, readdirSync, readFileSync, removeSync, writeFileSync } = require('fs-extra')

const { NETLIFY_PUBLISH_PATH, NETLIFY_FUNCTIONS_PATH } = require('../config')

Expand All @@ -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.

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

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?

.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.

.forEach((file) => {
const filePath = join(dirPath, file)
removeSync(filePath)
}
})
})
}

if (isConfiguredPublishDir) {
Expand Down