-
Notifications
You must be signed in to change notification settings - Fork 88
refactor: move into npm workspace #1304
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
Changes from all commits
3a9cc91
6effc54
c7907fa
cf30d86
a6627bc
c43522a
23838ed
1ef7c1e
aa5d528
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,13 +25,20 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
- name: Installing with latest Node.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is so we can use workspaces, which require node 16, but still run tests in node 12 |
||
uses: actions/setup-node@v2 | ||
if: "${{ matrix.node-version != '*' }}" | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
node-version: '*' | ||
check-latest: true | ||
- name: NPM Install | ||
run: npm ci | ||
- name: Switching to Node.js ${{ matrix.node-version }} to run tests | ||
uses: actions/setup-node@v2 | ||
if: "${{ matrix.node-version != '*' }}" | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
check-latest: true | ||
- name: Linting | ||
run: npm run format:ci | ||
if: "${{ matrix.node-version == '*' }}" | ||
|
@@ -55,14 +62,21 @@ jobs: | |
if: github.ref_name == 'main' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
- name: Installing with latest Node.js | ||
uses: actions/setup-node@v2 | ||
if: "${{ matrix.node-version != '*' }}" | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
node-version: '*' | ||
check-latest: true | ||
- name: NPM Install | ||
run: npm ci | ||
- name: Install Next.js Canary | ||
run: npm install -D next@canary --legacy-peer-deps | ||
- name: Switching to Node.js ${{ matrix.node-version }} to run tests | ||
uses: actions/setup-node@v2 | ||
if: "${{ matrix.node-version != '*' }}" | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
check-latest: true | ||
- name: Run tests against next@canary | ||
run: npm test |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
17.9.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this perhaps be set to v16 so that this is on an LTS version of node? Or is there something about v17 that we want for these changes? Depending on when it's looking like these changes will be merged and released we might be able to even go up to the newest LTS version (v18) which will be released on the April 19th. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I did this because I thought it needed to be 17 for workspaces to work properly, but I think 16 should be ok. Good point re 18 though. We should probably migrate later. I still need to work out the best way to run the node 12 tests though, because right now they're failing as they don't support workspaces at all. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ logs | |
*.log | ||
npm-debug.log* | ||
|
||
package.json | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"plugin": "4.3.2" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "base-path-demo", | ||
"version": "1.0.0", | ||
"description": "", | ||
"devDependencies": { | ||
"@netlify/plugin-nextjs": "*" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/netlify/netlify-plugin-nextjs.git" | ||
}, | ||
"author": "", | ||
"private": true, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/netlify/netlify-plugin-nextjs/issues" | ||
}, | ||
"homepage": "https://github.com/netlify/netlify-plugin-nextjs#readme" | ||
} |
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
[build] | ||
command = "next build" | ||
publish = ".next" | ||
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF ../../" | ||
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../../plugin" | ||
|
||
[build.environment] | ||
# cache Cypress binary in local "node_modules" folder | ||
# so Netlify caches it | ||
CYPRESS_CACHE_FOLDER = "../node_modules/.CypressBinary" | ||
# set TERM variable for terminal output | ||
TERM = "xterm" | ||
NODE_VERSION = "17" | ||
|
||
[dev] | ||
framework = "#static" | ||
|
||
[[plugins]] | ||
package = "./local-plugin" | ||
package = "../plugin-wrapper/" | ||
|
||
# This is a fake plugin, that makes it run npm install | ||
[[plugins]] | ||
package = "@netlify/plugin-local-install-core" | ||
package = "@netlify/plugin-local-install-core" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "default-demo", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/netlify/netlify-plugin-nextjs.git" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/netlify/netlify-plugin-nextjs/issues" | ||
}, | ||
"homepage": "https://github.com/netlify/netlify-plugin-nextjs#readme", | ||
"dependencies": { | ||
"@reach/dialog": "^0.16.2", | ||
"@reach/visually-hidden": "^0.16.0" | ||
}, | ||
"devDependencies": { | ||
"@netlify/plugin-nextjs": "*" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
import { useEffect, useState } from 'react' | ||
|
||
/** | ||
* https://nextjs.org/docs/basic-features/environment-variables | ||
*/ | ||
function EnvTest() { | ||
const [showEnv, setShowEnv] = useState(false) | ||
useEffect(() => setShowEnv(true), []) | ||
return ( | ||
<div> | ||
<h1>Environment Variables</h1> | ||
<a href="https://nextjs.org/docs/basic-features/environment-variables">Read Docs</a> | ||
<p>By default environment variables are only available in the Node.js environment, meaning they won't be exposed to the browser.</p> | ||
<p> | ||
<code>NEXT_PUBLIC_</code> environment variables are available in the browser, and can be used to configure the application. | ||
By default environment variables are only available in the Node.js environment, meaning they won't be | ||
exposed to the browser. | ||
</p> | ||
<p> | ||
<code>NEXT_PUBLIC_</code> environment variables are available in the browser, and can be used to configure the | ||
application. | ||
</p> | ||
<p>✅ Public Environment token found: <code>{process.env.NEXT_PUBLIC_GREETINGS || 'NOT FOUND (something went wrong)'}</code></p> | ||
<p>❌ Private Environment token should not be found: <code>{process.env.TEST_ENV_VAR || 'Everything worked'}</code></p> | ||
{showEnv ? ( | ||
<> | ||
<p> | ||
✅ Public Environment token found:{' '} | ||
<code>{process.env.NEXT_PUBLIC_GREETINGS || 'NOT FOUND (something went wrong)'}</code> | ||
</p> | ||
<p> | ||
❌ Private Environment token should not be found:{' '} | ||
<code>{process.env.TEST_ENV_VAR || 'Everything worked'}</code> | ||
</p> | ||
</> | ||
) : ( | ||
'We only want to test client-side env vars' | ||
)} | ||
</div> | ||
) | ||
} | ||
|
||
export default EnvTest | ||
export default EnvTest |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "next-export-demo", | ||
"version": "1.0.0", | ||
"description": "", | ||
"devDependencies": { | ||
"@netlify/plugin-nextjs": "*" | ||
}, | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/netlify/netlify-plugin-nextjs.git" | ||
}, | ||
"author": "", | ||
"private": true, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/netlify/netlify-plugin-nextjs/issues" | ||
}, | ||
"homepage": "https://github.com/netlify/netlify-plugin-nextjs#readme" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('../../../lib') | ||
module.exports = require('../../../plugin/lib') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// eslint-disable-next-line node/no-unpublished-require | ||
module.exports = require('../../plugin/lib') |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
name: 'plugin-wrapper' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "local-plugin", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"author": "", | ||
"license": "MIT", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"devDependencies": { | ||
"@netlify/plugin-nextjs": "*", | ||
"husky": "^7.0.4", | ||
"npm-run-all": "^4.1.5" | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're changing to manifest releases because the package is in a subdirectory