Skip to content

Commit

Permalink
Merge branch 'main' into fix-excludedPath
Browse files Browse the repository at this point in the history
  • Loading branch information
Skn0tt committed Nov 9, 2023
2 parents 0de48cc + e6fab5f commit 9b4accf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"eslint-plugin-unicorn": "^49.0.0",
"husky": "^4.3.0",
"netlify-cli": "^17.2.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2"
},
"dependencies": {
Expand Down
24 changes: 21 additions & 3 deletions src/helpers/setUpEdgeFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { Buffer } = require('node:buffer')
const { existsSync, readdirSync } = require('node:fs')
const { writeFile, mkdir, readFile } = require('node:fs/promises')
const { join, relative, sep, posix } = require('node:path')
const process = require('node:process')

const { readJson } = require('fs-extra')

Expand All @@ -20,8 +21,26 @@ const getAllFilesIn = (dir) =>

const toPosix = (path) => path.split(sep).join(posix.sep)

const getProject = (angularJson) => {
const projectName = angularJson.defaultProject ?? Object.keys(angularJson.projects)[0]
const getProject = (angularJson, failBuild) => {
const selectedProject = process.env.ANGULAR_PROJECT
if (selectedProject) {
const project = angularJson.projects[selectedProject]
if (!project) {
return failBuild(
`Could not find project selected project "${selectedProject}" in angular.json. Please update the ANGULAR_PROJECT environment variable.`,
)
}
return project
}

const projectNames = Object.keys(angularJson.projects)
const [projectName] = projectNames
if (projectNames.length > 1) {
console.warn(
`Found multiple projects in angular.json, deploying "${projectName}". To deploy a different one, set the ANGULAR_PROJECT environment variable to the project name.`,
)
}

return angularJson.projects[projectName]
}

Expand Down Expand Up @@ -62,7 +81,6 @@ const setUpEdgeFunction = async ({ angularJson, constants, failBuild }) => {
import process from "node:process"
globalThis.process = process
globalThis.global = globalThis
globalThis.DenoEvent = globalThis.Event // storing this for fixup-event.mjs
`

Expand Down

0 comments on commit 9b4accf

Please sign in to comment.