jineecode

react-native 라이센스 고지하기 [react-native-oss-license] 본문

React native

react-native 라이센스 고지하기 [react-native-oss-license]

지니코딩 2022. 5. 24. 16:06

https://github.com/k-tomoyasu/react-native-oss-license

 

GitHub - k-tomoyasu/react-native-oss-license: license list generator for React Native App(iOS & Android)

license list generator for React Native App(iOS & Android) - GitHub - k-tomoyasu/react-native-oss-license: license list generator for React Native App(iOS & Android)

github.com

npm i -g react-native-oss-license

 

플랫폼에 따라 다양한 방법이 있겠지만, 나는 json으로 뽑아서 FlatList로 돌리는 방법을 사용했다.

라이브러리가 너무 많으면 IDE 터미널에 내용이 다 표시되지 않으므로, 터미널을 따로 켜서 커맨드를 입력하는 것을 추천한다.

 

[프로젝트루트]에서 다음과 같이 입력한다

react-native-oss-license --json --only-direct-dependency --skip-not-required

(옵션은 여러가지가 있는데, only direct를 써주지 않으면 node 폴더를 다 가져오는 것 같았다)

 

 

결과를 복사해서 OpenSourceLicense.js 파일로 관리한다.

export const OpenSourceLicense = [
  {
    libraryName: '@eabdullazyanov/react-native-sms-user-consent',
    version: '1.0.10',
    _license: 'MIT',
    _description:
      "React Native wrapper for Android's SMS User Consent API, ready to use in React Native apps with minimum effort",
    homepage: 'https://github.com/akvelon/react-native-sms-user-consent#readme',
    author: {
      name: 'Eldar Abdullazyanov',
      email: 'eldar.abdullazyanov@akvelon.com',
    },
    repository: {
      type: 'git',
      url: 'git+https://github.com/akvelon/react-native-sms-user-consent.git',
      baseUrl: 'https://github.com/akvelon/react-native-sms-user-consent',
    },
    _licenseContent:
      'MIT License\n\nCopyright (c) 2021 Akvelon\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n',
  },
  ...
  ...
   }
  ]

이를 FlatList로 반복문을 태운다.

import React from 'react';
import {FlatList, ListRenderItem, Text} from 'react-native';
...
import {OpenSourceLicense} from './OpenSourceLicense';


const TermOpenSource = () => {
  const renderItem = ({item}) => {
    return (
      <>
        <ListWrapper>
          <ListTitle>{item.libraryName}</ListTitle>
          <Text>{item.version}</Text>
          <Text>{item._license}</Text>
          <Text>{item._description}</Text>
          <Text>{item._licenseContent}</Text>
        </ListWrapper>
        <Divider />
      </>
    );
  };

  return (
    <>
      <Layout isBgWhite>
        <CommonMain>
          <FlatList
            data={OpenSourceLicense}
            renderItem={renderItem}
            keyExtractor={(item) => String(item.libraryName)}
          />
        </CommonMain>
      </Layout>
    </>
  );
};

 

'React native' 카테고리의 다른 글

인증번호 timer  (0) 2022.05.25
react-native svg 사용하기  (0) 2022.05.25
react-native android 배포  (0) 2022.05.24
react-native toast 사용하기 [react-native-toast-message]  (0) 2022.05.24
React navigation (3)  (0) 2022.05.23
Comments