fix(expo): should support app.config.ts (#26713)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes https://github.com/nrwl/nx/issues/26467
This commit is contained in:
Emily Xiong 2024-06-27 09:37:22 -07:00 committed by GitHub
parent 2a803158ef
commit 412a450dae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -12,6 +12,8 @@ import {
runCLIAsync,
runE2ETests,
killPorts,
createFile,
removeFile,
} from 'e2e/utils';
import { join } from 'path';
@ -159,4 +161,18 @@ describe('@nx/expo', () => {
`${appName}/src/app/App.stories.tsx`
);
});
it('should work with app.config.ts', () => {
const appJson = join(appName, `app.json`);
const appJsonContent = readJson(appJson);
removeFile(appJson);
createFile(
join(appName, 'app.config.ts'),
`export default { expo: { name: 'my-app', slug: 'my-app' } };`
);
const result = runCLI(`show project ${appName} --json false`);
expect(result).toContain('start:');
expect(result).toContain('serve:');
createFile(appJson, JSON.stringify(appJsonContent));
});
});

View File

@ -53,7 +53,7 @@ export const createDependencies: CreateDependencies = () => {
};
export const createNodes: CreateNodes<ExpoPluginOptions> = [
'**/app.{json,config.js}',
'**/app.{json,config.js,config.ts}',
async (configFilePath, options, context) => {
options = normalizeOptions(options);
const projectRoot = dirname(configFilePath);