Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ontent-cloud-sdk into od/graphql/update-pagination-format
  • Loading branch information
kevinstubbs committed Jun 17, 2024
2 parents 2078545 + 5f3437b commit ffb566d
Show file tree
Hide file tree
Showing 152 changed files with 24,547 additions and 16,372 deletions.
9 changes: 0 additions & 9 deletions .changeset/fifty-peaches-work.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/gorgeous-glasses-tap.md

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ jobs:
run: pnpm --filter '*cli*' build:test

- name: Test
run: pnpm --filter '*cli*' test
run: pnpm test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
yarn.lock
yarn-error.log
package-lock.json
tsup.config.*.mjs

.env.local
.env.development
Expand Down
3 changes: 2 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
shamefully-hoist=true
save-workspace-protocol=false
prefer-workspace-packages=true
prefer-workspace-packages=true
link-workspace-packages=true
68 changes: 68 additions & 0 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion configs/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"prettier": "3.0.0"
"prettier": "3.2.5"
}
}
6 changes: 3 additions & 3 deletions local_testing/testpages/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"dependencies": {
"@pantheon-systems/pcc-react-sample-library": "workspace:*",
"next": "^13.5.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "^14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1"
},
"devDependencies": {
"@types/node": "^20.11.21",
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "pantheon-content-cloud-sdks",
"version": "0.0.1",
"private": true,
"license": "MIT",
"packageManager": "pnpm@8.6.11",
"packageManager": "pnpm@9.1.1",
"scripts": {
"preinstall": "npx only-allow pnpm",
"pre-commit": "pnpm install && pnpm lint && pnpm build && pnpm build:starters",
"dev": "turbo run dev --concurrency=20",
"build": "turbo run build --filter=./packages/*",
"lint": "turbo run lint --filter=./{packages,starters}/*",
"lint:fix": "turbo run lint:fix --filter=./{packages}/*",
"test": "turbo run test --filter=./{packages,starters}/*",
"build:starters": "turbo run build --filter=./starters/*",
"lint:starters": "turbo run lint --filter=./starters/*",
"ci:version": "changeset version",
Expand All @@ -28,7 +31,9 @@
"@pantheon-systems/pcc-react-sdk>trim": ">=0.0.3",
"@pantheon-systems/pcc-react-sdk>trim-newlines": ">=3.0.1",
"@pantheon-systems/pcc-react-sdk>yaml": ">=2.2.2",
"@pantheon-systems/pcc-react-sdk>prettier": "^3.0.0"
"@pantheon-systems/pcc-react-sdk>prettier": "^3.0.0",
"webpack-dev-middleware": "^7.2.1",
"@pantheon-systems/pcc-vue-sdk>ufo": "1.5.3"
}
},
"devDependencies": {
Expand Down
103 changes: 103 additions & 0 deletions packages/browser/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,108 @@
# @pantheon-systems/pcc-browser-sdk

## 3.6.0

### Patch Changes

- Updated dependencies [61363af]
- Updated dependencies [3651708]
- Updated dependencies [61363af]
- @pantheon-systems/pcc-sdk-core@3.6.0

## 3.6.0-beta.3

### Patch Changes

- @pantheon-systems/pcc-sdk-core@3.6.0-beta.3

## 3.6.0-beta.2

### Patch Changes

- @pantheon-systems/pcc-sdk-core@3.6.0-beta.2

## 3.6.0-beta.1

### Patch Changes

- Updated dependencies
- @pantheon-systems/pcc-sdk-core@3.6.0-beta.1

## 3.6.0-beta.0

### Patch Changes

- @pantheon-systems/pcc-sdk-core@3.6.0-beta.0

## 3.5.3

### Patch Changes

- Updated dependencies
- @pantheon-systems/pcc-sdk-core@3.5.3

## 3.5.3-beta.0

### Patch Changes

- Updated dependencies
- @pantheon-systems/pcc-sdk-core@3.5.3-beta.0

## 3.5.2

### Patch Changes

- 289e05c: Add updateConfig function which will override the default PCC
connection settings that PCCConvenienceFunctions will use.
- Updated dependencies [fcfa574]
- Updated dependencies [289e05c]
- @pantheon-systems/pcc-sdk-core@3.5.2

## 3.5.2-beta.1

### Patch Changes

- Add updateConfig function which will override the default PCC connection
settings that PCCConvenienceFunctions will use.
- Updated dependencies
- @pantheon-systems/pcc-sdk-core@3.5.2-beta.1

## 3.5.2-beta.0

### Patch Changes

- Updated dependencies
- @pantheon-systems/pcc-sdk-core@3.5.2-beta.0

## 3.5.1

### Patch Changes

- @pantheon-systems/pcc-sdk-core@3.5.1

## 3.5.0

### Patch Changes

- Updated dependencies [0e74720]
- Updated dependencies [4cab3e2]
- @pantheon-systems/pcc-sdk-core@3.5.0

## 3.4.1

### Patch Changes

- Updated dependencies [19f9ac8]
- @pantheon-systems/pcc-sdk-core@3.4.1

## 3.4.0

### Patch Changes

- Updated dependencies [37e1c39]
- Updated dependencies [5124a8b]
- @pantheon-systems/pcc-sdk-core@3.4.0

## 3.3.3

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@pantheon-systems/pcc-browser-sdk",
"author": "@pantheon-systems",
"description": "Pantheon Content Cloud Browser SDK",
"version": "3.3.3",
"version": "3.6.0",
"main": "dist/index.js",
"files": [
"dist",
Expand All @@ -12,7 +12,7 @@
"build": "tsup",
"dev": "tsup --watch",
"lint": "eslint . && prettier --check . && tsc --noEmit",
"lint:fix": "eslint . --fix && prettier --write . && tsc --noEmit"
"lint:fix": "eslint . --fix && prettier --write ."
},
"devDependencies": {
"eslint": "^8.57.0",
Expand All @@ -21,6 +21,6 @@
"typescript": "^5.3.3"
},
"dependencies": {
"@pantheon-systems/pcc-sdk-core": "^3.3.3"
"@pantheon-systems/pcc-sdk-core": "workspace:*"
}
}
3 changes: 3 additions & 0 deletions packages/browser/src/elements/pcc-article.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class PCCArticle extends HTMLElement {
const id = this.getAttribute("id") || undefined;
const slug = this.getAttribute("slug") || undefined;
const disableStyles = this.getAttribute("disable-styles") != null;
const preserveImageStyles =
this.getAttribute("preserve-image-styles") != null;
const passedInPublishingLevel =
this.getAttribute("publishing-level") || undefined;

Expand All @@ -27,6 +29,7 @@ class PCCArticle extends HTMLElement {

const config = {
disableStyles,
preserveImageStyles,
publishingLevel: publishingLevel
? publishingLevel
: // Default to REALTIME
Expand Down
9 changes: 7 additions & 2 deletions packages/browser/src/elements/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {

export type RendererConfig = {
disableStyles?: boolean;
preserveImageStyles?: boolean;
};

export function renderArticleToElement(
Expand Down Expand Up @@ -73,8 +74,12 @@ export const renderContentNode = (

const node = document.createElement(element.tag);

// Remove styles and classes if disableStyles is true
if (config?.disableStyles) {
// Remove styles and classes if disableStyles is true,
// unless the element is an img and preserveImageStyles is true.
if (
config?.disableStyles === true &&
(element.tag !== "img" || !config.preserveImageStyles)
) {
delete element.style;
delete element.attrs?.class;
}
Expand Down
Loading

0 comments on commit ffb566d

Please sign in to comment.