diff --git a/.eslintrc b/.eslintrc index 0c9c8c46cd7..971814f1df4 100644 --- a/.eslintrc +++ b/.eslintrc @@ -10,6 +10,8 @@ "react/no-access-state-in-setstate": 0, "react/jsx-props-no-spreading": 0, "react/state-in-constructor": ["error", "never"], - "no-useless-escape": 0 + "no-useless-escape": 0, + "react/forbid-dom-props": 0, + "react/forbid-component-props": 0 } } diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 796dff1bb09..449e1574f9a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -26,7 +26,7 @@ src/pages/community/patterns/login-pattern/* @lukefirth src/pages/data-visualization/* @theiliad @natashadecoste # Cal Smith for Angular tutorial -/src/pages/tutorial/angular/* @cal-smith +/src/pages/tutorial/angular/* @zvonimirfras # Lee Chase for Vue tutorial /src/pages/tutorial/vue/* @lee-chase diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml new file mode 100644 index 00000000000..98c40c9dc97 --- /dev/null +++ b/.github/workflows/add-to-project.yml @@ -0,0 +1,11 @@ +name: Add To Project + +on: + issues: + types: [opened, labeled] + +jobs: + issue-triage: + uses: carbon-design-system/carbon/.github/workflows/add-to-project.yml@main + secrets: + ADD_TO_PROJECT_PAT: ${{ secrets.ADD_TO_PROJECT_PAT }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..930acb3fcd3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: ci +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 18.x + uses: actions/setup-node@v2.4.1 + with: + node-version: '18.x' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Check formatting of project files + run: yarn format:check + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 18.x + uses: actions/setup-node@v2.4.1 + with: + node-version: '18.x' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Lint JavaScript files + run: yarn lint:js diff --git a/.github/workflows/dco.yml b/.github/workflows/dco.yml index 1ee3e7bd936..a15c09176d1 100644 --- a/.github/workflows/dco.yml +++ b/.github/workflows/dco.yml @@ -11,7 +11,7 @@ jobs: steps: - name: "DCO Assistant" if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the DCO document and I hereby sign the DCO.') || github.event_name == 'pull_request_target' - uses: cla-assistant/github-action@v2.1.2-beta + uses: cla-assistant/github-action@v2.2.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} @@ -28,4 +28,4 @@ jobs: custom-pr-sign-comment: "I have read the DCO document and I hereby sign the DCO." custom-allsigned-prcomment: "All contributors have signed the DCO." lock-pullrequest-aftermerge: false - use-dco-flag: true \ No newline at end of file + use-dco-flag: true diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f3d1bc78e86..cf37c3a6760 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,5 +1,9 @@ name: Deployment status +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + on: workflow_dispatch: inputs: @@ -10,35 +14,45 @@ on: - main jobs: - build: - runs-on: macos-latest - + gh-pages: + if: github.repository == 'carbon-design-system/carbon-website' + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14.x - uses: actions/setup-node@v2-beta + - uses: actions/checkout@v3 + - name: Use Node.js 18.x + uses: actions/setup-node@v3 with: - node-version: 14.x - + node-version: 18.x - name: Install packages run: yarn install --frozen-lockfile --network-timeout 300000 - + - name: Gatsby Cache Folder + uses: actions/cache@v3 + id: gatsby-cache-folder + with: + path: .cache + key: ${{ runner.os }}-cache-gatsby + restore-keys: | + ${{ runner.os }}-cache-gatsby + - name: Gatsby Public Folder + uses: actions/cache@v3 + id: gatsby-public-folder + with: + path: public/ + key: ${{ runner.os }}-public-gatsby + restore-keys: | + ${{ runner.os }}-public-gatsby - name: Build site run: yarn build:clean - - - name: Install IBM Cloud CLI - run: curl -fsSL https://clis.cloud.ibm.com/install/osx | sh - - - name: Install Cloud Foundry CLI - run: ibmcloud cf install -v 6.51.0 - - - name: Login to ibmcloud env: - API_KEY: ${{ secrets.API_KEY }} - run: - ibmcloud login -a "https://cloud.ibm.com" -u apikey -p "$API_KEY" -o - "carbon-design-system" -s "production" -r "us-south" - - - name: Deploy website + GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES: true + NODE_ENV: production + CI: true + - name: Add CNAME record + run: | + echo 'carbondesignsystem.com' > public/CNAME + - name: Deploy run: | - ibmcloud cf v3-zdt-push carbon-website -b https://github.com/cloudfoundry/nginx-buildpack.git + git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git + npx gh-pages -d public -u "github-actions " + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml new file mode 100644 index 00000000000..7bff43ed743 --- /dev/null +++ b/.github/workflows/issue-triage.yml @@ -0,0 +1,12 @@ +name: Issue Triage +on: + issues: + types: [opened] + issue_comment: + types: [created] +jobs: + issue-triage: + uses: carbon-design-system/carbon/.github/workflows/issue-triage.yml@main + secrets: + APP_ID: ${{ secrets.APP_ID }} + APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} diff --git a/.github/workflows/platform-content-sync.yml b/.github/workflows/platform-content-sync.yml new file mode 100644 index 00000000000..efce1cdb40d --- /dev/null +++ b/.github/workflows/platform-content-sync.yml @@ -0,0 +1,29 @@ +name: Sync content with platform + +on: + push: + branches: + - 'main' + paths: + - '**.mdx' + +jobs: + create_issue: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: carbon-design-system/carbon-platform + ref: main + - name: Generate token + uses: tibdex/github-app-token@v1 + id: generate_token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + - name: Create issue on platform repo + run: | + gh issue create --title "[Content sync]: carbon-website" --label "role: dev πŸ€–" --label "service: web-app 🌎" --body 'A pull request on carbon-website was just merged. It contains .mdx content changes that may need to be synced to platform: + - ${{ github.event.compare }}' + env: + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} diff --git a/.github/workflows/sync-platform-branch.yml b/.github/workflows/sync-platform-branch.yml new file mode 100644 index 00000000000..d6e79e538e4 --- /dev/null +++ b/.github/workflows/sync-platform-branch.yml @@ -0,0 +1,58 @@ +name: Sync Platform Branch +on: + schedule: + # Runs on Fridays 6:00 UTC (-6 CT, -5 EST) + # β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ minute (0 - 59) + # β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ hour (0 - 23) + # β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ day of the month (1 - 31) + # β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ month (1 - 12 or JAN-DEC) + # β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ day of the week (0 - 6 or SUN-SAT) + # β”‚ β”‚ β”‚ β”‚ β”‚ + # β”‚ β”‚ β”‚ β”‚ β”‚ + # β”‚ β”‚ β”‚ β”‚ β”‚ + - cron: 0 6 * * 5 + + # Enable running this workflow manually from the Actions tab + workflow_dispatch: # Allow for running this manually. + +jobs: + sync-branches: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Create PR branch πŸ€– + run: | + git branch carbon-platform-sync + git push origin carbon-platform-sync + + - name: Create Pull Request + uses: actions/github-script@v6 + with: + script: | + const { repo, owner } = context.repo; + const result = await github.rest.pulls.create({ + title: 'Sync carbon-platform branch', + owner, + repo, + head: 'carbon-platform-sync', + base: 'carbon-platform', + body: [ + 'Platform Sync, pulling in new content from main into carbon-platform branch', + 'This PR is auto-generated by [actions/github-script](https://github.com/actions/github-script).', + "**Note**: It’s ok for the CI cheks to fail on this PR, this code is not runnable due to the platform changes" + ].join('\n') + }); + github.rest.issues.addLabels({ + owner, + repo, + issue_number: result.data.number, + labels: ['status: enable automerge 🟠', 'status: ready for review πŸ‘€'] + }); + github.rest.pulls.requestReviewers({ + owner, + repo, + pull_number: result.data.number, + reviewers: ['francinelucca', 'andreancardona', 'alisonjoseph'] + }); diff --git a/.gitignore b/.gitignore index 505c0fd84d5..33c5078d629 100644 --- a/.gitignore +++ b/.gitignore @@ -102,8 +102,14 @@ public # Vscode settings .vscode/settings.json +# Vscode local history extension +.history/ + +# Jetbrains +.idea + # Build timestamp build-timestamp .now -.vercel \ No newline at end of file +.vercel diff --git a/.kodiak.toml b/.kodiak.toml index 505f9188836..8c7026011d4 100644 --- a/.kodiak.toml +++ b/.kodiak.toml @@ -2,5 +2,6 @@ version = 1 [merge] -automerge_label = "status: ready to merge πŸŽ‰" +automerge_label = ["status: ready to merge πŸŽ‰", "status: enable automerge 🟠"] +notify_on_conflict = "false" method = "squash" diff --git a/.nvmrc b/.nvmrc index ca3f1e5c83e..0828ab79473 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v14 \ No newline at end of file +v18 \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 27fcc0b16f9..00000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "editor.formatOnSave": true, - "eslint.lintTask.enable": true, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true - } -} diff --git a/api/survey.ts b/api/survey.ts index ddcd2a412c1..a1cea8e6009 100644 --- a/api/survey.ts +++ b/api/survey.ts @@ -3,7 +3,7 @@ import fetch, { FetchError } from 'node-fetch'; import { WebClient } from '@slack/web-api'; -require('dotenv').config(); +require('dotenv').config(); //eslint-disable-line @typescript-eslint/no-var-requires const permittedOrigins = [ 'https://www.carbondesignsystem.com', diff --git a/conf.d/rewrite.conf b/conf.d/rewrite.conf index c966c4a8a15..c17a5631163 100644 --- a/conf.d/rewrite.conf +++ b/conf.d/rewrite.conf @@ -2,6 +2,7 @@ rewrite /guidelines/iconography/(.*) /guidelines/icons/\$1 permanent; rewrite /guidelines/layout /guidelines/2x-grid/basics/\$1 permanent; rewrite /guidelines/content/glossary /guidelines/content/action-labels permanent; +rewrite /guidelines/color/implementation /guidelines/color/code/\$1 permanent; # Experimental -> Cloud, Data, and AI rewrite /experimental/cards/(.*) https://pages.github.ibm.com/CDAI-design/CDAI-design-website/components/card/\$1 permanent; @@ -28,7 +29,6 @@ rewrite /how-to-contribute/(.*) /contributing/\$1 permanent; # What's happening rewrite /updates/whats-new /whats-happening/releases permanent; rewrite /whats-happening/changelog-and-roadmap /whats-happening/releases permanent; -rewrite /updates/work-in-progress /whats-happening/work-in-progress permanent; # Help rewrite /updates/migration-guide/(.*) /help/migration-guide/\$1 permanent; @@ -44,3 +44,11 @@ rewrite /tutorial/vue/(.*) /developing/vue-tutorial/\$1 permanent; # Data-visualization rewrite /data-visualization/basic-charts/ /data-visualization/simple-charts/ permanent; rewrite /data-visualization/advanced-charts/ /data-visualization/complex-charts/ permanent; + +#v11 +rewrite https://v11.carbondesignsystem.com/migrating/guide/\$1 /migrating/guide/\$1 permanent; +rewrite /whats-happening/v11-release /migrating/guide/\$1 permanent; + +#Icon and pictogram contribution +rewrite /guidelines/icons/contribute/ /contributing/contribute-icons/ permanent; +rewrite /guidelines/pictograms/contribute/ /contributing/contribute-pictograms/ permanent; \ No newline at end of file diff --git a/gatsby-config.js b/gatsby-config.js index 4db646f2117..8d6822d2c88 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -50,6 +50,9 @@ module.exports = { subDirectory: '', }, mediumAccount: 'carbondesign', + theme: { + homepage: 'white', + }, }, }, { @@ -74,5 +77,6 @@ module.exports = { }, }, 'gatsby-plugin-remove-serviceworker', + 'gatsby-plugin-meta-redirect', ], }; diff --git a/gatsby-node.js b/gatsby-node.js index d3a044d179d..d4834afc2c2 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -34,3 +34,46 @@ exports.onCreateWebpackConfig = ({ actions, getConfig }) => { }); } }; + +exports.createPages = ({ actions }) => { + const { createRedirect } = actions; + + // Community index + createRedirect({ + fromPath: '/community/components', + toPath: '/community/component-index', + isPermanent: true, + }); + createRedirect({ + fromPath: '/community/contribute-a-component', + toPath: '/community/component-index', + isPermanent: true, + }); + + // Developing + createRedirect({ + fromPath: '/resources', + toPath: '/developing/developer-resources', + isPermanent: true, + }); + createRedirect({ + fromPath: '/tutorial/react/overview', + toPath: '/developing/react-tutorial/overview', + isPermanent: true, + }); + createRedirect({ + fromPath: '/tutorial/angular/overview', + toPath: '/developing/angular-tutorial/overview', + isPermanent: true, + }); + createRedirect({ + fromPath: '/tutorial/vue/overview', + toPath: '/developing/vue-tutorial/overview', + isPermanent: true, + }); + createRedirect({ + fromPath: '/guidelines/typography/styling-strategies', + toPath: '/guidelines/typography/style-strategies', + isPermanent: true, + }); +}; diff --git a/gatsby-ssr.js b/gatsby-ssr.js index ee38bdfaf91..1fbe9af7c0f 100644 --- a/gatsby-ssr.js +++ b/gatsby-ssr.js @@ -1,15 +1,45 @@ import React from 'react'; -import ogimage from './src/images/ogimage.png'; -export const onRenderBody = ({ setHeadComponents }) => { +export const onRenderBody = ({ setHeadComponents, setPostBodyComponents }) => { + const script = ` + if(!window) window = {}; + window.idaPageIsSPA = false; + window.digitalData = { + page: { + category: { + primaryCategory: 'DESIGN', + }, + pageInfo: { + ibm: { + siteID: 'CARBON_DESIGN_SYSTEM_WWW', + country: 'US', + industry: 'Design', + owner: 'carbon@us.ibm.com', + }, + }, + }, + }`; + setHeadComponents([ - , + , + , + , + , + , , - , + , { key="twitter:site" content="@_carbondesign" />, + , - - -``` - -Once you load `carbon-components.js` via `