Skip to content

Commit

Permalink
clean up legacy stuff (#444)
Browse files Browse the repository at this point in the history
* drop support for npm token in credentials.json

* remove --allow-experimantal flag

* update CHANGELOG
  • Loading branch information
dsokal authored Jun 9, 2021
1 parent 2bdaa0d commit 0ce7c1b
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 69 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This is the log of notable changes to EAS CLI and related packages.

### 🛠 Breaking changes

- Drop support for `experimental.npmToken` in credentials.json, EAS Secrets can be used instead. ([#444](https://github.com/expo/eas-cli/pull/444) by [@dsokal](https://github.com/dsokal))
- Remove `--allow-experimental` flag from `eas build:configure` as it has no effect now. ([#444](https://github.com/expo/eas-cli/pull/444) by [@dsokal](https://github.com/dsokal))

### 🎉 New features

- Make credentials manager work with multi-target iOS projects. ([#441](https://github.com/expo/eas-cli/pull/441) by [@dsokal](https://github.com/dsokal))
Expand Down
6 changes: 1 addition & 5 deletions packages/eas-cli/src/build/android/prepareJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { AndroidGenericBuildProfile, AndroidManagedBuildProfile } from '@expo/ea
import path from 'path';

import { AndroidCredentials } from '../../credentials/android/AndroidCredentialsProvider';
import { readEnvironmentSecretsAsync } from '../../credentials/credentialsJson/read';
import { getUsername } from '../../project/projectUtils';
import { ensureLoggedInAsync } from '../../user/actions';
import { gitRootDirectoryAsync } from '../../utils/git';
Expand Down Expand Up @@ -39,16 +38,14 @@ interface CommonJobProperties {
buildCredentials?: {
keystore: Android.Keystore;
};
environmentSecrets?: Record<string, string>;
};
}

async function prepareJobCommonAsync(
ctx: BuildContext<Platform.ANDROID>,
jobData: JobData
): Promise<Partial<CommonJobProperties>> {
const environmentSecrets = await readEnvironmentSecretsAsync(ctx.commandCtx.projectDir);
const credentials = jobData.credentials;
const { credentials } = jobData;
const buildCredentials = credentials
? {
buildCredentials: {
Expand Down Expand Up @@ -78,7 +75,6 @@ async function prepareJobCommonAsync(
clear: ctx.commandCtx.clearCache,
},
secrets: {
...(environmentSecrets ? { environmentSecrets } : {}),
...buildCredentials,
},
};
Expand Down
2 changes: 0 additions & 2 deletions packages/eas-cli/src/build/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const configureCommitMessage = {
export async function configureAsync(options: {
platform: RequestedPlatform;
projectDir: string;
allowExperimental: boolean;
}): Promise<void> {
await ensureGitRepoExistsAsync();
await maybeBailOnGitStatusAsync();
Expand All @@ -39,7 +38,6 @@ export async function configureAsync(options: {
user: await ensureLoggedInAsync(),
projectDir: options.projectDir,
exp,
allowExperimental: options.allowExperimental,
requestedPlatform: options.platform,
shouldConfigureAndroid: [RequestedPlatform.All, RequestedPlatform.Android].includes(
options.platform
Expand Down
1 change: 0 additions & 1 deletion packages/eas-cli/src/build/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export interface ConfigureContext {
user: Actor;
projectDir: string;
exp: ExpoConfig;
allowExperimental: boolean;
requestedPlatform: RequestedPlatform;
shouldConfigureAndroid: boolean;
shouldConfigureIos: boolean;
Expand Down
4 changes: 0 additions & 4 deletions packages/eas-cli/src/build/ios/prepareJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ArchiveSource, Cache, Ios, Job, Workflow, sanitizeJob } from '@expo/eas
import { IosGenericBuildProfile, IosManagedBuildProfile } from '@expo/eas-json';
import path from 'path';

import { readEnvironmentSecretsAsync } from '../../credentials/credentialsJson/read';
import { IosCredentials, TargetCredentials } from '../../credentials/ios/types';
import { getUsername } from '../../project/projectUtils';
import { ensureLoggedInAsync } from '../../user/actions';
Expand Down Expand Up @@ -48,8 +47,6 @@ async function prepareJobCommonAsync(
ctx: BuildContext<Platform.IOS>,
{ credentials, projectArchive }: { credentials?: IosCredentials; projectArchive: ArchiveSource }
): Promise<Partial<CommonJobProperties>> {
const environmentSecrets = await readEnvironmentSecretsAsync(ctx.commandCtx.projectDir);

const buildCredentials: CommonJobProperties['secrets']['buildCredentials'] = {};
if (credentials) {
const targetNames = Object.keys(credentials);
Expand Down Expand Up @@ -77,7 +74,6 @@ async function prepareJobCommonAsync(
clear: ctx.commandCtx.clearCache,
},
secrets: {
...(environmentSecrets ? { environmentSecrets } : {}),
buildCredentials,
},
};
Expand Down
14 changes: 0 additions & 14 deletions packages/eas-cli/src/commands/build/configure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ export default class BuildConfigure extends Command {
char: 'p',
options: ['android', 'ios', 'all'],
}),
'allow-experimental': flags.boolean({
description: 'Enable experimental configuration steps.',
default: false,
}),
};

async run() {
Expand All @@ -32,20 +28,10 @@ export default class BuildConfigure extends Command {

const platform =
(flags.platform as RequestedPlatform | undefined) ?? (await promptForPlatformAsync());
const allowExperimental = flags['allow-experimental'];

if (allowExperimental) {
Log.warn(
`Project configuration will execute some additional steps that might fail if structure of your native project is significantly different from ${chalk.bold(
'expo eject'
)} or ${chalk.bold('expo init')}`
);
}

await ensureLoggedInAsync();
await configureAsync({
platform,
allowExperimental,
projectDir: (await findProjectRootAsync()) ?? process.cwd(),
});

Expand Down
1 change: 0 additions & 1 deletion packages/eas-cli/src/commands/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ async function ensureProjectConfiguredAsync(projectDir: string): Promise<ExpoCon
await configureAsync({
projectDir,
platform: RequestedPlatform.All,
allowExperimental: false,
});
if (!(await isGitStatusCleanAsync())) {
throw new Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,29 +247,4 @@ describe('credentialsJson', () => {
});
});
});

describe('readEnvironmentSecretsAsync', () => {
it('should read environmentSecrets field correctly', async () => {
vol.fromJSON({
'./credentials.json': JSON.stringify({
ios: {
provisioningProfilePath: 'pprofile',
distributionCertificate: {
path: 'cert.p12',
password: 'certPass',
},
},
experimental: {
npmToken: 'VALUE',
},
}),
'./pprofile': 'somebinarycontent',
'./cert.p12': 'somebinarycontent2',
});
const result = await credentialsJsonReader.readEnvironmentSecretsAsync('.');
expect(result).toEqual({
NPM_TOKEN: 'VALUE',
});
});
});
});
11 changes: 0 additions & 11 deletions packages/eas-cli/src/credentials/credentialsJson/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,6 @@ async function readCredentialsForTargetAsync(
};
}

export async function readEnvironmentSecretsAsync(
projectDir: string
): Promise<Record<string, string> | undefined> {
if (!(await fs.pathExists(getCredentialsJsonPath(projectDir)))) {
return undefined;
}
const credentialsJson = await readAsync(projectDir);
const npmToken = credentialsJson?.experimental?.npmToken;
return npmToken ? { NPM_TOKEN: npmToken } : undefined;
}

async function readAsync(projectDir: string): Promise<CredentialsJson> {
const credentialsJSONRaw = await readRawAsync(projectDir);

Expand Down
6 changes: 0 additions & 6 deletions packages/eas-cli/src/credentials/credentialsJson/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { Keystore } from '../android/credentials';
export interface CredentialsJson {
android?: CredentialsJsonAndroidCredentials;
ios?: CredentialsJsonIosTargetCredentials | CredentialsJsonIosCredentials;
experimental?: {
npmToken?: string;
};
}

export interface CredentialsJsonAndroidCredentials {
Expand Down Expand Up @@ -65,7 +62,4 @@ export const CredentialsJsonSchema = Joi.object({
CredentialsJsonIosTargetCredentialsSchema.required()
),
],
experimental: Joi.object({
npmToken: Joi.string(),
}),
});

0 comments on commit 0ce7c1b

Please sign in to comment.