Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scaffolder): add scaffolder command #277

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
437 changes: 278 additions & 159 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@types/diff": "^5.2.1",
"@types/eslint__js": "^8.42.3",
"@types/express": "^4.17.17",
"@types/mustache": "^4.2.5",
"@types/node": "^18.7.13",
"@types/prompts": "2.4.9",
"@types/validate-npm-package-name": "4.0.2",
Expand Down Expand Up @@ -63,8 +64,11 @@
"crypto-random-string": "^5.0.0",
"diff": "^5.2.0",
"inquirer": "^9.2.6",
"mustache": "^4.2.0",
"octokit": "^4.0.2",
"open": "^10.1.0",
"openid-client": "^5.6.5",
"p-limit": "^6.1.0",
"prompts": "2.4.2",
"validate-npm-package-name": "5.0.1",
"which": "^3.0.1",
Expand Down
13 changes: 13 additions & 0 deletions src/commands/__snapshots__/scaffold.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`scaffold > list 1`] = `
"- name: astro
- name: laravel-11
"
`;

exports[`scaffold > start validate template is set 1`] = `""`;

exports[`scaffold > start with project id 1`] = `""`;

exports[`scaffold > start without project id 1`] = `""`;
2 changes: 2 additions & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as projects from './projects.js';
import * as ipAllow from './ip_allow.js';
import * as users from './user.js';
import * as orgs from './orgs.js';
import * as scaffold from './scaffold.js';
import * as branches from './branches.js';
import * as databases from './databases.js';
import * as roles from './roles.js';
Expand All @@ -15,6 +16,7 @@ export default [
auth,
users,
orgs,
scaffold,
projects,
ipAllow,
branches,
Expand Down
4 changes: 3 additions & 1 deletion src/commands/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const list = async (props: CommonProps & { orgId?: string }) => {
out.end();
};

const create = async (
export const create = async (
props: CommonProps & {
name?: string;
regionId?: string;
Expand Down Expand Up @@ -252,6 +252,8 @@ const create = async (
const psqlArgs = props['--'];
await psql(connection_uri, psqlArgs);
}

return data;
};

const deleteProject = async (props: CommonProps & IdOrNameProps) => {
Expand Down
20 changes: 20 additions & 0 deletions src/commands/scaffold.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe } from 'vitest';

import { test } from '../test_utils/fixtures';

describe('scaffold', () => {
test('list', async ({ testCliCommand }) => {
await testCliCommand(['scaffold', 'list']);
});

test('start with project id', async ({ testCliCommand }) => {
await testCliCommand([
'scaffold',
'start',
'--template-id',
'test-template',
'--project-id',
'test',
]);
});
});
Loading