When someone makes a code for their project using a certain library, oftentimes he will refer to the official documentation. But how does he need to think about the license?
Assuming I have been using an npm package @material-ui/core for my react project. The documentation explains that it provides a way to stylize my react component with makeStyles function like this:
// The MIT License (MIT)
//
// Copyright (c) 2014 Call-Em-All
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import React from 'react';
import { makeStyles } from '@material-ui/styles';
const useStyles = makeStyles({
root: {
backgroundColor: 'red',
color: props => props.color,
},
});
export default function MyComponent(props) {
const classes = useStyles(props);
return <div className={classes.root} />;
}
So, I have added the MIT license statement here because I borrowed the code from them. My concern is that, for example, if I write the following code,
- Do I need the statement in the file every time I use the
makeStyles
approach? - Do I need to include the statement somewhere in my repository?
- Don't I need to include it as long as I do not distribute a package based on the library?
If I must take option 1, I have to write the statement in hundreds of the files but is it necessary?
// The code here is based on the @material-ui/core document.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Call-Em-All
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import React from 'react';
import { Grid, Typography, makeStyles } from '@material-ui/styles';
const useStyles = makeStyles({
headline: {
fontSize: 120,
display: props => props.on ? true : false,
},
});
export default function HeadlineComponent(props) {
const classes = useStyles(props);
return (
<Grid>
<Typography variant="h1" className={classes.headline}>My excellent headline!</Typography>
</Grid>
);
}
useStyles
andclasses
, or the structure of the code? Certainly everyone must usemakeStyles
because it is a call of the function they provide, but we don't need to use those variable namings or code arrangement indeed. – kemakino Jun 23 '19 at 6:49