Skip to content

Commit

Permalink
use package files entry instead of .npmignore (#326)
Browse files Browse the repository at this point in the history
* do not generate .npmignore
* add files entry to generated package.json
* update test snapshots
* cleanup: remove example options not needed
  from template arguments in lib/lib.js
  (example options are still used to render example artifacts)
  • Loading branch information
brodycj authored May 4, 2020
1 parent a89916d commit 91369fe
Show file tree
Hide file tree
Showing 33 changed files with 204 additions and 255 deletions.
3 changes: 0 additions & 3 deletions lib/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ Android packageIdentifier: ${packageIdentifier}
license,
view,
useAppleNetworking,
generateExample,
exampleFileLinkage,
exampleName,
};

return renderTemplateIfValid(fs, moduleName, template, templateArgs);
Expand Down
21 changes: 12 additions & 9 deletions templates/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ ${name};
}, {
name: () => 'package.json',
content: ({ moduleName, platforms, githubAccount, authorName, authorEmail, license }) => {
const files =
`[
"README.md",` +
(platforms.indexOf('android') >= 0 ? `
"android",` : ``) + `
"index.js"` +
(platforms.indexOf('ios') >= 0 ? `,
"ios",
"${moduleName}.podspec"` : ``) + `
]`;

const peerDependencies =
`{
"react": "^16.8.1",
Expand All @@ -40,6 +51,7 @@ ${name};
"version": "1.0.0",
"description": "TODO",
"main": "index.js",
"files": ${files},
"scripts": {
"test": "echo \\"Error: no test specified\\" && exit 1"
},
Expand Down Expand Up @@ -149,15 +161,6 @@ buck-out/
return '*.pbxproj -text\n';
}

return '';
}
}, {
name: () => '.npmignore',
content: ({ generateExample, exampleName }) => {
if (generateExample) {
return `${exampleName}\n`;
}

return '';
}
}];
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ buck-out/
*.keystore
",
},
Object {
"name": "react-native-integration-view-test-package/.npmignore",
"theContent": "",
},
Object {
"name": "react-native-integration-view-test-package/README.md",
"theContent": "# react-native-integration-view-test-package
Expand Down Expand Up @@ -649,6 +645,13 @@ RCT_EXPORT_MODULE()
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-integration-view-test-package.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ buck-out/
*.keystore
",
},
Object {
"name": "react-native-integration-test-package/.npmignore",
"theContent": "",
},
Object {
"name": "react-native-integration-test-package/README.md",
"theContent": "# react-native-integration-test-package
Expand Down Expand Up @@ -645,6 +641,13 @@ RCT_EXPORT_METHOD(sampleMethod:(NSString *)stringArgument numberParameter:(nonnu
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-integration-test-package.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/android/
",
Expand Down Expand Up @@ -68,6 +66,13 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-alice-bobbi.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -162,12 +167,6 @@ content:
--------
*.pbxproj -text
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/android/build.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/android/
",
Expand Down Expand Up @@ -72,6 +70,13 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-alice-bobbi.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -166,13 +171,6 @@ content:
--------
*.pbxproj -text
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
example
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/android/build.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/android/
",
Expand Down Expand Up @@ -72,6 +70,13 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-alice-bobbi.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -166,13 +171,6 @@ content:
--------
*.pbxproj -text
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
test-demo
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/android/build.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/android/
",
Expand Down Expand Up @@ -58,6 +56,11 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -131,12 +134,6 @@ buck-out/
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/android/build.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/ios/
",
Expand Down Expand Up @@ -58,6 +56,12 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-alice-bobbi.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -139,12 +143,6 @@ content:
--------
*.pbxproj -text
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/react-native-alice-bobbi.podspec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/android/
",
Expand Down Expand Up @@ -68,6 +66,13 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"android\\",
\\"index.js\\",
\\"ios\\",
\\"react-native-alice-bobbi.podspec\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -162,12 +167,6 @@ content:
--------
*.pbxproj -text
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/android/build.gradle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* outputFile name: react-native-alice-bobbi/README.md
content:
Expand Down Expand Up @@ -48,6 +46,10 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"index.js\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -108,12 +110,6 @@ yarn-error.log
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
<<<<<<<< ======== >>>>>>>>
",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Array [
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* ensureDir dir: react-native-alice-bobbi/
",
"* outputFile name: react-native-alice-bobbi/README.md
content:
Expand Down Expand Up @@ -48,6 +46,10 @@ content:
\\"version\\": \\"1.0.0\\",
\\"description\\": \\"TODO\\",
\\"main\\": \\"index.js\\",
\\"files\\": [
\\"README.md\\",
\\"index.js\\"
],
\\"scripts\\": {
\\"test\\": \\"echo \\\\\\"Error: no test specified\\\\\\" && exit 1\\"
},
Expand Down Expand Up @@ -108,12 +110,6 @@ yarn-error.log
content:
--------
<<<<<<<< ======== >>>>>>>>
",
"* outputFile name: react-native-alice-bobbi/.npmignore
content:
--------
<<<<<<<< ======== >>>>>>>>
",
]
Expand Down
Loading

0 comments on commit 91369fe

Please sign in to comment.