Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: 💡 Bundle parameter shouldn't be a negation #34

Merged
merged 4 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stale-coats-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fleek-platform/cli': patch
---

Replace `noBundle` parameter by `bundle` to be more inline with remaining parameter settings and remove negation that can be counter-intuitive or confusing.
2 changes: 1 addition & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
"networkFetchFailed": "Failed to fetch Mapping, please retry deploying your function.",
"unsupportedPackage": "The {packageName} package is not currently supported by Fleek Functions.",
"showUnsupportedModulesDocLink": "Please refer to our documentation to see which packages we support.",
"noBundle": "Disable bundling",
"bundleCmd": "Adjust bundling preference. Set to `false` to disable it.",
"bundleDisabledInDirectory": "Bundling is disabled but the path points to a directory. The {filename} file will be uploaded.",
"functionDeployToPrivateStorage": "[🧪 Alpha] Function code will be private",
"functionsUseSgx": "[🧪 Alpha] Function will use trusted execution environment for sensitive computations using SGX",
Expand Down
6 changes: 3 additions & 3 deletions src/commands/functions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getWasmCodeFromPath } from './utils/getWasmCodeFromPath';
type DeployActionArgs = {
filePath?: string;
name?: string;
noBundle: boolean;
bundle: string;
private: boolean;
env: string[];
envFile?: string;
Expand All @@ -32,7 +32,7 @@ const deployAction: SdkGuardedFunction<DeployActionArgs> = async ({
const env = getEnvironmentVariables({ env: args.env, envFile: args.envFile });
const functionToDeploy = await getFunctionOrPrompt({ name: args.name, sdk });
const filePath = await getFunctionPathOrPrompt({ path: args.filePath });
const bundle = !args.noBundle;
const bundle = args.bundle !== 'false';
const isSGX = !!args.sgx;
const isTrustedPrivateEnvironment = isSGX && args.private;
const isUntrustedPublicEnvironment = !isSGX && !args.private;
Expand Down Expand Up @@ -97,7 +97,7 @@ const deployAction: SdkGuardedFunction<DeployActionArgs> = async ({
})
: undefined;

if (!output.debugEnabled && !args.noBundle) {
if (!output.debugEnabled && !args.bundle) {
fs.rmSync(filePathToUpload);
}

Expand Down
6 changes: 3 additions & 3 deletions src/commands/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { updateActionHandler } from './update';
type DeployOptions = {
path?: string;
name?: string;
noBundle: boolean;
bundle: string;
private: boolean;
env?: string[];
envFile?: string;
Expand Down Expand Up @@ -67,7 +67,7 @@ export default (program: Command) => {
.description(t('deployFunction'))
.option('-p, --path <functionCodePath>', t('functionCodePath'))
.option('-n, --name <functionName>', t('functionName'))
.option('--noBundle', t('noBundle'), false)
.option('-b, --bundle <bundle>', t('bundleCmd'), true)
.option('--private', t('functionDeployToPrivateStorage'), false)
.option('-e, --env <environmentVariables...>', t('environmentVariables'))
.option('--sgx', t('functionsUseSgx'), false)
Expand All @@ -79,7 +79,7 @@ export default (program: Command) => {
deployActionHandler({
filePath: options.path,
name: options.name,
noBundle: options.noBundle,
bundle: options.bundle,
private: options.private,
env: options.env ?? [],
envFile: options.envFile,
Expand Down