Skip to content

Commit 9fe5176

Browse files
committed
feat(build-core): Added additional build options
1 parent 8f9a3e7 commit 9fe5176

File tree

9 files changed

+417
-71
lines changed

9 files changed

+417
-71
lines changed

build/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"@storm-software/unbuild": "latest"
1717
},
1818
"devDependencies": {
19-
"@storm-software/build-tools": "latest",
2019
"@types/node": "^22.10.2",
2120
"esbuild": "^0.24.0",
2221
"tsup": "^8.3.5",

build/core/src/node-app/build.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
1616
-------------------------------------------------------------------*/
1717

18-
import type { AssetGlob } from "@storm-software/build-tools";
19-
import { build as esbuild } from "@storm-software/esbuild";
18+
import { build as esbuild, type ESBuildOptions } from "@storm-software/esbuild";
2019
import stormStack from "@storm-stack/build-plugin/esbuild";
2120
import { EntryPointsOption } from "../types";
2221

@@ -46,7 +45,7 @@ export interface NodeAppBuildOptions {
4645
*
4746
* @defaultValue []
4847
*/
49-
assets?: (AssetGlob | string)[];
48+
assets?: ESBuildOptions["assets"];
5049

5150
/**
5251
* The output path of the build
@@ -65,7 +64,7 @@ export interface NodeAppBuildOptions {
6564
* @param projectRoot - The project root
6665
* @param entry - The entry point(s) of the project
6766
*/
68-
export const build = async (
67+
export const build = (
6968
projectRoot: string,
7069
options: NodeAppBuildOptions = {}
7170
) => {
@@ -75,14 +74,15 @@ export const build = async (
7574
? [options.entryPoints]
7675
: options.entryPoints;
7776

78-
await esbuild([
77+
return esbuild([
7978
{
8079
entryPoints,
8180
projectRoot,
8281
outdir: options.outputPath || "dist",
8382
platform: "node",
8483
format: "cjs",
8584
bundle: true,
85+
generatePackageJson: true,
8686
minify: !options.debug,
8787
sourcemap: options.debug,
8888
plugins: [
@@ -98,6 +98,7 @@ export const build = async (
9898
platform: "node",
9999
format: "esm",
100100
bundle: true,
101+
generatePackageJson: true,
101102
minify: !options.debug,
102103
sourcemap: options.debug,
103104
plugins: [

build/core/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type { Options } from "tsup";
2121
const config: Options = getTsupConfig({
2222
name: "build-core",
2323
entryPoints: ["./src/node-app/index.ts"],
24-
external: ["nx", "@nx/*", "@swc/*", "typia"]
24+
external: ["nx", "@nx/*", "@swc/*", "@storm-software/*"]
2525
});
2626

2727
export default config;

build/nx/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
"@nx/js": "^20.3.0",
5757
"@nx/workspace": "^20.3.0",
5858
"@samchon/openapi": "^2.3.1",
59-
"@storm-software/build-tools": "latest",
6059
"@swc/core": "1.7.26",
6160
"@swc/wasm": "^1.10.1",
6261
"@types/node": "^22.10.2",
Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
import type { EntryPointsOption } from "@storm-stack/build-core";
2-
import type { AssetGlob } from "@storm-stack/build-tools";
1+
import type { NodeAppBuildOptions } from "@storm-stack/build-core";
32

4-
export type Platform = "browser" | "neutral" | "node" | "worker";
5-
6-
export interface NodeApplicationExecutorSchema {
7-
entryPoints: EntryPointsOption;
8-
outputPath: string;
9-
assets: (AssetGlob | string)[];
10-
debug?: boolean;
11-
}
3+
export type NodeApplicationExecutorSchema = Partial<
4+
Pick<NodeAppBuildOptions, "entryPoints" | "outputPath" | "assets" | "debug">
5+
>;

build/nx/tsup.config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,16 @@ const config: Options = getTsupConfig({
2222
name: "build-nx",
2323
entryPoints: ["./src/index.ts", "./src/executors/*/executor.ts"],
2424
format: ["cjs"],
25-
external: ["nx", "@nx/*", "@swc/*", "@angular-devkit/schematics", "vue-tsc"]
25+
dts: false,
26+
external: [
27+
"nx",
28+
"@nx/*",
29+
"@swc/*",
30+
"@storm-software/*",
31+
"@storm-stack/*",
32+
"@angular-devkit/schematics",
33+
"vue-tsc"
34+
]
2635
});
2736

2837
export default config;

lefthook.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pre-push:
7676
# run: 'pnpm exec storm-git readme-gen --templates="./tools/readme-templates"'
7777
# stage_fixed: true
7878
syncpack:
79-
glob: "**/{package.json}"
79+
glob: "**/{package.json,syncpack.config.js}"
8080
run: "pnpm syncpack"
8181
stage_fixed: true
8282
install:

pnpm-lock.yaml

Lines changed: 389 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

syncpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ export const config = {
3737
dependencies: ["typescript"],
3838
snapTo: ["@storm-stack/monorepo"]
3939
},
40+
{
41+
label:
42+
"Build related dependencies should all use the version specified in build-core",
43+
dependencies: ["@microsoft/api-extractor", "esbuild"],
44+
snapTo: ["@storm-stack/build-core"]
45+
},
4046
{
4147
label: "Nx Dependencies should all use the same version",
4248
dependencies: ["@nx/**", "nx"],

0 commit comments

Comments
 (0)