bugfix(react-native): change to entryFile absoluste path (#7953)

This commit is contained in:
Emily Xiong 2021-11-30 13:18:33 -05:00 committed by GitHub
parent 1aec1124e6
commit 49df712d5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 2 deletions

View File

@ -55,7 +55,7 @@ describe('react native', () => {
expect(() =>
checkFilesExist(`dist/apps/${appName}/android/main.jsbundle`)
).not.toThrow();
});
}, 1000000);
xit('should support create application with js', async () => {
const appName = uniq('my-app');

View File

@ -214,7 +214,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh <%= entryFile %>\n";
shellScript = "set -e\n\nexport NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh <%= entryFileAbsolutePath %>\n";
};
02884E84544B8E84B8B8F340 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;

View File

@ -30,6 +30,7 @@ describe('Normalize Options', () => {
projectName: 'my-app',
linter: Linter.EsLint,
entryFile: 'apps/my-app/src/main.tsx',
entryFileAbsolutePath: '/virtual/apps/my-app/src/main.tsx',
e2eTestRunner: 'none',
unitTestRunner: 'jest',
});
@ -52,6 +53,7 @@ describe('Normalize Options', () => {
parsedTags: [],
projectName: 'my-app',
entryFile: 'apps/my-app/src/main.tsx',
entryFileAbsolutePath: '/virtual/apps/my-app/src/main.tsx',
e2eTestRunner: 'none',
unitTestRunner: 'jest',
});
@ -76,6 +78,7 @@ describe('Normalize Options', () => {
parsedTags: [],
projectName: 'directory-my-app',
entryFile: 'apps/directory/my-app/src/main.tsx',
entryFileAbsolutePath: '/virtual/apps/directory/my-app/src/main.tsx',
e2eTestRunner: 'none',
unitTestRunner: 'jest',
});
@ -98,6 +101,7 @@ describe('Normalize Options', () => {
parsedTags: [],
projectName: 'directory-my-app',
entryFile: 'apps/directory/my-app/src/main.tsx',
entryFileAbsolutePath: '/virtual/apps/directory/my-app/src/main.tsx',
e2eTestRunner: 'none',
unitTestRunner: 'jest',
});
@ -121,6 +125,7 @@ describe('Normalize Options', () => {
parsedTags: [],
projectName: 'my-app',
entryFile: 'apps/my-app/src/main.tsx',
entryFileAbsolutePath: '/virtual/apps/my-app/src/main.tsx',
e2eTestRunner: 'none',
unitTestRunner: 'jest',
});

View File

@ -11,6 +11,7 @@ export interface NormalizedSchema extends Schema {
androidProjectRoot: string;
parsedTags: string[];
entryFile: string;
entryFileAbsolutePath: string;
}
export function normalizeOptions(
@ -41,6 +42,8 @@ export function normalizeOptions(
options.js ? '/src/main.js' : '/src/main.tsx'
);
const entryFileAbsolutePath = join(host.root, entryFile);
/**
* if options.name is "my-app"
* name: "my-app", className: 'MyApp', lowerCaseName: 'myapp', displayName: 'MyApp', projectName: 'my-app', appProjectRoot: 'apps/my-app', androidProjectRoot: 'apps/my-app/android', iosProjectRoot: 'apps/my-app/ios'
@ -61,5 +64,6 @@ export function normalizeOptions(
androidProjectRoot,
parsedTags,
entryFile,
entryFileAbsolutePath,
};
}