-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
Documentation enhancement #3703
Open
goratt12
wants to merge
21
commits into
ONEARMY:master
Choose a base branch
from
goratt12:documentation-enhancement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ed981c7
feat(functions): move notification logic from discussion store to fir…
goratt12 37ec4b9
fix(functions): removed old tests
goratt12 e847de0
Merge branch 'master' into 3563-move-discussion-notifications-to-func…
goratt12 a6fa28d
fix(functions): fixed lint issues due to merge
goratt12 570d807
fix(functions): changed IDiscussionComment to IComment
goratt12 a770ef7
fix(functions): addressed change requests
goratt12 990203b
feat(functions): prevent duplicate notifications
goratt12 d523fef
fix(functions): comment out notification tests in discussion specs
goratt12 13e4afe
Merge branch 'master' into 3563-move-discussion-notifications-to-func…
goratt12 471917c
Merge branch 'master' into 3563-move-discussion-notifications-to-func…
goratt12 2c64f01
fix(functions): fix requested changes
goratt12 7bad0cf
feat: changes to docs
goratt12 a23610b
feat: more changes
goratt12 d81fa83
feat: bit more changes
goratt12 fb689ff
feat: fun changes
goratt12 3a9817c
fix(functions): fixed lint issues
goratt12 fe8a972
Merge branch 'master' into 3563-move-discussion-notifications-to-func…
benfurber 6b78ce4
Merge branch 'documentation-enhancement' of https://github.com/goratt…
goratt12 22bd2db
fix(docs): working version
goratt12 4eabaa6
Merge branch 'master' into documentation-enhancement
goratt12 8e8464a
Merge branch 'master' into documentation-enhancement
goratt12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
import { envCheck } from './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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { getDiscussionCollectionName, randomID } from './db.utils' | ||
|
||
describe('getDiscussionCollectionName', () => { | ||
it('should return "questions" when sourceType is "question"', () => { | ||
const result = getDiscussionCollectionName('question') | ||
expect(result).toBe('questions') | ||
}) | ||
|
||
it('should return "howtos" when sourceType is "howto"', () => { | ||
const result = getDiscussionCollectionName('howto') | ||
expect(result).toBe('howtos') | ||
}) | ||
|
||
it('should return null when sourceType is unrecognized', () => { | ||
const result = getDiscussionCollectionName('unknown') | ||
expect(result).toBe(null) | ||
}) | ||
it('should return null when sourceType is an empty string', () => { | ||
const result = getDiscussionCollectionName('') | ||
expect(result).toBeNull() | ||
}) | ||
|
||
it('should return "research" when sourceType is "researchUpdate"', () => { | ||
const result = getDiscussionCollectionName('researchUpdate') | ||
expect(result).toBe('research') | ||
}) | ||
}) | ||
|
||
describe('randomID', () => { | ||
// generates a string of length 20 | ||
it('should generate a string of length 20 and include only alphanumeric characters', () => { | ||
const id = randomID() | ||
const alphanumericRegex = /^[a-zA-Z0-9]+$/ | ||
expect(id).toHaveLength(20) | ||
expect(alphanumericRegex.test(id)).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export type DiscussionEndpoints = 'howtos' | 'research' | 'questions' | ||
|
||
/** | ||
* Function used to determine the discussion collection name based on the source type. | ||
*/ | ||
export const getDiscussionCollectionName = ( | ||
sourceType: string, | ||
): DiscussionEndpoints | null => { | ||
switch (sourceType) { | ||
case 'question': | ||
return 'questions' | ||
case 'howto': | ||
return 'howtos' | ||
case 'researchUpdate': | ||
return 'research' | ||
default: | ||
return null | ||
} | ||
} | ||
|
||
/** | ||
* Function used to generate random ID in same manner as firestore | ||
*/ | ||
export const randomID = () => { | ||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | ||
let autoId = '' | ||
for (let i = 0; i < 20; i++) { | ||
autoId += chars.charAt(Math.floor(Math.random() * chars.length)) | ||
} | ||
return autoId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './auth.utils' | ||
export * from './data.utils' | ||
export * from './file.utils' | ||
export * from './db.utils' |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this still needed? we shouldn't use cra or webpack anymore