chore(repo): consolidate local env and clean root files
This commit is contained in:
@@ -9,13 +9,12 @@ import {
|
||||
createAwsV4Headers,
|
||||
encodeObjectKey,
|
||||
getCacheControl,
|
||||
loadRepoEnv,
|
||||
normalizeEndpoint,
|
||||
parseSimpleEnv,
|
||||
requestDogeCloudTemporaryS3Session,
|
||||
} from './oss-deploy-lib.mjs';
|
||||
|
||||
const repoRoot = process.cwd();
|
||||
const envFilePath = path.join(repoRoot, '.env.oss.local');
|
||||
const apkSourcePath = path.join(repoRoot, 'front', 'android', 'app', 'build', 'outputs', 'apk', 'debug', 'app-debug.apk');
|
||||
|
||||
function parseArgs(argv) {
|
||||
@@ -24,24 +23,6 @@ function parseArgs(argv) {
|
||||
};
|
||||
}
|
||||
|
||||
async function loadEnvFileIfPresent() {
|
||||
try {
|
||||
const raw = await fs.readFile(envFilePath, 'utf-8');
|
||||
const values = parseSimpleEnv(raw);
|
||||
for (const [key, value] of Object.entries(values)) {
|
||||
if (!process.env[key]) {
|
||||
process.env[key] = value;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT') {
|
||||
return;
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function requireEnv(name) {
|
||||
const value = process.env[name];
|
||||
if (!value) {
|
||||
@@ -133,7 +114,7 @@ async function uploadFile({
|
||||
|
||||
async function main() {
|
||||
const {dryRun} = parseArgs(process.argv.slice(2));
|
||||
await loadEnvFileIfPresent();
|
||||
await loadRepoEnv({repoRoot});
|
||||
|
||||
const androidScope = getAndroidReleaseScope();
|
||||
if (!androidScope) {
|
||||
|
||||
Reference in New Issue
Block a user