-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
771 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
"^prod" | ||
], | ||
"dependsOn": [ | ||
"clean", | ||
"^build" | ||
], | ||
"cache": true | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, { | ||
spaces: 2, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
if (await fs.pathExists(distPath)) { | ||
console.log(`Removing ${distPath}`) | ||
await fs.rm(distPath, { recursive: true, force: true }) | ||
} | ||
|
||
const tarball = 'create-redwood-app.tgz' | ||
|
||
if (await fs.pathExists(tarball)) { | ||
console.log(`Removing ${tarball}`) | ||
await fs.rm(tarball, { force: true }) | ||
} | ||
|
||
console.log('Done') | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
Oops, something went wrong.