Skip to content

Commit

Permalink
Merge branch 'main' into ds-crwa/esm-and-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar committed May 19, 2023
2 parents dc68e6b + 93838d3 commit aec1bfd
Show file tree
Hide file tree
Showing 449 changed files with 57,255 additions and 33,917 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const path = require('path')

const findUp = require('findup-sync')
const { findUp } = require('@redwoodjs/project-config')

// Framework Babel config is monorepo root ./babel.config.js
// `yarn lint` runs for each workspace, which needs findup for path to root
// `yarn lint` runs for each workspace, which needs findUp for path to root
const findBabelConfig = (cwd = process.cwd()) => {
const configPath = findUp('babel.config.js', { cwd })
const configPath = findUp('babel.config.js', cwd)
if (!configPath) {
throw new Error(`Eslint-parser could not find a "babel.config.js" file`)
}
Expand Down
9 changes: 9 additions & 0 deletions .github/actions/check_create_redwood_app/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Check create redwood app
description: Determines if the create redwood app JS template should be rebuilt
runs:
# `node18` isn't supported yet
using: node16
main: check_create_redwood_app.mjs
inputs:
labels:
required: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* eslint-env es6, node */
import { getInput } from '@actions/core'

// If the PR has the "crwa-ok" label, just pass.
const { labels } = JSON.parse(getInput('labels'))
const hasCRWA_OkLabel = labels.some((label) => label.name === 'crwa-ok')

if (hasCRWA_OkLabel) {
console.log('Skipping check because of the "crwa-ok" label')
} else {
// Check if the PR rebuilds the fixture. If it does, that's enough.
const { exec, getExecOutput } = await import('@actions/exec')
await exec('git fetch origin main')
const { stdout } = await getExecOutput('git diff origin/main --name-only')
const changedFiles = stdout.toString().trim().split('\n').filter(Boolean)
const didRebuildJS_Template = changedFiles.some((file) =>
file.startsWith('packages/create-redwood-app/templates/js')
)

if (didRebuildJS_Template) {
console.log(
[
// Empty space here (and in subsequent console logs)
// because git fetch origin main prints to stdout.
'',
"The create redwood app JS template's been rebuilt",
].join('\n')
)
} else {
// If it doesn't, does it need to be rebuilt? If not, no problem. Otherwise, throw.
const shouldRebuildJS_Template = changedFiles.some(
(file) =>
file.startsWith('packages/create-redwood-app/templates/ts')
)

if (!shouldRebuildJS_Template) {
console.log(['', "The create redwood app JS template doesn't need to be rebuilt"].join('\n'))
} else {
console.log(
[
'',
'This PR changes the create-redwood-app TS template.',
'That usually means the JS template needs to be rebuilt.',
`If you know that it doesn't, add the "crwa-ok" label. Otherwise, rebuild the JS template and commit the changes:`,
'',
' cd packages/create-redwood-app',
' yarn ts-to-js',
'',
].join('\n')
)

process.exitCode = 1
}
}
}
9 changes: 9 additions & 0 deletions .github/actions/check_create_redwood_app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "check_test_project_fixture",
"private": true,
"dependencies": {
"@actions/core": "1.10.0",
"@actions/exec": "1.1.1"
},
"packageManager": "yarn@3.5.1"
}
66 changes: 66 additions & 0 deletions .github/actions/check_create_redwood_app/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This file is generated by running "yarn install" inside your project.
# Manual changes might be lost - proceed with caution!

__metadata:
version: 6
cacheKey: 8c0

"@actions/core@npm:1.10.0":
version: 1.10.0
resolution: "@actions/core@npm:1.10.0"
dependencies:
"@actions/http-client": ^2.0.1
uuid: ^8.3.2
checksum: 9214d1e0cf5cf2a5d48b8f3b12488c6be9f6722ea60f2397409226e8410b5a3e12e558d9b66c93469d180399865ec20180119408a1770f026bd9ecac6965fcda
languageName: node
linkType: hard

"@actions/exec@npm:1.1.1":
version: 1.1.1
resolution: "@actions/exec@npm:1.1.1"
dependencies:
"@actions/io": ^1.0.1
checksum: 4a09f6bdbe50ce68b5cf8a7254d176230d6a74bccf6ecc3857feee209a8c950ba9adec87cc5ecceb04110182d1c17117234e45557d72fde6229b7fd3a395322a
languageName: node
linkType: hard

"@actions/http-client@npm:^2.0.1":
version: 2.0.1
resolution: "@actions/http-client@npm:2.0.1"
dependencies:
tunnel: ^0.0.6
checksum: b58987ba2f53d7988f612ede7ff834573a3360c21f8fdea9fea92f26ada0fd0efafb22aa7d83f49c18965a5b765775d5253e2edb8d9476d924c4b304ef726b67
languageName: node
linkType: hard

"@actions/io@npm:^1.0.1":
version: 1.1.2
resolution: "@actions/io@npm:1.1.2"
checksum: 61c871bbee1cf58f57917d9bb2cf6bb7ea4dc40de3f65c7fb4ec619ceff57fc98f56be9cca2d476b09e7a96e1cba0d88cd125c4f690d384b9483935186f256c1
languageName: node
linkType: hard

"check_test_project_fixture@workspace:.":
version: 0.0.0-use.local
resolution: "check_test_project_fixture@workspace:."
dependencies:
"@actions/core": 1.10.0
"@actions/exec": 1.1.1
languageName: unknown
linkType: soft

"tunnel@npm:^0.0.6":
version: 0.0.6
resolution: "tunnel@npm:0.0.6"
checksum: e27e7e896f2426c1c747325b5f54efebc1a004647d853fad892b46d64e37591ccd0b97439470795e5262b5c0748d22beb4489a04a0a448029636670bfd801b75
languageName: node
linkType: hard

"uuid@npm:^8.3.2":
version: 8.3.2
resolution: "uuid@npm:8.3.2"
bin:
uuid: dist/bin/uuid
checksum: bcbb807a917d374a49f475fae2e87fdca7da5e5530820ef53f65ba1d12131bd81a92ecf259cc7ce317cbe0f289e7d79fdfebcef9bfa3087c8c8a2fa304c9be54
languageName: node
linkType: hard
11 changes: 10 additions & 1 deletion .github/actions/telemetry_check/check.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-env node */

import http from 'http'
import path from 'path'

import { exec } from '@actions/exec'

Expand Down Expand Up @@ -36,13 +37,21 @@ try {
switch (mode) {
case 'crwa':
exitCode = await exec(
`yarn node ./packages/create-redwood-app/dist/create-redwood-app.js ../project-for-telemetry --typescript true --git false --yarn-install true`
`yarn node ./packages/create-redwood-app/dist/create-redwood-app.js ../project-for-telemetry --typescript true --git false`
)
if (exitCode) {
process.exit(1)
}
break
case 'cli':
exitCode = await exec(
`yarn install`, null, {
cwd: path.join(process.cwd(), '../project-for-telemetry')
}
)
if (exitCode) {
process.exit(1)
}
exitCode = await exec(
`yarn --cwd ../project-for-telemetry node ../redwood/packages/cli/dist/index.js info`
)
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/check-create-redwood-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Check create-redwood-app

on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]

# Cancel in-progress runs of this workflow.
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-create-redwood-app:
name: Check create redwood app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn install
working-directory: ./.github/actions/check_create_redwood_app

- name: Check create redwood app
uses: ./.github/actions/check_create_redwood_app
with:
labels: '{ "labels": ${{ toJSON(github.event.pull_request.labels) }} }'
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ jobs:

- name: 📢 Listen for telemetry (CRWA)
run: node ./.github/actions/telemetry_check/check.mjs --mode crwa
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false

- name: 📢 Listen for telemetry (CLI)
run: node ./.github/actions/telemetry_check/check.mjs --mode cli
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false

telemetry-check-docs:
needs: only-doc-changes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/require-release-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
with:
mode: exactly
count: 1
labels: "release:docs, release:chore, release:fix, release:feature, release:feature-breaking"
labels: "release:docs, release:chore, release:experiment, release:fix, release:feature, release:feature-breaking"
4 changes: 1 addition & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ tasks:
openMode: split-left
before: |
export RWFW_PATH="/workspace/redwood"
export RWJS_DEV_API_URL="http://localhost"
init: |
mkdir /workspace/rw-test-app
command: |
cd /workspace/rw-test-app
echo -e "\n\n\033[94m ======================================================" && echo -e "\n\033[33m ⌛ Please wait until the dev server is running on the right-side terminal. \n "rw-test-app" is being generated & linked with latest framework code. \n\nIf you make further changes to the framework..." && echo -e "1. \033[33mEnsure env vars are set \033[92m'export RWFW_PATH="/workspace/redwood" RWJS_DEV_API_URL="http://localhost"'\033[33m" && echo -e "2. \033[33mRun \033[92m'yarn rwfw project:sync'\033[33m to watch & sync changes into the test project" && echo -e "\n\033[94m ======================================================\n\n"
echo -e "\n\n\033[94m ======================================================" && echo -e "\n\033[33m ⌛ Please wait until the dev server is running on the right-side terminal. \n "rw-test-app" is being generated & linked with latest framework code. \n\nIf you make further changes to the framework..." && echo -e "1. \033[33mEnsure env vars are set \033[92m'export RWFW_PATH="/workspace/redwood"'\033[33m" && echo -e "2. \033[33mRun \033[92m'yarn rwfw project:sync'\033[33m to watch & sync changes into the test project" && echo -e "\n\033[94m ======================================================\n\n"
- name: "Dev Servers"
openMode: split-right
before: |
export RWFW_PATH="/workspace/redwood"
export RWJS_DEV_API_URL="http://localhost"
export REDWOOD_DISABLE_TELEMETRY=1
init: |
cd /workspace/redwood
Expand Down
Loading

0 comments on commit aec1bfd

Please sign in to comment.