Skip to content

Commit 8dfb9db

Browse files
committed
Merge remote-tracking branch 'origin/main' into dependencies
* origin/main: (205 commits) chore(release): publish feat(NotificationItemNew): add new forum notification icons ci: block PRs until automerge label is added, other ci cleanup chore(release): publish style(Anchor): Adds new anchor variants and styles necessary for usage [GM-159] [GM-160] chore(release): publish fix(Card)!: Animation Fixes and Gamut migration chore(release): publish fix(NotificationItemNew): tracking fix & accessibility improvement chore(release): publish feat(Form): Input, Select, TextArea, + Error Updates (#1439) chore(release): publish feat(PageHero): don't hide video on xs screens (#1505) chore(release): publish feat(GlobalHeader): header animation on scroll (#1430) chore(release): publish feat(GridForm): Add tooltip to gridform fields chore(release): publish fix(Modal): add aria-label prop chore(release): publish ...
2 parents 6b3251c + 87ffbed commit 8dfb9db

394 files changed

Lines changed: 15543 additions & 7827 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ references:
99
- image: circleci/node:12.16.0
1010
working_directory: ~/repo
1111
environment:
12-
GITHUB_BOT_USERNAME: codecademydev
12+
IGNORE_COMMIT_MESSAGE: 'chore(release): publish'
1313
NODE_OPTIONS: '--max_old_space_size=8196'
1414
CIRCLE_TEST_REPORTS: /tmp/test-results
1515

@@ -86,8 +86,9 @@ references:
8686
run:
8787
name: Skip build from automated commit
8888
command: |
89-
echo "Build started due to commit by ${CIRCLE_USERNAME}, blocking builds started by ${GITHUB_BOT_USERNAME}"
90-
if [ $CIRCLE_USERNAME == $GITHUB_BOT_USERNAME ] ; then circleci-agent step halt ; fi
89+
export COMMIT_MESSAGE=$(git log --format=oneline -n 1 $CIRCLE_SHA1)
90+
echo "Build started due to commit with message $COMMIT_MESSAGE, blocking builds started by ${IGNORE_COMMIT_MESSAGE}"
91+
if [[ $COMMIT_MESSAGE == *"${IGNORE_COMMIT_MESSAGE}"* ]] ; then circleci-agent step halt ; fi
9192
9293
skip_if_not_pr: &skip_if_not_pr
9394
run:
@@ -186,21 +187,6 @@ jobs:
186187
name: Lerna Publish
187188
command: yarn lerna publish --yes --conventional-commits --changelog-preset conventionalcommits --include-merged-tags --create-release=github
188189

189-
publish_next:
190-
<<: *default_env
191-
resource_class: large
192-
steps:
193-
- *skip_on_automated_commit
194-
- *add_github_ssh_key
195-
- *set_git_user
196-
- checkout
197-
- *restore_node_modules
198-
- *set_npm_token
199-
- *build_changed_packages
200-
- run:
201-
name: Lerna Publish
202-
command: yarn lerna publish --canary --preid=next --dist-tag=next
203-
204190
deploy:
205191
<<: *default_env
206192
resource_class: large
@@ -332,18 +318,11 @@ workflows:
332318
filters:
333319
branches:
334320
only: main
335-
- publish_next:
336-
requires:
337-
- checkout_code
338-
filters:
339-
branches:
340-
only: next
341321
- publish_alpha:
342322
filters:
343323
branches:
344324
ignore:
345325
- main
346-
- next
347326
- gh-pages
348327
requires:
349328
- checkout_code
@@ -366,7 +345,6 @@ workflows:
366345
branches:
367346
ignore:
368347
- main
369-
- next
370348
- gh-pages
371349
requires:
372350
- checkout_code

.eslintrc.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
/**
2-
* @remarks
3-
* This could just use `extends`
4-
* but making a monorepo module a dependency in the root
5-
* causes an extra copy to be saved to node-modules that isn't
6-
* symlinked, which we don't want. This should eventually just
7-
* move to a shared private module instead of having this in the
8-
* project root
9-
*/
10-
const defaultConfig = require('./packages/eslint-config');
11-
121
module.exports = {
13-
...defaultConfig,
142
root: true,
153

4+
extends: [require.resolve('./packages/eslint-config')],
5+
6+
plugins: ['local-rules'],
7+
168
overrides: [
17-
...defaultConfig.overrides,
18-
{
19-
files: ['*.mdx'],
20-
parser: 'eslint-mdx',
21-
},
229
{
2310
files: ['**/typings/*', '*.d.ts'],
2411
parserOptions: {
@@ -45,6 +32,7 @@ module.exports = {
4532
'ImportDeclaration[source.value=/^((?!module.scss).)*(.scss)$/]',
4633
},
4734
],
35+
'local-rules/gamut-import-paths': 'error',
4836
},
4937
},
5038
],
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Auto Request Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, ready_for_review, reopened]
6+
7+
jobs:
8+
auto-request-review:
9+
name: Auto Request Review
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Request review based on files changes and/or groups the author belongs to
13+
uses: necojackarc/auto-request-review@v0.5.0
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
config: .github/reviewers.yml # Config file location override

.github/workflows/automerge.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,14 @@ on:
66
- main
77
types:
88
- labeled
9-
- unlabeled
109
- synchronize
1110
- opened
1211
- edited
13-
- ready_for_review
1412
- reopened
15-
- unlocked
1613
pull_request_review:
1714
types:
1815
- submitted
19-
check_suite:
20-
types:
21-
- completed
22-
check_run:
23-
types:
24-
- completed
25-
status: {}
26-
push:
27-
branches:
28-
- main
16+
status:
2917

3018
jobs:
3119
automerge:
@@ -36,15 +24,15 @@ jobs:
3624
uses: fountainhead/action-wait-for-check@v1.0.0
3725
id: wait-for-build
3826
with:
39-
token: ${{ secrets.GITHUB_TOKEN }}
27+
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
4028
checkName: build-test
4129
ref: ${{ github.event.pull_request.head.sha || github.sha }}
4230
timeoutSeconds: 1200
4331
intervalSeconds: 30
4432
- name: automerge
4533
uses: pascalgn/automerge-action@v0.12.0
4634
env:
47-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
35+
GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
4836
MERGE_LABELS: "Ship It :shipit:"
4937
UPDATE_LABELS: "Ship It :shipit:,Auto Update"
5038
MERGE_REMOVE_LABELS: "Ship It :shipit:"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Check labels
2+
3+
on:
4+
pull_request:
5+
types: [opened, labeled, unlabeled, reopened]
6+
7+
jobs:
8+
ship-it:
9+
runs-on: ubuntu-18.04
10+
steps:
11+
- uses: sugarshin/required-labels-action@v0.3.1
12+
with:
13+
required_all: 'Ship It :shipit:'

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ _Shared node modules for codecademy.com & co_
99

1010
This repository is a monorepo that we manage using [Lerna](https://lernajs.io/). That means that we publish several packages to npm from the same codebase, including:
1111

12+
[`gamut-kit`: Include in your application instead of the individual packages to simplify version management. ](/packages/gamut-kit/README.md)
13+
14+
- [![npm version](https://badge.fury.io/js/%40codecademy%2Fgamut-kit.svg)](https://badge.fury.io/js/%40codecademy%2Fgamut-kit)
15+
1216
[`gamut`: Our React UI component library](/packages/gamut/README.md)
1317

1418
- [![npm version](https://badge.fury.io/js/%40codecademy%2Fgamut.svg)](https://badge.fury.io/js/%40codecademy%2Fgamut)
@@ -62,6 +66,23 @@ Every PR that changes files in a package publishes alpha releases that you can u
6266

6367
### Working with pre-published changes
6468

69+
Due to the inconsistencies of `yarn link` and symlinks in general in a lerna repo, we recommend using the `npm-link-better` package instead of `yarn link`.
70+
71+
To use it, follow these instructions:
72+
73+
1. in the terminal, `cd` into the root directory of the application that uses gamut (or any other client-modules package)
74+
1. Run `yarn build-all` (optional, but it rules out some other issues down the line)
75+
1. Run `npm-link-better` to link the package you're working on and start watching for changes
76+
1. `npx npm-link-better@0.6.0 --copy --watch ../client-modules/packages/gamut` (`../client-modules` or wherever your client-modules repo is)
77+
1. Make changes in the package client-modules repo and build the package, and you should see the changes reflected in your application
78+
79+
To run a watcher and build Gamut on changes, in `client_modules/packages/gamut` use `yarn build:watch`. Similar watch scripts exist in the other packages, but if not feel free to add one!
80+
81+
You may need to run `yarn build:all` before running the build task in gamut or another package, if that package depends on the other built packages existing to be built.
82+
83+
<details>
84+
<summary>Instructions for using `yarn link` instead (not recommended)</summary>
85+
6586
For quicker development cycles, it's possible to run a pre-published version of Gamut in another project. We do that using
6687
symlinks (the following instructions assume you have set up and built client-modules):
6788

@@ -83,7 +104,7 @@ If your other project uses React, you must link that copy of React in Gamut:
83104
[See the docs](https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react)
84105
for more information for why you have to do this.
85106

86-
To run a watcher and build Gamut on changes, in `client_modules/packages/gamut` use `yarn build:watch`
107+
</details>
87108

88109
#### Troubleshooting
89110

codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ comment:
88
after_n_builds: 4 # Must be the # of parallel test builds in CircleCI
99
layout: "diff, files"
1010
require_changes: true
11+
12+
ignore:
13+
- "**/*.js"
14+
- "**/*.md"
15+
- "**/*.mdx"

eslint-local-rules.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'gamut-import-paths': require('./eslint/gamut-import-paths').default,
3+
};

eslint/gamut-import-paths.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
module.exports.default = {
2+
create(context) {
3+
return {
4+
'ImportDeclaration[source.value=/(^@)codecademy(\\u002F)gamut/]': function (
5+
node
6+
) {
7+
const filename = context.getFilename();
8+
const importPath = node.source.value;
9+
10+
const fileDirectory = filename.split('/packages/')[1].split('/')[0];
11+
const importPackage = importPath.split('@codecademy/')[1].split('/')[0];
12+
13+
if (fileDirectory === importPackage) {
14+
context.report({
15+
messageId: 'useRelativeImport',
16+
node,
17+
});
18+
return;
19+
}
20+
21+
if (importPath.includes('/src')) {
22+
context.report({
23+
fix: (fixer) => {
24+
const indexOfSrc =
25+
node.source.range[0] + importPath.search('/src');
26+
if (importPath.endsWith('/src')) {
27+
return fixer.removeRange([indexOfSrc + 1, node.range[1] - 2]);
28+
}
29+
},
30+
messageId: 'removeSrc',
31+
node,
32+
});
33+
return;
34+
}
35+
36+
if (importPath.includes('/dist')) {
37+
context.report({
38+
fix: (fixer) => {
39+
const indexOfDist =
40+
node.source.range[0] + importPath.search('/dist');
41+
if (importPath.endsWith('/dist')) {
42+
return fixer.removeRange([indexOfDist + 1, node.range[1] - 2]);
43+
}
44+
},
45+
messageId: 'removeDist',
46+
node,
47+
});
48+
}
49+
},
50+
};
51+
},
52+
defaultOptions: [],
53+
meta: {
54+
docs: {
55+
category: 'Possible Errors',
56+
description: 'Ensure Gamut import statements have proper module paths.',
57+
recommended: 'error',
58+
},
59+
fixable: true,
60+
messages: {
61+
removeDist:
62+
'There is no need to append /dist to the end of this module path.',
63+
removeSrc:
64+
'There is no need to append /src to the end of this module path.',
65+
useRelativeImport: 'Use a relative path for this import statement.',
66+
},
67+
type: 'suggestion',
68+
schema: [],
69+
},
70+
name: 'gamut-import-paths',
71+
};

jest.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ module.exports = {
2323
'^~styleguide/blocks(.*)$':
2424
'<rootDir>/packages/styleguide/.storybook/components$1',
2525
'^@codecademy\\/gamut$': '<rootDir>/packages/gamut/src',
26+
'^@codecademy\\/gamut-labs$': '<rootDir>/packages/gamut-labs/src',
2627
'^@codecademy\\/gamut-styles$': '<rootDir>/packages/gamut-styles/src',
2728
'^@codecademy\\/gamut-system$': '<rootDir>/packages/gamut-system/src',
29+
'^@codecademy\\/gamut-tests$': '<rootDir>/packages/gamut-tests/src',
30+
'^@codecademy\\/variance$': '<rootDir>/packages/variance/src',
31+
'^@codecademy\\/gamut-illustrations$':
32+
'<rootDir>/packages/gamut-illustrations/src',
2833
'^@codecademy\\/macros$': '<rootDir>/packages/macros',
2934
},
3035
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
@@ -52,5 +57,5 @@ module.exports = {
5257
reporters: process.env.CI ? ['default', 'jest-junit'] : ['default'],
5358
coverageReporters: ['json', 'text', 'clover'],
5459
coverageDirectory: process.env.CI ? '/tmp/test-results/jest' : './coverage',
55-
collectCoverage: process.env.CI ? true : false,
60+
collectCoverage: !!process.env.CI,
5661
};

0 commit comments

Comments
 (0)