Git Product home page Git Product logo

pantheon-systems / decoupled-kit-js Goto Github PK

View Code? Open in Web Editor NEW
22.0 10.0 31.0 15.04 MB

Pantheon's monorepo for JavaScript SDKs, starter examples, and published npm packages.

Home Page: https://decoupledkit.pantheon.io/

License: GNU General Public License v3.0

TypeScript 63.93% JavaScript 24.71% CSS 3.54% Shell 0.17% Handlebars 4.40% MDX 3.26%
drupal gatsby headless jamstack nextjs starter-kit webops wordpress create-app decoupled-kit

decoupled-kit-js's Introduction

Pantheon Systems Decoupled Kits

Unit Tests Headless regression testing Canary Release Split Canary Sites Starter Split and Changesets

Prerequisites

Welcome to the Pantheon Systems Decoupled Kit Monorepo

This repo is a collection of multiple projects, organized by pnpm workspaces.

Workspaces

There are two main workspaces in the monorepo, starters, and packages, along with a configs workspace and web which houses the documentation.

Starters

Each directory in this workspace represents a starter kit that is mirrored to a standalone repo at release time. Please use the monorepo to develop against the starters.

Packages

The starters have a dependency on one or more of our npm packages, which live in this workspace. Each directory in this workspace represents a library to be published on npm, and to be consumed by the public, and our starter kits.

Setup the Monorepo

To configure the monorepo for development, the following should be installed locally:

  • Node.js version 18 LTS. We recommend using nvm

  • npm version 9.x.x

  • pnpm version 8.x.x

    We recommend using npm. Run the following command to install:

    npm install -g pnpm@8

Configure the Monorepo

To contribute to this project, follow the directions below. Also see CONTRIBUTING.md for more information.

  1. Fork this repo
  2. Clone your fork to your local machine.
  3. Install dependencies for all packages and starters using the following command. A postinstall script will build the packages:
    pnpm install
  4. Install the husky pre-commit hooks. Run the following command:
    pnpm husky install

Useful Scripts

There are several scripts you can use in the monorepo.

  • To see all available scripts:

    pnpm run
  • Test all projects in the monorepo that have a test script:

    pnpm test
  • Build all packages in the monorepo:

    pnpm build:pkgs
  • Start the nextjs-kit in watch mode:

    pnpm watch:nextjs-kit
  • Build and run the documentation:

    pnpm generate-docs && pnpm start:docs
  • Run commands in a targeted project, folder, or workspace, using the pnpm filter flag.

    For example, to start the Gatsby starter (filter by namespace):

    pnpm --filter gatsby-wordpress-starter develop
  • Lint the starters (filter by directory):

    pnpm --filter './starters/**' lint

If you need to run a command in a specific project, use the alias in the ROOT package.json scripts (pnpm run to see the full list in your terminal), or use a filter. Please do not cd into the project directory and use npm or yarn.


Versions and Releases

Generating a Changeset

To generate a new changeset, run pnpm changeset in the root of the repository. The generated Markdown files in the .changeset directory should be committed to the repository.

Creating and Publishing New Versions

Versions and releases are created as part of our CI process and typically should not be created manually.

Canary Releases

Each push to the canary (default) branch triggers the canary-release.yml GitHub Action workflow which will open a PR back to the repo, and on merge it will release any package with a changeset to the canary tag on GitHub and npm.


Bug Reports and Feature Requests


Further Reading

For more information on contributing to this project, see CONTRIBUTING.md

decoupled-kit-js's People

Contributors

abhisekmazumdar avatar backlineint avatar cobypear avatar dependabot[bot] avatar enzane avatar github-actions[bot] avatar joan-ing avatar joshkoenig avatar lotusbaba avatar mitchellmarkoff avatar namespacebrian avatar pantheon-decoupled-service-user avatar rh0 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

decoupled-kit-js's Issues

[bug]: Error on terminus build:project:create

Describe the bug

Running the terminus build:project:create command described in the documentation results in an error message.

  The "--profile" option does not exist.

Reproduction

Use Terminus 3 and install the Build Tools plugin using the documentation:

terminus self:plugin:install terminus-build-tools-plugin

I think the issue is that this installation mechanism brings in the most recent tagged release of Build Tools (made in January) and the profile option was added in February/March.

I think the needed resolution is a new tagged release of Build Tools that is installable when running terminus self:plugin:install terminus-build-tools-plugin

Logs

No response

Which packages/starters are effected?

  • next-drupal
  • gatsby-wordpress
  • drupal-kit
  • wordpress-kit
  • documentation
  • monorepo

Severity

Blocking all usage of Decoupled Kit

Additional Information

It's probably possible to work around this issue but installing a dev version of the plugin. I knew how to do that in Terminus 2. My few minutes of attempts in Terminus 3 have failed. I think with how small the resolution needed is, we should just cut a new release of Build Tools rather than documenting a work around that puts customers on a branch instead of a tagged release.

[feat]: next-drupal-starter - OpenID User Authentication Use Case

Describe the problem

This starter kit currently handles authentication and authorization from the perspective of a machine user that sources data from Drupal. It would be desirable to demonstrate an example for user authentication as well - a user can authenticate via a login form and as a result gains access to specific resources based on their Drupal account.

Describe the proposed solution

Provide an OpenID based user authentication option.

Drupal:
Assumes that Simple oAuth and OpenID Connect are installed.

Next:
Using NextAuth

High level flow:

  • User authenticates via next-auth / OpenID provider
  • This information is used to authenticate with Drupal
    ** OpenID connect will create a Drupal account the first time a user authenticates if it does not exist. What I'm not clear on is if this will happen when accounts are created via API based registration requests and if the next-auth token provides enough information to make SSO with Drupal possible.
    ** If OpenID can't create accounts via API requests, this step instead would have to try to authenticate or check for the existence of a Drupal account (as the machine user,) and if the account doesn't exist, create an account.
  • A user specific Drupal State store is created for that user. All user specific requests are made through that store.

Drupal State:

Alternatives considered

There are many other auth methods that could satisfy this, but this approach has the benefit of taking advantage of Drupal's simple oAuth Ecosystem.

Importance

It would make my life easier

Additional Information

No response

[docs]: Drupal starter and Next.js start appear to be incompatible

Expected behavior

Actual behavior

  • The Next.js site throws a build error because it expects recipe nodes but the starter Drupal site does not have that content type.

Steps to reproduce the problem

  1. Create a Drupal site using the steps in the documentation
  2. Use the Pantheon dashboard to create a Next.js site to create from the newly created Drupal site.
  3. See a build error
Step #9 - "build-auto-ssr-private-build": Error: Invalid objectName.
Step #9 - "build-auto-ssr-private-build": Check that node--recipe is a valid node in your Drupal instance or local store

Suggested Resolution

  • Update one or more of
  1. The Drupal starter (to include a recipe content type)
  2. The next.js starter (to not use a recipe content type)
  3. The documentation for combining the two (maybe document how spin up Umami if that's what the Next.js starter presently expects)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.