chore: add custom export executor for next app (#1999)
* chore: add custom export executor for next app * chore: update tsconfig path for export executor
This commit is contained in:
parent
71e8235faf
commit
5666b8f8e4
@ -32,7 +32,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"export": {
|
"export": {
|
||||||
"executor": "@nrwl/next:export",
|
"executor": "./tools/executors/next:export",
|
||||||
"options": {
|
"options": {
|
||||||
"buildTarget": "trading:build:production"
|
"buildTarget": "trading:build:production"
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,12 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"implementation": "./build/impl",
|
"implementation": "./build/impl",
|
||||||
"schema": "./build/schema.json",
|
"schema": "./build/schema.json",
|
||||||
"description": "Starts a next server with an optional explicit environment."
|
"description": "Builds a next app with an optional explicit environment."
|
||||||
|
},
|
||||||
|
"export": {
|
||||||
|
"implementation": "./export/impl",
|
||||||
|
"schema": "./serve/schema.json",
|
||||||
|
"description": "Exports a next app with an optional explicit environment."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
tools/executors/next/export/impl.ts
Normal file
22
tools/executors/next/export/impl.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import type { ExecutorContext } from '@nrwl/devkit';
|
||||||
|
import setup from '../../../utils/setup-environment';
|
||||||
|
import nextExportExecutor from '@nrwl/next/src/executors/export/export.impl';
|
||||||
|
import { NextExportBuilderOptions } from '@nrwl/next/src/utils/types';
|
||||||
|
|
||||||
|
type Schema = NextExportBuilderOptions & {
|
||||||
|
env: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function exportWithEnv(
|
||||||
|
options: Schema,
|
||||||
|
context: ExecutorContext
|
||||||
|
) {
|
||||||
|
const { env, ...nextOptions } = options;
|
||||||
|
await setup(env, context, 'tools/executors/next/export');
|
||||||
|
|
||||||
|
try {
|
||||||
|
return await nextExportExecutor(nextOptions, context);
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
18
tools/executors/next/export/schema.json
Normal file
18
tools/executors/next/export/schema.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"cli": "nx",
|
||||||
|
"id": "export",
|
||||||
|
"description": "Exports a next app app using @nrwl/next:export with an optional explicit environment",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"env": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Target environment to run the application in. This assumes an .env file present in the project's root in the following format: .env.{envName}"
|
||||||
|
},
|
||||||
|
"buildLibsFromSource": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Read buildable libraries from source instead of building them separately.",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["root", "outputPath"]
|
||||||
|
}
|
@ -8,6 +8,6 @@
|
|||||||
"sourceMap": false,
|
"sourceMap": false,
|
||||||
"inlineSourceMap": true
|
"inlineSourceMap": true
|
||||||
},
|
},
|
||||||
"include": ["build/impl.ts", "serve/impl.ts"],
|
"include": ["build/impl.ts", "serve/impl.ts", "export/impl.ts"],
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user