Skip to content

Example for extending Parse.User #606

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
merged 5 commits into from
Mar 21, 2019

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Mar 21, 2019

parse-community/Parse-SDK-JS#722

Should we always commit assets/js/bundle.js?

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

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

I think this is a good improvement, but we should fix the sdk to improve how it handles the static methods.

Here's how I did it for the php-sdk: https://github.com/parse-community/parse-php-sdk/pull/394/files

and here's an example of how to fix it for the JS-SDK: https://runkit.com/arthur/static-factory-w-subclass

You up for making the changes?

Parse.Object.registerSubclass('CustomUser', CustomUser);
```

In addition to queries, `logIn` and `signUp` returns subclass.
Copy link
Contributor

@acinader acinader Mar 21, 2019

Choose a reason for hiding this comment

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

will return the subclass CustomUser

@dplewis
Copy link
Member Author

dplewis commented Mar 21, 2019

Sounds like an easy fix. I didn't know about new this() in static functions

@@ -89,6 +89,36 @@ However, when using `extends`, the SDK is not automatically aware of your subcla
Parse.Object.registerSubclass('Monster', Monster);
```

Similarly, you can `extends` `Parse.User`
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should say "Similarly, you can use extends with Parse.User"

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good

@dplewis
Copy link
Member Author

dplewis commented Mar 21, 2019

@Tom-Fox1 What is bundle.js used for?

@TomWFox
Copy link
Contributor

TomWFox commented Mar 21, 2019

@dplewis sorry, I don’t know, I meant to look into it but haven’t yet

@dplewis dplewis merged commit ef86547 into parse-community:gh-pages Mar 21, 2019
@dplewis dplewis deleted the subclass-user branch March 21, 2019 19:15
@acinader
Copy link
Contributor

acinader commented Mar 21, 2019

@dplewis @Tom-Fox1

I just took a look and here's what I learned...

From looking at the package.json, I'm inferring the following (with high confidence):

  1. since we're deploying to Github pages, the site needs to be static.
  2. to make development sane, it is good to break the docs down into a set of files that help with headers, navigation, implying links, etc.
  3. bundle.js is the 'built' javascript file that has all of the sources 'compiled' into it so the whole doc set can be served from that one static file that requires no 'runtime' when a page is requested.
  4. during development, we want to watch changed files and dynamically serve up the current state of the files as they are edited. This is done with npm run dev which runs the dev script in package.json which uses jekyll to build the html & webpack to build the js 'on the fly'.
  5. after you've made all your changes, you'll want to commit to git so you can then push and create a PR on github. In package.json, we use husky to catch the commit and first call the npm script webpack which tells webpack to create a production build of bundle.js from the state of the files and then add it to the commit.
  6. we don't need to anything about the html because git hub pages supports jekyll and it'll look for _config.yml and then use that to build the html.

So the short answer is: bundle.js can be ignored by us in pr's and will automagically be changed any time there's a change.

and there's a TODO for @Tom-Fox1: take a look at _config.yml cause it has our tags for severfault (whatever that is) and stackoverlow.

now i understand the doc stuff much better....:).

@dplewis
Copy link
Member Author

dplewis commented Mar 21, 2019

@acinader Thanks for the detailed description. I understand it much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants