Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commonjs work #2878

Merged
merged 2 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 29 additions & 29 deletions buildsystem-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,7 @@ function PnPBuild(buildFlags?: string[]): (b: BuildTimeline) => BuildTimeline {
return (instance: BuildTimeline) => {

Build(buildFlags)(instance);
ReplaceVersion(["sp/behaviors/telemetry.js", "graph/behaviors/telemetry.js"])(instance);

return instance;
}
}

function PnPBuildCommonJS(buildFlags?: string[]): (b: BuildTimeline) => BuildTimeline {

if (!buildFlags) {
buildFlags = [];
}

buildFlags.push("--module", "commonjs", "--outDir", "./buildcjs")

return (instance: BuildTimeline) => {

Build(buildFlags)(instance);
ReplaceVersion([resolve("./buildcjs/packages/sp/behaviors/telemetry.js"), resolve("./buildcjs/packages/graph/behaviors/telemetry.js")], { pathsResolved: true })(instance);
ReplaceVersion(["sp/behaviors/telemetry.js", "graph/behaviors/telemetry.js"], {})(instance);

return instance;
}
Expand All @@ -66,13 +49,11 @@ function PnPPackage(): (b: BuildTimeline) => BuildTimeline {
CopyPackageFiles("built", ["**/*.d.ts", "**/*.js", "**/*.js.map", "**/*.d.ts.map"])(instance);
WritePackageJSON((p) => {
return Object.assign({}, p, {
funding: {
type: "individual",
url: "https://github.com/sponsors/patrick-rodgers/",
},
type: "module",
main: "./esm/index.js",
typings: "./esm/index",
engines: {
node: ">=14.15.1"
node: ">=18.12.0"
},
author: {
name: "Microsoft and other contributors"
Expand All @@ -85,7 +66,24 @@ function PnPPackage(): (b: BuildTimeline) => BuildTimeline {
repository: {
type: "git",
url: "git:github.com/pnp/pnpjs"
}
},
exports: {
".": {
"import": {
"types": "./esm/index",
"default": "./esm/index.js"
},
"require": {
"types": "./commonjs/index",
"default": "./commonjs/index.js"
},
"default": "./esm/index.js"
}
},
funding: {
type: "individual",
url: "https://github.com/sponsors/patrick-rodgers/",
},
});
})(instance);

Expand All @@ -112,6 +110,7 @@ export default <BuildSchema[]>[{
distFolder,
targets: [
resolve("./packages/tsconfig.json"),
resolve("./packages/tsconfig-commonjs.json"),
],
behaviors: [PnPBuild(), ...commonBehaviors],
},
Expand All @@ -121,31 +120,32 @@ export default <BuildSchema[]>[{
targets: [
resolve("./debug/launch/tsconfig.json"),
],
behaviors: [Build(), ReplaceVersion(["packages/sp/behaviors/telemetry.js", "packages/graph/behaviors/telemetry.js"]), ...commonBehaviors],
behaviors: [Build(), ReplaceVersion(["packages/sp/behaviors/telemetry.js", "packages/graph/behaviors/telemetry.js"], {}), ...commonBehaviors],
},
{
name: "package",
distFolder,
targets: [
resolve("./packages/tsconfig.json"),
resolve("./packages/tsconfig-commonjs.json"),
],
behaviors: [PnPBuild(), PnPBuildCommonJS(), PnPPackage(), ...commonBehaviors],
behaviors: [PnPBuild(), PnPPackage(), ...commonBehaviors],
},
{
name: "publish",
distFolder,
targets: [
resolve("./packages/tsconfig.json"),
],
behaviors: [PnPBuild(), PnPBuildCommonJS(), PnPPackage(), PnPPublish(commonPublishTags), ...commonBehaviors],
behaviors: [PnPBuild(), PnPPackage(), PnPPublish(commonPublishTags), ...commonBehaviors],
},
{
name: "publish-beta",
distFolder,
targets: [
resolve("./packages/tsconfig.json"),
],
behaviors: [PnPBuild(), PnPBuildCommonJS(), PnPPackage(), PnPPublish([...commonPublishTags, "--tag", "beta"]), ...commonBehaviors],
behaviors: [PnPBuild(), PnPPackage(), PnPPublish([...commonPublishTags, "--tag", "beta"]), ...commonBehaviors],
},
{
name: "publish-v3nightly",
Expand All @@ -161,5 +161,5 @@ export default <BuildSchema[]>[{
targets: [
resolve("./packages/tsconfig.json"),
],
behaviors: [PnPBuild(), PnPBuildCommonJS(), PnPPackage(), PublishNightly([...commonPublishTags], "v4nightly"), ...commonBehaviors],
behaviors: [PnPBuild(), PnPPackage(), PublishNightly([...commonPublishTags], "v4nightly"), ...commonBehaviors],
}];
133 changes: 67 additions & 66 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@azure/identity": "3.3.0",
"@azure/msal-node": "1.18.3",
"@microsoft/microsoft-graph-types": "2.38.0",
"@pnp/buildsystem": "^4.0.0-beta5",
"@pnp/buildsystem": "^4.0.0-beta7",
"@pnp/logging": "^3.21.0",
"@types/chai": "4.3.6",
"@types/chai-as-promised": "7.1.6",
Expand All @@ -26,6 +26,7 @@
"del-cli": "5.1.0",
"eslint": "8.49.0",
"findup-sync": "5.0.0",
"globby": "^14.0.0",
"mocha": "10.2.0",
"msal": "1.4.18",
"node-fetch": "3.3.2",
Expand Down
12 changes: 12 additions & 0 deletions packages/azidjsclient/tsconfig-commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../tsconfig-commonjs.json",
"include": [
"./**/*.ts",
"../queryable/**/*.ts"
],
"references": [
{
"path": "../queryable/tsconfig-commonjs.json"
}
]
}
10 changes: 10 additions & 0 deletions packages/core/tsconfig-commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../tsconfig-commonjs.json",
"include": [
"./**/*.ts"
],
"compilerOptions": {
"esModuleInterop": true
},
"references": []
}
16 changes: 16 additions & 0 deletions packages/graph/tsconfig-commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "../tsconfig-commonjs.json",
"include": [
"./**/*.ts",
"../core/**/*.ts",
"../queryable/**/*.ts"
],
"references": [
{
"path": "../core/tsconfig-commonjs.json"
},
{
"path": "../queryable/tsconfig-commonjs.json"
}
]
}
7 changes: 7 additions & 0 deletions packages/logging/tsconfig-commonjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig-commonjs.json",
"include": [
"./**/*.ts"
],
"references": []
}
Loading
Loading