Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
eef1585
chore: make node version more explicit
chrismclarke Dec 13, 2022
242b34d
Merge branch 'master' into chore/install-hooks
chrismclarke Dec 14, 2022
7cbea85
chore: add typo exception
chrismclarke Dec 14, 2022
46ce318
Merge branch 'master' of https://github.com/ONEARMY/community-platfor…
chrismclarke Dec 28, 2022
6aab178
fix: use standard button icon for Discord link
thisislawatts Dec 29, 2022
b9efe10
feat: adds link to Patreon in footer
thisislawatts Dec 29, 2022
6d10ad6
Merge pull request #2052 from ONEARMY/feat/adds-link-to-patreon-in-fo…
thisislawatts Dec 30, 2022
b7bcec3
Merge pull request #2051 from ONEARMY/fix/use-standard-button-icon
thisislawatts Dec 30, 2022
18101a3
fix: override blue border of subtle button variant
thisislawatts Dec 30, 2022
9b3f18a
Merge pull request #2055 from ONEARMY/fix/useful-stats-button
thisislawatts Jan 2, 2023
22ccdfd
fix: switch to secondary variant
thisislawatts Jan 3, 2023
26d7362
Merge pull request #2059 from ONEARMY/fix/switch-to-secondary-variant
thisislawatts Jan 3, 2023
44cbcde
feat: previousSlugs
Kiebert Jan 5, 2023
5a221f4
Merge branch 'ONEARMY:master' into feat/how-to-redirect-url-when-name…
Kiebert Jan 6, 2023
738f15d
feat: previousSlugs created in edit mode
Kiebert Jan 7, 2023
e466be7
Merge branch 'master' of https://github.com/ONEARMY/community-platfor…
chrismclarke Jan 13, 2023
c7d986a
Merge branch 'chore/install-hooks' of https://github.com/ONEARMY/comm…
chrismclarke Jan 13, 2023
916451e
refactor: move preinstall to healthcheck script
chrismclarke Jan 13, 2023
b1fd961
Merge pull request #2033 from ONEARMY/chore/install-hooks
chrismclarke Jan 13, 2023
5d10aed
Merge branch 'master' into feat/how-to-redirect-url-when-name-changes
chrismclarke Jan 13, 2023
b747903
chore: update node 16 to node 18
chrismclarke Jan 13, 2023
02e5d9c
fix: node 18 react-script changes
chrismclarke Jan 14, 2023
4cb6538
feat: previousSlugs with full history
Kiebert Jan 14, 2023
932a5ab
chore: upgrade functions webpack version
chrismclarke Jan 15, 2023
0dac344
feat: add node-version specific env
chrismclarke Jan 15, 2023
5e0cdd3
fix: broken svgs
chrismclarke Jan 15, 2023
149e71f
feat: update reat-scripts
chrismclarke Jan 15, 2023
c2c26a6
fix: comment out incompatible pino-logflare integration
chrismclarke Jan 15, 2023
d5e2aa0
fix: process polyfill issue
chrismclarke Jan 15, 2023
d4c4f01
chore: remove legacy ignore
chrismclarke Jan 15, 2023
93666d6
fix: window process refs
chrismclarke Jan 15, 2023
f9bcef5
chore: update storybook to use webpack 5
chrismclarke Jan 15, 2023
87b9968
fix: emulators docker node 18
chrismclarke Jan 15, 2023
25bc895
fix: emulator build caching and size reduction
chrismclarke Jan 15, 2023
4ace143
chore: code tidying
chrismclarke Jan 15, 2023
c23bd41
chore: code tidying
chrismclarke Jan 15, 2023
802879b
fix: cypress updates and fix
chrismclarke Jan 15, 2023
a3cc76f
chore: env fixes
chrismclarke Jan 15, 2023
aea7030
fix: process polyfill
chrismclarke Jan 15, 2023
e96daf7
feat: apply craco webpack overrides
chrismclarke Jan 16, 2023
b968b81
fix: cypress tests
chrismclarke Jan 16, 2023
e05264d
fix: add pino-logflare back into project
chrismclarke Jan 16, 2023
ca3f3d1
fix: reduce sourcemap warnings
chrismclarke Jan 16, 2023
8dbe3e2
chore: code tidying
chrismclarke Jan 16, 2023
a707a00
feat: add ci support for docker matrix
chrismclarke Jan 16, 2023
c6150fc
chore: ci
chrismclarke Jan 16, 2023
69b1cc7
chore: ci
chrismclarke Jan 16, 2023
531d90d
chore: add ci test for alt node versions
chrismclarke Jan 16, 2023
44145f9
chore: ci
chrismclarke Jan 16, 2023
71c4f39
chore: ci
chrismclarke Jan 16, 2023
e950939
chore: code tidying
chrismclarke Jan 16, 2023
14e928a
chore: ci
chrismclarke Jan 16, 2023
37c675b
chore: ci
chrismclarke Jan 16, 2023
dd46262
chore: ci
chrismclarke Jan 16, 2023
3bca564
chore: reduce circleci image size
chrismclarke Jan 16, 2023
b42eff0
chore: add envCheck and update ci env
chrismclarke Jan 16, 2023
6845144
chore: update unit env
chrismclarke Jan 16, 2023
2b4cc83
chore: ci
chrismclarke Jan 16, 2023
cba1485
chore: ci
chrismclarke Jan 17, 2023
0bcb0d8
chore: ci
chrismclarke Jan 17, 2023
21cf899
chore: ci
chrismclarke Jan 17, 2023
143a5d1
ci: try to limit unit test memory leaks
chrismclarke Jan 17, 2023
9b80f50
chore: fix typo
chrismclarke Jan 17, 2023
92cfda9
ci: unit test scripts
chrismclarke Jan 17, 2023
00120fb
chore: ci
chrismclarke Jan 17, 2023
38b2881
chore: ci
chrismclarke Jan 17, 2023
13cecec
chore: ci
chrismclarke Jan 17, 2023
6212776
chore: ci
chrismclarke Jan 17, 2023
b109249
Merge pull request #2064 from Kiebert/feat/how-to-redirect-url-when-n…
chrismclarke Jan 17, 2023
64fe2b8
chore: update envCheck
chrismclarke Jan 21, 2023
6b6feee
Merge branch 'master' into spike/node-18
chrismclarke Jan 21, 2023
7073785
Merge pull request #2067 from ONEARMY/spike/node-18
chrismclarke Jan 21, 2023
d3bb4af
chore(deps): pin to skip latest release
thisislawatts Jan 8, 2023
fc9472e
fix: add commitlint exports
chrismclarke Jan 21, 2023
bccbdb6
fix: adds accessible labels to moderation buttons
thisislawatts Jan 8, 2023
a0c508e
Merge pull request #2071 from ONEARMY/rebase/2065
chrismclarke Jan 21, 2023
c765b11
Merge branch 'master' into fix/commit-lint
chrismclarke Jan 21, 2023
d81c331
chore: remove globals in favour of local declaration
thisislawatts Jan 23, 2023
7c800b9
chore: remove unused mocks and components
thisislawatts Jan 23, 2023
892ade0
Merge pull request #2074 from ONEARMY/chore/remove-unused-mocks-and-c…
thisislawatts Jan 25, 2023
b85c777
Merge pull request #2070 from ONEARMY/fix/commit-lint
chrismclarke Jan 25, 2023
ce0391c
Merge pull request #2073 from ONEARMY/chore/remove-unused-globals
thisislawatts Jan 25, 2023
a3acfcf
chore: remove unused events
thisislawatts Jan 23, 2023
a722459
chore: remove unused mocks
thisislawatts Jan 23, 2023
d023039
chore: move map store helpers closer to call site
thisislawatts Jan 25, 2023
46d2f87
chore(deps): introduce linting to catch focused tests
thisislawatts Jan 25, 2023
a500475
chore: only print output in failure scenario
thisislawatts Jan 26, 2023
74a1408
Merge pull request #2075 from ONEARMY/chore/remove-unused-mocks
thisislawatts Jan 27, 2023
857c595
Merge branch 'master' into chore/deps-add-jest-linting
chrismclarke Jan 27, 2023
fe54f39
Merge pull request #2078 from ONEARMY/chore/adjust-env-check
chrismclarke Jan 27, 2023
bd52d0e
Merge pull request #2076 from ONEARMY/chore/deps-add-jest-linting
chrismclarke Jan 27, 2023
719a826
Merge branch 'production' into master
davehakkens Jan 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 34 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ version: 2.1
# Orbs - preconfigured environments for running specific jobs
######################################################################################################

# node: circleci/node@4.1.0
# cypress: cypress-io/cypress@1
orbs:
# for use with cimg image, to install web browsers
browser-tools: circleci/browser-tools@1.1.3
Expand All @@ -24,9 +22,21 @@ orbs:
# Aliases - code snippets that can be included inline in any other markup
######################################################################################################
aliases:
# use a base image running node v16 with chrome/firefox browsers preinstalled
# use a base image running node v18 with chrome/firefox browsers preinstalled
# This can be applied to any job via `docker: *docker` syntax
- &docker
- image: cimg/node:16.13.1-browsers
- image: cimg/node:18.13.0-browsers

# Use base image with support for node version parameter and matrix
# This can be applied to any job via `<<: *docker_matrix` syntax
- docker_matrix: &docker_matrix
parameters:
node-version:
type: string
default: 18.13.0-browsers
docker:
- image: cimg/node:<< parameters.node-version >>

# These can also be created as commands, but slighly tidier to just use inline
# restore/install/save can all be done with a single circle-ci orb, but less flexible and breaks intellisense
- &restore_yarn_cache
Expand Down Expand Up @@ -215,7 +225,7 @@ jobs:
rm package.json
npm config set package-lock false
npm i @types/node @commitlint/types @commitlint/config-conventional --force
npx commitlint --from=$(git merge-base remotes/origin/${CIRCLE_BRANCH} master) --verbose
npx @commitlint/cli@17.4.2 --from=$(git merge-base remotes/origin/${CIRCLE_BRANCH} master) --verbose
lint:
docker: *docker
steps:
Expand Down Expand Up @@ -270,13 +280,16 @@ jobs:
name: Install dependencies
command: yarn workspaces focus one-army-community-platform
- run:
command: yarn build:components && yarn run test:unit
# NOTE - run-in-band to try reduce memory leaks (https://github.com/facebook/jest/issues/7874)
command: yarn build:components && yarn run test:unit:ci
build:
docker: *docker
<<: *docker_matrix
environment:
GENERATE_SOURCEMAP: 'false'
SKIP_PREFLIGHT_CHECK: 'true'
# `medium` is the max allowed size for free builds (helps with out-of-memory issues) - https://circleci.com/docs/2.0/configuration-reference/#resourceclass
NODE_OPTIONS: '--max-old-space-size=5632'
# If experiencing out-of-memory issues can increase resource_class below and max space size above
# https://circleci.com/docs/2.0/configuration-reference/#resourceclass
resource_class: medium+
steps:
# whilst checkout-install could be persisted from previous step, that is less efficient than just using caching
Expand All @@ -291,12 +304,11 @@ jobs:
name: Set branch environment
command: |
echo 'export REACT_APP_BRANCH=${CIRCLE_BRANCH}' >> $BASH_ENV
echo 'export NODE_OPTIONS=--max-old-space-size=4096' >> $BASH_ENV
echo 'export REACT_APP_PROJECT_VERSION=${CIRCLE_SHA1}' >> $BASH_ENV
- run:
name: Check environment variables
command: |
echo REACT_APP_BRANCH=$REACT_APP_BRANCH NODE_OPTIONS=$NODE_OPTIONS
echo REACT_APP_BRANCH=$REACT_APP_BRANCH
echo $REACT_APP_PROJECT_VERSION
- run:
command: yarn build
Expand All @@ -306,7 +318,7 @@ jobs:
- build
storybook:
docker: *docker
resource_class: medium+
resource_class: medium
steps:
- setup_repo
- attach_workspace:
Expand Down Expand Up @@ -428,6 +440,17 @@ workflows:
- 'Lint code'
name: Build Application
context: build-context
- build:
requires:
- 'Lint code'
# Main build/deploy runs on LTS node, however still check compatibility for local dev work on other versions
name: Build Application (Node << matrix.node-version >>)
context: build-context
matrix:
parameters:
node-version:
- '16.13.1-browsers'
- 'current-browsers' # latest version supported https://circleci.com/developer/images/image/cimg/node
- test_unit:
name: 'Unit tests'
requires:
Expand Down
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"microservices",
"mockup",
"mockups",
"nodenv",
"onearmy",
"onearmyworld",
"phonebloks",
Expand Down
46 changes: 46 additions & 0 deletions .env-cmdrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Run a pre-flight check that developer environment setup in compatible way
const { envCheck } = require('./scripts/envCheck')
if (!process.env.CI) {
envCheck()
}

// Specific settings to use when running anything that requires a webpack compiler
// Enabled when npm command specifies `env-cmd -e webpack`
let webpack = {
NODE_OPTIONS: getNodeOptions(),
}

// Specific env to use with react-scripts / create-react-app
// Enabled when npm command specifies `env-cmd -e cra`
let cra = {
...webpack,
FAST_REFRESH: false,
}

exports.cra = cra
exports.webpack = webpack

/** Determine what node_options to provide depending on context */
function getNodeOptions() {
// Depending on node version use different environment variables to fix
// specific build or run issues
const NODE_VERSION = process.versions.node.split('.')[0]

let NODE_OPTIONS = process.env.NODE_OPTIONS || ''

// fix out-of-memory issues - default to 4GB but allow override from CI
// NOTE - would like to auto-calculate but does not support CI (https://github.com/nodejs/node/issues/27170)
if (!NODE_OPTIONS.includes('--max-old-space-size')) {
NODE_OPTIONS += ` --max-old-space-size=4096`
}
if (NODE_VERSION > '17') {
// fix https://github.com/facebook/create-react-app/issues/11708
// https://github.com/facebook/create-react-app/issues/12431
NODE_OPTIONS += ' --openssl-legacy-provider --no-experimental-fetch'
}

if (process.env.CI) {
console.log('NODE_OPTIONS', NODE_OPTIONS, '\n')
}
return NODE_OPTIONS.trim()
}
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"@typescript-eslint",
"prettier",
"unicorn",
"sort-class-members"
"sort-class-members",
"jest"
],
"extends": [
"plugin:react/recommended", // Uses the recommended rules from @eslint-plugin-react
Expand Down Expand Up @@ -55,6 +56,7 @@
"prefer": "type-imports"
}
],
"jest/no-focused-tests": "error",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/interface-name-prefix": "off",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
with:
# pull the repo from the pull request source, not the default local repo
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reset-staging-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Reset Staging Site
on:
# Run weekly on a Sunday at 02:00
schedule:
- cron: "0 0 * * SUN"
- cron: '0 0 * * SUN'
# Allow the script to be triggered directly from GitHub
workflow_dispatch:
jobs:
Expand All @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Set up Cloud SDK
uses:
google-github-actions/setup-gcloud@master
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ yarn-error.log*
# IntelliJ
/.idea
functions/firebase-debug.log
.env-*

# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
Expand Down
4 changes: 2 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: node:16
image: node:18
tasks:
- init: yarn install && yarn run build
command: yarn run start
Expand All @@ -10,4 +10,4 @@ ports:

github:
prebuilds:
branches: true
branches: true
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.1
18.13.0
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You can find useful links to learn more about these technologies [in the resourc

**Prerequisites**

- [Node.js v16](https://nodejs.org/en/download/)
- [Node.js v18](https://nodejs.org/en/download/)
- [Yarn v3](https://yarnpkg.com/getting-started/install)

With the above tools available, you are ready:
Expand Down
2 changes: 1 addition & 1 deletion commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { UserConfig } from '@commitlint/types'
import path from 'path'

const Configuration: UserConfig = {
export const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
/** Add optional custom formatter */
formatter: path.resolve(__dirname, 'commitlint.format.ts'),
Expand Down
2 changes: 1 addition & 1 deletion commitlint.format.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Formatter, FormattableReport } from '@commitlint/types'

// Custom formatter for commitlint message
const formatter: Formatter = function (report, options) {
export const formatter: Formatter = function (report, options) {
const { results, valid } = report as IFormatReport
if (results && !valid) {
console.log('\nCommit needs to be formatted as conventional commit')
Expand Down
1 change: 0 additions & 1 deletion config/.gitignore

This file was deleted.

68 changes: 68 additions & 0 deletions craco.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import type { WebpackConfigOverride } from '@craco/types'
import { DefinePlugin, ProvidePlugin } from 'webpack'
import type { RuleSetRule } from 'webpack'

/**
* Craco is used to provide config overrides to the default webpack config that is called
* from react-scripts.
*/
module.exports = {
webpack: {
configure: (webpackConfig: WebpackConfigOverride['webpackConfig']) => {
// Add polyfills for node (mostly imports for pino-logflare)
// https://github.com/facebook/create-react-app/issues/11756
// https://stackoverflow.com/questions/68707553/uncaught-referenceerror-buffer-is-not-defined
webpackConfig.resolve!.fallback = {
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
}
webpackConfig.module!.rules = hackUpdateRulesToSupportCJS(
webpackConfig.module!.rules as RuleSetRule[],
)
webpackConfig.plugins = [
...(webpackConfig.plugins as any[]),
// Fix calls to process (pino-logflare and cypress calling db.ts outside of cra)
// NOTE - react creates 'process.env' variable but does not assign anything to 'process'
// https://github.com/facebook/create-react-app/issues/11951
new DefinePlugin({
process: {},
}),
new ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
]
// Fix sourcemap warning
// https://github.com/facebook/create-react-app/discussions/11767
webpackConfig.ignoreWarnings = [
function ignoreSourcemapsloaderWarnings(warning) {
return (
warning.module &&
(warning.module as any).resource.includes('node_modules') &&
warning.details &&
warning.details.includes('source-map-loader')
)
},
]
return webpackConfig
},
},
}

/**
* Prepend a custom rule to support CJS files
*
* NOTE - should be resolved in future CRA release pending merge of
* https://github.com/facebook/create-react-app/pull/12021
*/
const hackUpdateRulesToSupportCJS = (rules: RuleSetRule[]) => {
return rules.map((rule) => {
if (rule.oneOf instanceof Array) {
rule.oneOf[rule.oneOf.length - 1].exclude = [
/\.(js|mjs|jsx|cjs|ts|tsx)$/,
/\.html$/,
/\.json$/,
]
}
return rule
})
}
Loading