eas-cli 0.33.1 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -26
- package/build/analytics.js +3 -9
- package/build/build/android/configure.js +2 -2
- package/build/build/android/graphql.js +2 -4
- package/build/build/android/prepareJob.js +4 -3
- package/build/build/build.js +2 -2
- package/build/build/configure.js +14 -7
- package/build/build/ios/UpdatesModule.js +2 -2
- package/build/build/ios/graphql.js +2 -23
- package/build/build/ios/prepareJob.js +4 -6
- package/build/build/metadata.js +5 -10
- package/build/build/utils/devClient.js +2 -2
- package/build/build/utils/repository.js +10 -7
- package/build/build/validate.js +4 -4
- package/build/commandUtils/EasCommand.d.ts +1 -0
- package/build/commandUtils/EasCommand.js +21 -0
- package/build/commands/branch/create.js +3 -2
- package/build/commands/branch/delete.js +1 -1
- package/build/commands/branch/list.js +1 -1
- package/build/commands/branch/publish.js +6 -5
- package/build/commands/branch/view.js +1 -1
- package/build/commands/build/index.js +35 -25
- package/build/commands/channel/edit.js +1 -1
- package/build/commands/channel/list.js +1 -1
- package/build/commands/channel/view.js +1 -1
- package/build/commands/diagnostics.js +2 -2
- package/build/commands/project/info.js +1 -1
- package/build/commands/update/view.js +1 -1
- package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
- package/build/credentials/credentialsJson/update.js +5 -4
- package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
- package/build/credentials/ios/actions/CreatePushKey.js +1 -1
- package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
- package/build/credentials/ios/actions/DistributionCertificateUtils.js +5 -7
- package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
- package/build/credentials/ios/actions/PushKeyUtils.js +5 -5
- package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
- package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
- package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
- package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
- package/build/credentials/manager/Actions.d.ts +47 -0
- package/build/credentials/manager/Actions.js +48 -0
- package/build/credentials/manager/AndroidActions.d.ts +6 -0
- package/build/credentials/manager/AndroidActions.js +114 -0
- package/build/credentials/manager/IosActions.d.ts +6 -0
- package/build/credentials/manager/IosActions.js +110 -0
- package/build/credentials/manager/ManageAndroid.d.ts +1 -29
- package/build/credentials/manager/ManageAndroid.js +26 -159
- package/build/credentials/manager/ManageIos.d.ts +1 -29
- package/build/credentials/manager/ManageIos.js +28 -155
- package/build/graphql/client.d.ts +8 -2
- package/build/graphql/generated.d.ts +85 -8
- package/build/graphql/generated.js +23 -1
- package/build/graphql/queries/BuildQuery.js +4 -1
- package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
- package/build/graphql/queries/ProjectQuery.js +3 -1
- package/build/graphql/queries/PublishQuery.js +4 -1
- package/build/graphql/queries/SubmissionQuery.js +5 -2
- package/build/graphql/queries/UserQuery.js +4 -1
- package/build/graphql/queries/WebhookQuery.js +6 -2
- package/build/log.d.ts +0 -2
- package/build/log.js +2 -12
- package/build/project/projectUtils.js +1 -1
- package/build/project/publish.js +2 -2
- package/build/project/workflow.js +2 -2
- package/build/submit/ios/IosSubmitter.js +1 -1
- package/build/user/User.js +1 -0
- package/build/utils/easCli.d.ts +1 -0
- package/build/utils/easCli.js +5 -0
- package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
- package/build/utils/{expoCommand.js → expoCli.js} +0 -0
- package/build/utils/profiles.js +9 -2
- package/build/vcs/clients/git.d.ts +26 -0
- package/build/vcs/clients/git.js +184 -0
- package/build/vcs/clients/gitNoCommit.d.ts +7 -0
- package/build/vcs/clients/gitNoCommit.js +27 -0
- package/build/vcs/clients/noVcs.d.ts +6 -0
- package/build/vcs/clients/noVcs.js +19 -0
- package/build/vcs/git.d.ts +10 -17
- package/build/vcs/git.js +7 -175
- package/build/vcs/index.d.ts +2 -2
- package/build/vcs/index.js +15 -6
- package/build/vcs/local.d.ts +18 -5
- package/build/vcs/local.js +61 -32
- package/build/vcs/vcs.d.ts +2 -1
- package/build/vcs/vcs.js +8 -4
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
|
@@ -27,7 +27,9 @@ exports.EnvironmentSecretsQuery = {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
${(0, graphql_1.print)(EnvironmentSecret_1.EnvironmentSecretFragmentNode)}
|
|
30
|
-
`, { accountName }
|
|
30
|
+
`, { accountName }, {
|
|
31
|
+
additionalTypenames: ['EnvironmentSecret'],
|
|
32
|
+
})
|
|
31
33
|
.toPromise());
|
|
32
34
|
return data.account.byName.environmentSecrets;
|
|
33
35
|
},
|
|
@@ -47,7 +49,7 @@ exports.EnvironmentSecretsQuery = {
|
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
${(0, graphql_1.print)(EnvironmentSecret_1.EnvironmentSecretFragmentNode)}
|
|
50
|
-
`, { appId })
|
|
52
|
+
`, { appId }, { additionalTypenames: ['EnvironmentSecret'] })
|
|
51
53
|
.toPromise());
|
|
52
54
|
return (_b = (_a = data.app) === null || _a === void 0 ? void 0 : _a.byId.environmentSecrets) !== null && _b !== void 0 ? _b : [];
|
|
53
55
|
},
|
|
@@ -18,7 +18,10 @@ exports.PublishQuery = {
|
|
|
18
18
|
}
|
|
19
19
|
`, {
|
|
20
20
|
storageKeys,
|
|
21
|
-
}, {
|
|
21
|
+
}, {
|
|
22
|
+
requestPolicy: 'network-only',
|
|
23
|
+
additionalTypenames: ['AssetMetadataResult'],
|
|
24
|
+
} // Since we reptitively query this to monitor the asset upload, we need to ensure it is not cached.
|
|
22
25
|
)
|
|
23
26
|
.toPromise());
|
|
24
27
|
return data.asset.metadata;
|
|
@@ -19,7 +19,10 @@ exports.SubmissionQuery = {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
${(0, graphql_1.print)(Submission_1.SubmissionFragmentNode)}
|
|
22
|
-
`, { submissionId }, {
|
|
22
|
+
`, { submissionId }, {
|
|
23
|
+
requestPolicy: useCache ? 'cache-first' : 'network-only',
|
|
24
|
+
additionalTypenames: ['Submission'],
|
|
25
|
+
})
|
|
23
26
|
.toPromise());
|
|
24
27
|
return data.submissions.byId;
|
|
25
28
|
},
|
|
@@ -49,7 +52,7 @@ exports.SubmissionQuery = {
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
${(0, graphql_1.print)(Submission_1.SubmissionFragmentNode)}
|
|
52
|
-
`, { appId, offset, limit, status, platform })
|
|
55
|
+
`, { appId, offset, limit, status, platform }, { additionalTypenames: ['Submission'] })
|
|
53
56
|
.toPromise());
|
|
54
57
|
return (_b = (_a = data.app) === null || _a === void 0 ? void 0 : _a.byId.submissions) !== null && _b !== void 0 ? _b : [];
|
|
55
58
|
},
|
|
@@ -23,7 +23,9 @@ exports.WebhookQuery = {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
${(0, graphql_1.print)(Webhook_1.WebhookFragmentNode)}
|
|
26
|
-
`, { appId, webhookFilter }
|
|
26
|
+
`, { appId, webhookFilter }, {
|
|
27
|
+
additionalTypenames: ['Webhook'],
|
|
28
|
+
})
|
|
27
29
|
.toPromise());
|
|
28
30
|
return (_b = (_a = data.app) === null || _a === void 0 ? void 0 : _a.byId.webhooks) !== null && _b !== void 0 ? _b : [];
|
|
29
31
|
},
|
|
@@ -39,7 +41,9 @@ exports.WebhookQuery = {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
${(0, graphql_1.print)(Webhook_1.WebhookFragmentNode)}
|
|
42
|
-
`, { webhookId }
|
|
44
|
+
`, { webhookId }, {
|
|
45
|
+
additionalTypenames: ['Webhook'],
|
|
46
|
+
})
|
|
43
47
|
.toPromise());
|
|
44
48
|
return data.webhook.byId;
|
|
45
49
|
},
|
package/build/log.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ export default class Log {
|
|
|
11
11
|
static succeed(message: string): void;
|
|
12
12
|
static withTick(...args: any[]): void;
|
|
13
13
|
private static consoleLog;
|
|
14
|
-
private static consoleWarn;
|
|
15
|
-
private static consoleError;
|
|
16
14
|
private static withTextColor;
|
|
17
15
|
private static isLastLineNewLine;
|
|
18
16
|
private static updateIsLastLineNewLine;
|
package/build/log.js
CHANGED
|
@@ -20,10 +20,10 @@ class Log {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
static error(...args) {
|
|
23
|
-
Log.
|
|
23
|
+
Log.consoleLog(...Log.withTextColor(args, chalk_1.default.red));
|
|
24
24
|
}
|
|
25
25
|
static warn(...args) {
|
|
26
|
-
Log.
|
|
26
|
+
Log.consoleLog(...Log.withTextColor(args, chalk_1.default.yellow));
|
|
27
27
|
}
|
|
28
28
|
static debug(...args) {
|
|
29
29
|
if (Log.isDebug) {
|
|
@@ -47,16 +47,6 @@ class Log {
|
|
|
47
47
|
// eslint-disable-next-line no-console
|
|
48
48
|
console.log(...args);
|
|
49
49
|
}
|
|
50
|
-
static consoleWarn(...args) {
|
|
51
|
-
Log.updateIsLastLineNewLine(args);
|
|
52
|
-
// eslint-disable-next-line no-console
|
|
53
|
-
console.warn(...args);
|
|
54
|
-
}
|
|
55
|
-
static consoleError(...args) {
|
|
56
|
-
Log.updateIsLastLineNewLine(args);
|
|
57
|
-
// eslint-disable-next-line no-console
|
|
58
|
-
console.error(...args);
|
|
59
|
-
}
|
|
60
50
|
static withTextColor(args, chalkColor) {
|
|
61
51
|
return args.map(arg => chalkColor(arg));
|
|
62
52
|
}
|
package/build/project/publish.js
CHANGED
|
@@ -13,7 +13,7 @@ const PublishMutation_1 = require("../graphql/mutations/PublishMutation");
|
|
|
13
13
|
const PublishQuery_1 = require("../graphql/queries/PublishQuery");
|
|
14
14
|
const log_1 = (0, tslib_1.__importDefault)(require("../log"));
|
|
15
15
|
const uploads_1 = require("../uploads");
|
|
16
|
-
const
|
|
16
|
+
const expoCli_1 = require("../utils/expoCli");
|
|
17
17
|
const uniqBy_1 = (0, tslib_1.__importDefault)(require("../utils/expodash/uniqBy"));
|
|
18
18
|
exports.TIMEOUT_LIMIT = 60000; // 1 minute
|
|
19
19
|
const fileMetadataJoi = joi_1.default.object({
|
|
@@ -108,7 +108,7 @@ async function buildBundlesAsync({ projectDir, inputDir, }) {
|
|
|
108
108
|
throw new Error('Could not locate package.json');
|
|
109
109
|
}
|
|
110
110
|
log_1.default.withTick(`Building bundle with expo-cli...`);
|
|
111
|
-
await (0,
|
|
111
|
+
await (0, expoCli_1.expoCommandAsync)(projectDir, ['export', '--output-dir', inputDir, '--experimental-bundle']);
|
|
112
112
|
}
|
|
113
113
|
exports.buildBundlesAsync = buildBundlesAsync;
|
|
114
114
|
async function resolveInputDirectoryAsync(customInputDirectory) {
|
|
@@ -6,7 +6,7 @@ const config_plugins_1 = require("@expo/config-plugins");
|
|
|
6
6
|
const eas_build_job_1 = require("@expo/eas-build-job");
|
|
7
7
|
const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
|
|
8
8
|
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
9
|
-
const vcs_1 =
|
|
9
|
+
const vcs_1 = require("../vcs");
|
|
10
10
|
async function resolveWorkflowAsync(projectDir, platform) {
|
|
11
11
|
let platformWorkflowMarker;
|
|
12
12
|
try {
|
|
@@ -19,7 +19,7 @@ async function resolveWorkflowAsync(projectDir, platform) {
|
|
|
19
19
|
return eas_build_job_1.Workflow.MANAGED;
|
|
20
20
|
}
|
|
21
21
|
if (await fs_extra_1.default.pathExists(platformWorkflowMarker)) {
|
|
22
|
-
return (await vcs_1.
|
|
22
|
+
return (await (0, vcs_1.getVcsClient)().isFileIgnoredAsync(path_1.default.relative(projectDir, platformWorkflowMarker)))
|
|
23
23
|
? eas_build_job_1.Workflow.MANAGED
|
|
24
24
|
: eas_build_job_1.Workflow.GENERIC;
|
|
25
25
|
}
|
|
@@ -65,7 +65,7 @@ class IosSubmitter extends BaseSubmitter_1.default {
|
|
|
65
65
|
// structuring order affects table rows order
|
|
66
66
|
return {
|
|
67
67
|
ascAppIdentifier,
|
|
68
|
-
appleIdUsername,
|
|
68
|
+
appleIdUsername: appleIdUsername !== null && appleIdUsername !== void 0 ? appleIdUsername : undefined,
|
|
69
69
|
projectId,
|
|
70
70
|
...(ascApiKeyResult
|
|
71
71
|
? { formattedAscApiKey: formatServiceAccountSummary(ascApiKeyResult) }
|
package/build/user/User.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const easCliVersion: string;
|
|
File without changes
|
|
File without changes
|
package/build/utils/profiles.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProfilesAsync = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const eas_json_1 = require("@expo/eas-json");
|
|
5
6
|
const log_1 = (0, tslib_1.__importDefault)(require("../log"));
|
|
6
7
|
async function getProfilesAsync({ platforms, profileName: profileNameArg,
|
|
7
8
|
// eslint-disable-next-line async-protect/async-suffix
|
|
@@ -14,13 +15,19 @@ readProfileAsync, }) {
|
|
|
14
15
|
profile = await readProfileAsync(platform, 'production');
|
|
15
16
|
profileName = 'production';
|
|
16
17
|
}
|
|
17
|
-
catch (
|
|
18
|
+
catch (errorOuter) {
|
|
19
|
+
if (errorOuter instanceof eas_json_1.errors.InvalidEasJsonError) {
|
|
20
|
+
throw errorOuter;
|
|
21
|
+
}
|
|
18
22
|
try {
|
|
19
23
|
profile = await readProfileAsync(platform, 'release');
|
|
20
24
|
profileName = 'release';
|
|
21
25
|
log_1.default.warn('The default profile changed from "release" to "production". We detected that you still have a "release" build profile, so we are using it. Update eas.json to have a profile named "production" under the `build` key, or specify which profile you\'d like to use with the --profile flag. This fallback behavior will be removed in the next major version of EAS CLI.');
|
|
22
26
|
}
|
|
23
|
-
catch (
|
|
27
|
+
catch (errorInner) {
|
|
28
|
+
if (errorInner instanceof eas_json_1.errors.InvalidEasJsonError) {
|
|
29
|
+
throw errorInner;
|
|
30
|
+
}
|
|
24
31
|
throw new Error('There is no profile named "production" in eas.json');
|
|
25
32
|
}
|
|
26
33
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Client } from '../vcs';
|
|
2
|
+
export default class GitClient extends Client {
|
|
3
|
+
ensureRepoExistsAsync(): Promise<void>;
|
|
4
|
+
commitAsync({ commitMessage, commitAllFiles, }: {
|
|
5
|
+
commitMessage: string;
|
|
6
|
+
commitAllFiles?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
isCommitRequiredAsync(): Promise<boolean>;
|
|
9
|
+
hasUncommittedChangesAsync(): Promise<boolean>;
|
|
10
|
+
getRootPathAsync(): Promise<string>;
|
|
11
|
+
makeShallowCopyAsync(destinationPath: string): Promise<void>;
|
|
12
|
+
getCommitHashAsync(): Promise<string | undefined>;
|
|
13
|
+
trackFileAsync(file: string): Promise<void>;
|
|
14
|
+
getBranchNameAsync(): Promise<string | null>;
|
|
15
|
+
getLastCommitMessageAsync(): Promise<string | null>;
|
|
16
|
+
showDiffAsync(): Promise<void>;
|
|
17
|
+
isFileUntrackedAsync(path: string): Promise<boolean>;
|
|
18
|
+
isFileIgnoredAsync(filePath: string): Promise<boolean>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Checks if git is configured to be case sensitive
|
|
22
|
+
* @returns {boolean | undefined}
|
|
23
|
+
* - boolean - is git case sensitive
|
|
24
|
+
* - undefined - case sensitivity is not configured and git is using default behavior
|
|
25
|
+
*/
|
|
26
|
+
export declare function isGitCaseSensitiveAsync(): Promise<boolean | undefined>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isGitCaseSensitiveAsync = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"));
|
|
6
|
+
const log_1 = (0, tslib_1.__importStar)(require("../../log"));
|
|
7
|
+
const prompts_1 = require("../../prompts");
|
|
8
|
+
const git_1 = require("../git");
|
|
9
|
+
const vcs_1 = require("../vcs");
|
|
10
|
+
class GitClient extends vcs_1.Client {
|
|
11
|
+
async ensureRepoExistsAsync() {
|
|
12
|
+
if (!(await (0, git_1.isGitInstalledAsync)())) {
|
|
13
|
+
throw new Error('git command not found, install it before proceeding');
|
|
14
|
+
}
|
|
15
|
+
if (await (0, git_1.doesGitRepoExistAsync)()) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
log_1.default.warn("It looks like you haven't initialized the git repository yet.");
|
|
19
|
+
log_1.default.warn('EAS Build requires you to use a git repository for your project.');
|
|
20
|
+
const confirmInit = await (0, prompts_1.confirmAsync)({
|
|
21
|
+
message: `Would you like us to run 'git init' in the current directory for you?`,
|
|
22
|
+
});
|
|
23
|
+
if (!confirmInit) {
|
|
24
|
+
throw new Error('A git repository is required for building your project. Initialize it and run this command again.');
|
|
25
|
+
}
|
|
26
|
+
await (0, spawn_async_1.default)('git', ['init']);
|
|
27
|
+
log_1.default.log("We're going to make an initial commit for your repository.");
|
|
28
|
+
const { message } = await (0, prompts_1.promptAsync)({
|
|
29
|
+
type: 'text',
|
|
30
|
+
name: 'message',
|
|
31
|
+
message: 'Commit message:',
|
|
32
|
+
initial: 'Initial commit',
|
|
33
|
+
validate: (input) => input !== '',
|
|
34
|
+
});
|
|
35
|
+
await this.commitAsync({ commitAllFiles: true, commitMessage: message });
|
|
36
|
+
}
|
|
37
|
+
async commitAsync({ commitMessage, commitAllFiles, }) {
|
|
38
|
+
if (commitAllFiles) {
|
|
39
|
+
await (0, spawn_async_1.default)('git', ['add', '-A']);
|
|
40
|
+
}
|
|
41
|
+
await (0, spawn_async_1.default)('git', ['add', '-u']);
|
|
42
|
+
await (0, spawn_async_1.default)('git', ['commit', '-m', commitMessage]);
|
|
43
|
+
}
|
|
44
|
+
async isCommitRequiredAsync() {
|
|
45
|
+
return await this.hasUncommittedChangesAsync();
|
|
46
|
+
}
|
|
47
|
+
async hasUncommittedChangesAsync() {
|
|
48
|
+
const changes = await (0, git_1.gitStatusAsync)({ showUntracked: true });
|
|
49
|
+
return changes.length > 0;
|
|
50
|
+
}
|
|
51
|
+
async getRootPathAsync() {
|
|
52
|
+
return (await (0, spawn_async_1.default)('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
|
|
53
|
+
}
|
|
54
|
+
async makeShallowCopyAsync(destinationPath) {
|
|
55
|
+
if (await this.hasUncommittedChangesAsync()) {
|
|
56
|
+
// it should already be checked before this function is called, but in case it wasn't
|
|
57
|
+
// we want to ensure that any changes were introduced by call to `setGitCaseSensitivityAsync`
|
|
58
|
+
throw new Error('You have some uncommitted changes in your repository.');
|
|
59
|
+
}
|
|
60
|
+
let gitRepoUri;
|
|
61
|
+
if (process.platform === 'win32') {
|
|
62
|
+
// getRootDirectoryAsync() will return C:/path/to/repo on Windows and path
|
|
63
|
+
// prefix should be file:///
|
|
64
|
+
gitRepoUri = `file:///${await this.getRootPathAsync()}`;
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// getRootDirectoryAsync() will /path/to/repo, and path prefix should be
|
|
68
|
+
// file:/// so only file:// needs to be prepended
|
|
69
|
+
gitRepoUri = `file://${await this.getRootPathAsync()}`;
|
|
70
|
+
}
|
|
71
|
+
const isCaseSensitive = await isGitCaseSensitiveAsync();
|
|
72
|
+
await setGitCaseSensitivityAsync(true);
|
|
73
|
+
try {
|
|
74
|
+
if (await this.hasUncommittedChangesAsync()) {
|
|
75
|
+
log_1.default.error('Detected inconsistent filename casing between your local filesystem and git.');
|
|
76
|
+
log_1.default.error('This will likely cause your build to fail. Impacted files:');
|
|
77
|
+
await (0, spawn_async_1.default)('git', ['status', '--short'], { stdio: 'inherit' });
|
|
78
|
+
log_1.default.newLine();
|
|
79
|
+
log_1.default.error(`Error: Resolve filename casing inconsistencies before proceeding. ${(0, log_1.learnMore)('https://expo.fyi/macos-ignorecase')}`);
|
|
80
|
+
throw new Error('You have some uncommitted changes in your repository.');
|
|
81
|
+
}
|
|
82
|
+
await (0, spawn_async_1.default)('git', [
|
|
83
|
+
'clone',
|
|
84
|
+
'--no-hardlinks',
|
|
85
|
+
'--depth',
|
|
86
|
+
'1',
|
|
87
|
+
gitRepoUri,
|
|
88
|
+
destinationPath,
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
await setGitCaseSensitivityAsync(isCaseSensitive);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async getCommitHashAsync() {
|
|
96
|
+
try {
|
|
97
|
+
return (await (0, spawn_async_1.default)('git', ['rev-parse', 'HEAD'])).stdout.trim();
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async trackFileAsync(file) {
|
|
104
|
+
await (0, spawn_async_1.default)('git', ['add', '--intent-to-add', file]);
|
|
105
|
+
}
|
|
106
|
+
async getBranchNameAsync() {
|
|
107
|
+
try {
|
|
108
|
+
return (await (0, spawn_async_1.default)('git', ['rev-parse', '--abbrev-ref', 'HEAD'])).stdout.trim();
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async getLastCommitMessageAsync() {
|
|
115
|
+
try {
|
|
116
|
+
return (await (0, spawn_async_1.default)('git', ['--no-pager', 'log', '-1', '--pretty=%B'])).stdout.trim();
|
|
117
|
+
}
|
|
118
|
+
catch (e) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
async showDiffAsync() {
|
|
123
|
+
const outputTooLarge = (await (0, git_1.getGitDiffOutputAsync)()).split(/\r\n|\r|\n/).length > 100;
|
|
124
|
+
await (0, git_1.gitDiffAsync)({ withPager: outputTooLarge });
|
|
125
|
+
}
|
|
126
|
+
async isFileUntrackedAsync(path) {
|
|
127
|
+
const withUntrackedFiles = await (0, git_1.gitStatusAsync)({ showUntracked: true });
|
|
128
|
+
const trackedFiles = await (0, git_1.gitStatusAsync)({ showUntracked: false });
|
|
129
|
+
const pathWithoutLeadingDot = path.replace(/^\.\//, ''); // remove leading './' from path
|
|
130
|
+
return (withUntrackedFiles.includes(pathWithoutLeadingDot) &&
|
|
131
|
+
!trackedFiles.includes(pathWithoutLeadingDot));
|
|
132
|
+
}
|
|
133
|
+
async isFileIgnoredAsync(filePath) {
|
|
134
|
+
try {
|
|
135
|
+
await (0, spawn_async_1.default)('git', ['check-ignore', '-q', filePath]);
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
catch (e) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.default = GitClient;
|
|
144
|
+
/**
|
|
145
|
+
* Checks if git is configured to be case sensitive
|
|
146
|
+
* @returns {boolean | undefined}
|
|
147
|
+
* - boolean - is git case sensitive
|
|
148
|
+
* - undefined - case sensitivity is not configured and git is using default behavior
|
|
149
|
+
*/
|
|
150
|
+
async function isGitCaseSensitiveAsync() {
|
|
151
|
+
if (process.platform !== 'darwin') {
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
const result = await (0, spawn_async_1.default)('git', ['config', '--get', 'core.ignorecase']);
|
|
156
|
+
const isIgnoreCaseEnabled = result.stdout.trim();
|
|
157
|
+
if (isIgnoreCaseEnabled === '') {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
else if (isIgnoreCaseEnabled === 'true') {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.isGitCaseSensitiveAsync = isGitCaseSensitiveAsync;
|
|
172
|
+
async function setGitCaseSensitivityAsync(enable) {
|
|
173
|
+
// we are assuming that if someone sets that on non-macos device then
|
|
174
|
+
// they know what they are doing
|
|
175
|
+
if (process.platform !== 'darwin') {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (enable === undefined) {
|
|
179
|
+
await (0, spawn_async_1.default)('git', ['config', '--unset', 'core.ignorecase']);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
await (0, spawn_async_1.default)('git', ['config', 'core.ignorecase', String(!enable)]);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import GitClient from './git';
|
|
2
|
+
export default class GitNoCommitClient extends GitClient {
|
|
3
|
+
isCommitRequiredAsync(): Promise<boolean>;
|
|
4
|
+
getRootPathAsync(): Promise<string>;
|
|
5
|
+
makeShallowCopyAsync(destinationPath: string): Promise<void>;
|
|
6
|
+
isFileIgnoredAsync(filePath: string): Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const spawn_async_1 = (0, tslib_1.__importDefault)(require("@expo/spawn-async"));
|
|
5
|
+
const path_1 = (0, tslib_1.__importDefault)(require("path"));
|
|
6
|
+
const local_1 = require("../local");
|
|
7
|
+
const git_1 = (0, tslib_1.__importDefault)(require("./git"));
|
|
8
|
+
class GitNoCommitClient extends git_1.default {
|
|
9
|
+
async isCommitRequiredAsync() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
async getRootPathAsync() {
|
|
13
|
+
return (await (0, spawn_async_1.default)('git', ['rev-parse', '--show-toplevel'])).stdout.trim();
|
|
14
|
+
}
|
|
15
|
+
async makeShallowCopyAsync(destinationPath) {
|
|
16
|
+
// normalize converts C:/some/path to C:\some\path on windows
|
|
17
|
+
const srcPath = path_1.default.normalize(await this.getRootPathAsync());
|
|
18
|
+
await (0, local_1.makeShallowCopyAsync)(srcPath, destinationPath);
|
|
19
|
+
}
|
|
20
|
+
async isFileIgnoredAsync(filePath) {
|
|
21
|
+
// normalize converts C:/some/path to C:\some\path on windows
|
|
22
|
+
const ignore = new local_1.Ignore(await this.getRootPathAsync());
|
|
23
|
+
await ignore.initIgnoreAsync();
|
|
24
|
+
return ignore.ignores(filePath);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = GitNoCommitClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const local_1 = require("../local");
|
|
4
|
+
const vcs_1 = require("../vcs");
|
|
5
|
+
class NoVcsClient extends vcs_1.Client {
|
|
6
|
+
async getRootPathAsync() {
|
|
7
|
+
return (0, local_1.getRootPath)();
|
|
8
|
+
}
|
|
9
|
+
async makeShallowCopyAsync(destinationPath) {
|
|
10
|
+
const srcPath = (0, local_1.getRootPath)();
|
|
11
|
+
await (0, local_1.makeShallowCopyAsync)(srcPath, destinationPath);
|
|
12
|
+
}
|
|
13
|
+
async isFileIgnoredAsync(filePath) {
|
|
14
|
+
const ignore = new local_1.Ignore((0, local_1.getRootPath)());
|
|
15
|
+
await ignore.initIgnoreAsync();
|
|
16
|
+
return ignore.ignores(filePath);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.default = NoVcsClient;
|
package/build/vcs/git.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
commitMessage: string;
|
|
6
|
-
commitAllFiles?: boolean;
|
|
7
|
-
}): Promise<void>;
|
|
8
|
-
hasUncommittedChangesAsync(): Promise<boolean>;
|
|
9
|
-
getRootPathAsync(): Promise<string>;
|
|
10
|
-
makeShallowCopyAsync(destinationPath: string): Promise<void>;
|
|
11
|
-
getCommitHashAsync(): Promise<string | undefined>;
|
|
12
|
-
trackFileAsync(file: string): Promise<void>;
|
|
13
|
-
getBranchNameAsync(): Promise<string | null>;
|
|
14
|
-
getLastCommitMessageAsync(): Promise<string | null>;
|
|
15
|
-
showDiffAsync(): Promise<void>;
|
|
16
|
-
isFileUntrackedAsync(path: string): Promise<boolean>;
|
|
17
|
-
isFileIgnoredAsync(filePath: string): Promise<boolean>;
|
|
1
|
+
export declare function isGitInstalledAsync(): Promise<boolean>;
|
|
2
|
+
export declare function doesGitRepoExistAsync(): Promise<boolean>;
|
|
3
|
+
interface GitStatusOptions {
|
|
4
|
+
showUntracked?: boolean;
|
|
18
5
|
}
|
|
6
|
+
export declare function gitStatusAsync({ showUntracked }?: GitStatusOptions): Promise<string>;
|
|
7
|
+
export declare function getGitDiffOutputAsync(): Promise<string>;
|
|
8
|
+
export declare function gitDiffAsync({ withPager, }?: {
|
|
9
|
+
withPager?: boolean;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
export {};
|