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

Added file watcher to now dev #2153

Merged
merged 22 commits into from Apr 16, 2019
Merged

Added file watcher to now dev #2153

merged 22 commits into from Apr 16, 2019

Conversation

TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Apr 12, 2019

This PR is for triggering background rebuilds. So far the files mapping is now kept in sync via the events produced by nsfw.

WIP for triggering background rebuilds. So far the `files` mapping is
now kept in sync via the events produced by `nsfw`.
@TooTallNate TooTallNate changed the title [now dev] Add nsfw file watcher [now dev] WIP Add nsfw file watcher Apr 12, 2019
@TooTallNate TooTallNate requested review from amio, styfle and leo April 12, 2019 22:18
@codecov-io
Copy link

codecov-io commented Apr 12, 2019

Codecov Report

Merging #2153 into canary will decrease coverage by 0.07%.
The diff coverage is 1.03%.

Impacted file tree graph

@@            Coverage Diff            @@
##           canary   #2153      +/-   ##
=========================================
- Coverage    4.43%   4.36%   -0.08%     
=========================================
  Files         243     244       +1     
  Lines        8652    8793     +141     
  Branches      902     923      +21     
=========================================
  Hits          384     384              
- Misses       8251    8392     +141     
  Partials       17      17
Impacted Files Coverage Δ
src/commands/dev/lib/types.ts 0% <ø> (ø) ⬆️
src/commands/dev/lib/dev-builder.ts 0% <0%> (ø) ⬆️
src/commands/dev/lib/dev-server.ts 0% <0%> (ø) ⬆️
src/commands/dev/lib/nsfw-module.ts 0% <0%> (ø)
src/commands/dev/lib/static-builder.ts 0% <0%> (ø) ⬆️
src/commands/dev/lib/builder-cache.ts 0% <0%> (ø) ⬆️
src/commands/dev/lib/dev-router.ts 72% <100%> (ø) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 614b9c4...ae23d00. Read the comment docs.

@types/nsfw/index.d.ts Outdated Show resolved Hide resolved
@types/nsfw/index.d.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@amio amio left a comment

Choose a reason for hiding this comment

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

We also need a live ignore filter, filter out our default IGNORES, and gets updated with .nowignore file change. But we can do this in another PR.

@TooTallNate
Copy link
Member Author

@leo This PR is more or less ready, except that we still need to figure out how to handle the nsfw.node binary file in our build process to make it work properly with pkg.

I suggest we fork nsfw and make it require the .node file from a temporary location, which now-cli would copy from it's snapshot filesystem to the temporary location before requiring nsfw.

@amio
Copy link
Contributor

amio commented Apr 15, 2019

@TooTallNate Looks like we just put nsfw.node by the side of dist/index.js then it should be fine 🤔

> Warning Cannot include addon %1 into executable.
  The addon must be distributed with executable as %2.
  /Users/xilo/git/zeit/now-cli/dist/build/Release/nsfw.node
  path-to-executable/nsfw.node

@leo
Copy link
Contributor

leo commented Apr 15, 2019

@amio The problem is not the bundling, it's the fact that nsfw then ready from the virtual file system inside pkg without being able to access the paths to watch on the real file system.

I'm working on it today.

@leo leo changed the title [now dev] WIP Add nsfw file watcher Added file watcher to now dev Apr 15, 2019
.circleci/config.yml Outdated Show resolved Hide resolved
// `BuilderOutputs` map was returned
result = { output: result as BuilderOutputs };
if (r.output) {
result = r as BuildResult;
Copy link
Member

Choose a reason for hiding this comment

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

So this why returning a version would be good because then you wouldn't need to cast. Oh well 🤷‍♂️

@leo leo merged commit 7979110 into canary Apr 16, 2019
@leo leo deleted the add/now-dev-nsfw branch April 16, 2019 18:13
leo pushed a commit that referenced this pull request Apr 25, 2019
* [now dev] Add `nsfw` file watcher

WIP for triggering background rebuilds. So far the `files` mapping is
now kept in sync via the events produced by `nsfw`.

* Add `now.json` caching and invalidation from nsfw events

* Add initial rebuilding logic from filesystem watching

* Remove previously built assets when a rebuild occurs

* Make `@now/static` not require a hard refresh

* Shut down the `nsfw` instance when stopping the DevServer

* Prettier and some minor tweaks

* Ship module

* Support private deps

* Fixed tests

* Fixed integration tests

* Revert "Support private deps"

This reverts commit 0b4991b.

* Support multiple platforms

* Typed

* Consider Alpine

* Bumped @zeit/nsfw to latest version

* Update src/commands/dev/lib/nsfw-module.ts

Co-Authored-By: leo <mindrun@icloud.com>

* Pass module path differently

* Bumped package

* Make binary executable

* Wait until piping is complete

* Added debug statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants