Skip to content

Commit

Permalink
ci: Test scaffolding. (#125)
Browse files Browse the repository at this point in the history
* Add CI for scaffold.

* Bump

* Fix name.

* Add CI only code.

* Make in other dir.

* Split up.

* Add testing.
  • Loading branch information
milesj authored May 13, 2022
1 parent 7788bb1 commit 04ee133
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,40 @@ jobs:
- run: yarn run pack
# Run again with packemon built files
- run: yarn run pack
scaffold-mono:
name: Scaffold (monorepo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --immutable
- run: yarn run setup
- run: mkdir ../work
- run: yarn packemon scaffold --template monorepo ../work
- run: yarn packemon scaffold --template monorepo-package ../work
# Test all the things
- run: cd ../work
- run: ls -R .
- run: yarn run check
scaffold-poly:
name: Scaffold (polyrepo)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --immutable
- run: yarn run setup
- run: mkdir ../work
- run: yarn packemon scaffold --template polyrepo ../work
- run: yarn packemon scaffold --template polyrepo-package ../work
# Test all the things
- run: cd ../work
- run: ls -R .
- run: yarn run check
docs:
name: Docs
runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions packages/packemon/src/commands/Scaffold.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ export class ScaffoldCommand extends Command {
this.dest = dest;
this.destDir = path.join(process.cwd(), dest);

// This is purely for testing in CI, as we have no way to pass stdin
if (process.env.CI) {
await this.scaffold({
author: 'Packemon',
template: this.template!,
projectName: 'packemon',
packageName: 'example',
packagePath: 'packages/example',
repoUrl: 'packemon',
year: new Date().getFullYear(),
});

return undefined;
}

const { Scaffold } = await import('../components/Scaffold');

return (
Expand Down

0 comments on commit 04ee133

Please sign in to comment.