Skip to content

Commit 6188e51

Browse files
[code-infra] Fix deploy (#212)
Signed-off-by: Olivier Tassinari <olivier.tassinari@gmail.com> Co-authored-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
1 parent 2b9d168 commit 6188e51

25 files changed

+20397
-15985
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.cache
22
/.git
3-
/contributor-dashboard-legacy/
43
/tools-public/toolpad/.generated/
54
/tools-public/toolpad/**/*.yml
5+
build
66
node_modules
77
pnpm-lock.yaml

.eslintrc.js

+6
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,11 @@ module.exports = {
2323
},
2424
overrides: [
2525
...baseline.overrides,
26+
{
27+
files: ['contributor-dashboard-legacy/**'],
28+
rules: {
29+
'import/no-unresolved': 'off', // TODO, to fix at one point
30+
},
31+
},
2632
],
2733
};

.gitignore

+1-19
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22

33
# dependencies
44
node_modules
5-
/.pnp
6-
.pnp.js
75

86
# testing
9-
/.env
107
/.eslintcache
118
/coverage
129

1310
# production
1411
/build
1512

16-
src
17-
1813
# misc
1914
.DS_Store
2015
.env.local
@@ -33,27 +28,14 @@ yarn-error.log*
3328
.netlify
3429

3530
# local env files
31+
.env
3632
.env.local
3733
.env.development.local
3834
.env.test.local
3935
.env.production.local
4036

4137
# docs
42-
4338
/docs/export
4439

4540
lerna-debug.log
46-
47-
.env
48-
4941
dist/
50-
51-
packages/toolpad-app/public/web_modules
52-
packages/toolpad-app/public/runtime
53-
packages/toolpad-app/public/reactDevtools
54-
packages/toolpad-app/public/runtime
55-
packages/toolpad-app/public/typings.json
56-
packages/toolpad-app/prisma/generated
57-
58-
59-
.toolpad-generated

.prettierignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
/tools-public/toolpad/**/*.yml
2-
/tools-public/toolpad/.generated/

contributor-dashboard-legacy/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Bugfixes and feature suggestions are greatly appreciated. Though this project is
1111
Copy `.env.example` to `.env` and fill in the values as instructed in the file.
1212

1313
```bash
14+
$ pnpm --ignore-workspace install
1415
$ npx netlify login
1516
$ npx netlify dev
1617
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
async function fetchCircleCIApiV2(endpoint) {
2+
const url = `https://circleci.com/api/v2/${endpoint}`;
3+
4+
// eslint-disable-next-line no-console
5+
console.log(url);
6+
const response = await fetch(url);
7+
const json = await response.json();
8+
return json;
9+
}
10+
11+
/**
12+
* netlify function that wraps CircleCI API v2 which requires authentification.
13+
*
14+
* @param {*} event
15+
* @param {*} context
16+
*/
17+
exports.handler = async function circleCIArtefact(event) {
18+
const { queryStringParameters } = event;
19+
20+
const buildNumberParameter = queryStringParameters.buildNumber;
21+
const buildNumber = parseInt(buildNumberParameter, 10);
22+
if (Number.isNaN(buildNumber)) {
23+
return {
24+
statusCode: 500,
25+
body: JSON.stringify(
26+
`Given query param buildNumber is not a number. Received '${buildNumberParameter}'.`,
27+
),
28+
};
29+
}
30+
// eslint-disable-next-line no-console
31+
console.log(`fetching details for job #${buildNumber}`);
32+
33+
const artifacts = await fetchCircleCIApiV2(
34+
`project/github/mui/material-ui/${buildNumber}/artifacts`,
35+
);
36+
const response = {
37+
statusCode: 200,
38+
body: JSON.stringify(artifacts),
39+
};
40+
41+
return response;
42+
};

contributor-dashboard-legacy/functions/test-profile-artifact.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const crypto = require("crypto");
22
const zlib = require("zlib");
3-
const fetch = require("node-fetch");
43
const { URL } = require("url");
54
const util = require("util");
65

@@ -42,7 +41,7 @@ function computeEtag(context) {
4241
*/
4342
exports.handler = async function fetchTestProfileArtifactHandler(
4443
event,
45-
context
44+
context,
4645
) {
4746
const { queryStringParameters } = event;
4847

@@ -54,7 +53,7 @@ exports.handler = async function fetchTestProfileArtifactHandler(
5453
return {
5554
statusCode: 500,
5655
body: JSON.stringify(
57-
`Given query param \`url\` is not a valid URL. Received '${urlParameter}'.`
56+
`Given query param \`url\` is not a valid URL. Received '${urlParameter}'.`,
5857
),
5958
};
6059
}
@@ -88,7 +87,7 @@ exports.handler = async function fetchTestProfileArtifactHandler(
8887
return {
8988
statusCode: 500,
9089
body: JSON.stringify(
91-
`Unable to get CircleCI response for '${url}' that is OK. Got ${testProfileArtifactResponse.status}`
90+
`Unable to get CircleCI response for '${url}' that is OK. Got ${testProfileArtifactResponse.status}`,
9291
),
9392
};
9493
}

contributor-dashboard-legacy/functions/test-profile-details.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
const fetch = require("node-fetch");
2-
31
/**
42
* Whether we sent Cache-Control headers.
53
* Can't send them from netlify due to https://community.netlify.com/t/netlify-function-responds-with-wrong-body/27138
@@ -76,7 +74,7 @@ exports.handler = async function fetchTestProfileDetails(event) {
7674
return {
7775
statusCode: 500,
7876
body: JSON.stringify(
79-
`Given query param jobNumber is not a number. Received '${jobNumberParameter}'.`
77+
`Given query param jobNumber is not a number. Received '${jobNumberParameter}'.`,
8078
),
8179
};
8280
}
+16-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
[build]
2-
functions = "functions"
2+
base = "contributor-dashboard-legacy"
3+
4+
# Directory (relative to root of your repo) that contains the deploy-ready
5+
# HTML files and assets generated by the build. If a base directory has
6+
# been specified, include it in the publish directory path.
7+
publish = "build"
8+
9+
# Default build command.
10+
command = "pnpm build"
11+
12+
[build.environment]
13+
NODE_VERSION = "18"
14+
PNPM_FLAGS = "--ignore-workspace"
15+
16+
[functions]
17+
directory = "functions"

contributor-dashboard-legacy/package.json

+11-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"name": "mui-maintainer-dashboard",
2+
"name": "contributor-dashboard-legacy",
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
66
"@emotion/react": "^11.1.2",
77
"@emotion/styled": "^11.0.0",
8-
"@material-ui/core": "^5.0.0-alpha.19",
9-
"@material-ui/icons": "^5.0.0-alpha.19",
8+
"@mui/icons-material": "^6.0.0",
9+
"@mui/material": "^6.0.0",
1010
"pretty-bytes": "^5.3.0",
11-
"react": "experimental",
12-
"react-dom": "experimental",
11+
"react": "^18.0.0",
12+
"react-dom": "^18.0.0",
1313
"react-query": "^2.0.0",
1414
"react-router": "^6.0.0-alpha.5",
1515
"react-router-dom": "^6.0.0-alpha.5"
@@ -20,14 +20,12 @@
2020
"@types/react-dom": "^17.0.0",
2121
"@types/react-router-dom": "^5.1.3",
2222
"netlify-cli": "^2.69.0",
23-
"node-fetch": "^2.6.1",
24-
"prettier": "^2.0.2",
25-
"react-scripts": "^4.0.3",
23+
"react-scripts": "^5.0.0",
2624
"typescript": "^4.1.0"
2725
},
2826
"scripts": {
29-
"start": "react-scripts start",
30-
"build": "DISABLE_ESLINT_PLUGIN=true react-scripts build",
27+
"start": "NODE_OPTIONS=--openssl-legacy-provider DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true react-scripts start",
28+
"build": "NODE_OPTIONS=--openssl-legacy-provider DISABLE_ESLINT_PLUGIN=true SKIP_PREFLIGHT_CHECK=true react-scripts build",
3129
"format": "prettier --write .",
3230
"format:check": "prettier --check .",
3331
"test": "echo 'No tests yet' && exit 1",
@@ -49,7 +47,7 @@
4947
"last 1 safari version"
5048
]
5149
},
52-
"engines": {
53-
"node": "^16.0.0"
54-
}
50+
"engines": {
51+
"node": ">=18.0.0"
52+
}
5553
}

0 commit comments

Comments
 (0)