These are chat archives for reactioncommerce/reaction

11th
Apr 2018
Santiago Botta
@sgobotta
Apr 11 2018 01:38
Hi. I'm trying to make some routes private (accessed only by some roles or groups only). Should I take a look at the audience, permissions arrays in the registry of the package where I defined the routes? All my templates are implemented in React. I'm not sure if I should modify the layoyt property or the registry property in my package registration. I'm a bit lost tbh. Any advice to start looking for reaction commerce built-in features that allow me to make some sections of my site private. I wouldn't like to redirect someone if that person tried to visit /someUrl. I need something stronger. Thanks in advance.
Nathan Smith
@NSMobileCS
Apr 11 2018 05:53
lll
lol
KunalDE
@KunalDE
Apr 11 2018 06:09
@Loan Laux Thank you.
Loan Laux
@loanlaux
Apr 11 2018 07:35
@KunalDE Hit me up here on Gitter or via email: contact@loanlaux.com.
galpeer
@galpeer
Apr 11 2018 08:58
Hi guys, a quick question: I'm trying to extend the "Address" scheme. But I'm getting: "Address.attachSchema is not a function". Do you have any idea how to extend it well?
Loan Laux
@loanlaux
Apr 11 2018 09:00
@galpeer The schema packaged moved from Atmosphere to NPM, introducing breaking changes in the API as well
I think there might be a few references to the old simple-schema in the docs
Loan Laux
@loanlaux
Apr 11 2018 09:01
@galpeer And the package's new repository: https://github.com/aldeed/simple-schema-js
galpeer
@galpeer
Apr 11 2018 09:01
you mean in 1.10 version?
because I'm already working with 1.10
Loan Laux
@loanlaux
Apr 11 2018 09:01
1.9 introduced the schema API change @galpeer
(if I'm not mistaken)
galpeer
@galpeer
Apr 11 2018 09:03
Thanks. I'm on 1.10 so I already passed this change. I assume it's related to the fact that "Address" is not a collection but a scheme object. I didn't find any example of extending a scheme which is not a collection
Loan Laux
@loanlaux
Apr 11 2018 09:03
The thing is, attachSchema is no more
You should use extend now if my memory is still good
My bad, no. Forget what I said.
galpeer
@galpeer
Apr 11 2018 09:05
Yep. Look on the Swag example for extending the Product
Loan Laux
@loanlaux
Apr 11 2018 09:05
@zenweasel to the rescue!
Brent Hoover
@zenweasel
Apr 11 2018 09:05
import SimpleSchema from "simpl-schema";
import { CartItem } from "/lib/collections/schemas";

CartItem.extend({
  "mySpecialCartProp": {
    type: String,
    optional: true
  }
});
sorry, pasted the wrong example at first
Nikolay Tsenkov
@nicroto
Apr 11 2018 09:06
Hey everyone, I have a couple of questions on licensing:
  • If I make a private fork of Reaction and customize it (change source within Reaction), am I allowed to keep my repo closed-source, provided that I am not distributing Reaction and I am only hosting it on my own servers?
  • Do I need to disclose source of plugins and themes I develop for use within my Reaction stores/websites?
Thanks.
Loan Laux
@loanlaux
Apr 11 2018 09:07
So let me correct what I said earlier @galpeer, attachSchema is still there. However, it's used to attach a schema to a particular collection. I'm not sure there's an address collection so you might be looking for extend instead.
galpeer
@galpeer
Apr 11 2018 09:07
honestly, attachScheme is working extending shops and products
so you are saying:
const ExtendedSchema = Schemas.Address.extend({
companyRole: {
optional: true,
type: String,
defaultValue: ""
}
});
should be enough?
no need to attachScheme?
Brent Hoover
@zenweasel
Apr 11 2018 09:08
I don’t think you need the new schema
galpeer
@galpeer
Apr 11 2018 09:09
so just extend and no attach will make the work for me?
Brent Hoover
@zenweasel
Apr 11 2018 09:09

I think

Schemas.Address.extend({
  companyRole: {
    optional: true,
    type: String,
    defaultValue: ""
  }
});

should work

from the docs " In other cases, you might want to skip the clone and actually mutate the original schema. This allows you to adjust the schema in a way that will be respected by all code that uses it, without that code even needing to realize that you’ve made adjustments."
this was one of the big wins from moving to node simple-schema
Loan Laux
@loanlaux
Apr 11 2018 09:11
That's pretty neat!
galpeer
@galpeer
Apr 11 2018 09:11
Great. I will try it now. I'm always trying to work with the latest version
Brent Hoover
@zenweasel
Apr 11 2018 09:11
Yeah, it makes it much easier for plugins to modify the schema (like Cart) that get used by core code
Loan Laux
@loanlaux
Apr 11 2018 09:11
And you should @galpeer, unless you want to find yourself migrating a 2 year-old Reaction project down the road. 😬
galpeer
@galpeer
Apr 11 2018 09:12
=)
Thanks guys!
Nikolay Tsenkov
@nicroto
Apr 11 2018 09:26
Sorry for interrupting you, guys, I didn't realize the conversation was still going.
@zenweasel may I DM you for the licensing questions I posted earlier?
Brent Hoover
@zenweasel
Apr 11 2018 09:29
I prefer to keep all conversations public so that everyone can benefit
the short answer is that the GPLv3 license allows you to do pretty much anything with the code except for presenting it as your own work
Nikolay Tsenkov
@nicroto
Apr 11 2018 09:45
So, then the answers to my questions, should be these, correct?
  • If I make a private fork of Reaction and customize it (change source within Reaction), am I allowed to keep my repo closed-source, provided that I am not distributing Reaction and I am only hosting it on my own servers? YES
  • Do I need to disclose source of plugins and themes I develop for use within my Reaction stores/websites? NO
Patrick Newell
@pnewell4_twitter
Apr 11 2018 10:28
good morning @zenweasel, can you help me get npm run test:unit working? It is failing on getUserFromToken.test.js, complaining about the async keyword. I'm sure this is a node or babel issue, but would like to know why it is working for others (and on the circle ci boxes). thanks!
for reference:
Node: 6.11.3
NPM: 3.8.6
Meteor Node: 8.9.4
Meteor NPM: 5.6.0
Reaction CLI: 0.29.0
Reaction: 1.10.0
Reaction branch: pmn4/Reaction-absoluteUrl
Docker: 17.09.0-ce
Patrick Newell
@pnewell4_twitter
Apr 11 2018 10:37
I think I answered my own question... (it's early on the east coast!)
I upgraded my node, reinstalled npm packages, and I'm off :rocket:
(thanks being my rubber duck!)
Brent Hoover
@zenweasel
Apr 11 2018 12:15
ah good, because I didn’t have a quick answer for you
(it’s late in Asia)
jiayimu
@jiayimu
Apr 11 2018 16:35
Hi guys. I have a question about Meteor env config. I am using Windows10 now and setting the SKIP_FIXTURES by set SKIP_FIXTURES=1 and SKIP_FIXTURES=true. However, none of them works, and I got "undefined" when I tried to log the process.env.SKIP_FIXTURES. Did I miss anything during my installation?
Santiago Botta
@sgobotta
Apr 11 2018 18:01
locally you should run the app like this:
SKIP_FIXTURES=1 reaction
or
export SKIP_FIXTURES=1
reaction
jiayimu
@jiayimu
Apr 11 2018 21:17
@sgobotta Hi, I am using Windows 10. If I type SKIP_FIXTURES=1 reaction in cmd, it shows "term 'SKIP_FIXTURES=1' is not recognized as the name of a cmdlet". Same error for "export".
Brent Hoover
@zenweasel
Apr 11 2018 21:18
Are you using the Powershell command line?
jiayimu
@jiayimu
Apr 11 2018 21:27
@zenweasel yes. I am using the Powershell command line. And type set SKIP_FIXTURES=1 under the reaction folder. But still got "undefined"
Brent Hoover
@zenweasel
Apr 11 2018 21:28
I don’t know that set works in powershell. Can you try the “classic” command line?
jiayimu
@jiayimu
Apr 11 2018 21:30
@zenweasel I used Visual Studio Code terminal to set the SKIP_FIXTURES as well. But it also gave me "undefined"
Brent Hoover
@zenweasel
Apr 11 2018 21:31
Not sure. This works for me using the command line
jiayimu
@jiayimu
Apr 11 2018 21:34
@zenweasel Still appreciate your help. Hope someone has solved this before.