Skip to content

Commit

Permalink
Merge pull request #57 from pantheon-systems/PCC-558-pcc-site-create-…
Browse files Browse the repository at this point in the history
…should-show-example-and-created-id-in-output

Pcc 558 pcc site create should show example and created id in output
  • Loading branch information
kevinstubbs authored Sep 12, 2023
2 parents 78f78c0 + 26787ca commit 980fb0b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
16 changes: 15 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,19 @@ $ pcc site components --url https://live-collabcms-fe-demo.appa.pantheon.site --

$ # Retrieve component schema from your site (replace www.example.com)
$ pcc site components --url https://www.example.com
$

```

## Example of creating a site and API key for it

```bash
$ pcc site create --url https://www.example.com
✔ Successfully created the site with given details. Id: THE_NEW_SITE_ID

$ pcc token create
✔ Successfully created token for your user.

Token: TOKEN-SECRET-GUID-DONT-SHARE-THIS

# You can use THE_NEW_SITE_ID as the value of PCC_SITE_ID and TOKEN-SECRET-GUID-DONT-SHARE-THIS for PCC_API_KEY
```
2 changes: 1 addition & 1 deletion packages/cli/src/cli/commands/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test("should be able to init starter kit for gatsby template", async () => {
fs.rmSync(appFolder, { recursive: true, force: true });
});

test("should be able to init starter kit for nextjs template with tyepscript", async () => {
test("should be able to init starter kit for nextjs template with typescript", async () => {
const appFolder = tmp.tmpNameSync();
await sh(`${PCC} init ${appFolder} --template nextjs --use-pnpm --ts`);

Expand Down
13 changes: 8 additions & 5 deletions packages/cli/src/cli/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,15 @@ const init = async ({

if (!skipInstallation) {
// Installing dependencies
const installProj = new SpinnerLogger(
"Installing dependencies...",
silentLogs,
);
const installProj = new SpinnerLogger("Installing dependencies...", false);
installProj.start();
await sh(`${packageManager} install`);
try {
await sh(`${packageManager} install`);
} catch (e) {
console.error(e);
throw e;
}

installProj.succeed("Installed dependencies!");
}

Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/cli/commands/sites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ import { errorHandler } from "../exceptions";
export const createSite = errorHandler<string>(async (url: string) => {
const spinner = ora("Creating site...").start();
try {
await AddOnApiHelper.createSite(url);
spinner.succeed(`Successfully created the site with given details.`);
const siteId = await AddOnApiHelper.createSite(url);
spinner.succeed(
`Successfully created the site with given details. Id: ${siteId}`,
);
} catch (e) {
spinner.fail();
throw e;
Expand Down

0 comments on commit 980fb0b

Please sign in to comment.