diff --git a/.npmrc b/.npmrc index 74637d3e..3f1a2e3d 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ shamefully-hoist=true save-workspace-protocol=false -prefer-workspace-packages=true \ No newline at end of file +prefer-workspace-packages=true +link-workspace-packages=true \ No newline at end of file diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs new file mode 100644 index 00000000..e0be01d2 --- /dev/null +++ b/.pnpmfile.cjs @@ -0,0 +1,68 @@ +const fs = require("fs"); +const path = require("path"); + +/** + * This pnpm install hook links all packages in the monorepo to their local versions. + * This allows us to use published version numbers in package.json files, while still + * depending on the local version of the package when inside the monorepo. + */ +const monorepoRoot = findMonorepoRoot(process.cwd()); +const workspacePackageDirectories = [ + "packages", + "starters", + "configs", + "local_testing", +]; +const workspacePackages = new Map(); + +workspacePackageDirectories.forEach((workspacePackageDir) => { + const allDirs = fs.readdirSync(path.join(monorepoRoot, workspacePackageDir)); + allDirs + .filter((dir) => { + return fs + .statSync(path.join(monorepoRoot, workspacePackageDir, dir)) + .isDirectory(); + }) + .forEach((dir) => { + const pkgPath = path.join(monorepoRoot, workspacePackageDir, dir); + const pkgName = require(path.join(pkgPath, "package.json")).name; + workspacePackages.set(pkgName, pkgPath); + }); +}); + +module.exports = { + hooks: { + // This runs after package.json is parsed but before versions are resolved + // We just set the dependencies to the local version if they are in the monorepo + // These changes to the package.json are not saved to disk, but the resolved versions + // are, which is fine for us because users cloning the starterkits will not use the + // monorepo's lockfile + readPackage(pkg) { + for (const dep in pkg.dependencies) { + if (workspacePackages.has(dep)) { + console.log(`INFO: Linking ${pkg.name} to local version of ${dep}`); + pkg.dependencies[dep] = `workspace:*`; + } + } + for (const dep in pkg.devDependencies) { + if (workspacePackages.has(dep)) { + console.log(`INFO: Linking ${pkg.name} to local version of ${dep}`); + pkg.devDependencies[dep] = `workspace:*`; + } + } + + return pkg; + }, + }, +}; + +function findMonorepoRoot(currentDir) { + let dir = currentDir; + while (dir !== path.parse(dir).root) { + if (fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) { + return dir; + } + dir = path.dirname(dir); + } + return null; +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 518dc68c..67ab5729 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,8 @@ overrides: '@pantheon-systems/pcc-react-sdk>prettier': ^3.0.0 webpack-dev-middleware: ^7.2.1 +pnpmfileChecksum: fxjsw7uvrtjknx3cbmatfizpni + importers: .: @@ -587,8 +589,8 @@ importers: specifier: ^2.3.0 version: 2.3.0(react@18.3.1) '@pantheon-systems/pcc-react-sdk': - specifier: 3.6.0-beta.3 - version: 3.6.0-beta.3(@types/react-dom@18.2.19)(@types/react@18.2.60)(csstype@3.1.3)(graphql-ws@5.15.0(graphql@16.8.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../../packages/react-sdk '@pantheon-systems/pds-toolkit-react': specifier: 1.0.0-dev.55 version: 1.0.0-dev.55(prop-types@15.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -630,8 +632,8 @@ importers: specifier: ^2.3.0 version: 2.3.0(react@18.3.1) '@pantheon-systems/pcc-react-sdk': - specifier: 3.6.0-beta.3 - version: 3.6.0-beta.3(@types/react-dom@18.2.19)(@types/react@18.2.60)(csstype@3.1.3)(graphql-ws@5.15.0(graphql@16.8.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../../packages/react-sdk '@pantheon-systems/pds-toolkit-react': specifier: 1.0.0-dev.55 version: 1.0.0-dev.55(prop-types@15.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -670,8 +672,8 @@ importers: starters/nextjs-starter: dependencies: '@pantheon-systems/pcc-react-sdk': - specifier: 3.6.0-beta.3 - version: 3.6.0-beta.3(@types/react-dom@18.2.19)(@types/react@18.2.60)(csstype@3.1.3)(graphql-ws@5.15.0(graphql@16.8.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../../packages/react-sdk '@pantheon-systems/pds-toolkit-react': specifier: 1.0.0-dev.55 version: 1.0.0-dev.55(prop-types@15.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -749,8 +751,8 @@ importers: starters/nextjs-starter-approuter-ts: dependencies: '@pantheon-systems/pcc-react-sdk': - specifier: 3.6.0-beta.3 - version: 3.6.0-beta.3(@types/react-dom@18.2.19)(@types/react@18.2.60)(csstype@3.1.3)(graphql-ws@5.15.0(graphql@16.8.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../../packages/react-sdk '@tailwindcss/typography': specifier: ^0.5.10 version: 0.5.10(tailwindcss@3.4.1) @@ -825,8 +827,8 @@ importers: starters/nextjs-starter-ts: dependencies: '@pantheon-systems/pcc-react-sdk': - specifier: 3.6.0-beta.3 - version: 3.6.0-beta.3(@types/react-dom@18.2.19)(@types/react@18.2.60)(csstype@3.1.3)(graphql-ws@5.15.0(graphql@16.8.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: workspace:* + version: link:../../packages/react-sdk '@pantheon-systems/pds-toolkit-react': specifier: 1.0.0-dev.55 version: 1.0.0-dev.55(prop-types@15.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -910,8 +912,8 @@ importers: starters/vue-starter: dependencies: '@pantheon-systems/pcc-vue-sdk': - specifier: ~3.6.0-beta.0 - version: 3.6.0-beta.3(@nuxt/kit@3.10.3(rollup@4.12.0))(@types/react@18.2.60)(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(graphql-ws@5.15.0(graphql@16.8.1))(h3@1.11.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.4.5)(vue@3.4.27(typescript@5.4.5)) + specifier: workspace:* + version: link:../../packages/vue-sdk devDependencies: '@nuxt/devtools': specifier: 1.0.0 @@ -3766,31 +3768,6 @@ packages: resolution: {integrity: sha512-+nGS3ReCByF6m+nbNB59x7Aa3CNjCCGuBLFzfkiJP1O3uVKKuJbkP4uO4t46YqH26nlugmOhqjT7nx5D0VPtdA==} engines: {node: '>= 18'} - '@pantheon-systems/pcc-react-sdk@3.6.0-beta.3': - resolution: {integrity: sha512-//VPpA/0ZnuBcDsPbSrdwfHmkFj15Csoe0J13ES5Nuf8/wnXakWNWvI1MuTonsgo1KJSJkAM7MLjTziU4BoFXg==} - engines: {node: '>=18.10.0'} - peerDependencies: - '@types/react': '>=18' - '@types/react-dom': '>=18' - react: '>=18' - react-dom: '>=18' - peerDependenciesMeta: - '@types/react': - optional: true - - '@pantheon-systems/pcc-sdk-core@3.6.0-beta.3': - resolution: {integrity: sha512-/uzo+Xm1aRbnMcEek5iPDLWFMhS9/tJQm8y0rS9TbzNY1GCY5CcL9tuSmibaF+vIHvkAqDnrOLTkk74z18vbFQ==} - - '@pantheon-systems/pcc-vue-sdk@3.6.0-beta.3': - resolution: {integrity: sha512-/5Nw8itKpfuorTmEtfmZYphvbzJqcdR0G66lHnsZybJC9yI/EdyO3KDJjLZyRpyU0FdlUQGojUzaBk7zbEoGZw==} - engines: {node: '>=18.0.0'} - peerDependencies: - h3: ^1.8.2 - vue: '>=3.0.0' - peerDependenciesMeta: - h3: - optional: true - '@pantheon-systems/pds-toolkit-react@1.0.0-dev.55': resolution: {integrity: sha512-xjXj7asV6oeTKiYQGkl0APX5fovjF1DDbSmD79p52S8jb+Mto1k9w//+aDg0yBjTKPwUi+NrHZ7FQ34uQlXmbQ==} peerDependencies: @@ -17872,77 +17849,6 @@ snapshots: '@octokit/webhooks-types': 7.3.2 aggregate-error: 3.1.0 - '@pantheon-systems/pcc-react-sdk@3.6.0-beta.3(@types/react-dom@18.2.19)(@types/react@18.2.60)(csstype@3.1.3)(graphql-ws@5.15.0(graphql@16.8.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@apollo/client': 3.10.4(@types/react@18.2.60)(graphql-ws@5.15.0(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@pantheon-systems/pcc-sdk-core': 3.6.0-beta.3(@types/react@18.2.60)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/react-dom': 18.2.19 - framer-motion: 10.18.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - goober: 2.1.14(csstype@3.1.3) - graphql: 16.8.1 - query-string: 8.2.0 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react-laag: 2.0.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - react-markdown: 8.0.7(@types/react@18.2.60)(react@18.3.1) - rehype-raw: 6.1.1 - remark-heading-id: 1.0.1 - unist-util-visit: 5.0.0 - optionalDependencies: - '@types/react': 18.2.60 - transitivePeerDependencies: - - csstype - - graphql-ws - - subscriptions-transport-ws - - supports-color - - '@pantheon-systems/pcc-sdk-core@3.6.0-beta.3(@types/react@18.2.60)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@apollo/client': 3.10.4(@types/react@18.2.60)(graphql-ws@5.15.0(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - graphql: 16.8.1 - graphql-tag: 2.12.6(graphql@16.8.1) - graphql-ws: 5.15.0(graphql@16.8.1) - query-string: 8.2.0 - typescript: 5.4.5 - zod: 3.22.4 - zod-validation-error: 1.5.0(zod@3.22.4) - transitivePeerDependencies: - - '@types/react' - - react - - react-dom - - subscriptions-transport-ws - - '@pantheon-systems/pcc-vue-sdk@3.6.0-beta.3(@nuxt/kit@3.10.3(rollup@4.12.0))(@types/react@18.2.60)(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(graphql-ws@5.15.0(graphql@16.8.1))(h3@1.11.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.4.5)(vue@3.4.27(typescript@5.4.5))': - dependencies: - '@apollo/client': 3.10.4(@types/react@18.2.60)(graphql-ws@5.15.0(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@pantheon-systems/pcc-sdk-core': 3.6.0-beta.3(@types/react@18.2.60)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@vue/apollo-composable': 4.0.0-beta.12(@apollo/client@3.10.4(@types/react@18.2.60)(graphql-ws@5.15.0(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(graphql@16.8.1)(typescript@5.4.5)(vue@3.4.27(typescript@5.4.5)) - floating-vue: 5.2.2(@nuxt/kit@3.10.3(rollup@4.12.0))(vue@3.4.27(typescript@5.4.5)) - graphql: 16.8.1 - hast-util-to-jsx-runtime: 2.3.0 - html-url-attributes: 3.0.0 - query-string: 8.2.0 - rehype-raw: 6.1.1 - remark-heading-id: 1.0.1 - remark-parse: 11.0.0 - remark-rehype: 11.1.0 - unified: 11.0.4 - unist-util-visit: 5.0.0 - vue: 3.4.27(typescript@5.4.5) - vue-demi: 0.14.7(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(vue@3.4.27(typescript@5.4.5)) - optionalDependencies: - h3: 1.11.1 - transitivePeerDependencies: - - '@nuxt/kit' - - '@types/react' - - '@vue/composition-api' - - graphql-ws - - react - - react-dom - - subscriptions-transport-ws - - supports-color - - typescript - '@pantheon-systems/pds-toolkit-react@1.0.0-dev.55(prop-types@15.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@floating-ui/react': 0.24.8(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -20614,19 +20520,6 @@ snapshots: transitivePeerDependencies: - typescript - '@vue/apollo-composable@4.0.0-beta.12(@apollo/client@3.10.4(@types/react@18.2.60)(graphql-ws@5.15.0(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(graphql@16.8.1)(typescript@5.4.5)(vue@3.4.27(typescript@5.4.5))': - dependencies: - '@apollo/client': 3.10.4(@types/react@18.2.60)(graphql-ws@5.15.0(graphql@16.8.1))(graphql@16.8.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - graphql: 16.8.1 - throttle-debounce: 5.0.0 - ts-essentials: 9.4.1(typescript@5.4.5) - vue: 3.4.27(typescript@5.4.5) - vue-demi: 0.14.7(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(vue@3.4.27(typescript@5.4.5)) - optionalDependencies: - '@vue/composition-api': 1.7.2(vue@3.4.27(typescript@5.4.5)) - transitivePeerDependencies: - - typescript - '@vue/babel-helper-vue-transform-on@1.2.1': {} '@vue/babel-plugin-jsx@1.2.1(@babel/core@7.24.0)': @@ -20778,11 +20671,6 @@ snapshots: vue: 3.3.4 optional: true - '@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5))': - dependencies: - vue: 3.4.27(typescript@5.4.5) - optional: true - '@vue/devtools-api@6.6.1': {} '@vue/reactivity-transform@3.3.4': @@ -24246,14 +24134,6 @@ snapshots: flatted@3.3.1: {} - floating-vue@5.2.2(@nuxt/kit@3.10.3(rollup@4.12.0))(vue@3.4.27(typescript@5.4.5)): - dependencies: - '@floating-ui/dom': 1.1.1 - vue: 3.4.27(typescript@5.4.5) - vue-resize: 2.0.0-alpha.1(vue@3.4.27(typescript@5.4.5)) - optionalDependencies: - '@nuxt/kit': 3.10.3(rollup@4.12.0) - floating-vue@5.2.2(@nuxt/kit@3.10.3)(vue@3.3.4): dependencies: '@floating-ui/dom': 1.1.1 @@ -31091,10 +30971,6 @@ snapshots: optionalDependencies: typescript: 5.3.3 - ts-essentials@9.4.1(typescript@5.4.5): - optionalDependencies: - typescript: 5.4.5 - ts-interface-checker@0.1.13: {} ts-invariant@0.10.3: @@ -32062,22 +31938,12 @@ snapshots: optionalDependencies: '@vue/composition-api': 1.7.2(vue@3.3.4) - vue-demi@0.14.7(@vue/composition-api@1.7.2(vue@3.4.27(typescript@5.4.5)))(vue@3.4.27(typescript@5.4.5)): - dependencies: - vue: 3.4.27(typescript@5.4.5) - optionalDependencies: - '@vue/composition-api': 1.7.2(vue@3.4.27(typescript@5.4.5)) - vue-devtools-stub@0.1.0: {} vue-resize@2.0.0-alpha.1(vue@3.3.4): dependencies: vue: 3.3.4 - vue-resize@2.0.0-alpha.1(vue@3.4.27(typescript@5.4.5)): - dependencies: - vue: 3.4.27(typescript@5.4.5) - vue-router@4.3.0(vue@3.4.27(typescript@5.4.5)): dependencies: '@vue/devtools-api': 6.6.1