Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

add sandbox schematics #73 #127

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

Merged
lurock merged 2 commits into SoCreate:master from sulco:feature/sandbox-schematics
Aug 21, 2018
Merged

Conversation

@sulco
Copy link
Contributor

@sulco sulco commented Aug 9, 2018

Adds sandbox schematics (addresses issue #73)

Will be executed when you run e.g. ng generate angular-playground:sandbox user/avatar and will generate a sandbox file. It takes a

  • name [required] of the component including the path (similarly as a built-in ng g c path/name generator)
  • --flat (optional, defaults to "false") - that works the same way as when creating an Angular component from the CLI

In order to try this functionality locally, un the dummy Angular project's directory run:

  • npm uninstall angular-playground
  • npm link angular-playground
  • ng generate angular-playground:sandbox user/avatar

--
Please do bug me if you have any questions or doubts :) I intended this PR to be a MVP for this functionality that we can build upon once it's live and kicking.
e.g. when generating a sandbox one could specify a list of scenarios (so that you don't have to write "storyOf" by hand) or to have SandboxOfConfig configuration also generated.

Copy link
Contributor

Awesome @sulco. We appreciate the second commit and will get to reviewing both shortly.

sulco reacted with thumbs up emoji

Copy link
Contributor

@timstoddard timstoddard left a comment

Choose a reason for hiding this comment

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

Hey @sulco, again nice work, the sandbox schematics worked as expected when I tested it. Please fix the few small comments I made before we can merge the PR.

options.name = parsedPath.name;
options.path = parsedPath.path;

const targetPath = options.flat === 'true' // until https://github.com/angular/devkit/issues/393 is fixed this is a "true"/"false" string
Copy link
Contributor

@timstoddard timstoddard Aug 10, 2018

Choose a reason for hiding this comment

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

The linked issue is in an archived repository. Please file an issue in the new repository and link it here.
Link to new repo: https://github.com/angular/angular-cli/tree/master/packages/angular_devkit

options.path = parsedPath.path;

const targetPath = options.flat === 'true' // until https://github.com/angular/devkit/issues/393 is fixed this is a "true"/"false" string
? parsedPath.path
Copy link
Contributor

@timstoddard timstoddard Aug 10, 2018

Choose a reason for hiding this comment

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

Since you've set options.path to be this same value, and you don't use parsedPath anywhere else after this, I think it would make sense (for consistency) to use options.path here instead of parsedPath.path.

/**
* Should the sandbox be created in the component's directory.
*/
flat: "true" | "false";
Copy link
Contributor

@timstoddard timstoddard Aug 10, 2018

Choose a reason for hiding this comment

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

Change these to be single quotes.

@sulco sulco force-pushed the feature/sandbox-schematics branch from 13751df to d18534a Compare August 11, 2018 15:13
Copy link
Contributor Author

sulco commented Aug 11, 2018

Hey @timstoddard, thanks for the review! The options.path is on point, and the other issues went away "on their own" - after updating "@angular-devkit/core": "^0.7.1" -> 0.7.3 booleans are read correctly, so I've updated the code to reflect that.

@sulco sulco force-pushed the feature/sandbox-schematics branch from d18534a to 3524e02 Compare August 12, 2018 12:25
lurock
lurock previously approved these changes Aug 21, 2018
@lurock lurock dismissed stale reviews from timstoddard and themself via 573ec71 August 21, 2018 19:31
@lurock lurock merged commit 77659d7 into SoCreate:master Aug 21, 2018
@sulco sulco deleted the feature/sandbox-schematics branch August 21, 2018 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@lurock lurock lurock approved these changes

+1 more reviewer

@timstoddard timstoddard timstoddard left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /