Skip to content

Commit bfe6fa2

Browse files
committed
Run smoke test in CI
1 parent f3ff44e commit bfe6fa2

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
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: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ export function defineGenerator({
6060
name,
6161
}: GeneratorOptions): Generator {
6262
const generatorName = name;
63-
const generatorArgs = [copy(), log(), ...args]
63+
const generatorArgs = [copy(), cwd(), log(), ...args]
6464
.map((argFactory) => argFactory(generatorName))
6565
.sort((a, b) => a.name.localeCompare(b.name));
6666

6767
async function run(args: Args): Promise<void> {
68-
const packagePath = cwd();
68+
const packagePath = args.cwd ?? processCwd();
6969
const packageJson: EmberPackageJson = await readJson(
7070
join(packagePath, "package.json"),
7171
);
@@ -252,6 +252,14 @@ export function copy(): GeneratorArgFactory {
252252
});
253253
}
254254

255+
export function cwd(): GeneratorArgFactory {
256+
return () => ({
257+
description: "The current working directory to run the generator in",
258+
name: "cwd",
259+
type: "string",
260+
});
261+
}
262+
255263
export function log(): GeneratorArgFactory {
256264
return (generatorName) => ({
257265
description: `Log the generated ${generatorName} to the console, instead of writing it to disk`,

0 commit comments

Comments
 (0)