Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar committed Dec 30, 2023
1 parent eb049f5 commit 75b6626
Show file tree
Hide file tree
Showing 25 changed files with 771 additions and 526 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/crwa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: 🌲 CRWA

on:
pull_request:
push:
branches: ['next', 'release/**']

# 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

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}

jobs:
build-lint-test:
needs: check

strategy:
matrix:
os: [ubuntu-latest, windows-latest]

name: πŸ— Build, lint, test / ${{ matrix.os }} / node 18 latest
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: β¬’ Enable Corepack
run: corepack enable

- name: β¬’ Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: β¬’ Enable Corepack
run: corepack enable

- name: 🐈 Set up yarn cache
uses: ./.github/actions/set-up-yarn-cache

- name: 🐈 Yarn install
run: yarn install --inline-builds
env:
GITHUB_TOKEN: ${{ github.token }}

- name: πŸ—οΈ Build
run: yarn build

- name: πŸ—οΈ Set up test project
run: |
PROJECT_PATH=$(yarn set-up-test-harness)
echo "PROJECT_PATH=$PROJECT_PATH >> $GITHUB_ENV"
- name: 🌲 CRWA
run: PROJECT_PATH=$PROJECT_PATH yarn test:e2e
1 change: 1 addition & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"^prod"
],
"dependsOn": [
"clean",
"^build"
],
"cache": true
Expand Down
2 changes: 0 additions & 2 deletions packages/create-redwood-app/.babelrc.js

This file was deleted.

16 changes: 8 additions & 8 deletions packages/create-redwood-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@

<h2 align="center">Ship today with architecture for tomorrow.</h2>

Redwood is an opinionated, edge-ready framework for modern multi-client applications, built on React, GraphQL, and Prisma with full TypeScript support and ready to go with zero config.
Redwood is an opinionated framework for modern multi-client applications, built on React, GraphQL, and Prisma with full TypeScript support and ready to go with zero config.

Want great developer experience and easy scaling? How about an integrated front- and back-end test suite, boilerplate code generators, component design, logging, API security + auth, and serverless or traditional deploy support? Redwood is here! Redwood works with the components and development workflow you love but with simple conventions and helpers to make your experience even better.

<br>

<h2>Quick Start</h2>

Redwood requires Node.js >=14.x <=16.x and Yarn v1.15 (or newer).
Redwood requires Node.js =20.x.

```console
yarn create redwood-app redwood-project
cd redwood-project
yarn create redwood-app my-redwood-app
cd my-redwood-app
yarn install
yarn redwood dev
```

<h3>Resources</h3>

- The [Redwood Tutorial](https://redwoodjs.com/docs/tutorial): The best way to learn Redwood
- The [Redwood Tutorial](https://redwoodjs.com/docs/tutorial): the best way to learn Redwood
- The [Redwood CLI](https://redwoodjs.com/docs/cli-commands): code generators, DB helpers, setup commands, and more
- [Documentation](https://redwoodjs.com/docs) and [How To's](https://redwoodjs.com/how-to/custom-function)
- Join the Community [Forums](https://community.redwoodjs.com) and [Chat](https://discord.gg/redwoodjs)

<br>

<h1>Contributing to create-redwood-app</h1>
<h2>Contributing to create-redwood-app</h2>

_Contributors are Welcome! Get started [here](https://redwoodjs.com/docs/contributing). And don't hesitate to ask for help on the forums and chat_

Expand Down
23 changes: 0 additions & 23 deletions packages/create-redwood-app/build.mjs

This file was deleted.

19 changes: 19 additions & 0 deletions packages/create-redwood-app/docs/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- use the test fixture

the test fixture

```
yarn create-redwood-app ...
```

unless you're testing telemetry, you probably want to disable it...

```
REDWOOD_DISABLE_TELEMETRY=1
```

- scrpts in package.json

- the prompt scripts use expect an older cli tool. i tried zx at first but yeah

- bundle...
11 changes: 11 additions & 0 deletions packages/create-redwood-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('jest').Config} */
const config = {
transform: {},

testPathIgnorePatterns: ['<rootDir>/templates/'],

// rootDir: '.',
// testMatch: ['<rootDir>/tests/*.test.js'],
}

export default config
60 changes: 43 additions & 17 deletions packages/create-redwood-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,72 @@
"directory": "packages/create-redwood-app"
},
"license": "MIT",
"bin": "./dist/create-redwood-app.js",
"type": "module",
"bin": "./dist/createRedwoodApp.js",
"files": [
"dist",
"templates"
],
"scripts": {
"build": "yarn node ./build.mjs",
"benchmark": "node ./scripts/benchmark.js",
"build": "node ./scripts/build.js",
"build:pack": "yarn pack -o create-redwood-app.tgz",
"build:watch": "nodemon --watch src --ignore dist,template --exec \"yarn build\"",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "yarn run jest tests",
"ts-to-js": "yarn node ./tsToJS.mjs"
"clean": "node ./scripts/clean.js",
"set-up-test-project": "node ./scripts/setUpTestProject.js",
"test": "node --experimental-vm-modules $(yarn bin jest)",
"test:e2e": "yarn test ./tests/e2e.test.js",
"test:templates": "yarn test ./tests/templates.test.js",
"ts-to-js": "node ./scripts/tsToJS.js"
},
"dependencies": {
"devDependencies": {
"@babel/core": "^7.22.20",
"@babel/plugin-transform-typescript": "^7.22.15",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/exporter-trace-otlp-http": "0.45.1",
"@opentelemetry/resources": "1.18.1",
"@opentelemetry/sdk-trace-node": "1.18.1",
"@opentelemetry/semantic-conventions": "1.18.1",
"@redwoodjs/tui": "6.0.7",
"chalk": "4.1.2",
"@types/babel__core": "7.20.4",
"check-node-version": "4.2.1",
"ci-info": "4.0.0",
"envinfo": "7.11.0",
"esbuild": "0.19.9",
"execa": "5.1.1",
"fs-extra": "11.2.0",
"jest": "29.7.0",
"klaw-sync": "6.0.0",
"nx": "17.2.5",
"semver": "7.5.4",
"systeminformation": "5.21.20",
"terminal-link": "2.1.1",
"untildify": "4.0.0",
"uuid": "9.0.1",
"yargs": "17.7.2"
},
"devDependencies": {
"@babel/core": "^7.22.20",
"@babel/plugin-transform-typescript": "^7.22.15",
"@types/babel__core": "7.20.4",
"esbuild": "0.19.9",
"jest": "29.7.0",
"klaw-sync": "6.0.0"
},
"gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
"gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1",
"nx": {
"targets": {
"build:pack": {
"dependsOn": [
"ts-to-js"
]
},
"set-up-test-project": {
"dependsOn": [
"build:pack"
]
},
"benchmark": {
"dependsOn": [
"set-up-test-project"
]
},
"test:e2e" : {
"dependsOn": [
"set-up-test-project"
]
}
}
}
}
7 changes: 7 additions & 0 deletions packages/create-redwood-app/scripts/benchmark.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node */

import { cd, $ } from 'zx'

cd(process.env.PROJECT_PATH)

await $`hyperfine 'yarn create-redwood-app -y'`
32 changes: 32 additions & 0 deletions packages/create-redwood-app/scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import * as esbuild from 'esbuild'
import fs from 'fs-extra'

const jsBanner = `\
#!/usr/bin/env node
const require = (await import("node:module")).createRequire(import.meta.url);
const __filename = (await import("node:url")).fileURLToPath(import.meta.url);
const __dirname = (await import("node:path")).dirname(__filename);
`

const result = await esbuild.build({
entryPoints: ['src/createRedwoodApp.js'],
outdir: 'dist',

platform: 'node',
format: 'esm',
bundle: true,

banner: {
js: jsBanner,
},

// minify: true,

logLevel: 'info',
metafile: true,
})

await fs.writeJSON(new URL('./meta.json', import.meta.url), result.metafile, {

Check failure on line 30 in packages/create-redwood-app/scripts/build.js

View workflow job for this annotation

GitHub Actions / πŸ— Build, lint, test / ubuntu-latest / node 18 latest

'URL' is not defined
spaces: 2,
})
17 changes: 17 additions & 0 deletions packages/create-redwood-app/scripts/clean.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fs from 'fs-extra'

const distPath = new URL('../dist', import.meta.url)

Check failure on line 3 in packages/create-redwood-app/scripts/clean.js

View workflow job for this annotation

GitHub Actions / πŸ— Build, lint, test / ubuntu-latest / node 18 latest

'URL' is not defined

if (await fs.pathExists(distPath)) {
console.log(`Removing ${distPath}`)

Check failure on line 6 in packages/create-redwood-app/scripts/clean.js

View workflow job for this annotation

GitHub Actions / πŸ— Build, lint, test / ubuntu-latest / node 18 latest

'console' is not defined
await fs.rm(distPath, { recursive: true, force: true })
}

const tarball = 'create-redwood-app.tgz'

if (await fs.pathExists(tarball)) {
console.log(`Removing ${tarball}`)

Check failure on line 13 in packages/create-redwood-app/scripts/clean.js

View workflow job for this annotation

GitHub Actions / πŸ— Build, lint, test / ubuntu-latest / node 18 latest

'console' is not defined
await fs.rm(tarball, { force: true })
}

console.log('Done')

Check failure on line 17 in packages/create-redwood-app/scripts/clean.js

View workflow job for this annotation

GitHub Actions / πŸ— Build, lint, test / ubuntu-latest / node 18 latest

'console' is not defined
27 changes: 27 additions & 0 deletions packages/create-redwood-app/scripts/setUpTestHarness.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Configstore from 'configstore'
import { cd, fs, os, path, $ } from 'zx'

const config = new Configstore('create-redwood-app')
let projectPath = config.get('projectPath')

const projectExists = projectPath && (await fs.pathExists(projectPath))

if (!projectExists) {
const date = (await $`date '+%Y%m%d_%H%M%S'`).stdout.trim()
projectPath = path.join(os.tmpdir(), `crwa_${date}`)

await fs.mkdir(projectPath)
await $`yarn --cwd ${projectPath} init -2`

config.set('projectPath', projectPath)
}

const tarball = 'create-redwood-app.tgz'

await $`mv ${tarball} ${projectPath}`
cd(projectPath)
await $`yarn add ./${tarball}`

await $`echo 'PROJECT_PATH=${projectPath} yarn node --experimental-vm-modules $(yarn bin jest) e2e' | pbcopy`

console.log(projectPath)

Check failure on line 27 in packages/create-redwood-app/scripts/setUpTestHarness.js

View workflow job for this annotation

GitHub Actions / πŸ— Build, lint, test / ubuntu-latest / node 18 latest

'console' is not defined
Loading

0 comments on commit 75b6626

Please sign in to comment.