rock 0.4.0 → 0.8.13
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 +51 -182
- package/dist/src/bin.d.ts +2 -0
- package/dist/src/bin.d.ts.map +1 -0
- package/dist/src/bin.js +7 -0
- package/dist/src/bin.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/adHocTemplates.d.ts +13 -0
- package/dist/src/lib/adHocTemplates.js +366 -0
- package/dist/src/lib/adHocTemplates.js.map +1 -0
- package/dist/src/lib/checkDeprecatedOptions.d.ts +1 -0
- package/dist/src/lib/checkDeprecatedOptions.d.ts.map +1 -0
- package/dist/src/lib/checkDeprecatedOptions.js +60 -0
- package/dist/src/lib/checkDeprecatedOptions.js.map +1 -0
- package/dist/src/lib/cli.d.ts +6 -0
- package/dist/src/lib/cli.d.ts.map +1 -0
- package/dist/src/lib/cli.js +101 -0
- package/dist/src/lib/cli.js.map +1 -0
- package/dist/src/lib/plugins/clean.d.ts +2 -0
- package/dist/src/lib/plugins/clean.d.ts.map +1 -0
- package/dist/src/lib/plugins/clean.js +317 -0
- package/dist/src/lib/plugins/clean.js.map +1 -0
- package/dist/src/lib/plugins/fingerprint.d.ts +12 -0
- package/dist/src/lib/plugins/fingerprint.d.ts.map +1 -0
- package/dist/src/lib/plugins/fingerprint.js +72 -0
- package/dist/src/lib/plugins/fingerprint.js.map +1 -0
- package/dist/src/lib/plugins/logConfig.d.ts +14 -0
- package/dist/src/lib/plugins/logConfig.d.ts.map +1 -0
- package/dist/src/lib/plugins/logConfig.js +54 -0
- package/dist/src/lib/plugins/logConfig.js.map +1 -0
- package/dist/src/lib/plugins/remoteCache.d.ts +2 -0
- package/dist/src/lib/plugins/remoteCache.d.ts.map +1 -0
- package/dist/src/lib/plugins/remoteCache.js +335 -0
- package/dist/src/lib/plugins/remoteCache.js.map +1 -0
- package/dist/src/lib/plugins/templateIndexHtml.d.ts +5 -0
- package/dist/src/lib/plugins/templateIndexHtml.js +189 -0
- package/dist/src/lib/plugins/templateIndexHtml.js.map +1 -0
- package/dist/src/lib/plugins/templateManifestPlist.d.ts +8 -0
- package/dist/src/lib/plugins/templateManifestPlist.js +36 -0
- package/dist/src/lib/plugins/templateManifestPlist.js.map +1 -0
- package/package.json +31 -50
- package/.npmignore +0 -1
- package/.travis.yml +0 -4
- package/CHANGELOG.md +0 -61
- package/LICENSE +0 -15
- package/bin/rock +0 -43
- package/docs/predefined-tokens.md +0 -31
- package/lib/rock.js +0 -213
- package/lib/tweezers.js +0 -37
- package/lib/util.js +0 -9
- package/test/mocha.opts +0 -3
- package/test/resources/expect/myapp/LICENSE +0 -15
- package/test/resources/expect/myapp/README.md +0 -17
- package/test/resources/expect/myapp/ignore_this/READTHIS.md +0 -1
- package/test/resources/expect/myapp/lib/cool_module.js +0 -4
- package/test/resources/expect/myapp/test/cool_module.test.js +0 -4
- package/test/resources/rock.conf.json +0 -3
- package/test/resources/rocks/date.txt +0 -1
- package/test/resources/rocks/literal-alt.txt +0 -1
- package/test/resources/rocks/literal.txt +0 -1
- package/test/resources/rocks/node-lib/.rock/rock.json +0 -9
- package/test/resources/rocks/node-lib/.rock/scripts/bye.js +0 -1
- package/test/resources/rocks/node-lib/.rock/scripts/hi.sh +0 -3
- package/test/resources/rocks/node-lib/LICENSE +0 -15
- package/test/resources/rocks/node-lib/README.md +0 -17
- package/test/resources/rocks/node-lib/ignore_this/READTHIS.md +0 -1
- package/test/resources/rocks/node-lib/lib/{{project-name}}.js +0 -4
- package/test/resources/rocks/node-lib/test/{{project-name}}.test.js +0 -4
- package/test/resources/rocks/node-lib-tmpl/.rock/rock.json +0 -13
- package/test/resources/rocks/node-lib-tmpl/.rock/scripts/bye.js +0 -1
- package/test/resources/rocks/node-lib-tmpl/.rock/scripts/hi.sh +0 -3
- package/test/resources/rocks/node-lib-tmpl/LICENSE +0 -15
- package/test/resources/rocks/node-lib-tmpl/README.md +0 -17
- package/test/resources/rocks/node-lib-tmpl/ignore_this/READTHIS.md +0 -1
- package/test/resources/rocks/node-lib-tmpl/lib/@@project-name@@.js +0 -4
- package/test/resources/rocks/node-lib-tmpl/test/@@project-name@@.test.js +0 -4
- package/test/rock-bin.test.js +0 -73
- package/test/rock-dload-github.test.js +0 -41
- package/test/rock-file.test.js +0 -47
- package/test/rock.predefined-locals.js +0 -52
- package/test/rock.test.js +0 -78
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function isValidRNDependency(config) {
|
|
2
|
+
return (Object.keys(config.platforms).filter((key) => Boolean(config.platforms[key])).length !== 0);
|
|
3
|
+
}
|
|
4
|
+
function filterConfig(config) {
|
|
5
|
+
const filtered = { ...config };
|
|
6
|
+
// `react-native` is not a dependency. When loading it through community CLI it's not an issue,
|
|
7
|
+
// but in our case we don't install `@react-native-community/cli-platform-*` as a dependencies
|
|
8
|
+
// so the config.platforms key is empty, which makes autolinking treat it as a dependency.
|
|
9
|
+
delete filtered.dependencies['react-native'];
|
|
10
|
+
const dependencies = {};
|
|
11
|
+
Object.keys(filtered.dependencies).forEach((item) => {
|
|
12
|
+
if (isValidRNDependency(filtered.dependencies[item])) {
|
|
13
|
+
dependencies[item] = filtered.dependencies[item];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
...filtered,
|
|
18
|
+
dependencies,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export const logConfig = async (args, ownConfig) => {
|
|
22
|
+
const { loadConfigAsync } = await import('@react-native-community/cli-config');
|
|
23
|
+
const config = await loadConfigAsync({
|
|
24
|
+
projectRoot: ownConfig.root,
|
|
25
|
+
selectedPlatform: args.platform,
|
|
26
|
+
});
|
|
27
|
+
const platforms = ownConfig.platforms && args.platform
|
|
28
|
+
? { [args.platform]: ownConfig.platforms[args.platform] }
|
|
29
|
+
: ownConfig.platforms;
|
|
30
|
+
for (const platform in platforms) {
|
|
31
|
+
config.project[platform] = platforms[platform].autolinkingConfig.project;
|
|
32
|
+
}
|
|
33
|
+
console.log(JSON.stringify(filterConfig(config), null, 2));
|
|
34
|
+
};
|
|
35
|
+
export const logConfigPlugin = (ownConfig) => (api) => {
|
|
36
|
+
api.registerCommand({
|
|
37
|
+
name: 'config',
|
|
38
|
+
description: 'Output autolinking config',
|
|
39
|
+
action: async (args) => {
|
|
40
|
+
await logConfig(args, ownConfig);
|
|
41
|
+
},
|
|
42
|
+
options: [
|
|
43
|
+
{
|
|
44
|
+
name: '-p, --platform <string>',
|
|
45
|
+
description: 'Select platform, e.g. ios or android',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
name: 'internal_config',
|
|
51
|
+
description: 'Configuration plugin',
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=logConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logConfig.js","sourceRoot":"","sources":["../../../../src/lib/plugins/logConfig.ts"],"names":[],"mappings":"AAMA,SAAS,mBAAmB,CAAC,MAAwB;IACnD,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAC/B,CAAC,MAAM,KAAK,CAAC,CACf,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,MAAM,QAAQ,GAAG,EAAE,GAAG,MAAM,EAAE,CAAC;IAC/B,+FAA+F;IAC/F,8FAA8F;IAC9F,0FAA0F;IAC1F,OAAO,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAqC,EAAE,CAAC;IAC1D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,C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AAe,CAAC;QAClB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,2BAA2B;QACxC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACrB,MAAM,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,WAAW,EAAE,sCAAsC;aACpD;SACF;KACF,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,sBAAsB;KACpC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteCache.d.ts","sourceRoot":"","sources":["../../../../src/lib/plugins/remoteCache.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAiP5D,eAAO,MAAM,iBAAiB,SAE3B,KAAK,SAAS,KAAG,YA6DjB,CAAC"}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { color, colorLink, formatArtifactName, getLocalArtifactPath, getLocalBinaryPath, handleDownloadResponse, handleUploadResponse, logger, relativeToCwd, RockError, spawn, spinner, } from '@rock-js/tools';
|
|
5
|
+
import AdmZip from 'adm-zip';
|
|
6
|
+
import * as tar from 'tar';
|
|
7
|
+
import { templateIndexHtml, templateManifestPlist } from '../adHocTemplates.js';
|
|
8
|
+
async function remoteCache({ action, args, remoteCacheProvider, projectRoot, fingerprintOptions, }) {
|
|
9
|
+
const isJsonOutput = args.json;
|
|
10
|
+
if (!remoteCacheProvider) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const remoteBuildCache = remoteCacheProvider();
|
|
14
|
+
validateArgs(args, action);
|
|
15
|
+
const artifactName = args.name ??
|
|
16
|
+
(await formatArtifactName({
|
|
17
|
+
platform: args.platform,
|
|
18
|
+
traits: args.traits,
|
|
19
|
+
root: projectRoot,
|
|
20
|
+
fingerprintOptions,
|
|
21
|
+
raw: isJsonOutput,
|
|
22
|
+
}));
|
|
23
|
+
switch (action) {
|
|
24
|
+
case 'list': {
|
|
25
|
+
const artifacts = await remoteBuildCache.list({
|
|
26
|
+
artifactName,
|
|
27
|
+
limit: args.all ? undefined : 1,
|
|
28
|
+
});
|
|
29
|
+
if (artifacts.length > 0 && !args.all) {
|
|
30
|
+
const artifact = artifacts[0];
|
|
31
|
+
if (isJsonOutput) {
|
|
32
|
+
console.log(JSON.stringify(artifact, null, 2));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
logger.log(`Artifact information:
|
|
36
|
+
- name: ${color.bold(color.blue(artifact.name))}
|
|
37
|
+
- url: ${colorLink(artifact.url)}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (artifacts.length > 0 && args.all) {
|
|
41
|
+
if (isJsonOutput) {
|
|
42
|
+
console.log(JSON.stringify(artifacts, null, 2));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
artifacts.forEach((artifact) => {
|
|
46
|
+
logger.log(`Artifact information:
|
|
47
|
+
- name: ${color.bold(color.blue(artifact.name))}
|
|
48
|
+
- url: ${colorLink(artifact.url)}`);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case 'list-all': {
|
|
55
|
+
const artifactName = undefined;
|
|
56
|
+
const artifacts = await remoteBuildCache.list({ artifactName });
|
|
57
|
+
const platform = args.platform;
|
|
58
|
+
const traits = args.traits;
|
|
59
|
+
const output = platform && traits
|
|
60
|
+
? artifacts.filter((artifact) => artifact.name.startsWith(`rock-${platform}-${traits.join('-')}`))
|
|
61
|
+
: artifacts;
|
|
62
|
+
if (isJsonOutput) {
|
|
63
|
+
console.log(JSON.stringify(output, null, 2));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
logger.log(`Artifacts:
|
|
67
|
+
${output
|
|
68
|
+
.map((artifact) => `- name: ${color.bold(color.blue(artifact.name))}\n- url: ${colorLink(artifact.url)}`)
|
|
69
|
+
.join('\n')}
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
case 'download': {
|
|
75
|
+
const localArtifactPath = getLocalArtifactPath(artifactName);
|
|
76
|
+
const response = await remoteBuildCache.download({ artifactName });
|
|
77
|
+
const loader = spinner({ silent: isJsonOutput });
|
|
78
|
+
loader.start(`Downloading cached build from ${color.bold(remoteBuildCache.name)}`);
|
|
79
|
+
await handleDownloadResponse(response, localArtifactPath, (progress, totalMB) => {
|
|
80
|
+
loader.message(`Downloading cached build from ${color.bold(remoteBuildCache.name)} (${progress}% of ${totalMB} MB)`);
|
|
81
|
+
});
|
|
82
|
+
const binaryPath = getLocalBinaryPath(localArtifactPath);
|
|
83
|
+
loader.stop(`Downloaded cached build from ${color.bold(remoteBuildCache.name)}`);
|
|
84
|
+
if (!binaryPath) {
|
|
85
|
+
throw new RockError(`Failed to save binary for "${artifactName}".`);
|
|
86
|
+
}
|
|
87
|
+
if (isJsonOutput) {
|
|
88
|
+
console.log(JSON.stringify({ name: artifactName, path: binaryPath }, null, 2));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
logger.log(`Artifact information:
|
|
92
|
+
- name: ${color.bold(color.blue(artifactName))}
|
|
93
|
+
- path: ${colorLink(relativeToCwd(binaryPath))}`);
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case 'upload': {
|
|
98
|
+
const localArtifactPath = getLocalArtifactPath(artifactName);
|
|
99
|
+
const binaryPath = args.binaryPath ?? getLocalBinaryPath(localArtifactPath);
|
|
100
|
+
if (!binaryPath) {
|
|
101
|
+
throw new RockError(`No binary found for "${artifactName}".`);
|
|
102
|
+
}
|
|
103
|
+
const buffer = await getBinaryBuffer(binaryPath, artifactName, localArtifactPath, args);
|
|
104
|
+
try {
|
|
105
|
+
let uploadedArtifact;
|
|
106
|
+
const appFileName = path.basename(binaryPath);
|
|
107
|
+
const appName = appFileName.replace(/\.[^/.]+$/, '');
|
|
108
|
+
const { name, url, getResponse } = await remoteBuildCache.upload({
|
|
109
|
+
artifactName,
|
|
110
|
+
uploadArtifactName: args.adHoc
|
|
111
|
+
? `ad-hoc/${artifactName}/${appName}.ipa`
|
|
112
|
+
: undefined,
|
|
113
|
+
});
|
|
114
|
+
const uploadMessage = `${args.adHoc ? 'IPA, index.html and manifest.plist' : 'build'} to ${color.bold(remoteBuildCache.name)}`;
|
|
115
|
+
const loader = spinner({ silent: isJsonOutput });
|
|
116
|
+
loader.start(`Uploading ${uploadMessage}`);
|
|
117
|
+
await handleUploadResponse(getResponse, buffer, (progress, totalMB) => {
|
|
118
|
+
loader.message(`Uploading ${uploadMessage} (${progress}% of ${totalMB} MB)`);
|
|
119
|
+
});
|
|
120
|
+
uploadedArtifact = { name, url };
|
|
121
|
+
// Upload index.html and manifest.plist for ad-hoc distribution
|
|
122
|
+
if (args.adHoc) {
|
|
123
|
+
const { version, bundleIdentifier } = await getInfoPlist(binaryPath);
|
|
124
|
+
const { url: urlIndexHtml, getResponse: getResponseIndexHtml } = await remoteBuildCache.upload({
|
|
125
|
+
artifactName,
|
|
126
|
+
uploadArtifactName: `ad-hoc/${artifactName}/index.html`,
|
|
127
|
+
});
|
|
128
|
+
getResponseIndexHtml(Buffer.from(templateIndexHtml({ appName, bundleIdentifier, version })), 'text/html');
|
|
129
|
+
const { getResponse: getResponseManifestPlist } = await remoteBuildCache.upload({
|
|
130
|
+
artifactName,
|
|
131
|
+
uploadArtifactName: `ad-hoc/${artifactName}/manifest.plist`,
|
|
132
|
+
});
|
|
133
|
+
getResponseManifestPlist((baseUrl) => Buffer.from(templateManifestPlist({
|
|
134
|
+
appName,
|
|
135
|
+
version,
|
|
136
|
+
baseUrl: baseUrl.replace('/manifest.plist', ''),
|
|
137
|
+
ipaName: appFileName,
|
|
138
|
+
bundleIdentifier,
|
|
139
|
+
platformIdentifier: 'com.apple.platform.iphoneos',
|
|
140
|
+
})));
|
|
141
|
+
// For ad-hoc distribution, we want the url to point to the index.html for easier installation
|
|
142
|
+
uploadedArtifact = { name, url: urlIndexHtml.split('?')[0] + '' };
|
|
143
|
+
}
|
|
144
|
+
loader.stop(`Uploaded ${uploadMessage}`);
|
|
145
|
+
if (isJsonOutput) {
|
|
146
|
+
console.log(JSON.stringify(uploadedArtifact, null, 2));
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
logger.log(`Artifact information:
|
|
150
|
+
- name: ${color.bold(color.blue(uploadedArtifact.name))}
|
|
151
|
+
- url: ${colorLink(uploadedArtifact.url)}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw new RockError(`Failed to upload build to ${color.bold(remoteBuildCache.name)}`, { cause: error });
|
|
156
|
+
}
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
case 'delete': {
|
|
160
|
+
const deletedArtifacts = await remoteBuildCache.delete({
|
|
161
|
+
artifactName,
|
|
162
|
+
limit: args.all || args.allButLatest ? undefined : 1,
|
|
163
|
+
skipLatest: args.allButLatest,
|
|
164
|
+
});
|
|
165
|
+
if (isJsonOutput) {
|
|
166
|
+
console.log(JSON.stringify(deletedArtifacts, null, 2));
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
logger.log(`Deleted artifacts:
|
|
170
|
+
${deletedArtifacts
|
|
171
|
+
.map((artifact) => `- name: ${color.bold(color.blue(artifact.name))}\n- url: ${colorLink(artifact.url)}`)
|
|
172
|
+
.join('\n')}`);
|
|
173
|
+
}
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
case 'get-provider-name': {
|
|
177
|
+
console.log(remoteBuildCache.name);
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
async function getInfoPlist(binaryPath) {
|
|
184
|
+
const ipaFileName = path.basename(binaryPath);
|
|
185
|
+
const appName = path.basename(ipaFileName, '.ipa');
|
|
186
|
+
const ipaPath = binaryPath;
|
|
187
|
+
const zip = new AdmZip(ipaPath);
|
|
188
|
+
const infoPlistPath = `Payload/${appName}.app/Info.plist`;
|
|
189
|
+
const infoPlistEntry = zip.getEntry(infoPlistPath);
|
|
190
|
+
if (!infoPlistEntry) {
|
|
191
|
+
throw new RockError(`Info.plist not found at ${infoPlistPath} in ${ipaFileName}`);
|
|
192
|
+
}
|
|
193
|
+
const infoPlistBuffer = infoPlistEntry.getData();
|
|
194
|
+
const tempPlistPath = path.join(os.tmpdir(), 'rock-temp-info.plist');
|
|
195
|
+
fs.writeFileSync(tempPlistPath, infoPlistBuffer);
|
|
196
|
+
let version = 'unknown';
|
|
197
|
+
let bundleIdentifier = 'unknown';
|
|
198
|
+
try {
|
|
199
|
+
await spawn('plutil', [
|
|
200
|
+
'-convert',
|
|
201
|
+
'json',
|
|
202
|
+
'-o',
|
|
203
|
+
tempPlistPath,
|
|
204
|
+
tempPlistPath,
|
|
205
|
+
]);
|
|
206
|
+
const jsonContent = fs.readFileSync(tempPlistPath, 'utf8');
|
|
207
|
+
const infoPlistJson = JSON.parse(jsonContent);
|
|
208
|
+
version =
|
|
209
|
+
infoPlistJson['CFBundleShortVersionString'] ||
|
|
210
|
+
infoPlistJson['CFBundleVersion'] ||
|
|
211
|
+
'unknown';
|
|
212
|
+
bundleIdentifier = infoPlistJson['CFBundleIdentifier'];
|
|
213
|
+
}
|
|
214
|
+
finally {
|
|
215
|
+
if (fs.existsSync(tempPlistPath)) {
|
|
216
|
+
fs.unlinkSync(tempPlistPath);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return { version, bundleIdentifier };
|
|
220
|
+
}
|
|
221
|
+
async function getBinaryBuffer(binaryPath, artifactName, localArtifactPath, args) {
|
|
222
|
+
// For ad-hoc, we don't need to zip the binary, we just upload the IPA
|
|
223
|
+
if (args.adHoc) {
|
|
224
|
+
return fs.readFileSync(binaryPath);
|
|
225
|
+
}
|
|
226
|
+
const zip = new AdmZip();
|
|
227
|
+
const isAppDirectory = binaryPath.endsWith('.app') && fs.statSync(binaryPath).isDirectory();
|
|
228
|
+
const absoluteTarballPath = args.binaryPath ?? path.join(localArtifactPath, 'app.tar.gz');
|
|
229
|
+
if (isAppDirectory) {
|
|
230
|
+
const appDirectoryName = path.basename(binaryPath);
|
|
231
|
+
if (args.binaryPath && !fs.existsSync(absoluteTarballPath)) {
|
|
232
|
+
throw new RockError(`No tarball found for "${artifactName}" in "${localArtifactPath}".`);
|
|
233
|
+
}
|
|
234
|
+
await tar.create({
|
|
235
|
+
file: absoluteTarballPath,
|
|
236
|
+
cwd: path.dirname(binaryPath),
|
|
237
|
+
gzip: true,
|
|
238
|
+
filter: (filePath) => filePath.includes(appDirectoryName),
|
|
239
|
+
}, [appDirectoryName]);
|
|
240
|
+
zip.addLocalFile(absoluteTarballPath);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
zip.addLocalFile(binaryPath);
|
|
244
|
+
}
|
|
245
|
+
const buffer = zip.toBuffer();
|
|
246
|
+
if (isAppDirectory) {
|
|
247
|
+
fs.unlinkSync(absoluteTarballPath);
|
|
248
|
+
}
|
|
249
|
+
return buffer;
|
|
250
|
+
}
|
|
251
|
+
function validateArgs(args, action) {
|
|
252
|
+
if (!action) {
|
|
253
|
+
// @todo make Commander handle this
|
|
254
|
+
throw new RockError('Action is required. Available actions: list, list-all, download, upload, delete');
|
|
255
|
+
}
|
|
256
|
+
if (action === 'list-all' || action === 'get-provider-name') {
|
|
257
|
+
// return early as we don't need to validate name or platform
|
|
258
|
+
// to list all artifacts or get provider name
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (args.name && (args.platform || args.traits)) {
|
|
262
|
+
throw new RockError('Cannot use "--name" together with "--platform" or "--traits". Use either name or platform with traits');
|
|
263
|
+
}
|
|
264
|
+
if (!args.name) {
|
|
265
|
+
if ((args.platform && !args.traits) || (!args.platform && args.traits)) {
|
|
266
|
+
throw new RockError('Either "--platform" and "--traits" must be provided together');
|
|
267
|
+
}
|
|
268
|
+
if (!args.platform || !args.traits) {
|
|
269
|
+
throw new RockError('Either "--name" or "--platform" and "--traits" must be provided');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export const remoteCachePlugin = () => (api) => {
|
|
274
|
+
api.registerCommand({
|
|
275
|
+
name: 'remote-cache',
|
|
276
|
+
description: 'Manage remote cache',
|
|
277
|
+
action: async (action, args) => {
|
|
278
|
+
await remoteCache({
|
|
279
|
+
action,
|
|
280
|
+
args,
|
|
281
|
+
remoteCacheProvider: (await api.getRemoteCacheProvider()) || null,
|
|
282
|
+
projectRoot: api.getProjectRoot(),
|
|
283
|
+
fingerprintOptions: api.getFingerprintOptions(),
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
args: [
|
|
287
|
+
{
|
|
288
|
+
name: '[action]',
|
|
289
|
+
description: 'Select action, e.g. list, list-all, download, upload, delete, get-provider-name',
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
options: [
|
|
293
|
+
{
|
|
294
|
+
name: '--json',
|
|
295
|
+
description: 'Output in JSON format',
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
name: '--name <string>',
|
|
299
|
+
description: 'Full artifact name',
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: '--all',
|
|
303
|
+
description: 'List or delete all matching artifacts. Affects "list" and "delete" actions only',
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
name: '--all-but-latest',
|
|
307
|
+
description: 'Delete all but the latest matching artifact. Affects "delete" action only',
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: '-p, --platform <string>',
|
|
311
|
+
description: 'Select platform, e.g. ios or android',
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: '-t, --traits <list>',
|
|
315
|
+
description: `Comma-separated traits that construct final artifact name. Traits for Android are: variant; for iOS: destination and configuration.
|
|
316
|
+
Example iOS: --traits simulator,Release
|
|
317
|
+
Example Android: --traits debug`,
|
|
318
|
+
parse: (val) => val.split(','),
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: '--binary-path <string>',
|
|
322
|
+
description: 'Path to the binary to upload',
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
name: '--ad-hoc',
|
|
326
|
+
description: 'Upload IPA for ad-hoc distribution and installation from URL. Additionally uploads index.html and manifest.plist',
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
});
|
|
330
|
+
return {
|
|
331
|
+
name: 'internal_remote-cache',
|
|
332
|
+
description: 'Manage remote cache',
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
//# sourceMappingURL=remoteCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteCache.js","sourceRoot":"","sources":["../../../../src/lib/plugins/remoteCache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EACL,KAAK,EACL,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,MAAM,EACN,aAAa,EACb,SAAS,EACT,KAAK,EACL,OAAO,GACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAahF,KAAK,UAAU,WAAW,CAAC,EACzB,MAAM,EACN,IAAI,EACJ,mBAAmB,EACnB,WAAW,EACX,kB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,QAAQ;gBACd,WAAW,EAAE,uBAAuB;aACrC;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,WAAW,EAAE,oBAAoB;aAClC;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,iFAAiF;aACpF;YACD;gBACE,IAAI,EAAE,kBAAkB;gBACxB,WAAW,EACT,2EAA2E;aAC9E;YACD;gBACE,IAAI,EAAE,yBAAyB;gBAC/B,WAAW,EAAE,sCAAsC;aACpD;YACD;gBACE,IAAI,EAAE,qBAAqB;gBAC3B,WAAW,EAAE;;gCAES;gBACtB,KAAK,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;aACvC;YACD;gBACE,IAAI,EAAE,wBAAwB;gBAC9B,WAAW,EAAE,8BAA8B;aAC5C;YACD;gBACE,IAAI,EAAE,UAAU;gBAChB,WAAW,EACT,kHAAkH;aACrH;SACF;KACF,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,qBAAqB;KACnC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
export const templateIndexHtmlPlugin = ({ appName, version, manifestPlistUrl, }) => {
|
|
2
|
+
return `<!DOCTYPE html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Download iOS App</title>
|
|
8
|
+
<style>
|
|
9
|
+
* {
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body {
|
|
16
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
17
|
+
Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
18
|
+
min-height: 100vh;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
padding: 20px;
|
|
23
|
+
font-size: 16px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.container {
|
|
27
|
+
text-align: center;
|
|
28
|
+
max-width: 500px;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.app-icon {
|
|
33
|
+
width: 100px;
|
|
34
|
+
height: 100px;
|
|
35
|
+
margin: 0 auto 15px;
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
font-size: 48px;
|
|
40
|
+
color: white;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
h1 {
|
|
44
|
+
color: #1d1d1f;
|
|
45
|
+
font-size: 28px;
|
|
46
|
+
font-weight: 600;
|
|
47
|
+
margin-bottom: 15px;
|
|
48
|
+
overflow-wrap: break-word;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.subtitle {
|
|
52
|
+
color: #86868b;
|
|
53
|
+
font-size: 16px;
|
|
54
|
+
line-height: 1.5;
|
|
55
|
+
margin-bottom: 30px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.version {
|
|
59
|
+
color: #1d1d1f;
|
|
60
|
+
font-size: 16px;
|
|
61
|
+
line-height: 1.5;
|
|
62
|
+
margin-bottom: 10px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.download-button {
|
|
66
|
+
background: #8232ff;
|
|
67
|
+
color: white;
|
|
68
|
+
border: none;
|
|
69
|
+
padding: 16px 32px;
|
|
70
|
+
border-radius: 2px;
|
|
71
|
+
font-size: 14px;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
transition: all 0.3s ease;
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
display: inline-block;
|
|
76
|
+
margin-bottom: 20px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.download-button:hover {
|
|
80
|
+
transform: translateY(-2px);
|
|
81
|
+
box-shadow: 0 10px 25px rgba(0, 122, 255, 0.3);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.download-button:active {
|
|
85
|
+
transform: translateY(0);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.instructions {
|
|
89
|
+
background: #f5f5f7;
|
|
90
|
+
border-radius: 2px;
|
|
91
|
+
padding: 20px;
|
|
92
|
+
margin-top: 20px;
|
|
93
|
+
text-align: left;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.instructions h3 {
|
|
97
|
+
color: #1d1d1f;
|
|
98
|
+
font-size: 16px;
|
|
99
|
+
margin-bottom: 10px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.instructions ol {
|
|
103
|
+
color: #86868b;
|
|
104
|
+
font-size: 14px;
|
|
105
|
+
line-height: 1.6;
|
|
106
|
+
padding-left: 20px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.instructions li {
|
|
110
|
+
margin-bottom: 8px;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.adhoc-info {
|
|
114
|
+
text-align: left;
|
|
115
|
+
margin-top: 20px;
|
|
116
|
+
padding: 1em 2em;
|
|
117
|
+
border-left: 2px solid #8232ff;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.adhoc-info-title {
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
margin-bottom: 10px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.adhoc-info-text {
|
|
126
|
+
color: #1d1d1f;
|
|
127
|
+
margin: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.footer {
|
|
131
|
+
text-align: center;
|
|
132
|
+
margin-top: 40px;
|
|
133
|
+
font-size: 12px;
|
|
134
|
+
color: #86868b;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.link {
|
|
138
|
+
color: #8232ff;
|
|
139
|
+
text-decoration: none;
|
|
140
|
+
}
|
|
141
|
+
</style>
|
|
142
|
+
</head>
|
|
143
|
+
<body>
|
|
144
|
+
<div class="container">
|
|
145
|
+
<div class="app-icon">📱</div>
|
|
146
|
+
|
|
147
|
+
<h1>${appName}</h1>
|
|
148
|
+
<p class="version">Version ${version}</p>
|
|
149
|
+
<p class="subtitle">
|
|
150
|
+
Download and install the latest version of our iOS app directly to your
|
|
151
|
+
device.
|
|
152
|
+
</p>
|
|
153
|
+
|
|
154
|
+
<a
|
|
155
|
+
href="itms-services://?action=download-manifest&url=${manifestPlistUrl}"
|
|
156
|
+
class="download-button">
|
|
157
|
+
Download App
|
|
158
|
+
</a>
|
|
159
|
+
|
|
160
|
+
<div class="instructions">
|
|
161
|
+
<h3>Installation Instructions:</h3>
|
|
162
|
+
<ol>
|
|
163
|
+
<li>Tap the "Download App" button above</li>
|
|
164
|
+
<li>If prompted, tap "Install" in the popup dialog</li>
|
|
165
|
+
<li>Go to Settings > General > VPN & Device Management</li>
|
|
166
|
+
<li>Find your developer certificate and tap "Trust"</li>
|
|
167
|
+
<li>The app will now be available on your home screen</li>
|
|
168
|
+
</ol>
|
|
169
|
+
</div>
|
|
170
|
+
|
|
171
|
+
<div class="adhoc-info">
|
|
172
|
+
<p class="adhoc-info-title">Ad-hoc build notice</p>
|
|
173
|
+
<p class="adhoc-info-text">
|
|
174
|
+
This is an ad-hoc build for testing purposes. Make sure you're using a
|
|
175
|
+
device that's registered in the provisioning profile.
|
|
176
|
+
</p>
|
|
177
|
+
</div>
|
|
178
|
+
<div class="footer">
|
|
179
|
+
<p>
|
|
180
|
+
Generated with <a class="link" href="https://rnef.dev">RNEF</a> by
|
|
181
|
+
<a class="link" href="https://callstack.com">Callstack</a>
|
|
182
|
+
</p>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
</body>
|
|
186
|
+
</html>
|
|
187
|
+
`;
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=templateIndexHtml.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateIndexHtml.js","sourceRoot":"","sources":["../../../../src/lib/plugins/templateIndexHtml.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,OAAO,EACP,OAAO,EACP,gBAAgB,GAKjB,EAAE,EAAE;IACH,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAiJG,OAAO;mCACgB,OAAO;;;;;;;8DAOoB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC7E,CAAC;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const templateManifestPlistPlugin: ({ baseUrl, ipaName, bundleIdentifier, version, appName, platformIdentifier, }: {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
ipaName: string;
|
|
4
|
+
bundleIdentifier: string;
|
|
5
|
+
version: string;
|
|
6
|
+
appName: string;
|
|
7
|
+
platformIdentifier: string;
|
|
8
|
+
}) => string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const templateManifestPlistPlugin = ({ baseUrl, ipaName, bundleIdentifier, version, appName, platformIdentifier, }) => {
|
|
2
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
3
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
4
|
+
<plist version="1.0">
|
|
5
|
+
<dict>
|
|
6
|
+
<key>items</key>
|
|
7
|
+
<array>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>assets</key>
|
|
10
|
+
<array>
|
|
11
|
+
<dict>
|
|
12
|
+
<key>kind</key>
|
|
13
|
+
<string>software-package</string>
|
|
14
|
+
<key>url</key>
|
|
15
|
+
<string>${baseUrl}/${ipaName}</string>
|
|
16
|
+
</dict>
|
|
17
|
+
</array>
|
|
18
|
+
<key>metadata</key>
|
|
19
|
+
<dict>
|
|
20
|
+
<key>bundle-identifier</key>
|
|
21
|
+
<string>${bundleIdentifier}</string>
|
|
22
|
+
<key>bundle-version</key>
|
|
23
|
+
<string>${version}</string>
|
|
24
|
+
<key>kind</key>
|
|
25
|
+
<string>software</string>
|
|
26
|
+
<key>platform-identifier</key>
|
|
27
|
+
<string>${platformIdentifier ?? 'com.apple.platform.iphoneos'}</string>
|
|
28
|
+
<key>title</key>
|
|
29
|
+
<string>${appName}</string>
|
|
30
|
+
</dict>
|
|
31
|
+
</dict>
|
|
32
|
+
</array>
|
|
33
|
+
</dict>
|
|
34
|
+
</plist>`;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=templateManifestPlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templateManifestPlist.js","sourceRoot":"","sources":["../../../../src/lib/plugins/templateManifestPlist.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,OAAO,EACP,OAAO,EACP,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,kBAAkB,GAQnB,EAAE,EAAE;IACH,OAAO;;;;;;;;;;;;;8BAaqB,OAAO,IAAI,OAAO;;;;;;0BAMtB,gBAAgB;;0BAEhB,OAAO;;;;0BAKf,kBAAkB,IAAI,6BACxB;;0BAEU,OAAO;;;;;WAKtB,CAAC;AACZ,CAAC,CAAC"}
|