Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@monteway/next
Advanced tools
Useful utilities for Next.js apps.
Also a production-ready Dockerfile for Next.js projects.
npm i @moneway/next
errorPropsResponse
Return an object that is compatible with the result of getServerSideProps
/ getStaticProps
and includes an internal property marking the response as having some error.
import { errorPropsResponse } from '@monteway/next/error';
import type { GetServerSidePropsContext } from 'next';
export async function getServerSideProps(context: GetServerSidePropsContext) {
try {
// Pretend we have a call here to some API that can throw
// an error when user has no access to the page.
} catch {
// This responds with HTTP 403 status
// and returns
// {
// props: {
// error: 'You cannot access this page',
// __isErrorProps__: true
// },
// }
return errorPropsResponse(context.res, {
statusCode: 403,
error: 'You cannot access this page',
});
}
}
isErrorProps
Checks if the argument is from errorPropsResponse
.
import { errorPropsResponse, isErrorProps } from '@monteway/next/error';
const response = errorPropsResponse(null, {
statusCode: 403,
error: 'You cannot access this page',
});
isErrorProps(response.props);
// true
This package includes also a official Dockerfile for Next.js project which is production ready.
We have extended it with some optional build arguments that can be used to extend the image.
--build-arg | Description |
---|---|
BEFORE_INSTALL_COMMAND | Run before npm install |
AFTER_INSTALL_COMMAND | Run after npm install |
BEFORE_BUILD_COMMAND | Run before npm run build |
AFTER_BUILD_COMMAND | Run after npm run build |
Example usage of the Dockerfile (make sure the Docker context is root of the Next.js app):
docker build \
--build-arg BEFORE_INSTALL_COMMAND="exit 0" \
--build-arg AFTER_INSTALL_COMMAND="exit 0" \
--build-arg BEFORE_BUILD_COMMAND="exit 0" \
--build-arg AFTER_BUILD_COMMAND="exit 0" \
--tag ${IMAGE_TAG} \
--file node_modules/@monteway/next/dockerfile .
FAQs
Utilities for Monterail projects based on Next.js
The npm package @monteway/next receives a total of 5 weekly downloads. As such, @monteway/next popularity was classified as not popular.
We found that @monteway/next demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.