Skip to content

Scaffold multi-package workspace.#6850

Merged
ovflowd merged 1 commit into
nodejs:mainfrom
anthonyshew:fbac7
Jul 3, 2024
Merged

Scaffold multi-package workspace.#6850
ovflowd merged 1 commit into
nodejs:mainfrom
anthonyshew:fbac7

Conversation

@anthonyshew
Copy link
Copy Markdown
Contributor

@anthonyshew anthonyshew commented Jun 19, 2024

Description

Create the structure for a multi-package workspace for the Node.js website.

Core maintainers have expressed a desire for re-using code from the website in other places. These changes allows for those publishable packages to be created, since they can now be broken out to their own separate packages.

Unfortunately, this involves a large-scale cutover from the repository's previous structure, invalidating PR's that come from current main. I've received maintainer approval for my disruptiveness. 🙏

Fortunately, those outstanding PRs can be fairly easily re-aligned with this PR, since I've made near-zero changes as far as the source code is concerned. This PR updates tooling, rather than functional code. (Prettier updated ~10 files that I saw at one point, but I don't believe this came from the changes I've made. I think the source code was somehow out-of-sync with the Prettier configuration.) If you'd like your PR to meet back up with this one, you should be able to move them from their current location to ./apps/site/<your-path>.

Validation

  • One thing I can say I certainly don't know about in this repo is crowdin.yml. I'm not familiar with that tool so I don't know if it makes sense to move into the apps/site directory or if it needs to stay in the root.
  • I've tried to find breakages and configuration differences from main to here and have satisfied my initial attempts to break myself.
  • We can name the directory for the site something other than site, as desired. Just let me know!
  • I'll need some help making sure that CI has been re-aligned properly, both in GHA and in Vercel (cc @ovflowd in particular for Vercel, I believe).

Anthony's Checklist

  • Does the site build locally?
  • Does husky pass?
  • Do lints pass locally?
  • Does lint-staged work?
  • Do test pass locally?
  • Do commands in the root of the repository run?
  • Do the expected turbo tasks run when invoked?
  • Update repo's meta-documentation for contributors
  • Does internationalization work as expected?
  • Does Vercel build?
  • Re-align GHA checks

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ❌ Failed (Inspect) Jul 3, 2024 9:13pm

id: turborepo_arguments
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--cache-dir
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--force
run: echo "turbo_args=--force=true --cache-dir=.turbo/cache" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown
Contributor Author

@anthonyshew anthonyshew Jun 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed as of Turborepo 2, since it's the default.

@bmuenzenmeyer
Copy link
Copy Markdown
Contributor

bmuenzenmeyer commented Jun 24, 2024

I looked into crowdin renames - this was the best I could find so far.

https://community.crowdin.com/t/change-source-file-name-without-loosing-progress/7594/3

I will ask in our Slack channel with Crowdin to confirm or supply something more detailed

@Andrulko
Copy link
Copy Markdown
Contributor

One thing I can say I certainly don't know about in this repo is crowdin.yml. I'm not familiar with that tool so I don't know if it makes sense to move into the apps/site directory or if it needs to stay in the root.

Please keep this file in the root of the branch, it is used by Crowdin <-> GitHub connector:
https://support.crowdin.com/github-integration/

It would be required to update paths to EN files to be able to sync sources and translations:
https://github.com/nodejs/nodejs.org/blob/main/crowdin.yml

Please pause Crowdin <-> GitHub sync before merging the PR, then after it's merged Crowdin team will help to adapt the existing Crowdin project and configuration file to the new structure.

@anthonyshew
Copy link
Copy Markdown
Contributor Author

Thanks, @Andrulko! I've remapped those paths now, if you'd like to check them to confirm I've done so correctly.

@Andrulko
Copy link
Copy Markdown
Contributor

@anthonyshew Just to make sure that everything would work fine, let's insert / at the beginning of path. Please use the configuration below:

commit_message: 'chore: synced translations from crowdin [skip ci]'
append_commit_message: false
pull_request_title: '[automated]: crowdin sync'
pull_request_labels:
  - 'github_actions:pull-request'
files:
  - source: /apps/site/pages/en/**/*.md
    translation: /apps/site/pages/%two_letters_code%/**/%original_file_name%
    content_segmentation: 0
    ignore:
      - /apps/site/pages/en/blog/**/*.md
      - /apps/site/pages/en/learn/**/*.md
      - /apps/site/pages/en/download/index.md
      - /apps/site/pages/en/download/current.md
    languages_mapping:
      two_letters_code:
        es-ES: es
        pt-BR: pt-br
        zh-CN: zh-cn
        zh-TW: zh-tw
  - source: /apps/site/pages/en/**/*.mdx
    translation: /apps/site/pages/%two_letters_code%/**/%original_file_name%
    content_segmentation: 0
    ignore:
      - /apps/site/pages/en/blog/**/*.mdx
      - /apps/site/pages/en/learn/**/*.mdx
    languages_mapping:
      two_letters_code:
        es-ES: es
        pt-BR: pt-br
        zh-CN: zh-cn
        zh-TW: zh-tw
  - source: /apps/site/i18n/locales/en.json
    translation: /apps/site/i18n/locales/%two_letters_code%.json
    languages_mapping:
      two_letters_code:
        es-ES: es
        pt-BR: pt-br
        zh-CN: zh-cn
        zh-TW: zh-tw

Everything else looks good! Before you merge this branch, please pause GitHub sync in Crowdin (otherwise, it will upload new /apps/site folders along with files). I will help to move the existing files in Crowdin project to the new path and then we can safely resume the sync. No new files will be uploaded in this case 👌

@anthonyshew
Copy link
Copy Markdown
Contributor Author

Updated with that. Thank you!

@bmuenzenmeyer

This comment was marked as resolved.

Comment thread package.json Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Running Lighthouse audit...

@ovflowd ovflowd added the github_actions:pull-request Trigger Pull Request Checks label Jul 3, 2024
@github-actions github-actions Bot removed the github_actions:pull-request Trigger Pull Request Checks label Jul 3, 2024
@anthonyshew