Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Commit

Permalink
feat: add NFT bundler (#713)
Browse files Browse the repository at this point in the history
* feat: add NFT bundler

* chore: add benchmark for NFT

* chore: fix usage of `basePath` in tests

* refactor: add `basePath` to `listFunctionsFiles`

* chore: add `repositoryRoot` test

* chore: remove docs for `repositoryRoot`

This property will likely get deprecated in a future version

* feat: use `repositoryRoot` in NFT

* refactor: use `repositoryRoot` in `getSrcFiles`

* chore: increase maximum number of open files

* chore: increase open file limit in MacOS
  • Loading branch information
eduardoboucas committed Oct 13, 2021
1 parent 7fe58f1 commit 8e09e87
Show file tree
Hide file tree
Showing 23 changed files with 1,686 additions and 248 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
node-version: 10.18.0
fail-fast: false
steps:
# Increasing the maximum number of open files. See:
# https://github.com/actions/virtual-environments/issues/268
- name: Increase open file limit
run: sudo ulimit -Sn 65536
if: "${{ matrix.os == 'macOS-latest' }}"
- name: Git checkout
uses: actions/checkout@v2
- name: Node.js ${{ matrix.node }}
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,6 @@ JSON-formatted string with the following properties:

Maximum number of functions to bundle at the same time.

#### `repositoryRoot`

- _Type_: `string`
- _Default value_: The value of `basePath`

The path of the project's repository root. This defines the boundary where Node modules can be found. It usually is the
same value as the `basePath` property, but may be a parent directory in the case of a monorepo setup.

### Return value

This returns a `Promise` resolving to an array of objects describing each archive. Every object has the following
Expand Down
24 changes: 24 additions & 0 deletions benchmarks/nft.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { join } = require('path')

const { zipFunctions } = require('../dist/main')

const { timeFunction } = require('./helpers/main')

const BENCHMARK_OUTPUT = 'benchmarks/output'
const RUNS = 3

const runBenchmarks = async function () {
const func = join(__dirname, 'fixtures')

const largeDepsNft = await timeFunction(
() =>
zipFunctions(func, BENCHMARK_OUTPUT, {
config: { '*': { nodeBundler: 'nft' } },
}),
RUNS,
)

console.log(`${largeDepsNft}ms`)
}

runBenchmarks()
1 change: 1 addition & 0 deletions benchmarks/run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
npm ci --prefix benchmarks/fixtures
npm run build
node benchmarks/nft.js > .delta.largeDepsNft
node benchmarks/zisi.js > .delta.largeDepsZisi
node benchmarks/esbuild.js > .delta.largeDepsEsbuild

1 comment on commit 8e09e87

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱ Benchmark results

largeDepsEsbuild: 13.4s

largeDepsNft: 1m

largeDepsZisi: 1m 17.4s

Please sign in to comment.