Commit graph

54 commits

Author SHA1 Message Date
Andrew Hurle
88f27ef947
Fix bug where returning { notFound: true } from GSP broke next export (#24481)
* Fix bug where returning `{ notFound: true }` from GSP broke `next export`

We could just as easily omit the notFoundRoutes check, but I didn't want
to mask other potential bugs that would result in missing files

* update check

* move check

Co-authored-by: jj@jjsweb.site <jj@jjsweb.site>
2021-09-18 10:20:45 -05:00
JJ Kasper
a92a5caec2
Update test set-up to leverage playwright when able to (#28634)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2021-09-13 14:36:25 +02:00
hiro
a9c1bd797d
Fixed typos that existed on some files (#28314)
* fix: naviagtion -> navigation

* fix: compatability -> compatibility
2021-08-19 21:54:13 -05:00
Houssein Djirdeh
6645248d41
[ESLint] Remove error when file patterns are unmatched + ESLint setup changes (#27119)
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2021-07-16 20:19:08 +02:00
Tim Neutkens
b34a0c98fa
Update err.sh links to use nextjs.org/docs/messages instead (#23353) 2021-03-29 10:25:00 +02:00
Jonathan G
6c59cbb46a
[Feature] Progress bar for static build (#15297)
Co-authored-by: Tim Neutkens <timneutkens@me.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2020-08-04 09:58:23 +02:00
Jan Potoms
bd24b70d60
Fix trailing slash handling in exporting pages with getStaticPaths (#14620)
Fixes https://github.com/vercel/next.js/issues/14573
2020-06-27 11:59:27 +00:00
JJ Kasper
b1025995b2
Update to reject when test command fails (#13722)
As noticed in https://github.com/vercel/next.js/pull/13506 when a build or export command fails the tests can just stall. This attempts to address that by rejecting when the command doesn't exit correctly and `stdout` and `stderr` aren't being looked at
2020-06-09 18:28:15 +00:00
Jan Potoms
989b6ad145
Preserve url better in exportTrailingSlash (#13840)
Discovered while doing https://github.com/vercel/next.js/pull/13333. `#` or `?` used to be stripped if there wasn't a value behind
2020-06-07 17:15:06 +00:00
Joe Haddad
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
JJ Kasper
ce0a32c39e
Make sure to not duplicate exports with exportTrailingSlash (#11011)
This makes sure we don't duplicate the `/` route or any others while exporting with `exportTrailingSlash` enabled. We do still output `404.html` with `exportTrailingSlash` enabled in case anyone was relying on this file being present.

Fixes: https://github.com/zeit/next.js/issues/11008
2020-05-27 05:48:50 +00:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -04:00
Jan Potoms
32057c849d
Use the jest-circus test runner (#12974) 2020-05-16 16:56:06 -04:00
Shu Uesugi
cc139b8d89
More renaming ZEIT → Vercel (#12649) 2020-05-09 17:21:53 +02:00
matamatanot
ba30381c99
Use fs.promises in test files (#12432) 2020-05-03 20:10:23 -04:00
JJ Kasper
127f707c18 Tweak export test to be more stable (#10241)
Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-23 15:40:12 -05:00
JJ Kasper
53e9983d83 Add hydration callback for testing (#10195)
* Add hydration callback for testing

* Update size-limit test
2020-01-21 15:33:58 -05:00
JJ Kasper
563f3c084c
Honor exportTrailingSlash for default 404 (#10109) 2020-01-15 14:18:31 -06:00
Jan Potoms
2112e81ae4 Don't prepend a slash on empty path (#9973)
Fixes https://github.com/zeit/next.js/issues/9678

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-08 11:45:17 -05:00
JJ Kasper
ae78e8f5be Fix get(Static|Initial)Props re-running when updating query (#9907)
* Add failing test for re-calling getStaticProps after updating query

* Fix get(Static|Initial)Props re-running when updating query

* Update invalid export tests

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-01-03 15:36:24 -05:00
Joe Haddad
18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00
JJ Kasper
e2d713f93e De-experimentalize the public/ folder (#8661)
* Remove experimental.publicDirectory config

* Error when public is set as an output dir

* Remove experimental.publicDirectory checks

* Update publicFiles checking in next build
2019-10-06 13:44:03 +02:00
JJ Kasper
4e9e51035e Match public files priority in dev (#8641)
* Match public files priority in dev

* Remove un-needed old public file handling

* Run public file priority test for non-dev also

* Make sure to enable publicDirectory

* Add checking for conflicting pages in dev and during build

* Add error for public dir middleware conflict

* Add err.sh for _next conflict

* Move up public dir conflict checking

* Only run _next conflict check in dev when path contains it
2019-09-16 23:06:30 +02:00
Tim Neutkens
2ba352da39 Move next-server back into next package (#8613)
* Initial move

* Make emitting work

* Update paths

* Remove leftover files

* Add correct externals configuration

* Import correct path

* Update path to work with ts-server test

* Update lib directory

* Compile next-server/lib
2019-09-04 10:00:54 -04:00
Luis Fernando Alvarez D
36aabe05a2 Show warning if next export detects an API route (#8257)
* Throw error if next export detects an api route

* Moved the test to the export tests

* Added missing comma

* Move the API route comment

* Add comma after replace

* Show a warning instead
2019-08-12 00:37:20 +02:00
Joe Haddad
aac5121466
Apply missing formatting (#8079)
* Reapply missing formatting

* Fix lint
2019-07-23 14:33:49 -04:00
Lukáš Huvar
2450c85e81 exportPathMap dynamic routes params fix (#7846)
* Fix dynamic page export fixes #7829

* Adding handling of unmatched path

* Remove logs

* Fix newline

* Tests

* Fix promise

* Fix amp tests

* Revert test

* Adjust error document

* Remove old argument

* Simplify export test

* Ensure page !== path for this check
2019-07-10 17:13:44 -04:00
Joe Haddad
b0b1c320a8 Experimentalize public/ (#7771)
* Experimentalize `public/`

* Update tests for publicDirectory config
2019-07-08 07:45:41 +02:00
Joe Haddad
b2a9670ca4
Make exportTrailingSlash stable (#7746) 2019-07-03 13:25:44 -04:00
Joe Haddad
3aed76fad8
Unflag Automatic Prerendering (#7666)
* Unflag Dynamic Routing

* Unflag Automatic Prerendering

* Ensure pages are lambdas for test

* Fix file check

* Fix tests

* oof

* Use lambda for document middleware test
2019-06-28 16:01:11 -04:00
JJ Kasper
8a8cde1b39
Refresh query on mount for exported pages (#7462)
* Refresh query on mount for exported pages

* Make sure to only refresh query if it is different

* Only update if search isn't empty

* Merge pre-rendered query values with
current query values

* Remove dynamic restriction for autoExporting

* Update dynamic routing test fo autoExport

* Remove autoExport from client-navigation test

* Remove logs and update trailing slash config

* Update nextExport tests in client-navigation

* Disable autoExport in export suite
2019-05-30 17:34:05 -07:00
Joe Haddad
b3170d2648
Format missed files (#7464)
* Format missed files

* Remove unnecessary rule

* Fix type error
2019-05-29 18:19:32 -07:00
JJ Kasper
cdd54afb0d Add auto static/dynamic (#7293)
* Add automatic exporting of pages with no getInitialProps

* Add support for exporting serverless to static
and serving the html files during next start

* Fix missing runtimeEnv when requiring page, re-add warning
when trying to export with serverless, and update tests

* Update flying-shuttle test

* revert un-used pagesManifest change

* remove query.amp RegExp test

* Fix windows backslashes not being replaced

* Re-enable serverless support for next start

* bump

* Fix getInitialProps check

* Fix incorrect error check

* Re-add check for reserved pages

* Fix static check

* Update to ignore /api pages and clean up some tests

* Re-add needed next.config for test and correct behavior

* Update RegExp for ignored pages for auto-static

* Add checking for custom getInitialProps in pages/_app

* Update isPageStatic logic to only use default export

* Re-add retrying to CircleCi

* Update query during dev to only have values
available during export for static pages

* Fix test

* Add warning when page without default export is
found and make sure to update pages-manifest
correctly in flying-shuttle mode

* Fix backslashes not being replaced

* Integrate auto-static with flying-shuttle
and make sure AMP is handled in flying-shuttle

* Add autoExport for opting in
2019-05-22 09:36:53 -07:00
Luis Fernando Alvarez D
74771bc5e4
Add support for /public (#7213) 2019-05-03 11:57:47 -05:00
Fredrik Höglund
54e45eb74d Export 404 even if undefined in exportPathMap (#6912)
This PR adds the `_error`-page as an `404.html`-export, even when it is not explicitly defined in a custom `exportPathMap`.

It also fixes two false negative tests related to this. Previously the tests were matching the fallback 404-page from the test-server, rather than the `404.html`-page from next, which was actually not being generated. The test server is also not set up to serve `/404.html` as `/404` which the tests now reflect.

**Caveat**

In its current state, this PR removes `/404.html` from the `defaultPathMap` passed to the custom `exportPathMap`-functions, since it instead adds it after that function is run. While it is possible that someone is relying on this to exist, it is to my knowledge undocumented and also unlikely to be used for anything but merging it into the custom pathMap.

Since this would now merge `undefined` which would result in it being added later on anyway, I deemed it safe, but would be happy to undo that part of the PR if necessary as it was only cleanup.

**Examples**

As a way to demonstrate what this PR does, this is how examples changed:

* `basic-export` - Behaviour is unchanged, still has a `404.html`
* `with-static-export` - Now has a `404.html`
2019-04-22 05:24:28 +09:00
JJ Kasper
14eef58702 Re-add chromedriver retrying from previous webdriver setup (#6846)
* Re-add previous webdriver setup with falling
back to BrowserStack setup

* Add missing webdriver imports
2019-04-01 16:09:09 +02:00
JJ Kasper
533018f7d0 Update tests for BrowserStack (#6810)
Update tests to setup webdriver stuff in `jest-environment` and re-use one browser session instead of spawning one for each webdriver call to prevent creating too many BrowserStack sessions.
2019-03-29 16:05:53 +01:00
JJ Kasper
e1cf32ca60 Update export tests and fixed import (#6738)
* Fix import in export worker

* Update export tests

* Turn test parallelism up

* Fix config in export-default-map

* Switch parallelism back to 3
2019-03-20 11:42:02 -04:00
Joe Haddad
31f6f4c606
Ensure browser gets closed during testing (#6724)
* Ensure browser gets closed during testing

* Remove fit
2019-03-19 18:03:50 -04:00
JJ Kasper
a6ddaefe22 Add experimental exportTrailingSlash config (#6664)
By default when `next export`ing a Next.js application we will automatically append a `/` to all urls to be fully compatible with the directory structure being output.

However since most platforms support directory indexes it makes sense to change this default in the future.

This PR adds `exportTrailingSlash` as experimental flag. We'll try this out for a bit on nextjs.org / zeit.co/docs before introducing it as new option.

The default value is `true` as this is the current behavior in stable Next.js.

```
{
  experimental: {
    exportTrailingSlash: false
  }
}
```

⚠️ as with all experimental flags being added this is subject to breaking between canary/stable versions.
2019-03-17 00:54:58 +01:00
JJ Kasper
38ad8d870c
Fix export with folders that contain dot (#6538) 2019-03-12 18:30:03 -05:00
Connor Davis
861edad459 Implement Recursive Delete (#6489)
Removes `rimraf` for a smaller custom lib

Benchmarks (in ms):
```
rimraf 1
518.536376
rimraf 2
416.112451
rimraf 3
451.905842
rimraf 4
525.117395
rimraf 5
434.230384
---- Average: 469.18ms
-----------
recursive delete 1
121.493979
recursive delete 2
130.335272
recursive delete 3
149.798316
recursive delete 4
182.184688
recursive delete 5
130.346207
--- Average: 142.83ms
```
`recursiveDelete` finishes in ~30% of the time it takes `rimraf` (3.3 times faster)
2019-03-05 14:01:42 +01:00
Connor Davis
fcf1167cd4 Upgrade standard and fix files (#6358)
Upgrades `standard` to major version 12
2019-02-19 22:45:07 +01:00
Connor Davis
bd249180c6
Fix Runtime Config in next export (#6258) 2019-02-11 19:28:47 -06:00
Tim Neutkens
189ac8bb1b
Remove /asset from exportPathMap (#6053)
For some reason one test inconsistently failed.
2019-01-14 15:32:55 +01:00
Tim Neutkens
02ab732096
Remove next/asset (#6046)
* Remove next/asset

Reasoning described in #5970

* Remove next/asset tests

* Bring back asset-page
2019-01-14 01:32:20 +01:00
Corentin.Andre
1496ad6299 fix: update correct path to use when exporting 404 page (#5470)
When exporting error page, next defaults it to 404/index.html which is not recognized as a default 404 page.

This should fix https://github.com/zeit/next.js/issues/5035
2018-11-03 01:19:41 +01:00
Henrik Wenz
18488f47b0 Fix linter (#5350)
* Fix linter

* Add test env

* Fix lint errors
2018-10-20 17:00:01 +02:00
Henrik Wenz
ef01f13e5d Improve test setup (#5388)
* Update jest

* Let jest start chromedriver

This makes sure chromedriver always ends even if the test was canceled by the user.

* Properly close browser in production-config test

* Properly close browser in production/security test

* Properly close browser in export test

* Properly close browser in app-aspath test

* Remove taskr from project root

This isn’t needed anymore

* Readd taskr to project root (temporary)

* Improve global setup/teardown

* Properly close browser in basic/client-navigation test

Clicking an target=_blank link will open a second browser window. We can only close this by using broser.quit()
2018-10-07 15:04:43 +02:00
Andy
b041fa4782 Support for wasm (#5316)
* Set a default path for wasm modules

* Added the mimetype "application/wasm" for wasm files

* Upgrade write-file-webpack-plugin to 4.4.1

* Made dynamic(import()) in test to dynamic(() => import())
2018-10-02 13:10:07 +02:00