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

Configure NODE_PATH to load plugin from GitHub workspace #19

Merged
merged 17 commits into from
Dec 11, 2019
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
results/
.lighthouseci/
.lighthouseci/
node_modules/.yarn-integrity
435 changes: 0 additions & 435 deletions node_modules/.yarn-integrity

This file was deleted.

Binary file added node_modules/chrome-launcher/.DS_Store
Binary file not shown.
27 changes: 27 additions & 0 deletions node_modules/is-windows/index.js

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

71 changes: 71 additions & 0 deletions node_modules/is-windows/package.json

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

Binary file added node_modules/ws/lib/.DS_Store
Binary file not shown.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"dependencies": {
"@actions/core": "^1.2.0",
"@lhci/cli": "0.3.4"
"@lhci/cli": "0.3.4",
"is-windows": "^1.0.2"
},
"devDependencies": {
"@types/node": "10",
Expand Down
13 changes: 13 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
// Append the node_modules of the github workspace and the node_modules of this action
// to NODE_PATH. This supports lighthouse plugins - all the workspace needs to do it
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this comment is enough, then explain more in detail in the docs.

Suggested change
// to NODE_PATH. This supports lighthouse plugins - all the workspace needs to do it
// to NODE_PATH.

// `npm install` the plugin. The copy of lighthouse within this action will be used.

const nodePathDelim = require('is-windows')() ? ';' : ':';
const nodePathParts = [
...(process.env.NODE_PATH || '').split(nodePathDelim),
`${__dirname}/../node_modules`,
`${process.env.GITHUB_WORKSPACE}/node_modules`,
];
process.env.NODE_PATH = nodePathParts.join(nodePathDelim);

const core = require('@actions/core')
const childProcess = require('child_process')
const lhciCliPath = require.resolve('@lhci/cli/src/cli.js')
const input = require('./input.js')


connorjclark marked this conversation as resolved.
Show resolved Hide resolved
// audit urls with Lighthouse CI
async function main() {
core.startGroup('Action config')
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,11 @@ is-typedarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"

is-windows@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==

is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
Expand Down