From 2c1b7ed503785b2a9f9a27c3a3f62d6f3d5f6b63 Mon Sep 17 00:00:00 2001 From: Patrick Rodgers Date: Wed, 20 Dec 2023 12:00:36 -0500 Subject: [PATCH] build system --- buildsystem-config.ts | 21 +++++++++++-- package-lock.json | 31 +++---------------- tools/buildsystem/package.json | 2 +- tools/buildsystem/src/behaviors/build.ts | 2 ++ .../src/behaviors/copy-asset-files.ts | 4 +-- .../src/behaviors/copy-package-files.ts | 2 ++ .../src/behaviors/publish-nightly.ts | 4 ++- tools/buildsystem/src/behaviors/publish.ts | 2 ++ .../src/behaviors/replace-version.ts | 2 ++ tools/buildsystem/src/behaviors/webpack.ts | 2 ++ .../src/behaviors/write-packagejson.ts | 2 ++ 11 files changed, 41 insertions(+), 33 deletions(-) diff --git a/buildsystem-config.ts b/buildsystem-config.ts index 6607d53f1..de70280c2 100644 --- a/buildsystem-config.ts +++ b/buildsystem-config.ts @@ -1,14 +1,31 @@ import { resolve } from "path"; -import { BuildSchema } from "@pnp/buildsystem"; +import { + BuildSchema, + BuildTimeline, + Build, + ReplaceVersion, + } from "@pnp/buildsystem"; // import { ConfigCollection, BuildSchema, Tasks, PackageSchema, PublishSchema } from "@pnp/buildsystem"; +export function PnPBuild(): (b: BuildTimeline) => BuildTimeline { + + return (instance: BuildTimeline) => { + + Build()(instance); + ReplaceVersion(["sp/behaviors/telemetry.js", "graph/behaviors/telemetry.js"])(instance); + + return instance; + } +} + export default [{ name: "build", distFolder: "./dist/packages", targets: [ resolve("./packages/tsconfig.json"), - ] + ], + behaviors: [PnPBuild()] }]; // export default [ diff --git a/package-lock.json b/package-lock.json index c898426e9..03f4103f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@azure/identity": "3.3.0", "@azure/msal-node": "1.18.3", "@microsoft/microsoft-graph-types": "2.38.0", - "@pnp/buildsystem": "^4.0.0-beta1", + "@pnp/buildsystem": "^4.0.0-beta2", "@types/chai": "4.3.6", "@types/chai-as-promised": "7.1.6", "@types/core-js": "2.5.6", @@ -599,13 +599,12 @@ } }, "node_modules/@pnp/buildsystem": { - "version": "4.0.0-beta1", - "resolved": "https://registry.npmjs.org/@pnp/buildsystem/-/buildsystem-4.0.0-beta1.tgz", - "integrity": "sha512-Ve8vqiaEl+qAte6EFNZ3dPjh8VqhIg/LF/dvJ0oJ5sxq6onhSrsow3DqhbymUfsqKkGa0KGF5EfAHWur+/YGAw==", + "version": "4.0.0-beta2", + "resolved": "https://registry.npmjs.org/@pnp/buildsystem/-/buildsystem-4.0.0-beta2.tgz", + "integrity": "sha512-nLds0p8l/HMqpsAIiymdyMUpT1xrRxBGDUKcgGJRLcpYmLdLkCHHfkEvTsQlyyDdeFd1KV1iYaJQ3HToZ2bnQg==", "dev": true, "dependencies": { "@pnp/core": "^3.21.0", - "@pnp/logging": "^3.21.0", "globby": "^14.0.0", "liftoff": "^4.0.0", "replace-in-file": "^7.0.2", @@ -758,28 +757,6 @@ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true }, - "node_modules/@pnp/logging": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/@pnp/logging/-/logging-3.21.0.tgz", - "integrity": "sha512-ELisAFH1CRBwFrxpJFNUvO8BbDktvFVG4TMyZWcAvv4qlTQo+B35UXW2Iw2zyNErWUSXV71ZGw71NXzSQ9D4qA==", - "dev": true, - "dependencies": { - "tslib": "2.4.1" - }, - "engines": { - "node": ">=14.15.1" - }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/patrick-rodgers/" - } - }, - "node_modules/@pnp/logging/node_modules/tslib": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", - "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", - "dev": true - }, "node_modules/@sindresorhus/merge-streams": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-1.0.0.tgz", diff --git a/tools/buildsystem/package.json b/tools/buildsystem/package.json index 16592fde2..b3cb7cb69 100644 --- a/tools/buildsystem/package.json +++ b/tools/buildsystem/package.json @@ -1,6 +1,6 @@ { "name": "@pnp/buildsystem", - "version": "4.0.0-beta2", + "version": "4.0.0-beta3", "bin": { "pnpbuild": "bin/buildsystem.js" }, diff --git a/tools/buildsystem/src/behaviors/build.ts b/tools/buildsystem/src/behaviors/build.ts index 5e817d402..d93bd0186 100644 --- a/tools/buildsystem/src/behaviors/build.ts +++ b/tools/buildsystem/src/behaviors/build.ts @@ -35,5 +35,7 @@ export function Build(flags?: string[]): TimelinePipe { }); }); }); + + return instance; } } diff --git a/tools/buildsystem/src/behaviors/copy-asset-files.ts b/tools/buildsystem/src/behaviors/copy-asset-files.ts index c7835df01..15181e5ee 100644 --- a/tools/buildsystem/src/behaviors/copy-asset-files.ts +++ b/tools/buildsystem/src/behaviors/copy-asset-files.ts @@ -45,7 +45,7 @@ export function CopyAssetFiles(path: string, pattern: string[]): TimelinePipe { this.log(`Completed CopyAssetFiles.`); }); - } - + return instance; + } } \ No newline at end of file diff --git a/tools/buildsystem/src/behaviors/copy-package-files.ts b/tools/buildsystem/src/behaviors/copy-package-files.ts index acf4c3488..6767e7904 100644 --- a/tools/buildsystem/src/behaviors/copy-package-files.ts +++ b/tools/buildsystem/src/behaviors/copy-package-files.ts @@ -45,5 +45,7 @@ export function CopyPackageFiles(source: "src" | "built", pattern: string[]): Ti this.log(`Completing CopyPackageFiles with pattern ${stringPattern} on target '${this.context.target.tsconfigPath}'`); }); + + return instance; } } diff --git a/tools/buildsystem/src/behaviors/publish-nightly.ts b/tools/buildsystem/src/behaviors/publish-nightly.ts index 16cbefc4b..d1eb7cada 100644 --- a/tools/buildsystem/src/behaviors/publish-nightly.ts +++ b/tools/buildsystem/src/behaviors/publish-nightly.ts @@ -3,7 +3,7 @@ import { BuildTimeline } from "src/build-timeline"; import { Publish } from "./publish.js"; import { resolve } from "path"; import importJSON from "../lib/import-json.js"; -import buildWriteFile from "src/lib/write-file.js"; +import buildWriteFile from "../lib/write-file.js"; /** * Does a nightly publish after setting the nightly version and updating deps @@ -49,5 +49,7 @@ export function PublishNightly(flags: string[], nightlyName: "v3nightly" | "v4ni // we want to publish Publish(flags)(instance); + + return instance; } } diff --git a/tools/buildsystem/src/behaviors/publish.ts b/tools/buildsystem/src/behaviors/publish.ts index feb5d2570..089a93f8f 100644 --- a/tools/buildsystem/src/behaviors/publish.ts +++ b/tools/buildsystem/src/behaviors/publish.ts @@ -38,5 +38,7 @@ export function Publish(flags?: string[]): TimelinePipe { await Promise.all(promises); }); + + return instance; } } diff --git a/tools/buildsystem/src/behaviors/replace-version.ts b/tools/buildsystem/src/behaviors/replace-version.ts index 3c1018b1d..e8fd4cad0 100644 --- a/tools/buildsystem/src/behaviors/replace-version.ts +++ b/tools/buildsystem/src/behaviors/replace-version.ts @@ -21,5 +21,7 @@ export function ReplaceVersion(paths: string[], versionMask = /\$\$Version\$\$/i return (replace)(options); }); + + return instance; } } diff --git a/tools/buildsystem/src/behaviors/webpack.ts b/tools/buildsystem/src/behaviors/webpack.ts index b4c809db2..d1e782b1a 100644 --- a/tools/buildsystem/src/behaviors/webpack.ts +++ b/tools/buildsystem/src/behaviors/webpack.ts @@ -27,5 +27,7 @@ export function Webpack(config: wp.Configuration): TimelinePipe { }); }); }); + + return instance; } } diff --git a/tools/buildsystem/src/behaviors/write-packagejson.ts b/tools/buildsystem/src/behaviors/write-packagejson.ts index 4e81d235d..54fbf115d 100644 --- a/tools/buildsystem/src/behaviors/write-packagejson.ts +++ b/tools/buildsystem/src/behaviors/write-packagejson.ts @@ -42,5 +42,7 @@ export function WritePackageJSON(transform?: (p: any) => typeof p): TimelinePipe await Promise.all(promises); }); + + return instance; } }