construct-hub-webapp 0.1.981 → 0.1.982

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/.projenrc.ts +0 -367
package/package.json CHANGED
@@ -68,7 +68,7 @@
68
68
  "express-http-proxy": "^1.6.3",
69
69
  "jsii-docgen": "^6.3.27",
70
70
  "prettier": "^2.8.8",
71
- "projen": "^0.78.10",
71
+ "projen": "^0.78.11",
72
72
  "react-app-rewired": "^2.2.1",
73
73
  "standard-version": "^9",
74
74
  "ts-node": "^10.9.2",
@@ -121,7 +121,7 @@
121
121
  "node": ">= 16.17.0"
122
122
  },
123
123
  "license": "Apache-2.0",
124
- "version": "0.1.981",
124
+ "version": "0.1.982",
125
125
  "eslintConfig": {
126
126
  "extends": [
127
127
  "react-app",
package/.projenrc.ts DELETED
@@ -1,367 +0,0 @@
1
- import { github, web } from "projen";
2
- import { workflows } from "projen/lib/github";
3
-
4
- const PROXY_URL = "https://constructs.dev/";
5
-
6
- const project = new web.ReactTypeScriptProject({
7
- defaultReleaseBranch: "main",
8
- name: "construct-hub-webapp",
9
- projenrcTs: true,
10
-
11
- // Author metadata
12
- authorEmail: "construct-ecosystem-team@amazon.com",
13
- authorName: "Amazon Web Services, Inc.",
14
-
15
- // Repository information
16
- repository: "https://github.com/cdklabs/construct-hub-webapp.git",
17
-
18
- // since this is an app project, we need to enable these explicitly
19
- // in order to be able to publish this as an npm module.
20
- releaseToNpm: true,
21
- releaseWorkflow: true,
22
- package: true,
23
- tsconfig: {
24
- compilerOptions: {
25
- target: "es6",
26
- },
27
- },
28
-
29
- minNodeVersion: "16.17.0",
30
-
31
- eslint: true,
32
- prettier: true,
33
-
34
- deps: [
35
- "@chakra-ui/anatomy",
36
- "@chakra-ui/icons",
37
- "@chakra-ui/react",
38
- "@chakra-ui/theme-tools",
39
- "@emotion/react@^11",
40
- "@emotion/styled@^11",
41
- "hast-util-sanitize",
42
- "@jsii/spec",
43
- "copy-to-clipboard", // Used by Chakra-UI, included for testing
44
- "date-fns",
45
- "framer-motion@^4",
46
- "jsii-reflect",
47
- "lunr",
48
- "node-emoji",
49
- "prism-react-renderer",
50
- "react-query",
51
- "react-helmet",
52
- "react-markdown",
53
- "react-router-dom",
54
- "rehype-raw",
55
- "rehype-sanitize",
56
- "remark-emoji",
57
- "remark-gfm",
58
- "semver",
59
- "spdx-license-list",
60
- // PWA Functionality
61
- "workbox-core",
62
- "workbox-expiration",
63
- "workbox-precaching",
64
- "workbox-routing",
65
- "workbox-strategies",
66
- ],
67
-
68
- devDeps: [
69
- "@types/lunr",
70
- "@types/node-emoji",
71
- "@types/react@17.045",
72
- "@types/react-dom@17.0.21",
73
- "@types/react-helmet@6.1.7",
74
- "@types/react-router-dom@5.3.3",
75
- "@types/semver",
76
- "eslint-plugin-jsx-a11y",
77
- "eslint-plugin-prefer-arrow",
78
- "eslint-plugin-react-hooks",
79
- "eslint-plugin-react",
80
- "react-app-rewired",
81
- "jsii-docgen",
82
- "util",
83
- ],
84
-
85
- autoApproveOptions: {
86
- allowedUsernames: ["cdklabs-automation"],
87
- secret: "GITHUB_TOKEN",
88
- },
89
-
90
- autoApproveUpgrades: true,
91
- });
92
-
93
- project.package.addField("resolutions", {
94
- // addressing https://github.com/advisories/GHSA-rp65-9cf3-cjxr forcefully until
95
- // react-scripts fixes the dependency chain.
96
- // if test pass, we should be ok with this override, even though its a different major version.
97
- "nth-check": "2.0.1",
98
- // addressing https://github.com/facebook/react/issues/24304
99
- "@types/react": "17.0.72",
100
- // not sure why this is needed, but some dependencies have a transient dependency
101
- // on wrap-ansi@8 which is an ESM module. When performing `yarn upgrade npm-check-updates`
102
- // yarn gets confused somehow and uses the @8 one which causes things to break
103
- "wrap-ansi": "7.0.0",
104
- });
105
-
106
- project.gitignore.addPatterns("/.vscode/");
107
- project.npmignore?.addPatterns("/.vscode/");
108
-
109
- (function addCypress() {
110
- project.addDevDeps("cypress");
111
-
112
- project.addTask("cypress:open", {
113
- exec: "cypress open",
114
- description: "open the cypress test runner UI",
115
- });
116
-
117
- project.addTask("cypress:run", {
118
- exec: "cypress run",
119
- description: "run the cypress suite in CLI",
120
- });
121
-
122
- project.gitignore.addPatterns("cypress/videos/", "cypress/screenshots/");
123
- project.eslint?.addIgnorePattern("cypress/");
124
-
125
- // Express is used to create a local proxy server used in CI + local build testing
126
- (function addExpress() {
127
- project.addDevDeps("express", "express-http-proxy");
128
- project.addTask("proxy-server", {
129
- exec: "node ./scripts/proxy-server",
130
- });
131
-
132
- project.addTask("proxy-server:ci", {
133
- exec: "npx react-app-rewired build && CI=true yarn proxy-server",
134
- });
135
- })();
136
-
137
- const cypressRunSteps = [
138
- {
139
- name: "Checkout",
140
- uses: "actions/checkout@v3",
141
- },
142
- {
143
- name: "Cypress Run",
144
- uses: "cypress-io/github-action@v3",
145
- env: {
146
- DEBUG: "@cypress/github-action",
147
- },
148
- with: {
149
- start: "yarn proxy-server:ci",
150
- "wait-on": "http://localhost:3000",
151
- "wait-on-timeout": 150,
152
- },
153
- },
154
- {
155
- uses: "actions/upload-artifact@v3",
156
- if: "failure()",
157
- with: {
158
- name: "cypress-screenshots",
159
- path: "cypress/screenshots",
160
- },
161
- },
162
- {
163
- uses: "actions/upload-artifact@v3",
164
- if: "always()",
165
- with: {
166
- name: "cypress-videos",
167
- path: "cypress/videos",
168
- },
169
- },
170
- ];
171
-
172
- const integWorkflow = project.github?.addWorkflow("integ")!;
173
- const e2e = "e2e";
174
- integWorkflow.on({ workflowDispatch: {}, pullRequest: {} });
175
- integWorkflow.addJob(e2e, {
176
- name: e2e,
177
- runsOn: ["ubuntu-latest"],
178
- permissions: {
179
- checks: github.workflows.JobPermission.WRITE,
180
- contents: github.workflows.JobPermission.READ,
181
- },
182
- steps: cypressRunSteps,
183
- });
184
-
185
- project.autoMerge?.addConditions(`status-success=${e2e}`);
186
-
187
- // Set up a canary that tests that the latest code on our main branch
188
- // works against data on https://constructs.dev.
189
- //
190
- // We need to use the version of the front-end from the main branch
191
- // and not the version that is live, otherwise it's possible for newer
192
- // tests to run against an older (incompatible) version of the frontend
193
- // due to deployment delays and give us false positives.
194
- const e2eCanary = project.github?.addWorkflow("e2e-canary")!;
195
- e2eCanary.on({
196
- schedule: [
197
- {
198
- cron: "*/30 * * * *", // run every 30 minutes
199
- },
200
- ],
201
- workflowDispatch: {},
202
- });
203
- e2eCanary.addJobs({
204
- test: {
205
- name: "constructs.dev canary",
206
- runsOn: ["ubuntu-latest"],
207
- permissions: {
208
- checks: github.workflows.JobPermission.WRITE,
209
- contents: github.workflows.JobPermission.READ,
210
- },
211
- steps: [
212
- ...cypressRunSteps,
213
- {
214
- name: "Create failure issue",
215
- if: "failure()",
216
- uses: "imjohnbo/issue-bot@v3",
217
- with: {
218
- labels: "failed-release",
219
- title: `E2E Canary for https://constructs.dev failed.`,
220
- body: "See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
221
- },
222
- env: {
223
- GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}",
224
- },
225
- },
226
- ],
227
- },
228
- });
229
- })();
230
-
231
- (function addJest() {
232
- project.addDevDeps(
233
- // "jest",
234
- // "babel-jest",
235
- // "ts-node",
236
- "@testing-library/react",
237
- "@testing-library/jest-dom",
238
- "@testing-library/react-hooks",
239
- "@testing-library/user-event"
240
- );
241
-
242
- project.addTask("test:unit", {
243
- // exec: "jest",
244
- exec: "npx react-app-rewired test",
245
- });
246
-
247
- project.addTask("test:update", {
248
- exec: "npx react-app-rewired test -u",
249
- });
250
-
251
- project.eslint?.addIgnorePattern("jest.config.ts");
252
- })();
253
-
254
- // This task is used to analyze dead code
255
- (function addAnalyzeExports() {
256
- project.addDevDeps("ts-unused-exports");
257
- project.addTask("analyze-exports", { exec: "node scripts/analyze-exports" });
258
- })();
259
-
260
- // npm tarball will only include the contents of the "build"
261
- // directory, which is the output of our static website.
262
- project.npmignore?.addPatterns("!/build");
263
- project.npmignore?.addPatterns("/public");
264
-
265
- // Ignore local config.json
266
- project.npmignore?.addPatterns("/build/config.json");
267
- project.gitignore.addPatterns("/public/config.json");
268
-
269
- // test fixtures
270
- project.npmignore?.addPatterns("src/__fixtures__");
271
-
272
- // these are development assemblies fetched specifically
273
- // by each developer.
274
- project.gitignore.exclude("public/data");
275
-
276
- // Proxy requests to awscdk.io for local testing
277
- project.package.addField("proxy", PROXY_URL);
278
-
279
- // setup linting for create-react-app specific tools
280
- project.eslint?.addRules({
281
- "import/no-extraneous-dependencies": [
282
- "error",
283
- {
284
- devDependencies: ["**/setupTests.ts", "**/*.test.tsx", "**/*.test.ts"],
285
- optionalDependencies: false,
286
- peerDependencies: true,
287
- },
288
- ],
289
- });
290
-
291
- // React specific overrides
292
- project.eslint?.addOverride({
293
- files: ["src/**/*.tsx", "src/**/*.ts"],
294
- extends: [
295
- "plugin:react/recommended",
296
- "plugin:react-hooks/recommended",
297
- "plugin:jsx-a11y/recommended",
298
- ],
299
- settings: {
300
- react: {
301
- version: "detect",
302
- },
303
- },
304
- plugins: ["jsx-a11y", "prefer-arrow"],
305
- rules: {
306
- "@typescript-eslint/no-use-before-define": ["error"],
307
- "no-use-before-define": "off",
308
- "prefer-arrow/prefer-arrow-functions": [
309
- "error",
310
- {
311
- singleReturnOnly: false,
312
- },
313
- ],
314
- "react/jsx-sort-props": ["warn"],
315
- "react/prop-types": ["off"],
316
- "react/react-in-jsx-scope": ["off"],
317
- },
318
- } as any);
319
-
320
- // rewire cra tasks, all apart from eject.
321
- rewireCRA(project.tasks.tryFind("build"));
322
- rewireCRA(project.tasks.tryFind("test"));
323
- rewireCRA(project.tasks.tryFind("dev"));
324
-
325
- // trigger construct-hub to pick up changes from construct-hub-webapp
326
- // whenever a new release is made
327
- project.release?.addJobs({
328
- upgrade_construct_hub: {
329
- name: "Upgrade construct-hub",
330
- runsOn: ["ubuntu-latest"],
331
- permissions: {
332
- actions: workflows.JobPermission.WRITE,
333
- },
334
- needs: ["release", "release_github", "release_npm"],
335
- steps: [
336
- {
337
- name: "Trigger upgrade workflow",
338
- run: 'gh api -X POST /repos/cdklabs/construct-hub/actions/workflows/upgrade-main.yml/dispatches --field ref="main"',
339
- env: {
340
- GITHUB_TOKEN: "${{ secrets.PROJEN_GITHUB_TOKEN }}",
341
- },
342
- },
343
- ],
344
- },
345
- });
346
-
347
- // replace default service worker script with no-op worker
348
- const replaceWorker = project.addTask("replace-worker");
349
- replaceWorker.exec("cp src/no-op-sw.js build/service-worker.js");
350
- replaceWorker.exec("rm build/service-worker.js.map");
351
- project.compileTask.spawn(replaceWorker);
352
-
353
- project.synth();
354
-
355
- /**
356
- * Rewire a create-react-app task to use 'react-app-rewired` instead of 'react-scripts'
357
- * so that our configuration overrides will take affect.
358
- *
359
- * @see https://www.npmjs.com/package/react-app-rewired
360
- */
361
- function rewireCRA(craTask: any) {
362
- for (const step of craTask.steps) {
363
- if (step.exec && step.exec.startsWith("react-scripts")) {
364
- step.exec = step.exec.replace("react-scripts", "react-app-rewired");
365
- }
366
- }
367
- }