@solana-mobile/dapp-store-cli 0.4.0 → 0.4.1
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/lib/esm/CliUtils.js +105 -0
- package/lib/esm/CliUtils.js.map +1 -0
- package/lib/esm/commands/{validate.js → ValidateCommand.js} +4 -3
- package/lib/esm/commands/ValidateCommand.js.map +1 -0
- package/lib/esm/commands/create/{app.js → CreateCliApp.js} +5 -4
- package/lib/esm/commands/create/CreateCliApp.js.map +1 -0
- package/lib/esm/commands/create/{publisher.js → CreateCliPublisher.js} +5 -4
- package/lib/esm/commands/create/CreateCliPublisher.js.map +1 -0
- package/lib/esm/commands/create/{release.js → CreateCliRelease.js} +5 -4
- package/lib/esm/commands/create/CreateCliRelease.js.map +1 -0
- package/lib/esm/commands/create/index.js +3 -3
- package/lib/esm/commands/create/index.js.map +1 -1
- package/lib/esm/commands/index.js +1 -1
- package/lib/esm/commands/index.js.map +1 -1
- package/lib/esm/commands/publish/{remove.js → PublishCliRemove.js} +4 -3
- package/lib/esm/commands/publish/PublishCliRemove.js.map +1 -0
- package/lib/esm/commands/publish/{submit.js → PublishCliSubmit.js} +4 -3
- package/lib/esm/commands/publish/PublishCliSubmit.js.map +1 -0
- package/lib/esm/commands/publish/{support.js → PublishCliSupport.js} +4 -3
- package/lib/esm/commands/publish/PublishCliSupport.js.map +1 -0
- package/lib/esm/commands/publish/{update.js → PublishCliUpdate.js} +4 -3
- package/lib/esm/commands/publish/PublishCliUpdate.js.map +1 -0
- package/lib/esm/commands/publish/index.js +4 -4
- package/lib/esm/commands/publish/index.js.map +1 -1
- package/lib/esm/commands/scaffolding/{init.js → ScaffoldInit.js} +2 -2
- package/lib/esm/commands/scaffolding/ScaffoldInit.js.map +1 -0
- package/lib/esm/commands/scaffolding/index.js +1 -1
- package/lib/esm/commands/scaffolding/index.js.map +1 -1
- package/lib/esm/config/PublishDetails.js +178 -0
- package/lib/esm/config/PublishDetails.js.map +1 -0
- package/lib/esm/index.js +16 -15
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/package.json +2 -2
- package/lib/types/{utils.d.ts → CliUtils.d.ts} +2 -11
- package/lib/types/CliUtils.d.ts.map +1 -0
- package/lib/types/commands/{validate.d.ts → ValidateCommand.d.ts} +1 -1
- package/lib/types/commands/ValidateCommand.d.ts.map +1 -0
- package/lib/types/commands/create/{app.d.ts → CreateCliApp.d.ts} +2 -2
- package/lib/types/commands/create/CreateCliApp.d.ts.map +1 -0
- package/lib/types/commands/create/{publisher.d.ts → CreateCliPublisher.d.ts} +1 -1
- package/lib/types/commands/create/CreateCliPublisher.d.ts.map +1 -0
- package/lib/types/commands/create/{release.d.ts → CreateCliRelease.d.ts} +2 -2
- package/lib/types/commands/create/CreateCliRelease.d.ts.map +1 -0
- package/lib/types/commands/create/index.d.ts +3 -3
- package/lib/types/commands/create/index.d.ts.map +1 -1
- package/lib/types/commands/index.d.ts +1 -1
- package/lib/types/commands/index.d.ts.map +1 -1
- package/lib/types/commands/publish/{remove.d.ts → PublishCliRemove.d.ts} +2 -2
- package/lib/types/commands/publish/PublishCliRemove.d.ts.map +1 -0
- package/lib/types/commands/publish/{submit.d.ts → PublishCliSubmit.d.ts} +2 -2
- package/lib/types/commands/publish/PublishCliSubmit.d.ts.map +1 -0
- package/lib/types/commands/publish/{support.d.ts → PublishCliSupport.d.ts} +2 -2
- package/lib/types/commands/publish/PublishCliSupport.d.ts.map +1 -0
- package/lib/types/commands/publish/{update.d.ts → PublishCliUpdate.d.ts} +2 -2
- package/lib/types/commands/publish/PublishCliUpdate.d.ts.map +1 -0
- package/lib/types/commands/publish/index.d.ts +4 -4
- package/lib/types/commands/publish/index.d.ts.map +1 -1
- package/lib/types/commands/scaffolding/{init.d.ts → ScaffoldInit.d.ts} +1 -1
- package/lib/types/commands/scaffolding/ScaffoldInit.d.ts.map +1 -0
- package/lib/types/commands/scaffolding/index.d.ts +1 -1
- package/lib/types/commands/scaffolding/index.d.ts.map +1 -1
- package/lib/types/config/PublishDetails.d.ts +17 -0
- package/lib/types/config/PublishDetails.d.ts.map +1 -0
- package/lib/types/upload/CachedStorageDriver.d.ts +3 -3
- package/lib/types/upload/CachedStorageDriver.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/CliUtils.ts +135 -0
- package/src/commands/{validate.ts → ValidateCommand.ts} +3 -2
- package/src/commands/create/{app.ts → CreateCliApp.ts} +4 -5
- package/src/commands/create/{publisher.ts → CreateCliPublisher.ts} +4 -5
- package/src/commands/create/{release.ts → CreateCliRelease.ts} +4 -7
- package/src/commands/create/index.ts +3 -3
- package/src/commands/index.ts +1 -1
- package/src/commands/publish/{remove.ts → PublishCliRemove.ts} +3 -2
- package/src/commands/publish/{submit.ts → PublishCliSubmit.ts} +3 -2
- package/src/commands/publish/{support.ts → PublishCliSupport.ts} +3 -2
- package/src/commands/publish/{update.ts → PublishCliUpdate.ts} +3 -2
- package/src/commands/publish/index.ts +4 -4
- package/src/commands/scaffolding/{init.ts → ScaffoldInit.ts} +1 -1
- package/src/commands/scaffolding/index.ts +1 -1
- package/src/config/PublishDetails.ts +273 -0
- package/src/index.ts +17 -17
- package/README.md +0 -86
- package/lib/esm/commands/create/app.js.map +0 -1
- package/lib/esm/commands/create/publisher.js.map +0 -1
- package/lib/esm/commands/create/release.js.map +0 -1
- package/lib/esm/commands/publish/remove.js.map +0 -1
- package/lib/esm/commands/publish/submit.js.map +0 -1
- package/lib/esm/commands/publish/support.js.map +0 -1
- package/lib/esm/commands/publish/update.js.map +0 -1
- package/lib/esm/commands/scaffolding/init.js.map +0 -1
- package/lib/esm/commands/validate.js.map +0 -1
- package/lib/esm/config/index.js +0 -18
- package/lib/esm/config/index.js.map +0 -1
- package/lib/esm/utils.js +0 -261
- package/lib/esm/utils.js.map +0 -1
- package/lib/types/commands/create/app.d.ts.map +0 -1
- package/lib/types/commands/create/publisher.d.ts.map +0 -1
- package/lib/types/commands/create/release.d.ts.map +0 -1
- package/lib/types/commands/publish/remove.d.ts.map +0 -1
- package/lib/types/commands/publish/submit.d.ts.map +0 -1
- package/lib/types/commands/publish/support.d.ts.map +0 -1
- package/lib/types/commands/publish/update.d.ts.map +0 -1
- package/lib/types/commands/scaffolding/init.d.ts.map +0 -1
- package/lib/types/commands/validate.d.ts.map +0 -1
- package/lib/types/config/index.d.ts +0 -9
- package/lib/types/config/index.d.ts.map +0 -1
- package/lib/types/utils.d.ts.map +0 -1
- package/src/config/index.ts +0 -38
- package/src/utils.ts +0 -377
package/src/utils.ts
DELETED
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import type { AndroidDetails, App, Publisher, Release, ReleaseJsonMetadata } from "@solana-mobile/dapp-store-publishing-tools";
|
|
3
|
-
import type { Connection } from "@solana/web3.js";
|
|
4
|
-
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
5
|
-
import type { CLIConfig } from "./config/index.js";
|
|
6
|
-
import { getConfig } from "./config/index.js";
|
|
7
|
-
import debugModule from "debug";
|
|
8
|
-
import { dump } from "js-yaml";
|
|
9
|
-
import * as util from "util";
|
|
10
|
-
import { exec } from "child_process";
|
|
11
|
-
import * as path from "path";
|
|
12
|
-
import { BundlrStorageDriver, keypairIdentity, Metaplex, toMetaplexFile } from "@metaplex-foundation/js";
|
|
13
|
-
import { imageSize } from "image-size";
|
|
14
|
-
import updateNotifier from "update-notifier";
|
|
15
|
-
import cliPackage from "./package.json" assert { type: "json" };
|
|
16
|
-
import boxen from "boxen";
|
|
17
|
-
import ver from "semver";
|
|
18
|
-
|
|
19
|
-
import { CachedStorageDriver } from "./upload/CachedStorageDriver.js";
|
|
20
|
-
|
|
21
|
-
const runImgSize = util.promisify(imageSize);
|
|
22
|
-
const runExec = util.promisify(exec);
|
|
23
|
-
|
|
24
|
-
export class Constants {
|
|
25
|
-
static CLI_VERSION = "0.4.0";
|
|
26
|
-
static CONFIG_FILE_NAME = "config.yaml";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const debug = debugModule("CLI");
|
|
30
|
-
|
|
31
|
-
export const checkForSelfUpdate = async () => {
|
|
32
|
-
const notifier = updateNotifier({ pkg: cliPackage });
|
|
33
|
-
const updateInfo = await notifier.fetchInfo();
|
|
34
|
-
|
|
35
|
-
const latestVer = new ver.SemVer(updateInfo.latest);
|
|
36
|
-
const currentVer = new ver.SemVer(updateInfo.current);
|
|
37
|
-
|
|
38
|
-
if (latestVer.major > currentVer.major || latestVer.minor > currentVer.minor) {
|
|
39
|
-
throw new Error("Please update to the latest version of the dApp Store CLI before proceeding.");
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const checkMintedStatus = async (conn: Connection, pubAddr: string, appAddr: string, releaseAddr: string) => {
|
|
44
|
-
const results = await conn.getMultipleAccountsInfo([
|
|
45
|
-
new PublicKey(pubAddr),
|
|
46
|
-
new PublicKey(appAddr),
|
|
47
|
-
new PublicKey(releaseAddr),
|
|
48
|
-
]);
|
|
49
|
-
|
|
50
|
-
const rentAccounts = results.filter((item) => !(item == undefined) && item?.lamports > 0);
|
|
51
|
-
if (rentAccounts?.length != 3) {
|
|
52
|
-
throw new Error("Please ensure you have minted all of your NFTs before submitting to the Solana Mobile dApp publisher portal.");
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const parseKeypair = (pathToKeypairFile: string) => {
|
|
57
|
-
try {
|
|
58
|
-
const keypairFile = fs.readFileSync(pathToKeypairFile, "utf-8");
|
|
59
|
-
return Keypair.fromSecretKey(Buffer.from(JSON.parse(keypairFile)));
|
|
60
|
-
} catch (e) {
|
|
61
|
-
showMessage
|
|
62
|
-
(
|
|
63
|
-
"KeyPair Error",
|
|
64
|
-
"Something went wrong when attempting to retrieve the keypair at " + pathToKeypairFile,
|
|
65
|
-
"error"
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
const AaptPrefixes = {
|
|
71
|
-
quoteRegex: "'(.*?)'",
|
|
72
|
-
quoteNonLazyRegex: "'(.*)'",
|
|
73
|
-
packagePrefix: "package: name=",
|
|
74
|
-
verCodePrefix: "versionCode=",
|
|
75
|
-
verNamePrefix: "versionName=",
|
|
76
|
-
sdkPrefix: "sdkVersion:",
|
|
77
|
-
localePrefix: "locales: ",
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const getConfigWithChecks = async (
|
|
81
|
-
buildToolsDir: string | null = null
|
|
82
|
-
): Promise<CLIConfig> => {
|
|
83
|
-
const configFilePath = `${process.cwd()}/${Constants.CONFIG_FILE_NAME}`;
|
|
84
|
-
|
|
85
|
-
const config = await getConfig(configFilePath);
|
|
86
|
-
|
|
87
|
-
if (buildToolsDir && fs.lstatSync(buildToolsDir).isDirectory()) {
|
|
88
|
-
// We validate that the config is going to have at least one installable asset
|
|
89
|
-
const apkEntry = config.release.files.find(
|
|
90
|
-
(asset: CLIConfig["release"]["files"][0]) => asset.purpose === "install"
|
|
91
|
-
)!;
|
|
92
|
-
const apkPath = path.join(process.cwd(), apkEntry?.uri);
|
|
93
|
-
if (!fs.existsSync(apkPath)) {
|
|
94
|
-
throw new Error("Invalid path to APK file.");
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
config.release.android_details = await getAndroidDetails(
|
|
98
|
-
buildToolsDir,
|
|
99
|
-
apkPath
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const publisherIcon = config.publisher.media?.find(
|
|
104
|
-
(asset: any) => asset.purpose === "icon"
|
|
105
|
-
)?.uri;
|
|
106
|
-
|
|
107
|
-
if (publisherIcon) {
|
|
108
|
-
const iconPath = path.join(process.cwd(), publisherIcon);
|
|
109
|
-
await checkIconCompatibility(iconPath, "Publisher");
|
|
110
|
-
|
|
111
|
-
const iconBuffer = await fs.promises.readFile(iconPath);
|
|
112
|
-
config.publisher.icon = toMetaplexFile(iconBuffer, publisherIcon);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const appIcon = config.app.media?.find(
|
|
116
|
-
(asset: any) => asset.purpose === "icon"
|
|
117
|
-
)?.uri;
|
|
118
|
-
|
|
119
|
-
if (appIcon) {
|
|
120
|
-
const iconPath = path.join(process.cwd(), appIcon);
|
|
121
|
-
await checkIconCompatibility(iconPath, "App");
|
|
122
|
-
|
|
123
|
-
const iconBuffer = await fs.promises.readFile(iconPath);
|
|
124
|
-
config.app.icon = toMetaplexFile(iconBuffer, appIcon);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const releaseIcon = config.release.media?.find(
|
|
128
|
-
(asset: any) => asset.purpose === "icon"
|
|
129
|
-
)?.uri;
|
|
130
|
-
|
|
131
|
-
if (releaseIcon) {
|
|
132
|
-
const iconPath = path.join(process.cwd(), releaseIcon);
|
|
133
|
-
await checkIconCompatibility(iconPath, "Release");
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (!appIcon && !releaseIcon) {
|
|
137
|
-
throw new Error("Please specify at least one media entry of type icon in your configuration file");
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
config.release.media.forEach((item: CLIConfig["release"]["media"][0]) => {
|
|
141
|
-
const imagePath = path.join(process.cwd(), item.uri);
|
|
142
|
-
if (!fs.existsSync(imagePath) || !checkImageExtension(imagePath)) {
|
|
143
|
-
throw new Error(`Invalid media path or file type: ${item.uri}. Please ensure the file is a jpeg, png, or webp file.`)
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
validateLocalizableResources(config);
|
|
148
|
-
|
|
149
|
-
const googlePkg = config.solana_mobile_dapp_publisher_portal.google_store_package;
|
|
150
|
-
if (googlePkg?.length) {
|
|
151
|
-
const pkgCompare = new RegExp("[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)+").exec(googlePkg);
|
|
152
|
-
|
|
153
|
-
if (!pkgCompare?.length) {
|
|
154
|
-
throw new Error("Please provide a valid Google store package name in the Publisher Portal section of your configuration file.");
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return config;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const checkIconCompatibility = async (path: string, typeString: string) => {
|
|
162
|
-
if (!fs.existsSync(path) || !checkImageExtension(path)) {
|
|
163
|
-
throw new Error(`Please check the path to your ${typeString} icon and ensure the file is a jpeg, png, or webp file.`)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (await checkIconDimensions(path)) {
|
|
167
|
-
throw new Error("Icons must have square dimensions and be no greater than 512px by 512px.")
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const checkImageExtension = (uri: string): boolean => {
|
|
172
|
-
const fileExt = path.extname(uri).toLowerCase();
|
|
173
|
-
return (
|
|
174
|
-
fileExt == ".png" ||
|
|
175
|
-
fileExt == ".jpg" ||
|
|
176
|
-
fileExt == ".jpeg" ||
|
|
177
|
-
fileExt == ".webp"
|
|
178
|
-
);
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* We need to pre-check some things in the localized resources before we move forward
|
|
183
|
-
*/
|
|
184
|
-
const validateLocalizableResources = (config: CLIConfig) => {
|
|
185
|
-
if (!config.release.catalog["en-US"]) {
|
|
186
|
-
throw new Error("Please ensure you have the en-US locale strings in your configuration file.");
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const baselineSize = Object.keys(config.release.catalog["en-US"]).length;
|
|
190
|
-
Object.keys(config.release.catalog).forEach((locale) => {
|
|
191
|
-
const size = Object.keys(config.release.catalog[locale]).length;
|
|
192
|
-
|
|
193
|
-
if (size != baselineSize) {
|
|
194
|
-
throw new Error("Please ensure you have included all localized strings for all locales in your configuration file.");
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
const descsWrongLength = Object.values(config.release.catalog)
|
|
199
|
-
.map((x) => x.short_description)
|
|
200
|
-
.filter((desc) => !desc?.length || desc.length > 50);
|
|
201
|
-
|
|
202
|
-
if (descsWrongLength.length > 0) {
|
|
203
|
-
throw new Error("Please ensure all translations of short_description are between 0 and 50 characters");
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
export const isDevnet = (rpcUrl: string): boolean => {
|
|
209
|
-
return rpcUrl.indexOf("devnet") != -1;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export const isTestnet = (rpcUrl: string): boolean => {
|
|
213
|
-
return rpcUrl.indexOf("testnet") != -1;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export const checkSubmissionNetwork = (rpcUrl: string) => {
|
|
217
|
-
if (isDevnet(rpcUrl) || isTestnet(rpcUrl)) {
|
|
218
|
-
throw new Error("It looks like you are attempting to submit a request with a devnet or testnet RPC endpoint. Please ensure that your NFTs are minted on mainnet beta, and re-run with a mainnet beta RPC endpoint.");
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export const generateNetworkSuffix = (rpcUrl: string): string => {
|
|
223
|
-
let suffix = "";
|
|
224
|
-
|
|
225
|
-
if (isDevnet(rpcUrl)) {
|
|
226
|
-
suffix = "?cluster=devnet";
|
|
227
|
-
} else if (isTestnet(rpcUrl)) {
|
|
228
|
-
suffix = "?cluster=testnet";
|
|
229
|
-
} else {
|
|
230
|
-
suffix = "?cluster=mainnet";
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return suffix;
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
export const showMessage = (
|
|
237
|
-
titleMessage = "",
|
|
238
|
-
contentMessage = "",
|
|
239
|
-
type: "standard" | "error" | "warning" = "standard",
|
|
240
|
-
): string => {
|
|
241
|
-
let color = "cyan";
|
|
242
|
-
if (type == "error") {
|
|
243
|
-
color = "redBright";
|
|
244
|
-
} else if (type == "warning") {
|
|
245
|
-
color = "yellow";
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const msg = boxen(contentMessage, {
|
|
249
|
-
title: titleMessage,
|
|
250
|
-
padding: 1,
|
|
251
|
-
margin: 1,
|
|
252
|
-
borderStyle: 'single',
|
|
253
|
-
borderColor: color,
|
|
254
|
-
textAlignment: "left",
|
|
255
|
-
titleAlignment: "center",
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
console.log(msg);
|
|
259
|
-
return msg;
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
const checkIconDimensions = async (iconPath: string): Promise<boolean> => {
|
|
263
|
-
const size = await runImgSize(iconPath);
|
|
264
|
-
|
|
265
|
-
return size?.width != size?.height || (size?.width ?? 0) > 512;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
const getAndroidDetails = async (
|
|
269
|
-
aaptDir: string,
|
|
270
|
-
apkPath: string
|
|
271
|
-
): Promise<AndroidDetails> => {
|
|
272
|
-
const { stdout } = await runExec(`${aaptDir}/aapt2 dump badging ${apkPath}`);
|
|
273
|
-
|
|
274
|
-
const appPackage = new RegExp(
|
|
275
|
-
AaptPrefixes.packagePrefix + AaptPrefixes.quoteRegex
|
|
276
|
-
).exec(stdout);
|
|
277
|
-
const versionCode = new RegExp(
|
|
278
|
-
AaptPrefixes.verCodePrefix + AaptPrefixes.quoteRegex
|
|
279
|
-
).exec(stdout);
|
|
280
|
-
const versionName = new RegExp(
|
|
281
|
-
AaptPrefixes.verNamePrefix + AaptPrefixes.quoteRegex
|
|
282
|
-
).exec(stdout);
|
|
283
|
-
const minSdk = new RegExp(
|
|
284
|
-
AaptPrefixes.sdkPrefix + AaptPrefixes.quoteRegex
|
|
285
|
-
).exec(stdout);
|
|
286
|
-
const permissions = [...stdout.matchAll(/uses-permission: name='(.*)'/g)];
|
|
287
|
-
const locales = new RegExp(
|
|
288
|
-
AaptPrefixes.localePrefix + AaptPrefixes.quoteNonLazyRegex
|
|
289
|
-
).exec(stdout);
|
|
290
|
-
|
|
291
|
-
let localeArray = Array.from(locales?.values() ?? []);
|
|
292
|
-
if (localeArray.length == 2) {
|
|
293
|
-
const localesSrc = localeArray[1];
|
|
294
|
-
localeArray = ["en-US"].concat(localesSrc.split("' '").slice(1));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
if (localeArray.length >= 60) {
|
|
298
|
-
showMessage(
|
|
299
|
-
"The bundle apk claims supports for following locales",
|
|
300
|
-
"Claim for supported locales::\n" +
|
|
301
|
-
localeArray +
|
|
302
|
-
"\nIf this release does not support all these locales the release may be rejected" +
|
|
303
|
-
"\nSee details at https://developer.android.com/guide/topics/resources/multilingual-support#design for configuring the supported locales",
|
|
304
|
-
"warning"
|
|
305
|
-
)
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
return {
|
|
309
|
-
android_package: appPackage?.[1] ?? "",
|
|
310
|
-
min_sdk: parseInt(minSdk?.[1] ?? "0", 10),
|
|
311
|
-
version_code: parseInt(versionCode?.[1] ?? "0", 10),
|
|
312
|
-
version: versionName?.[1] ?? "0",
|
|
313
|
-
permissions: permissions.flatMap(permission => permission[1]),
|
|
314
|
-
locales: localeArray,
|
|
315
|
-
};
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
type SaveToConfigArgs = {
|
|
319
|
-
publisher?: Pick<Publisher, "address">;
|
|
320
|
-
app?: Pick<App, "address">;
|
|
321
|
-
release?: Pick<Release, "address">;
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
export const saveToConfig = async ({
|
|
325
|
-
publisher,
|
|
326
|
-
app,
|
|
327
|
-
release,
|
|
328
|
-
}: SaveToConfigArgs) => {
|
|
329
|
-
const currentConfig = await getConfigWithChecks();
|
|
330
|
-
|
|
331
|
-
delete currentConfig.publisher.icon;
|
|
332
|
-
delete currentConfig.app.icon;
|
|
333
|
-
|
|
334
|
-
const newConfig: CLIConfig = {
|
|
335
|
-
publisher: {
|
|
336
|
-
...currentConfig.publisher,
|
|
337
|
-
address: publisher?.address ?? currentConfig.publisher.address,
|
|
338
|
-
},
|
|
339
|
-
app: {
|
|
340
|
-
...currentConfig.app,
|
|
341
|
-
address: app?.address ?? currentConfig.app.address,
|
|
342
|
-
},
|
|
343
|
-
release: {
|
|
344
|
-
...currentConfig.release,
|
|
345
|
-
address: release?.address ?? currentConfig.release.address,
|
|
346
|
-
},
|
|
347
|
-
solana_mobile_dapp_publisher_portal:
|
|
348
|
-
currentConfig.solana_mobile_dapp_publisher_portal,
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
// TODO(jon): Verify the contents of the YAML file
|
|
352
|
-
fs.writeFileSync(`${process.cwd()}/${Constants.CONFIG_FILE_NAME}`, dump(newConfig));
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
export const getMetaplexInstance = (
|
|
356
|
-
connection: Connection,
|
|
357
|
-
keypair: Keypair
|
|
358
|
-
) => {
|
|
359
|
-
const metaplex = Metaplex.make(connection).use(keypairIdentity(keypair));
|
|
360
|
-
const isDevnet = connection.rpcEndpoint.includes("devnet");
|
|
361
|
-
|
|
362
|
-
const bundlrStorageDriver = isDevnet
|
|
363
|
-
? new BundlrStorageDriver(metaplex, {
|
|
364
|
-
address: "https://devnet.bundlr.network",
|
|
365
|
-
providerUrl: "https://api.devnet.solana.com",
|
|
366
|
-
})
|
|
367
|
-
: new BundlrStorageDriver(metaplex);
|
|
368
|
-
|
|
369
|
-
metaplex.storage().setDriver(
|
|
370
|
-
new CachedStorageDriver(bundlrStorageDriver, {
|
|
371
|
-
assetManifestPath: isDevnet
|
|
372
|
-
? "./.asset-manifest-devnet.json"
|
|
373
|
-
: "./.asset-manifest.json",
|
|
374
|
-
})
|
|
375
|
-
);
|
|
376
|
-
return metaplex;
|
|
377
|
-
};
|