Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: netlify/cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.21.2
Choose a base ref
...
head repository: netlify/cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.21.3
Choose a head ref
  • 4 commits
  • 7 files changed
  • 4 contributors

Commits on Apr 21, 2021

  1. 1
    Copy the full SHA
    841d21b View commit details
  2. 1
    Copy the full SHA
    c56ba26 View commit details

Commits on Apr 22, 2021

  1. fix(deps): update dependency stripe to v8.145.0 (#2155)

    Co-authored-by: Renovate Bot <bot@renovateapp.com>
    renovate[bot] and renovate-bot authored Apr 22, 2021
    1
    Copy the full SHA
    cc2e2e4 View commit details
  2. chore: release 3.21.3 (#2189)

    Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
    token-generator-app[bot] authored Apr 22, 2021
    1
    Copy the full SHA
    58a00d8 View commit details
16 changes: 11 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -8,16 +8,22 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.config.os }}
timeout-minutes: 30
defaults:
run:
shell: ${{ matrix.config.shell }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
config:
- { os: macOS-latest, shell: bash }
- { os: ubuntu-latest, shell: bash }
- { os: windows-latest, shell: cmd }
node-version: [10.x, 15.x]
exclude:
- os: macOS-latest
- config: { os: macOS-latest, shell: bash }
node-version: 10.x
- os: windows-latest
- config: { os: windows-latest, shell: cmd }
node-version: 10.x
fail-fast: false

@@ -47,7 +53,7 @@ jobs:
- name: Get test coverage flags
id: test-coverage-flags
run: |-
os=${{ matrix.os }}
os=${{ matrix.config.os }}
node=${{ matrix.node-version }}
echo "::set-output name=os::${os/-latest/}"
echo "::set-output name=node::node_${node//./}"
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [3.21.3](https://www.github.com/netlify/cli/compare/v3.21.2...v3.21.3) (2021-04-22)


### Bug Fixes

* **command-dev:** newly added functions are not recognized ([#2186](https://www.github.com/netlify/cli/issues/2186)) ([c56ba26](https://www.github.com/netlify/cli/commit/c56ba26af1e74ecb389f730723921d3fa00eb8fc))
* **deps:** update dependency stripe to v8.145.0 ([#2155](https://www.github.com/netlify/cli/issues/2155)) ([cc2e2e4](https://www.github.com/netlify/cli/commit/cc2e2e4f425887a0878247082e6520137471aba9))

### [3.21.2](https://www.github.com/netlify/cli/compare/v3.21.1...v3.21.2) (2021-04-21)


2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "netlify-cli",
"description": "Netlify command line tool",
"version": "3.21.2",
"version": "3.21.3",
"author": "Netlify Inc.",
"contributors": [
"Mathias Biilmann <matt@netlify.com> (https://twitter.com/biilmann)",
14 changes: 7 additions & 7 deletions src/functions-templates/js/stripe-charge/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions src/functions-templates/js/stripe-subscription/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 29 additions & 7 deletions src/utils/serve-functions.js
Original file line number Diff line number Diff line change
@@ -153,18 +153,28 @@ const buildClientContext = function (headers) {
}
}

const clearCache = ({ action, omitLog }) => (path) => {
const logBeforeAction = ({ omitLog, path, action }) => {
if (!omitLog) {
console.log(`${NETLIFYDEVLOG} ${path} ${action}, reloading...`)
}
}

const logAfterAction = ({ omitLog, path, action }) => {
if (!omitLog) {
console.log(`${NETLIFYDEVLOG} ${path} ${action}, successfully reloaded!`)
}
}

const clearRequireCache = () => {
Object.keys(require.cache).forEach((key) => {
delete require.cache[key]
})
}

if (!omitLog) {
console.log(`${NETLIFYDEVLOG} ${path} ${action}, successfully reloaded!`)
}
const clearCache = ({ action, omitLog }) => (path) => {
logBeforeAction({ omitLog, path, action })
clearRequireCache()
logAfterAction({ omitLog, path, action })
}

const shouldBase64Encode = function (contentType) {
@@ -182,9 +192,9 @@ const validateFunctions = function ({ functions, capabilities, warn }) {
const DEBOUNCE_WAIT = 300

const createHandler = async function ({ dir, capabilities, omitFileChangesLog, warn }) {
const { functions, watchDirs } = await getFunctionsAndWatchDirs(dir)
let { functions, watchDirs } = await getFunctionsAndWatchDirs(dir)
validateFunctions({ functions, capabilities, warn })
const watcher = chokidar.watch(watchDirs, { ignored: /node_modules/ })
const watcher = chokidar.watch(watchDirs, { ignored: /node_modules/, ignoreInitial: true })

const debouncedOnChange = debounce(clearCache({ action: 'modified', omitLog: omitFileChangesLog }), DEBOUNCE_WAIT, {
leading: false,
@@ -194,7 +204,19 @@ const createHandler = async function ({ dir, capabilities, omitFileChangesLog, w
leading: false,
trailing: true,
})
watcher.on('change', debouncedOnChange).on('unlink', debouncedOnUnlink)
watcher
.on('change', debouncedOnChange)
.on('unlink', debouncedOnUnlink)
.on('add', async (path) => {
logBeforeAction({ omitLog: omitFileChangesLog, path, action: 'added' })

await watcher.unwatch(watchDirs)
;({ functions, watchDirs } = await getFunctionsAndWatchDirs(dir))
clearRequireCache()
await watcher.add(watchDirs)

logAfterAction({ omitLog: omitFileChangesLog, path, action: 'added' })
})

const logger = winston.createLogger({
levels: winston.config.npm.levels,