Fork me on GitHub
#off-topic
<
2016-11-08
>
cfleming11:11:59

Could someone help a node-illiterate with a typings problem?

anmonteiro11:11:29

@cfleming "typings problem"? I can try to help

cfleming11:11:07

I’m trying to install a TypeScript definitions file to get IDE assistance with the AWS SDK.

cfleming11:11:18

I think TS also uses the defs for JS codegen.

cfleming11:11:37

Frankly this is all as confusing as hell 😞

cfleming11:11:19

Which are definitions files generated automatically from the JSON representation of their APIs.

anmonteiro11:11:51

oh I've never dealt with TypeScript, but what are you having trouble with?

cfleming11:11:45

I’m not really sure about the basic workflow for node modules. I added aws-sdk to package.json, did npm update and it’s now in my node_modules.

cfleming11:11:44

Then for the definitions I did: npm install aws-sdk-typescript —save-dev, which added it to package.json and installed it in node_modules too as aws-sdk-typescript

cfleming11:11:56

(it’s added as a dev dependency)

cfleming11:11:39

However TS is still complaining that it “cannot find module"

anmonteiro11:11:45

so if you run Node in the directory where the package.json is, it should be able to see those packages in node_modules

anmonteiro11:11:00

I suppose TS is a node program?

cfleming11:11:29

In this case the compiler is being run automatically by IntelliJ, but I believe so, yes.

Prakash11:11:01

u probaby need to regenerate shrinkrwap.json if u are using that

cfleming11:11:25

@pcbalodi I don’t think I have one of those, how would I make one?

anmonteiro11:11:49

hrm could IntelliJ be running TypeScript from another folder? i.e. not the one which has node_modules

Prakash11:11:55

just check if u have a file called shrinkwrap.json in same directory as package.json

cfleming11:11:37

@anmonteiro I’d be very surprised if IntelliJ got something so basic wrong, but it’s possible.

cfleming11:11:52

I think it’s much more likely I just don’t understand how to do this correctly.

cfleming11:11:27

It’s confusing now the type definitions are npm artifacts - that means that they’re under node_modules but not required at runtime.

cfleming11:11:45

At least, I assume they should be under node_modules - perhaps dev artifacts should be somewhere else?

anmonteiro11:11:07

no, everything should be going to node_modules

cfleming11:11:27

Ok, and then when I create a deployment package, only the prod ones are added to it?

anmonteiro11:11:36

devDependencies vs dependencies is the Node.js poorman's Maven scope

cfleming11:11:52

Right, that’s what I figured.

cfleming11:11:16

Man, switching ecosystems is hard, especially to JavaScript.

cfleming11:11:35

Multiple module systems etc is all very confusing.

cfleming11:11:57

Am I correct in thinking that commonJS is the only one I care about if I’m only using Node?

anmonteiro11:11:12

I think that's the only one you need to worry about, yes

cfleming11:11:17

Great, thanks.

cfleming11:11:01

Can I remove my existing module by deleting it from dev-dependencies and removing it from node_modules?

dominicm11:11:12

For the most part, CommonJS has "won", Babel can transpile, that is, it turns import * as lib from "lib" to var lib = require("lib");

cfleming11:11:46

Great, that seems to have worked.

cfleming11:11:57

Thanks for all the help guys, I appreciate it.

anmonteiro11:11:14

awesome, np!

markx16:11:11

Hey guys, a question about license here. I fount many clojure projects are using Eclipse Public License. If I use a library written in Eclipse Public License, do I also have to use this license?

kasuko16:11:46

@markx First thing, anything anyone says here probably isn’t valid legal advice. However given that. No you don’t have to use the Eclipse Public License (which is why it’s used) see here https://eclipse.org/legal/eplfaq.php#PROPPROD

kasuko16:11:23

Note: I work at a company that builds proprietary software using Clojure and Clojure libraries.

markx16:11:09

@kasuko Thanks! I am just trying to make some open source toy project, which nobody would care about, but still want to do it in the right way.

markx16:11:33

"as long as it references the EPL portion and complies, for that portion, with the terms of the EPL." What does this mean?

markx16:11:47

Do you know any projects that do this?

kasuko16:11:49

Again, not an expert, just reading the license but I believe that applies to the following portion

kasuko16:11:52

>a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.

kasuko16:11:06

Which I think means that if you change the license you have to i) exclude warranties from the contributors (library author) ii) you are responsible for any lawsuits brought upon by your software that uses the library iii) note any changes that you make, and that they are your changes iv) provide or inform how to get the source code for the libraries you include

markx16:11:19

No worries. Let’s say I’ll make a project(under apache or MIT ) that draws some shapes, using quil or seasaw (both under EPL), what do I need to do?

kasuko16:11:43

Well are you changing quil or seasaw?

markx16:11:15

Assuming I only use those libs, and do not modify them.

kasuko16:11:30

If you aren’t changing the library then you shouldn't have to do anything. You can just make your application under the new license.

kasuko16:11:58

If you do change the quil or seasaw library but don’t want to contribute those changes upstream is where all this junk applies

markx16:11:31

When people say stuff like “disclosure”, or “notice their contribution”, what do they mean? Is it just to add a few lines saying “this project uses XXX, which is under XXX license”, in the README file?

markx16:11:19

Or in my example case, do I need to state in my README file that I’m using quil?

kasuko17:11:12

That means if you distribute the library than you also must include the license for that library.

kasuko17:11:25

For example if you build a standalone jar and want to distribute that

markx17:11:01

Practically, how do I “include the license for that library” ?

kasuko17:11:11

For you I don’t think this matters. You have to provide the original license if you change the library and distribute it. Since you aren’t modifying the library I don’t think you have to do so.

kasuko17:11:39

However I am providing too much legal advice and again I am really not an expert … nor even really experienced. I know you can do it. As for the exact specifics I may have said too much!

markx18:11:11

@kasuko No worries. I will not take your words for granted. I’m just trying to get the hang of it.

markx18:11:44

Well you just said that, if I distribute the standalone jar, I would have to include the license for that library. I will use the lib and distribute it as part of my project, but not modify it, so do I need to provide the EPL in this case?

markx18:11:36

Taking this project https://github.com/kkinnear/zprint as an example. It’s under MIT, and it doesn’t mention EPL anywhere. Is this wrong?

kasuko18:11:31

No, because zprint doesn’t distribute any EPL code.

kasuko18:11:41

if we grab the zprint jar file you will see

kasuko18:11:45

>» unzip zprint-0.2.7.jar Archive: zprint-0.2.7.jar inflating: META-INF/MANIFEST.MF inflating: META-INF/maven/zprint/zprint/pom.xml inflating: META-INF/leiningen/zprint/zprint/project.clj inflating: project.clj inflating: META-INF/leiningen/zprint/zprint/README.md inflating: META-INF/leiningen/zprint/zprint/LICENSE inflating: META-INF/maven/zprint/zprint/pom.properties creating: zprint/ inflating: zprint/ansi.cljc inflating: zprint/config.cljc inflating: zprint/core.cljc inflating: zprint/finish.cljc inflating: zprint/focus.cljc inflating: zprint/macros.cljc inflating: zprint/sutil.cljc inflating: zprint/zprint.cljc inflating: zprint/zutil.cljc

kasuko18:11:46

so all code being distributed by zprint is MIT code. It has dependencies on EPL libraries but doesn’t include those libraries

kasuko18:11:40

As for the standalone jar … I can’t seem to find how that works legally.

kasuko18:11:59

From what I read … it doesn’t seem to so I must be missing something

markx18:11:35

Ah! Just to confirm my understanding, in zprint’s case, if you distribute the jar built from lein jar, it would be ok because the jar doesn’t include EPL libs. But if you do lein uberjar, it would be wrong.

markx18:11:57

Did I get you correctly?

kasuko19:11:45

As far as I can see I think so. The lein uberjar would include all the .class files from the dependencies but then it should

reference the EPL portion and complies, for that portion, with the terms of the EPL
but I don’t see how it would do that.

markx19:11:27

@kasuko What do you mean by “don’t see how it would do that”?

markx19:11:01

@kasuko After researching for quite a while, I think I have some idea now. I still have questions, but they are more detailed. Thanks for the help!