-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove sharp dep from build since it's provided by lambda layer * fix deps
- Loading branch information
Showing
5 changed files
with
36 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,12 +28,13 @@ const project = new awscdk.AwsCdkConstructLibrary({ | |
'@types/fs-extra', | ||
'@types/micromatch', | ||
'@types/aws-lambda', | ||
'esbuild', | ||
'aws-lambda', | ||
'serverless-http', | ||
'jszip', | ||
'glob', | ||
] /* Runtime dependencies of this module. */, | ||
devDeps: ['aws-sdk', '[email protected]'] /* Build dependencies for this module. */, | ||
peerDeps: ['esbuild'], | ||
|
||
// do not generate sample test files | ||
sampleCode: false, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { Token } from 'aws-cdk-lib'; | |
import { Construct } from 'constructs'; | ||
import * as spawn from 'cross-spawn'; | ||
import * as fs from 'fs-extra'; | ||
import * as glob from 'glob'; | ||
import { listDirectory } from './NextjsAssetsDeployment'; | ||
import { CompressionLevel, NextjsBaseProps } from './NextjsBase'; | ||
|
||
|
@@ -121,6 +122,24 @@ export class NextjsBuild extends Construct { | |
if (buildResult.status !== 0) { | ||
throw new Error('The app "build" script failed.'); | ||
} | ||
|
||
// cleanup | ||
// delete the `sharp` module since it's provided by the lambda layer | ||
const sharpPathNpm = path.join(this._getNextStandaloneDir(), 'node_modules', 'sharp'); // npm/yarn | ||
if (fs.existsSync(sharpPathNpm)) { | ||
// delete the sharp folder | ||
if (!this.props.quiet) console.debug('├ Deleting sharp module from', sharpPathNpm); | ||
fs.removeSync(sharpPathNpm); | ||
} | ||
// is there a `[email protected]` folder in the `node_modules/.pnpm` folder? | ||
const pnpmModulesDir = path.join(this._getNextStandaloneDir(), 'node_modules', '.pnpm'); // pnpm | ||
// get glob pattern for sharp version | ||
const matches = glob.sync(path.join(pnpmModulesDir, 'sharp@*')); | ||
if (matches.length > 0) { | ||
// delete the sharp folder | ||
if (!this.props.quiet) console.debug('├ Deleting sharp module from', matches[0]); | ||
fs.removeSync(matches[0]); | ||
} | ||
} | ||
|
||
// getNextBuildId() { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.