Skip to content

Commit 2572493

Browse files
committed
Run smoke test in CI
1 parent a761790 commit 2572493

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,13 @@ jobs:
3535
- macos-latest
3636
- ubuntu-latest
3737
- windows-latest
38+
39+
smoke-test:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: ./.github/actions/setup-environment
44+
- run: pnpm build
45+
- run: pnpm dlx ember-cli@latest new smoke-test-app -b @ember/app-blueprint --pnpm
46+
- run: node bin/gember.js component foo --cwd=smoke-test-app
47+
- run: cd smoke-test-app && pnpm test

src/generator.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ensureDir, pathExists, readJson } from "fs-extra/esm";
55
import Handlebars from "handlebars";
66
import { readFile, writeFile } from "node:fs/promises";
77
import { dirname, join, relative } from "node:path";
8-
import { cwd } from "node:process";
8+
import { cwd as processCwd } from "node:process";
99
import { fileURLToPath } from "node:url";
1010
import { resolveConfig, type Config } from "./config.js";
1111
import { FileReference } from "./file-reference.js";
@@ -53,12 +53,12 @@ export function defineGenerator({
5353
name,
5454
}: GeneratorOptions): Generator {
5555
const generatorName = name;
56-
const generatorArgs = [copy(), log(), ...args]
56+
const generatorArgs = [copy(), cwd(), log(), ...args]
5757
.map((argFactory) => argFactory(generatorName))
5858
.sort((a, b) => a.name.localeCompare(b.name));
5959

6060
async function run(args: Args): Promise<void> {
61-
const packagePath = cwd();
61+
const packagePath = args.cwd ?? processCwd();
6262
const packageJson: EmberPackageJson = await readJson(
6363
join(packagePath, "package.json"),
6464
);
@@ -232,6 +232,14 @@ export function copy(): GeneratorArgFactory {
232232
});
233233
}
234234

235+
export function cwd(): GeneratorArgFactory {
236+
return () => ({
237+
description: "The current working directory to run the generator in",
238+
name: "cwd",
239+
type: "string",
240+
});
241+
}
242+
235243
export function log(): GeneratorArgFactory {
236244
return (generatorName) => ({
237245
description: `Log the generated ${generatorName} to the console, instead of writing it to disk`,

0 commit comments

Comments
 (0)