Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Refactor projectDir -> projectRoot (#3292)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBacon authored Mar 16, 2021
1 parent e180d0c commit 320f1b2
Show file tree
Hide file tree
Showing 33 changed files with 357 additions and 348 deletions.
4 changes: 2 additions & 2 deletions packages/config-plugins/src/android/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ export function setPackageInAndroidManifest(
return androidManifest;
}

export async function getApplicationIdAsync(projectDir: string): Promise<string | null> {
const buildGradlePath = getAppBuildGradle(projectDir);
export async function getApplicationIdAsync(projectRoot: string): Promise<string | null> {
const buildGradlePath = getAppBuildGradle(projectRoot);
if (!(await fs.pathExists(buildGradlePath))) {
return null;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/dev-tools/server/DevToolsServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function createAuthenticationContextAsync({ port }: { port: number
};
}

export async function startAsync(projectDir: string): Promise<string> {
export async function startAsync(projectRoot: string): Promise<string> {
const port = await freeportAsync(19002, { hostnames: [null, 'localhost'] });
const server = express();

Expand All @@ -73,19 +73,19 @@ export async function startAsync(projectDir: string): Promise<string> {
httpServer.once('listening', resolve);
httpServer.listen(port, listenHostname);
});
startGraphQLServer(projectDir, httpServer, authenticationContext);
await ProjectSettings.setPackagerInfoAsync(projectDir, { devToolsPort: port });
startGraphQLServer(projectRoot, httpServer, authenticationContext);
await ProjectSettings.setPackagerInfoAsync(projectRoot, { devToolsPort: port });
return `http://${listenHostname}:${port}`;
}

export function startGraphQLServer(
projectDir: string,
projectRoot: string,
httpServer: http.Server,
authenticationContext: any
) {
const layout = createLayout();
const issues = new Issues();
const messageBuffer = createMessageBuffer(projectDir, issues);
const messageBuffer = createMessageBuffer(projectRoot, issues);
SubscriptionServer.create(
{
schema: GraphQLSchema,
Expand All @@ -94,7 +94,7 @@ export function startGraphQLServer(
onOperation: (operation, params) => ({
...params,
context: createContext({
projectDir,
projectDir: projectRoot,
messageBuffer,
layout,
issues,
Expand Down
6 changes: 3 additions & 3 deletions packages/expo-cli/e2e/__tests__/start-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ProjectSettings } from 'xdl';
import { EXPO_CLI } from '../TestUtils';

const tempDir = temporary.directory();
const projectDir = path.join(tempDir, 'my-app');
const projectRoot = path.join(tempDir, 'my-app');

beforeAll(async () => {
// jest.setTimeout(60000);
Expand All @@ -16,7 +16,7 @@ beforeAll(async () => {
});

xtest('start --offline', async () => {
const promise = spawnAsync(EXPO_CLI, ['start', '--offline'], { cwd: projectDir });
const promise = spawnAsync(EXPO_CLI, ['start', '--offline'], { cwd: projectRoot });
const cli = promise.child;

cli.stderr.pipe(process.stderr);
Expand All @@ -39,7 +39,7 @@ xtest('start --offline with existing packager info', async () => {
packagerPid: 1337,
});

const promise = spawnAsync(EXPO_CLI, ['start', '--offline'], { cwd: projectDir });
const promise = spawnAsync(EXPO_CLI, ['start', '--offline'], { cwd: projectRoot });
const cli = promise.child;

cli.stderr.pipe(process.stderr);
Expand Down
4 changes: 2 additions & 2 deletions packages/expo-cli/src/commands/bundle-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ type Options = {
platform?: string;
};

async function action(projectDir: string, options: Options) {
async function action(projectRoot: string, options: Options) {
try {
await Detach.bundleAssetsAsync(projectDir, options);
await Detach.bundleAssetsAsync(projectRoot, options);
} catch (e) {
Log.error(e);
Log.error(
Expand Down
Loading

0 comments on commit 320f1b2

Please sign in to comment.