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: move function builders to functions lib #2811

Merged
merged 3 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 0 additions & 17 deletions src/function-builder-detectors/README.md

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const execa = require('execa')
const debounce = require('lodash/debounce')
const minimist = require('minimist')

const { fileExistsAsync, readFileAsync } = require('../lib/fs')
const { fileExistsAsync, readFileAsync } = require('../../../../fs')

const DEBOUNCE_WAIT = 300

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ const makeDir = require('make-dir')
const pFilter = require('p-filter')
const sourceMapSupport = require('source-map-support')

const { normalizeFunctionsConfig } = require('../lib/functions/config')
const { memoizedBuild } = require('../lib/functions/memoized-build')
const { getPathInProject } = require('../lib/settings')
const { getFunctions } = require('../utils/get-functions')
const { NETLIFYDEVERR } = require('../utils/logo')
const { getFunctions } = require('../../../../../utils/get-functions')
const { NETLIFYDEVERR } = require('../../../../../utils/logo')
const { getPathInProject } = require('../../../../settings')
const { normalizeFunctionsConfig } = require('../../../config')
const { memoizedBuild } = require('../../../memoized-build')

const ZIP_CONCURRENCY = 5

Expand Down
5 changes: 3 additions & 2 deletions src/utils/detect-functions-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ const fs = require('fs')
const path = require('path')

const detectFunctionsBuilder = async function (parameters) {
const buildersPath = path.join(__dirname, '..', 'lib', 'functions', 'runtimes', 'js', 'builders')
const detectors = fs
.readdirSync(path.join(__dirname, '..', 'function-builder-detectors'))
.readdirSync(buildersPath)
// only accept .js detector files
.filter((filename) => filename.endsWith('.js'))
// Sorting by filename
.sort()
// eslint-disable-next-line node/global-require, import/no-dynamic-require
.map((det) => require(path.join(__dirname, '..', `function-builder-detectors/${det}`)))
.map((det) => require(path.join(buildersPath, det)))

for (const detector of detectors) {
// eslint-disable-next-line no-await-in-loop
Expand Down