Skip to content

Commit

Permalink
[code-infra] Fix deploy (#212)
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Tassinari <[email protected]>
Co-authored-by: Jan Potoms <[email protected]>
  • Loading branch information
oliviertassinari and Janpot authored Oct 16, 2024
1 parent 2b9d168 commit 6188e51
Show file tree
Hide file tree
Showing 25 changed files with 20,397 additions and 15,985 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.cache
/.git
/contributor-dashboard-legacy/
/tools-public/toolpad/.generated/
/tools-public/toolpad/**/*.yml
build
node_modules
pnpm-lock.yaml
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ module.exports = {
},
overrides: [
...baseline.overrides,
{
files: ['contributor-dashboard-legacy/**'],
rules: {
'import/no-unresolved': 'off', // TODO, to fix at one point
},
},
],
};
20 changes: 1 addition & 19 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@

# dependencies
node_modules
/.pnp
.pnp.js

# testing
/.env
/.eslintcache
/coverage

# production
/build

src

# misc
.DS_Store
.env.local
Expand All @@ -33,27 +28,14 @@ yarn-error.log*
.netlify

# local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# docs

/docs/export

lerna-debug.log

.env

dist/

packages/toolpad-app/public/web_modules
packages/toolpad-app/public/runtime
packages/toolpad-app/public/reactDevtools
packages/toolpad-app/public/runtime
packages/toolpad-app/public/typings.json
packages/toolpad-app/prisma/generated


.toolpad-generated
2 changes: 0 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
/tools-public/toolpad/**/*.yml
/tools-public/toolpad/.generated/
1 change: 1 addition & 0 deletions contributor-dashboard-legacy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Bugfixes and feature suggestions are greatly appreciated. Though this project is
Copy `.env.example` to `.env` and fill in the values as instructed in the file.

```bash
$ pnpm --ignore-workspace install
$ npx netlify login
$ npx netlify dev
```
42 changes: 42 additions & 0 deletions contributor-dashboard-legacy/functions/circle-ci-artifacts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
async function fetchCircleCIApiV2(endpoint) {
const url = `https://circleci.com/api/v2/${endpoint}`;

// eslint-disable-next-line no-console
console.log(url);
const response = await fetch(url);
const json = await response.json();
return json;
}

/**
* netlify function that wraps CircleCI API v2 which requires authentification.
*
* @param {*} event
* @param {*} context
*/
exports.handler = async function circleCIArtefact(event) {
const { queryStringParameters } = event;

const buildNumberParameter = queryStringParameters.buildNumber;
const buildNumber = parseInt(buildNumberParameter, 10);
if (Number.isNaN(buildNumber)) {
return {
statusCode: 500,
body: JSON.stringify(
`Given query param buildNumber is not a number. Received '${buildNumberParameter}'.`,
),
};
}
// eslint-disable-next-line no-console
console.log(`fetching details for job #${buildNumber}`);

const artifacts = await fetchCircleCIApiV2(
`project/github/mui/material-ui/${buildNumber}/artifacts`,
);
const response = {
statusCode: 200,
body: JSON.stringify(artifacts),
};

return response;
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const crypto = require("crypto");
const zlib = require("zlib");
const fetch = require("node-fetch");
const { URL } = require("url");
const util = require("util");

Expand Down Expand Up @@ -42,7 +41,7 @@ function computeEtag(context) {
*/
exports.handler = async function fetchTestProfileArtifactHandler(
event,
context
context,
) {
const { queryStringParameters } = event;

Expand All @@ -54,7 +53,7 @@ exports.handler = async function fetchTestProfileArtifactHandler(
return {
statusCode: 500,
body: JSON.stringify(
`Given query param \`url\` is not a valid URL. Received '${urlParameter}'.`
`Given query param \`url\` is not a valid URL. Received '${urlParameter}'.`,
),
};
}
Expand Down Expand Up @@ -88,7 +87,7 @@ exports.handler = async function fetchTestProfileArtifactHandler(
return {
statusCode: 500,
body: JSON.stringify(
`Unable to get CircleCI response for '${url}' that is OK. Got ${testProfileArtifactResponse.status}`
`Unable to get CircleCI response for '${url}' that is OK. Got ${testProfileArtifactResponse.status}`,
),
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
const fetch = require("node-fetch");

/**
* Whether we sent Cache-Control headers.
* Can't send them from netlify due to https://community.netlify.com/t/netlify-function-responds-with-wrong-body/27138
Expand Down Expand Up @@ -76,7 +74,7 @@ exports.handler = async function fetchTestProfileDetails(event) {
return {
statusCode: 500,
body: JSON.stringify(
`Given query param jobNumber is not a number. Received '${jobNumberParameter}'.`
`Given query param jobNumber is not a number. Received '${jobNumberParameter}'.`,
),
};
}
Expand Down
17 changes: 16 additions & 1 deletion contributor-dashboard-legacy/netlify.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
[build]
functions = "functions"
base = "contributor-dashboard-legacy"

# Directory (relative to root of your repo) that contains the deploy-ready
# HTML files and assets generated by the build. If a base directory has
# been specified, include it in the publish directory path.
publish = "build"

# Default build command.
command = "pnpm build"

[build.environment]
NODE_VERSION = "18"
PNPM_FLAGS = "--ignore-workspace"

[functions]
directory = "functions"
24 changes: 11 additions & 13 deletions contributor-dashboard-legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "mui-maintainer-dashboard",
"name": "contributor-dashboard-legacy",
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.1.2",
"@emotion/styled": "^11.0.0",
"@material-ui/core": "^5.0.0-alpha.19",
"@material-ui/icons": "^5.0.0-alpha.19",
"@mui/icons-material": "^6.0.0",
"@mui/material": "^6.0.0",
"pretty-bytes": "^5.3.0",
"react": "experimental",
"react-dom": "experimental",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-query": "^2.0.0",
"react-router": "^6.0.0-alpha.5",
"react-router-dom": "^6.0.0-alpha.5"
Expand All @@ -20,14 +20,12 @@
"@types/react-dom": "^17.0.0",
"@types/react-router-dom": "^5.1.3",
"netlify-cli": "^2.69.0",
"node-fetch": "^2.6.1",
"prettier": "^2.0.2",
"react-scripts": "^4.0.3",
"react-scripts": "^5.0.0",
"typescript": "^4.1.0"
},
"scripts": {
"start": "react-scripts start",
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
"start": "NODE_OPTIONS=--openssl-legacy-provider DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true react-scripts start",
"build": "NODE_OPTIONS=--openssl-legacy-provider DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true react-scripts build",
"format": "prettier --write .",
"format:check": "prettier --check .",
"test": "echo 'No tests yet' && exit 1",
Expand All @@ -49,7 +47,7 @@
"last 1 safari version"
]
},
"engines": {
"node": "^16.0.0"
}
"engines": {
"node": ">=18.0.0"
}
}
Loading

0 comments on commit 6188e51

Please sign in to comment.