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

No default preset supported #67

Merged
merged 7 commits into from
Sep 13, 2019
Merged

No default preset supported #67

merged 7 commits into from
Sep 13, 2019

Conversation

DanielSanudo
Copy link
Contributor

@DanielSanudo DanielSanudo commented Sep 11, 2019

Summary

No default preset supported. One preset or preset path will be required to be defined.

Screenshot updated with the error output.
Screen Shot 2019-09-12 at 1 07 20 PM

Also I have replaced the default preset with the godaddy for the docs and tests. Are we going to make it public? should I use another name for it?

Changelog

Test Plan

Tests added for the new scenario.

Copy link
Contributor

@SivanMehta SivanMehta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the nextjs-preset by default instead of one that's not going to be open-source.

@@ -116,7 +116,7 @@ configure your app to be a Progressive Web App!
// gasket.config.js
module.exports = {
plugins: {
presets: ['default'],
presets: ['godaddy'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use nextjs or @gasket/nextjs-preset as the example in these docs.

@@ -66,7 +66,7 @@ describe('create', function () {
});

it('executes expected bootstrap actions', async () => {
const cmd = new CreateCommand(['myapp']);
const cmd = new CreateCommand(['myapp', '--presets=godaddy']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use --presets=godaddy in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You wanted to mean nextjs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced also the --preset-path with --presets.

@@ -88,15 +88,15 @@ module.exports = {
### Short names
Items in these arrays are module names. Gasket supports shorthand naming;
`'mocha'` expands to `@gasket/mocha-plugin` in the `add` and `remove` arrays,
`default` expands to `@gasket/default-preset` in the `presets` array.
`godaddy` expands to `@gasket/godaddy-preset` in the `presets` array.

If no config file or plugin configuration is present in `gasket.config.js`, the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should no longer be true. You can delete this section, 93-102

@@ -144,6 +144,10 @@ module.exports = function makeCreateContext(argv = [], flags = {}) {
const rawPlugins = plugins.reduce(flatten, []);
const pkgLinks = npmLink.reduce(flatten, []);

if (!presetPath && rawPresets.length === 0) {
throw new Error('Preset or preset path not found');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look into printing out the help for the create command here? i.e. the results of running gasket help create?

If not, rephrase this error to help the user know what to.

Suggested change
throw new Error('Preset or preset path not found');
throw new Error('No preset was specified. Use --presets flag or run `gasket help create` for more info.');

Copy link
Contributor

@kinetifex kinetifex Sep 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, you don't need to mention preset path since it's a hidden dev-only flag, but you should continue to error if neither --presets or --preset-path are set as you're doing now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a way of displaying the help but not sure if it ok to use it. This is the signature of the function:
protected _help(): never;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have uploaded a screenshot with the new output.

@kinetifex kinetifex merged commit 41b2c85 into master Sep 13, 2019
@kinetifex kinetifex deleted the no-defualt-preset branch September 13, 2019 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants