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
Converts clasp clone to inquirer #132
Conversation
If user does clasp clone without a scriptId, it will get the 10 most recent scripts and prompt the user to choose one. Signed-off-by: campionfellin <campionfellin@gmail.com>
Pull Request Test Coverage Report for Build 96
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! LGTM.
Before we dive deeper into inquirer
, let's create some plans:
- We should abstract out the interface of each method with the implementation
- We might want to take the opportunity to break apart
clasp
into multiple files in the next PR.
I know I was resistant to multi-files before, but I think it'd be smart for testing and extensibility.
- Files
src/commands.ts
(module.export
each command as a function)src/utils.ts
(settings, OAuth, dotfiles)index.ts
(tie everything together)
Like #106, but be sure to not utils.*
, just import { DOTFILE } from 'utils.ts';
.
Aside, it would be great if each command had a gif (it's not too hard to record): https://giphy.com/apps/giphycapture
index.ts
Outdated
@@ -218,6 +218,14 @@ const createQuestions = [{ | |||
default: LOG.UNTITLED_SCRIPT_TITLE, | |||
}]; | |||
|
|||
// Questions (prompts) for clasp clone | |||
const cloneQuestions = [{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline this const
to increase locality and reduce the number of identifiers.
index.ts
Outdated
const drive = google.drive({version: 'v3', auth: oauth2Client}); | ||
const res = await drive.files.list({ | ||
pageSize: 10, | ||
fields: 'nextPageToken, files(id, name)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextPageToken
not used.
index.ts
Outdated
if (!scriptId) { | ||
getAPICredentials(async () => { | ||
const drive = google.drive({version: 'v3', auth: oauth2Client}); | ||
const res = await drive.files.list({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { data } =
index.ts
Outdated
console.log(err); | ||
}); | ||
} else { | ||
console.log('No script files found.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strings in files.
Use LOG.FINDING_SCRIPTS_DNE
.
Sounds good, quite a few steps there so I'm going to break it into a few issues just for better tracking (in no particular order):
|
Signed-off-by: campionfellin <campionfellin@gmail.com>
Changes should be addressed now. |
If user does clasp clone without a scriptId, it will get the 10 most recent scripts and prompt the user to choose one.
Also adds test for this new functionality.
Signed-off-by: campionfellin campionfellin@gmail.com
Goes towards Clasp 2.0
npm run test
succeeds.brings test coverage > %50