Skip to content

Commit

Permalink
refactor: 💡 bundling parameters (#15)
Browse files Browse the repository at this point in the history
## Why?

Bundling parameters.

## How?

- fix Bundle argument
- Declare node_module paths

## Tickets?

-
[PLAT-1273](https://linear.app/fleekxyz/issue/PLAT-1273/bundling-parameters)

## Contribution checklist?

- [x] The commit messages are detailed
- [x] The `build` command runs locally
- [ ] Assets or static content are linked and stored in the project
- [ ] You have manually tested
- [ ] You have provided tests

## Security checklist?

- [ ] Sensitive data has been identified and is being protected properly
- [ ] Injection has been prevented (parameterized queries, no eval or
system calls)

## Preview?

Optionally, provide the preview url here
  • Loading branch information
heldrida authored Aug 13, 2024
1 parent 4189880 commit f726bcc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/happy-feet-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@fleek-platform/cli': minor
---

Bundling parameter amends
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
"commander": "^9.4.1",
"conf": "^10.2.0",
"dotenv": "^16.4.5",
"esbuild": "^0.21.3",
"esbuild": "^0.21.4",
"files-from-path": "^1.0.0",
"glob": "^8.1.0",
"lodash-es": "^4.17.21",
"multiformats": "9.9.0",
"multiformats": "^9.9.0",
"nanoid": "^3.3.4",
"ora": "^3.4.0",
"press-any-key": "^0.1.1",
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/commands/functions/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ 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 bundledFilePath = await getCodeFromPath({
filePath,
bundle: args.noBundle,
bundle,
env,
});

Expand Down
5 changes: 5 additions & 0 deletions src/commands/functions/utils/getCodeFromPath.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'path';
import * as fs from 'node:fs';
import * as os from 'node:os';

Expand Down Expand Up @@ -105,6 +106,9 @@ const transpileCode = async (args: TranspileCodeArgs) => {
);
}

const filePathWorkDir = path.dirname(filePath);
const nodeModulesPath = path.join(filePathWorkDir, 'node_modules');

const buildOptions: BuildOptions = {
entryPoints: [filePath],
bundle,
Expand All @@ -117,6 +121,7 @@ const transpileCode = async (args: TranspileCodeArgs) => {
outfile: outFile,
minify: true,
plugins,
nodePaths: [nodeModulesPath],
};

buildOptions.banner = {
Expand Down

0 comments on commit f726bcc

Please sign in to comment.