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

cli: Default path argument for page create #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions cli/src/cli_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ const validateAndGetCreateArgs = (
isPublic: boolean;
withThreads: boolean;
} => {
if (args.length < 2) {
if (args.length < 1) {
logMessage(
'number of arguments does not match, command expects at least 2 arguments,' +
' the project name and the project location, ' +
'number of arguments does not match, command expects at least 1 arguments,' +
' the project name and optional project location, ' +
'the project location can be relative or absolute.\n' +
' Example usage: "wle-cloud pages create my-project-name --access unlisted --no-threads'
' Example usage: "wle-cloud pages create my-project-name --access unlisted --noThreads'
);
throw new Error('failed to process command');
}
return {
projectName: args[0],
projectLocation: args[1],
projectLocation: args[1] ?? './deploy',
isPublic: checkAndGetAccessType(config),
// if no threads is true, withThreads is false
withThreads: !config.PAGE_NO_THREADS,
Expand Down
9 changes: 2 additions & 7 deletions cli/src/resources/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,7 @@ export class PageClient {
create: boolean,
withThreads = true
): Promise<UploadPageResponse> {
logMessage(
'uploading page files... ',
projectName,
' isPublic ',
isPublic
);
logMessage('uploading page files... ', projectName, ' isPublic ', isPublic);
const formData = new FormData();
const file = fs.readFileSync(deploymentArchivePath);

Expand Down Expand Up @@ -320,7 +315,7 @@ export class PageClient {

async #deleteDeploymentArchive(deploymentArchivePath: string) {
logMessage('removing deployment archive...');
await fs.rmSync(deploymentArchivePath, { recursive: true });
fs.rmSync(deploymentArchivePath, { recursive: true });
logMessage('removed deployment archive');
}
}