앱 개발 후 Open Source License 에 대한 고지가 필요한데, 사용한 License 들의 목록을 한번에 확인 가능한 라이브러리가 있다.
1. 모듈 설치
sudo npm i -g react-native-oss-license
* based on
https://www.npmjs.com/package/react-native-oss-license
* referred
https://github.com/davglass/license-checker
https://github.com/yami-beta/license-list
2. 사용한 License 목록 확인
- react-native-oss-liocense 옵션을 보면 os 별로 별도 파일로 추출할 수 있지만, json 으로 출력하여 구성하는 방법을 사용함
react-native-oss-license --json --only-direct-dependency
- Options:
-f, --format <format> output format. options:[settings-bundle,license-tools-plugin,about-libraries]
--dev include devDependencies (default: false)
--depth <depth> dependencies depth (default: null)
--output-path <outputPath> specify path where output file
--json output json to stdout (default: false)
--add-version-number write library version number (default: false)
--only-direct-dependency output only dependencies you write packages.json. (default: false)
--skip-not-required skip licenses those not require copyright notice (default: false)
--bundle-id <bundleId> unique id of your app. It is used for output such as "plist" filename, etc. (default: null)
--uses-plugin whether AboutLibraries android plugin is used on native side as well (default: false)
--version show current version
-h, --help output usage information
3. json 으로 출력된 결과를 OpenSourceLicense.js 파일을 생성하여 데이터로 구성
# OpenSourceLicense.js
export const OpenSourceLicense = [
{
libraryName: '@babel/code-frame',
version: '7.14.5',
_license: 'MIT',
_description:
'Generate errors that contain a code frame that point to source locations.',
homepage: 'https://babel.dev/docs/en/next/babel-code-frame',
author: {name: 'The Babel Team', url: 'https://babel.dev/team'},
repository: {
type: 'git',
url: 'git+https://github.com/babel/babel.git',
directory: 'packages/babel-code-frame',
},
_licenseContent:
'MIT License\n\nCopyright (c) 2014-present Sebastian McKenzie and other contributors\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n"Software"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n',
},
...
]
4.해당 데이터를 읽어와 FlatList 를 통해 목록을 보여주고, 클릭 시 상세 내역을 확인도록 구성함
'React Native > React Native_etc' 카테고리의 다른 글
[React Native - android] .abb 추출하기 (0) | 2021.09.30 |
---|---|
[React Native] release 버전에서 axios 사용 시 에러 발생 해결 (0) | 2021.09.15 |
[React Native] 초기 설치 및 간단하게 babel.config.js 설정 (3) | 2021.08.27 |
[React Native] Versio Upgrade 0.61.5 → 0.64.2 (0) | 2021.07.27 |
[React Native] gradle wrapper default version 변경 (0) | 2021.06.23 |