From 47a1df124decd41b743b7af3263da204955d297c Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 16 Mar 2016 10:21:20 +0100 Subject: [PATCH 01/39] Remove a roadmap (legacy) --- README.md | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/README.md b/README.md index 36d51e2..e6bf36d 100644 --- a/README.md +++ b/README.md @@ -157,16 +157,6 @@ While making your own plugins for `rnpm` you may use any names for the commands, The documentation is still in progress, but if you are interested in the concept and good practices, see sample implementation [here](https://github.com/rnpm/rnpm-plugin-link/blob/master/index.js) -## Roadmap - -First priority: **core elements** -- [ ] Test coverage -- [X] Plugins support - -Second priority: **new plugins** -- [ ] rnpm ship -- [ ] rnpm build - We're open for community ideas! If you know how to improve `rnpm` - please, [let us know](https://github.com/rnpm/rnpm/issues/new)! From 20d4d958de2c8be3137291e76ba745d7490190d5 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sun, 20 Mar 2016 12:55:26 +0100 Subject: [PATCH 02/39] Bump glob to align with link --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c23d1c4..89bc1ae 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "homepage": "https://github.com/rnpm/rnpm#readme", "dependencies": { "commander": "^2.9.0", - "glob": "^6.0.1", + "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.0.0", "rnpm-plugin-link": "^1.6.0", From 96ed0c5497f527f64c078be12ee6eac33da33f56 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Mon, 28 Mar 2016 12:03:05 -0700 Subject: [PATCH 03/39] Make TEST_PROJECTS regex case insensitive --- src/config/ios/findProject.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/config/ios/findProject.js b/src/config/ios/findProject.js index 0923f0d..8503aa3 100644 --- a/src/config/ios/findProject.js +++ b/src/config/ios/findProject.js @@ -9,7 +9,7 @@ const GLOB_PATTERN = '**/*.xcodeproj'; /** * Regexp matching all test projects */ -const TEST_PROJECTS = /(test|example)/; +const TEST_PROJECTS = /test|example/i; /** * Base iOS folder @@ -36,8 +36,7 @@ module.exports = function findProject(folder) { ignore: GLOB_EXCLUDE_PATTERN, }) .filter(project => { - const xcPath = project.toLowerCase(); - return path.dirname(xcPath) === IOS_BASE || !xcPath.match(TEST_PROJECTS); + return path.dirname(project) === IOS_BASE || !TEST_PROJECTS.test(project); }); if (projects.length === 0) { From 928d88e2ee6f407ba280f7e05b6de2db10801918 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 28 Mar 2016 21:30:08 +0200 Subject: [PATCH 04/39] Bump link dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 89bc1ae..25f308c 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.0.0", - "rnpm-plugin-link": "^1.6.0", + "rnpm-plugin-link": "^1.6.3", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From 1d748b5709f4ae9f4a14439e5dbbff6514ae1d1a Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Mon, 28 Mar 2016 21:30:12 +0200 Subject: [PATCH 05/39] Release v1.5.3. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 25f308c..7a1ecd3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.5.2", + "version": "1.5.3", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 81f9a67b7ea62e2b1682b89090884a36941e5085 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 31 Mar 2016 08:06:51 +0200 Subject: [PATCH 06/39] Bump link for the future --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7a1ecd3..72fe186 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.0.0", - "rnpm-plugin-link": "^1.6.3", + "rnpm-plugin-link": "^1.6.6", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From 2bb57f6f25e31e2f61d9cdea25525bfdfea56994 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 31 Mar 2016 11:30:38 +0200 Subject: [PATCH 07/39] Release v1.5.4. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 72fe186..64fcb7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.5.3", + "version": "1.5.4", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 640b33f4e9ace1632a9243e6ac48e8d83a8319e0 Mon Sep 17 00:00:00 2001 From: Libin Lu Date: Tue, 5 Apr 2016 02:21:55 -0400 Subject: [PATCH 08/39] exclude Pods in child folders * exclude Pods in child folders * add test for ios project ignore path * add test for ios project ignore path --- src/config/ios/findProject.js | 2 +- test/ios/findProject.spec.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/config/ios/findProject.js b/src/config/ios/findProject.js index 8503aa3..8a97406 100644 --- a/src/config/ios/findProject.js +++ b/src/config/ios/findProject.js @@ -19,7 +19,7 @@ const IOS_BASE = 'ios'; /** * These folders will be excluded from search to speed it up */ -const GLOB_EXCLUDE_PATTERN = ['@(Pods|node_modules)/**']; +const GLOB_EXCLUDE_PATTERN = ['@(Pods|node_modules)/**', '**/@(Pods|node_modules)/**']; /** * Finds iOS project by looking for all .xcodeproj files diff --git a/test/ios/findProject.spec.js b/test/ios/findProject.spec.js index f7a3593..ca667fd 100644 --- a/test/ios/findProject.spec.js +++ b/test/ios/findProject.spec.js @@ -27,11 +27,21 @@ describe('ios::findProject', () => { expect(findProject('')).toBe(null); }); + it('should ignore node_modules in child folders', () => { + mockFs({ ios: { node_modules: projects.flat }}); + expect(findProject('')).toBe(null); + }); + it('should ignore Pods', () => { mockFs({ Pods: projects.flat }); expect(findProject('')).toBe(null); }); + it('should ignore node_modules in child folders', () => { + mockFs({ ios: { Pods: projects.flat }}); + expect(findProject('')).toBe(null); + }); + it('should ignore xcodeproj from example folders', () => { mockFs({ examples: projects.flat, From 1a573d1bf85f1684869df6b9e0cecd84363f9e60 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 5 Apr 2016 08:22:29 +0200 Subject: [PATCH 09/39] Some minor tweaks to findProject --- src/config/ios/findProject.js | 2 +- test/ios/findProject.spec.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/config/ios/findProject.js b/src/config/ios/findProject.js index 8a97406..2b8d58a 100644 --- a/src/config/ios/findProject.js +++ b/src/config/ios/findProject.js @@ -19,7 +19,7 @@ const IOS_BASE = 'ios'; /** * These folders will be excluded from search to speed it up */ -const GLOB_EXCLUDE_PATTERN = ['@(Pods|node_modules)/**', '**/@(Pods|node_modules)/**']; +const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules)/**']; /** * Finds iOS project by looking for all .xcodeproj files diff --git a/test/ios/findProject.spec.js b/test/ios/findProject.spec.js index ca667fd..2a8326f 100644 --- a/test/ios/findProject.spec.js +++ b/test/ios/findProject.spec.js @@ -27,19 +27,19 @@ describe('ios::findProject', () => { expect(findProject('')).toBe(null); }); - it('should ignore node_modules in child folders', () => { - mockFs({ ios: { node_modules: projects.flat }}); - expect(findProject('')).toBe(null); - }); - it('should ignore Pods', () => { mockFs({ Pods: projects.flat }); expect(findProject('')).toBe(null); }); - it('should ignore node_modules in child folders', () => { - mockFs({ ios: { Pods: projects.flat }}); - expect(findProject('')).toBe(null); + it('should ignore Pods inside `ios` folder', () => { + mockFs({ + ios: { + Pods: projects.flat, + SampleApp: projects.flat.ios, + }, + }); + expect(findProject('')).toBe('ios/SampleApp/sampleProject.xcodeproj'); }); it('should ignore xcodeproj from example folders', () => { From a9175eff2ca542050048cb29e90024cd76081692 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 5 Apr 2016 08:23:39 +0200 Subject: [PATCH 10/39] Release v1.5.5. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 64fcb7f..37d8f8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.5.4", + "version": "1.5.5", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 96e346ef0cc0b62e4d91f4b7f7d4d1751275c6e8 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 5 Apr 2016 12:04:34 +0200 Subject: [PATCH 11/39] Add empty plist key To be used for automatically adding various things to Info.plist, related to https://github.com/rnpm/rnpm/issues/132 --- src/config/ios/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/ios/index.js b/src/config/ios/index.js index 3171504..04ada20 100644 --- a/src/config/ios/index.js +++ b/src/config/ios/index.js @@ -24,6 +24,7 @@ exports.projectConfig = function projectConfigIOS(folder, userConfig) { projectPath: projectPath, projectName: path.basename(projectPath), libraryFolder: userConfig.libraryFolder || 'Libraries', + plist: userConfig.plist || [], }; }; From ba1833e5ab32ba3832dc33511e489e59134e6a6a Mon Sep 17 00:00:00 2001 From: Li Jie Date: Wed, 6 Apr 2016 19:14:17 +0800 Subject: [PATCH 12/39] Add `sample` to ignore words. --- src/config/ios/findProject.js | 2 +- test/fixtures/ios.js | 2 +- test/ios/findProject.spec.js | 16 ++++++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/config/ios/findProject.js b/src/config/ios/findProject.js index 2b8d58a..17c99cf 100644 --- a/src/config/ios/findProject.js +++ b/src/config/ios/findProject.js @@ -9,7 +9,7 @@ const GLOB_PATTERN = '**/*.xcodeproj'; /** * Regexp matching all test projects */ -const TEST_PROJECTS = /test|example/i; +const TEST_PROJECTS = /test|example|sample/i; /** * Base iOS folder diff --git a/test/fixtures/ios.js b/test/fixtures/ios.js index f3382db..5094355 100644 --- a/test/fixtures/ios.js +++ b/test/fixtures/ios.js @@ -2,7 +2,7 @@ const fs = require('fs'); const path = require('path'); exports.valid = { - 'sampleProject.xcodeproj': { + 'demoProject.xcodeproj': { 'project.pbxproj': fs.readFileSync(path.join(__dirname, './files/project.pbxproj')), }, }; diff --git a/test/ios/findProject.spec.js b/test/ios/findProject.spec.js index 2a8326f..6626921 100644 --- a/test/ios/findProject.spec.js +++ b/test/ios/findProject.spec.js @@ -36,10 +36,10 @@ describe('ios::findProject', () => { mockFs({ ios: { Pods: projects.flat, - SampleApp: projects.flat.ios, + DemoApp: projects.flat.ios, }, }); - expect(findProject('')).toBe('ios/SampleApp/sampleProject.xcodeproj'); + expect(findProject('')).toBe('ios/DemoApp/demoProject.xcodeproj'); }); it('should ignore xcodeproj from example folders', () => { @@ -54,6 +54,18 @@ describe('ios::findProject', () => { expect(findProject('').toLowerCase()).not.toContain('example'); }); + it('should ignore xcodeproj from sample folders', () => { + mockFs({ + samples: projects.flat, + Samples: projects.flat, + sample: projects.flat, + KeychainSample: projects.flat, + Zpp: projects.flat, + }); + + expect(findProject('').toLowerCase()).not.toContain('sample'); + }); + it('should ignore xcodeproj from test folders at any level', () => { mockFs({ test: projects.flat, From 2cc3ea7d7e1839163cdd5b7c7fd8585ed3b1d3a4 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 6 Apr 2016 22:04:22 +0200 Subject: [PATCH 13/39] Support params in config --- src/config/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/index.js b/src/config/index.js index 7e64d41..ac8b4bb 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -37,5 +37,6 @@ exports.getDependencyConfig = function getDependencyConfig(packageName) { android: android.dependencyConfig(folder, rnpm.android || {}), assets: findAssets(folder, rnpm.assets), commands: wrapCommands(rnpm.commands), + params: rnpm.params || {}, }); }; From 74a71a4f78e916e9925cde9e28061fb2d02723f7 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 6 Apr 2016 23:11:21 +0200 Subject: [PATCH 14/39] Bump link, cc: @Kureev --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 37d8f8f..eacb0b2 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.0.0", - "rnpm-plugin-link": "^1.6.6", + "rnpm-plugin-link": "^1.7.0", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From e888ee1c4af69180343260693bc1fa400efbf225 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 6 Apr 2016 23:13:50 +0200 Subject: [PATCH 15/39] Release v1.6.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eacb0b2..dcbccbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.5.5", + "version": "1.6.0", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 4d04bb48080ce7e4532a5ca2a16d3678610fe933 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 6 Apr 2016 23:18:19 +0200 Subject: [PATCH 16/39] Params readme update --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index e6bf36d..0b4377a 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,32 @@ In this scenario we're using custom `prelink` and `postlink` hooks for `rnpm-plu While making your own plugins for `rnpm` you may use any names for the commands, but we strongly recommend you to use a convention we suggest to avoid collisions: `when` + `plugin name`: `prelink` = `pre` + `link`. +### Params +On Android - you can specify a custom `packageInstance` to be used when linking your project. The reason for that is often that your package constructor simply requires extra user provided config (e.g. API token). `rnpm` allows you to define an array of additional arguments to get from user during linking process that you can then, reference in your `packageInstance`. + +Simply include the following in your package.json: +```json +"rnpm": { + "params": [{ + "type": "input", + "name": "gaToken", + "message": "What's your GA token" + }] +} +``` +and update your `packageInstance` with the new variable: +```json +"rnpm": { + "android": { + "packageInstance": "new SomeLibName(this, ${gaToken})" + } +} +``` + +Starting from now on - users will be presented an interactive form powered by `inquirer` each time they run `rnpm link`. + +**Note**: We pass `params` array directly to inquirer which means you can also let users choose an answer from a list as well as provide a default value! See [API docs](https://github.com/SBoudrias/Inquirer.js/#question) for more details. + ### Developers The documentation is still in progress, but if you are interested in the concept and good practices, see sample implementation [here](https://github.com/rnpm/rnpm-plugin-link/blob/master/index.js) From d21c440b83672620fce7c8157c499c6beaada61c Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Wed, 6 Apr 2016 23:25:29 +0200 Subject: [PATCH 17/39] Update `Sponsors` section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b4377a..93e72d1 100644 --- a/README.md +++ b/README.md @@ -232,7 +232,7 @@ Special thanks to [Sonny Lazuardi](https://github.com/sonnylazuardi) for the awe This tool development and maintenance is sponsored by below companies: - + ## License From c554f301a48ac41e70dc674cdbc79aa27e27779f Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 7 Apr 2016 09:12:51 +0200 Subject: [PATCH 18/39] Fixes #138 --- src/config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/index.js b/src/config/index.js index ac8b4bb..ad608c5 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -37,6 +37,6 @@ exports.getDependencyConfig = function getDependencyConfig(packageName) { android: android.dependencyConfig(folder, rnpm.android || {}), assets: findAssets(folder, rnpm.assets), commands: wrapCommands(rnpm.commands), - params: rnpm.params || {}, + params: rnpm.params || [], }); }; From 745d6ecd7aa580ce4d82610a547feb85173479f1 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 7 Apr 2016 09:13:41 +0200 Subject: [PATCH 19/39] Bump link to its latest --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dcbccbd..8cb8217 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.0.0", - "rnpm-plugin-link": "^1.7.0", + "rnpm-plugin-link": "^1.7.1", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From ae7fc3061df469de899223c703487c07ba4fa76e Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 7 Apr 2016 09:13:46 +0200 Subject: [PATCH 20/39] Release v1.6.1. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8cb8217..ea5f74a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.6.0", + "version": "1.6.1", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From bace181448554d0a261174033392ab8af1b28963 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 9 Apr 2016 16:49:21 +0200 Subject: [PATCH 21/39] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea5f74a..b68b7f6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.0.0", - "rnpm-plugin-link": "^1.7.1", + "rnpm-plugin-link": "^1.7.2", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From 4a23caa86f4033b3626eabb86d87afbdfd12f4b1 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 9 Apr 2016 16:49:34 +0200 Subject: [PATCH 22/39] Release v1.6.2. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b68b7f6..5f566ff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.6.1", + "version": "1.6.2", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 90ba795e61142a5896a9f19cc9a2bdbde71b86d9 Mon Sep 17 00:00:00 2001 From: Kureev Alexey Date: Mon, 11 Apr 2016 14:50:28 +0200 Subject: [PATCH 23/39] Export strings path --- src/config/android/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config/android/index.js b/src/config/android/index.js index 7038524..f827730 100644 --- a/src/config/android/index.js +++ b/src/config/android/index.js @@ -38,6 +38,11 @@ exports.projectConfig = function projectConfigAndroid(folder, userConfig) { userConfig.mainActivityPath || `src/main/java/${packageFolder}/MainActivity.java` ); + const stringsPath = path.join( + sourceDir, + userConfig.stringsPath || 'src/main/res/values/strings.xml' + ); + const settingsGradlePath = path.join( folder, 'android', @@ -58,6 +63,7 @@ exports.projectConfig = function projectConfigAndroid(folder, userConfig) { sourceDir, isFlat, folder, + stringsPath, manifestPath, buildGradlePath, settingsGradlePath, From fd9adb25fd327d987c8fb0c5d664dc1e590f558f Mon Sep 17 00:00:00 2001 From: Sibelius Seraphini Date: Wed, 27 Apr 2016 08:06:44 -0300 Subject: [PATCH 24/39] fix undefined pjson, closes rnpm/rnpm#147 (#148) --- src/findPlugins.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/findPlugins.js b/src/findPlugins.js index 43e626d..58d3855 100644 --- a/src/findPlugins.js +++ b/src/findPlugins.js @@ -12,8 +12,9 @@ const flatten = require('lodash').flatten; const isPlugin = (dependency) => !!~dependency.indexOf('rnpm-plugin-'); const findPluginInFolder = (folder) => { + var pjson; try { - const pjson = require(path.join(folder, 'package.json')); + pjson = require(path.join(folder, 'package.json')); } catch (e) { return []; } From ebdd21a82ad58fecc7bc0c8b169c7fd34fcc05d3 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 30 Apr 2016 15:49:57 +0200 Subject: [PATCH 25/39] Release v1.6.3. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5f566ff..8c3d8c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.6.2", + "version": "1.6.3", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 750a68ca9604c8304b9c2a1e8fd4927a6c42c98d Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 30 Apr 2016 15:50:50 +0200 Subject: [PATCH 26/39] Release v1.6.4. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c3d8c4..10daa6e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.6.3", + "version": "1.6.4", "description": "React Native Package Manager", "main": "./src/getActions.js", "scripts": { From 075f03e094f8e96494480ac55e0b837456aaf9b0 Mon Sep 17 00:00:00 2001 From: Hassan Khan Date: Sun, 1 May 2016 05:54:49 +0100 Subject: [PATCH 27/39] Update package.json Fixed incorrect filename --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 10daa6e..d395d32 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "rnpm", "version": "1.6.4", "description": "React Native Package Manager", - "main": "./src/getActions.js", + "main": "./src/getCommands.js", "scripts": { "test": "jest" }, From d3f4069044aea4701709bbcbe9a2c0a6afe313ed Mon Sep 17 00:00:00 2001 From: Kureev Alexey Date: Sun, 1 May 2016 14:37:43 +0200 Subject: [PATCH 28/39] 1.6.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d395d32..08a7853 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.6.4", + "version": "1.6.5", "description": "React Native Package Manager", "main": "./src/getCommands.js", "scripts": { From 71e90b626b1ce27f121e56ede2a928c5ca2602f4 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 3 May 2016 13:05:54 +0200 Subject: [PATCH 29/39] Bump versions --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 08a7853..a3a0b28 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,8 @@ "commander": "^2.9.0", "glob": "^7.0.1", "lodash": "^3.10.1", - "rnpm-plugin-install": "^1.0.0", - "rnpm-plugin-link": "^1.7.2", + "rnpm-plugin-install": "^1.1.0", + "rnpm-plugin-link": "^1.7.4", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From 46ea4b1b71fbff90e64f3cfecadfc7696c51cc20 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Tue, 3 May 2016 13:06:24 +0200 Subject: [PATCH 30/39] Release v1.7.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a3a0b28..1d3df49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.6.5", + "version": "1.7.0", "description": "React Native Package Manager", "main": "./src/getCommands.js", "scripts": { From 22aec4846a859e403d3c9331e2a72d64b2b87ec1 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 5 May 2016 21:09:09 +0200 Subject: [PATCH 31/39] Initial commit :fire: --- src/config/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/config/index.js b/src/config/index.js index ad608c5..318b0be 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -30,7 +30,14 @@ exports.getProjectConfig = function getProjectConfig() { */ exports.getDependencyConfig = function getDependencyConfig(packageName) { const folder = path.join(process.cwd(), 'node_modules', packageName); - const rnpm = getRNPMConfig(folder); + var rnpm; + + // Will throw when package.json is not present in a nested folder + try { + rnpm = getRNPMConfig(folder); + } catch (err) { + rnpm = {}; + } return Object.assign({}, rnpm, { ios: ios.dependencyConfig(folder, rnpm.ios || {}), From 5924dc7b4732781b84ce0e912e236cd757353ce0 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 28 May 2016 18:00:46 +0200 Subject: [PATCH 32/39] Support flags in rnpm (#171) --- bin/cli | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/cli b/bin/cli index 774129a..06c8edb 100755 --- a/bin/cli +++ b/bin/cli @@ -12,15 +12,25 @@ updateNotifier({ pkg }).notify(); cli.version(pkg.version); -const addCommand = (command) => - cli +const defaultOptParser = (val) => val; + +const addCommand = (command) => { + const cmd = cli .command(command.name) .usage(command.usage) .description(command.description) .action(function runAction() { - command.func(config, arguments); + command.func(config, arguments, this.opts()); }); + (command.options || []) + .forEach(opt => cmd.option( + opt.flags, + opt.description, + opt.parse || defaultOptParser, + opt.default + )); +}; flatten(commands).forEach(addCommand); From d1a7fd0c28501b6e48e803a7644cd55025eef98a Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 28 May 2016 18:47:02 +0200 Subject: [PATCH 33/39] Release v1.8.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d3df49..737af64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.7.0", + "version": "1.8.0", "description": "React Native Package Manager", "main": "./src/getCommands.js", "scripts": { From 7ef2ccb01032d07a42dc9c1959cedbc0667a319a Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 28 May 2016 18:58:37 +0200 Subject: [PATCH 34/39] Document `options` in the readme cc: @Kureev you are the docs master, make it :fire: --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93e72d1..53aca4f 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Command exported by installed plugin will be available straight away. First of all, every plugin is [just a function](https://github.com/rnpm/rnpm-plugin-link/blob/master/src/link.js#L81) which accepts `config` and `args` parameters. Every plugin consists of [public interface](https://github.com/rnpm/rnpm-plugin-link/blob/master/index.js) for CLI and [implementation intself](https://github.com/rnpm/rnpm-plugin-link/blob/master/src/link.js). We use **public interface** to make your plugins auto-pluggable and easy to use for end-users. Every public interface consists of `name`, `func` & `description` fields: -- `name` - Name of the plugin. After plugin installation it'll be used as a command name. For instance plugin with following interface: +- `name` - Name of the plugin. After plugin installation it'll be used as a command name. For instance a plugin with the following interface: ```javascript module.exports = { func: require('./src/link'), @@ -115,6 +115,23 @@ We use **public interface** to make your plugins auto-pluggable and easy to use - `func` - Plugin itself. This function will be used when you run a command above - `description` - Command description. If user runs `$ rnpm --help`, this field will be displayed as a command description. +- `options` - An array of flags user can specify for your plugin to run. When defined, your exported `func` will receive an object of options as a 3rd argument. For instance a plugin with the following: + + ```js + options: [{ + flags: '-L, --list [path]', + description: 'List flag', + parse: (val) => val.split(',').map(Number), + default: [1,2,3], + }], + ``` + will receive the following object: + ``` + { list: [1,2,3] } + ``` + by default. + + **Note**: `parse` and `default` are optional. You can check [commander.js](https://github.com/tj/commander.js#option-parsing) docs for more information on how to define `flags` value. Also, in the case you want to expose multiple commands from the one plugin, you may use an array syntax: ```javascript From bdb41b4fa01850a347c43b64c79193300dc7fa5f Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Wed, 8 Jun 2016 17:14:15 -0700 Subject: [PATCH 35/39] Support specifying iOS shared libraries (#172) * Update mock-fs to support Node v6 * Normalize iOS shared library names This relates to #122, but the bulk of the work must be done in npm-plugin-link. --- package.json | 2 +- src/config/ios/index.js | 14 ++++++++++++++ test/ios/getProjectConfig.spec.js | 10 ++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 737af64..0f862d6 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "devDependencies": { "babel-eslint": "^4.1.5", "eslint": "^1.9.0", - "mock-fs": "^3.5.0", + "mock-fs": "^3.9.0", "mock-require": "^1.2.1", "rewire": "^2.5.1", "jest-cli": "^0.9.0-fb2" diff --git a/src/config/ios/index.js b/src/config/ios/index.js index 04ada20..5e1f2c0 100644 --- a/src/config/ios/index.js +++ b/src/config/ios/index.js @@ -1,6 +1,19 @@ const path = require('path'); const findProject = require('./findProject'); +/** + * For libraries specified without an extension, add '.tbd' for those that + * start with 'lib' and '.framework' to the rest. + */ +const mapSharedLibaries = (libraries) => { + return libraries.map(name => { + if (path.extname(name)) { + return name; + } + return name + (name.indexOf('lib') === 0 ? '.tbd' : '.framework'); + }); +}; + /** * Returns project config by analyzing given folder and applying some user defaults * when constructing final object @@ -24,6 +37,7 @@ exports.projectConfig = function projectConfigIOS(folder, userConfig) { projectPath: projectPath, projectName: path.basename(projectPath), libraryFolder: userConfig.libraryFolder || 'Libraries', + sharedLibraries: mapSharedLibaries(userConfig.sharedLibraries || []), plist: userConfig.plist || [], }; }; diff --git a/test/ios/getProjectConfig.spec.js b/test/ios/getProjectConfig.spec.js index bba3bed..82a2245 100644 --- a/test/ios/getProjectConfig.spec.js +++ b/test/ios/getProjectConfig.spec.js @@ -22,5 +22,15 @@ describe('ios::getProjectConfig', () => { expect(getProjectConfig(folder, userConfig)).toBe(null); }); + it('should return normalized shared library names', () => { + const projectConfig = getProjectConfig('testDir/nested', { + sharedLibraries: ['libc++', 'libz.tbd', 'HealthKit', 'HomeKit.framework'], + }); + + expect(projectConfig.sharedLibraries).toEqual( + ['libc++.tbd', 'libz.tbd', 'HealthKit.framework', 'HomeKit.framework'] + ); + }); + afterEach(mockFs.restore); }); From 54ba57dc37a455d69844dcb3a6af814d091ea91a Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 11 Jun 2016 15:09:05 +0200 Subject: [PATCH 36/39] Bump link version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f862d6..bb42207 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "glob": "^7.0.1", "lodash": "^3.10.1", "rnpm-plugin-install": "^1.1.0", - "rnpm-plugin-link": "^1.7.4", + "rnpm-plugin-link": "^1.8.0", "update-notifier": "^0.6.0", "xmldoc": "^0.4.0" }, From 7acee5113d0d4ca52d0c4f16422faf2960447a34 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Sat, 11 Jun 2016 15:09:29 +0200 Subject: [PATCH 37/39] Release v1.9.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb42207..da31a81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rnpm", - "version": "1.8.0", + "version": "1.9.0", "description": "React Native Package Manager", "main": "./src/getCommands.js", "scripts": { From 769b69264f035fe366132df777fab7f6fd3bf03f Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 30 Jun 2016 00:18:03 +0200 Subject: [PATCH 38/39] Support react-native plugins (#179) * Support react-native plugins * Remove misleading name --- src/findPlugins.js | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/src/findPlugins.js b/src/findPlugins.js index 58d3855..8cb8818 100644 --- a/src/findPlugins.js +++ b/src/findPlugins.js @@ -9,13 +9,29 @@ const flatten = require('lodash').flatten; * @param {String} dependency Name of the dependency * @return {Boolean} If dependency is a rnpm plugin */ -const isPlugin = (dependency) => !!~dependency.indexOf('rnpm-plugin-'); +const isRNPMPlugin = (dependency) => !!~dependency.indexOf('rnpm-plugin-'); +const isReactNativePlugin = (dependency) => !!~dependency.indexOf('react-native-'); -const findPluginInFolder = (folder) => { - var pjson; +const readPackage = (folder) => { try { - pjson = require(path.join(folder, 'package.json')); + return require(path.join(folder, 'package.json')); } catch (e) { + return null; + } +}; + +const findPluginsInReactNativePackage = (pjson) => { + if (!pjson.rnpm || !pjson.rnpm.plugin) { + return []; + } + + return path.join(pjson.name, pjson.rnpm.plugin); +}; + +const findPluginInFolder = (folder) => { + const pjson = readPackage(folder); + + if (!pjson) { return []; } @@ -24,7 +40,22 @@ const findPluginInFolder = (folder) => { Object.keys(pjson.devDependencies || {}) ); - return deps.filter(isPlugin); + return deps.reduce( + (acc, pkg) => { + if (isRNPMPlugin(pkg)) { + return acc.concat(pkg); + } + if (isReactNativePlugin(pkg)) { + const pjson = readPackage(path.join(folder, 'node_modules', pkg)); + if (!pjson) { + return acc; + } + return acc.concat(findPluginsInReactNativePackage(pjson)); + } + return acc; + }, + [] + ); }; /** From 1db2a06850f8f727b5c68ab0f3450f140c24ac91 Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 1 Aug 2016 11:24:46 +0200 Subject: [PATCH 39/39] Bye-bye, rnpm :cry: --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 53aca4f..4de3e7c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,16 @@ +# Dear friends, + +Last November me ([@Kureev](https://github.com/Kureev)) and Mike ([@grabbou](https://github.com/grabbou)) started RNPM. We aimed to bring you a better developer experience and bridge the tooling gap we had back then. Now, as you may know, RNPM is merged into [React Native core](https://github.com/facebook/react-native). It means that from now on you don't need to install a third-party software to use your favorite linking functionality (just use a react-native cli). We'd like to say a big "Thank you!" to everybody who supported us, filed new issues, composed PRs and helped us to review them. + +Now, when RNPM is a part of React Native, we're going to seal this repository and keep working on React Native tooling inside the core. That said, I kindly ask you to file all new issues / prs in react-native repo and cc us. This repo (and other rnpm plugins) will be a available for a few more months in a read-only mode. + +With love, +Alexey Kureev and MichaƂ Grabowski + +![](http://esq.h-cdn.co/assets/16/17/640x360/gallery-1462115295-obama-mic-drop.gif) + + + ![rnpm logo](http://s18.postimg.org/ex7oladjt/logornpm_final4.png) ![npm version](https://img.shields.io/npm/v/rnpm.svg) ![dependencies](https://img.shields.io/david/rnpm/rnpm.svg) [![Code Climate](https://codeclimate.com/github/rnpm/rnpm/badges/gpa.svg)](https://codeclimate.com/github/rnpm/rnpm) [![Test Coverage](https://codeclimate.com/github/rnpm/rnpm/badges/coverage.svg)](https://codeclimate.com/github/rnpm/rnpm/coverage) [![Circle CI](https://img.shields.io/circleci/project/rnpm/rnpm/master.svg)](https://circleci.com/gh/rnpm/rnpm)