Further RNPM integration

Summary:
This commit removes `rnpm` folder that we left during initial merge to keep the diff cleaner. The `core`, `link` and `install` have now the same directory structure as any other command to make development more natural for all of us.

From most notable differences:
1) the `src` folder is now gone. The new structure should make it easier for people to work with the stuff and also move us closer to 100% rnpm integration,
2) There's also no `package.json` present in any of the `rnpm` packages, since they are no longer standalone modules,
3) There's no `bugs.url` in link.js since main package.json of React doesn't specify it. Decided to hardcode it to facebook/react-native since it's really unlikely to change. If one would prefer to use pkg.bugs.url as before, a separate PR modifying package.json should be sent.
Closes https://github.com/facebook/react-native/pull/9509

Differential Revision: D3751115

fbshipit-source-id: 74ae8330f7634df0887ad676808f47eee4b8de85
This commit is contained in:
Mike Grabowski
2016-08-22 08:56:14 -07:00
committed by Facebook Github Bot 3
parent 25f2a26ce9
commit 0af640bfae
134 changed files with 101 additions and 226 deletions

View File

@@ -0,0 +1,84 @@
jest.autoMockOff();
const findProject = require('../../config/ios/findProject');
const mockFs = require('mock-fs');
const projects = require('../../__fixtures__/projects');
const ios = require('../../__fixtures__/ios');
const userConfig = {};
describe('ios::findProject', () => {
it('should return path to xcodeproj if found', () => {
mockFs(projects.flat);
expect(findProject('')).not.toBe(null);
});
it('should return null if there\'re no projects', () => {
mockFs({ testDir: projects });
expect(findProject('')).toBe(null);
});
it('should return ios project regardless of its name', () => {
mockFs({ ios: ios.validTestName });
expect(findProject('')).not.toBe(null);
});
it('should ignore node_modules', () => {
mockFs({ node_modules: projects.flat });
expect(findProject('')).toBe(null);
});
it('should ignore Pods', () => {
mockFs({ Pods: projects.flat });
expect(findProject('')).toBe(null);
});
it('should ignore Pods inside `ios` folder', () => {
mockFs({
ios: {
Pods: projects.flat,
DemoApp: projects.flat.ios,
},
});
expect(findProject('')).toBe('ios/DemoApp/demoProject.xcodeproj');
});
it('should ignore xcodeproj from example folders', () => {
mockFs({
examples: projects.flat,
Examples: projects.flat,
example: projects.flat,
KeychainExample: projects.flat,
Zpp: projects.flat,
});
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,
IntegrationTests: projects.flat,
tests: projects.flat,
Zpp: {
tests: projects.flat,
src: projects.flat,
},
});
expect(findProject('').toLowerCase()).not.toContain('test');
});
afterEach(mockFs.restore);
});

View File

@@ -0,0 +1,36 @@
jest.autoMockOff();
const getProjectConfig = require('../../config/ios').projectConfig;
const mockFs = require('mock-fs');
const projects = require('../../__fixtures__/projects');
describe('ios::getProjectConfig', () => {
const userConfig = {};
beforeEach(() => mockFs({ testDir: projects }));
it('should return an object with ios project configuration', () => {
const folder = 'testDir/nested';
expect(getProjectConfig(folder, userConfig)).not.toBe(null);
expect(typeof getProjectConfig(folder, userConfig)).toBe('object');
});
it('should return `null` if ios project was not found', () => {
const folder = 'testDir/empty';
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);
});