skip to Main Content

I tried hard to understand the goal of this keystonejs project https://github.com/keystonejs/keystone which is based on lot of modules in it and lot of package.json in it.

it does contain root package.json as well.

it is based on react 17 and node 14/16 and graphql.

package structure root

package structure of sub-module

root package.json

{
  "name": "@keystone-6/mono-repo",
  "description": "KeystoneJS monorepo for all the @keystone-6 packages",
  "private": true,
  "version": "0.0.0",
  "author": "The KeystoneJS Development Team",
  "license": "MIT",
  "repository": "https://github.com/keystonejs/keystone",
  "homepage": "https://github.com/keystonejs/keystone",
  "scripts": {
    "prisma": "prisma",
    "docs": "manypkg run @keystone-6/website dev",
    "coverage": "cross-env DISABLE_LOGGING=true NODE_ENV=test jest --runInBand --coverage",
    "format:file": "prettier --write",
    "format": "prettier --write "**/*.{js,json,ts,tsx,md,mdx}" && remark . --output",
    "fresh": "yarn clean && yarn",
    "clean": "rimraf "**/node_modules" "**/yarn-error.log" "**/out.log" "**/.DS_Store" "**/dist"",
    "lint:eslint": "eslint . --ext ts,tsx,js",
    "lint:prettier": "prettier --list-different "**/*.{js,json,ts,tsx}"",
    "lint:markdown": "remark . --frail --quiet",
    "lint:types": "tsc",
    "lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:markdown && yarn lint:types && yarn lint:filters",
    "test": "yarn lint && yarn test:unit",
    "test:unit": "cross-env DISABLE_LOGGING=true NODE_ENV=test jest --no-watchman --runInBand --logHeapUsage",
    "test:unit:debug": "cross-env NODE_ENV=test node --inspect-brk `which jest` --runInBand",
    "test:admin-ui": "yarn jest tests/admin-ui-tests",
    "benchmark": "yarn workspace @keystone-6/benchmarks-legacy go",
    "changeset": "changeset",
    "publish-changed": "yarn build && changeset publish --public",
    "version-packages": "changeset version",
    "build": "preconstruct build",
    "prepare": "manypkg check && preconstruct dev && yarn run --silent contributing-guide && node scripts/generate-artifacts-for-projects",
    "contributing-guide": "is-ci && exit 0 || chalk -t "{bold 📝 Contributing to KeystoneJS?}" && terminal-link "🔗 Read the full Contributing Guide" "https://github.com/keystonejs/keystone/blob/main/CONTRIBUTING.md"",
    "npm-tag": "manypkg npm-tag",
    "update": "manypkg upgrade",
    "update-project-schemas": "cross-env UPDATE_SCHEMAS=1 node scripts/generate-artifacts-for-projects",
    "generate-filters": "cd prisma-utils && yarn generate",
    "lint:filters": "cd prisma-utils && yarn verify"
  },
  "dependencies": {
    "@babel/core": "^7.16.0",
    "@babel/plugin-proposal-class-properties": "^7.16.0",
    "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/plugin-transform-runtime": "^7.16.0",
    "@babel/preset-env": "^7.16.0",
    "@babel/preset-react": "^7.16.0",
    "@babel/preset-typescript": "^7.16.0",
    "@changesets/changelog-github": "^0.4.1",
    "@changesets/cli": "^2.18.0",
    "@jest/test-sequencer": "^27.3.1",
    "@manypkg/cli": "^0.19.1",
    "@preconstruct/cli": "2.1.5",
    "@preconstruct/eslint-plugin-format-js-tag": "^0.2.0",
    "@testing-library/jest-dom": "^5.15.0",
    "@types/babel__core": "^7.1.16",
    "@types/jest": "^27.0.2",
    "@types/node-fetch": "^2.5.12",
    "@types/normalize-path": "3.0.0",
    "@typescript-eslint/eslint-plugin": "^5.7.0",
    "@typescript-eslint/parser": "^5.7.0",
    "chalk-cli": "^5.0.0",
    "cross-env": "^7.0.3",
    "eslint": "^7.32.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jest": "^25.2.4",
    "eslint-plugin-react": "^7.27.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "is-ci": "^3.0.1",
    "jest": "^27.3.1",
    "prettier": "^2.5.0",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "remark-cli": "^6.0.1",
    "remark-frontmatter": "^1.3.3",
    "remark-toc": "^5.1.1",
    "rimraf": "^3.0.2",
    "terminal-link-cli": "^3.0.0",
    "typescript": "^4.4.4"
  },
  "prettier": {
    "proseWrap": "preserve",
    "singleQuote": true,
    "trailingComma": "es5",
    "printWidth": 100,
    "arrowParens": "avoid",
    "overrides": [
      {
        "files": "docs/**",
        "options": {
          "embeddedLanguageFormatting": "off"
        }
      }
    ]
  },
  "remarkConfig": {
    "settings": {
      "commonmark": true,
      "fences": true,
      "listItemIndent": "1",
      "rule": "-",
      "ruleSpaces": false
    },
    "plugins": [
      "remark-frontmatter",
      "remark-toc"
    ]
  },
  "workspaces": {
    "packages": [
      "design-system/packages/*",
      "design-system/website",
      "docs",
      "examples-staging/*",
      "examples/*",
      "packages/*",
      "tests/admin-ui-tests",
      "tests/api-tests",
      "tests/benchmarks",
      "tests/examples-smoke-tests",
      "tests/test-projects/*",
      "prisma-utils",
      "scripts/*"
    ]
  },
  "preconstruct": {
    "packages": [
      "packages/*",
      "design-system/packages/*",
      "prisma-utils",
      "scripts/*"
    ]
  },
  "manypkg": {
    "defaultBranch": "main"
  },
  "jest": {
    "setupFilesAfterEnv": [
      "./tests/jest/setup.ts"
    ],
    "testSequencer": "./tests/jest/jest-sequencer.js",
    "testEnvironment": "node",
    "testPathIgnorePatterns": [
      "/node_modules/"
    ],
    "transformIgnorePatterns": [
      "/node_modules/",
      "\.pnp\.[^\/]+$"
    ],
    "collectCoverageFrom": [
      "packages/**/*.{js,ts,tsx}",
      "!**/*.d.ts",
      "!packages/**/dist/**",
      "!packages/keystone/src/fields/**/test-fixtures.{js,ts}"
    ]
  },
  "resolutions": {
    "babel-plugin-remove-graphql-queries": "2.7.2"
  },
  "engines": {
    "node": "^14.15 || ^16.13"
  }
}

Is this repository code keystonejs framework itself ? if yes should I use this as dependency in my local keystonejs framework ?

Can we run this project in local ? or can we create docker image of this ?

Can anyone please suggest me some thing on this as I am not able to understand the main purpose behind this repo ?

even I tried below dockerfile to create image of it but was not successful and ended up on getting some issue related to run command of yarn

# https://docs.docker.com/samples/library/node/
ARG NODE_VERSION=16.13
# https://github.com/Yelp/dumb-init/releases
ARG DUMB_INIT_VERSION=1.2.2

# Build container
FROM node:${NODE_VERSION}-alpine AS build
ARG DUMB_INIT_VERSION

WORKDIR /home/node

RUN apk add --no-cache build-base python2 yarn && 
    wget -O dumb-init -q https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64 && 
    chmod +x dumb-init
ADD ./package.json ./package.json
ADD ./yarn.lock ./yarn.lock

RUN yarn install

ADD . /home/node

RUN yarn build && yarn cache clean

# Runtime container
FROM node:${NODE_VERSION}-alpine

WORKDIR /home/node

COPY --from=build /home/node /home/node

EXPOSE 3000
CMD ["./dumb-init", "yarn", "start"]

ERROR:

[+] Building 50.6s (11/14)                                                                                                                                                                   
 => [internal] load build definition from Dockerfile                                                                                                                                    0.0s
 => => transferring dockerfile: 813B                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                       0.0s
 => => transferring context: 34B                                                                                                                                                        0.0s
 => [internal] load metadata for docker.io/library/node:16.13-alpine                                                                                                                    3.3s
 => [auth] library/node:pull token for registry-1.docker.io                                                                                                                             0.0s
 => [internal] load build context                                                                                                                                                       1.2s
 => => transferring context: 635.00kB                                                                                                                                                   1.2s
 => [build 1/8] FROM docker.io/library/node:16.13-alpine@sha256:2f50f4a428f8b5280817c9d4d896dbee03f072e93f4e0c70b90cc84bd1fcfe0d                                                        0.0s
 => CACHED [build 2/8] WORKDIR /home/node                                                                                                                                               0.0s
 => CACHED [build 3/8] RUN apk add --no-cache build-base python2 yarn &&     wget -O dumb-init -q https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 &&   0.0s
 => CACHED [build 4/8] ADD ./package.json ./package.json                                                                                                                                0.0s
 => CACHED [build 5/8] ADD ./yarn.lock ./yarn.lock                                                                                                                                      0.0s
 => ERROR [build 6/8] RUN yarn install                                                                                                                                                 46.0s
------
 > [build 6/8] RUN yarn install:
#11 0.589 yarn install v1.22.15
#11 0.743 [1/5] Validating package.json...
#11 0.750 [2/5] Resolving packages...
#11 1.840 [3/5] Fetching packages...
#11 35.27 info [email protected]: The platform "linux" is incompatible with this module.
#11 35.27 info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
#11 35.29 info [email protected]: The platform "linux" is incompatible with this module.
#11 35.29 info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
#11 35.30 [4/5] Linking dependencies...
#11 35.30 warning " > [email protected]" has unmet peer dependency "gatsby@^2.0.0".
#11 35.30 warning " > [email protected]" has unmet peer dependency "graphql@^14.1.1".
#11 43.78 [5/5] Building fresh packages...
#11 44.28 success Saved lockfile.
#11 44.29 $ manypkg check && preconstruct dev && yarn run --silent contributing-guide && node scripts/generate-artifacts-for-projects
#11 44.58 ☔️ success workspaces valid!
#11 45.09 🎁 info project is valid!
#11 45.09 🎁 success created links!
#11 45.57 📝 Contributing to KeystoneJS?
#11 45.75 🔗 Read the full Contributing Guide (​https://github.com/keystonejs/keystone/blob/main/CONTRIBUTING.md​)
#11 45.80 node:internal/modules/cjs/loader:936
#11 45.80   throw err;
#11 45.80   ^
#11 45.80 
#11 45.80 Error: Cannot find module '/home/node/scripts/generate-artifacts-for-projects'
#11 45.80     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
#11 45.80     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
#11 45.80     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
#11 45.80     at node:internal/main/run_main_module:17:47 {
#11 45.80   code: 'MODULE_NOT_FOUND',
#11 45.80   requireStack: []
#11 45.80 }
#11 45.81 error Command failed with exit code 1.
#11 45.81 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn install]: exit code: 1


I want to know the intention of this repo.

2

Answers


  1. This is the repo for Keystone JS, a Headless Content Management System.

    The Keystone website https://keystonejs.com has material explaining the project and how to use it.

    Login or Signup to reply.
  2. KeystoneJS describes itself as "a CMS for developers". As @rasterisk says in their answer, the official website has more general info that may help you orient yourself or see the Keystone docs site for details.

    Is this repository code keystonejs framework itself?

    Yes. As per the description in the root package.json you posted, it’s the "KeystoneJS monorepo for all the @keystone-6 packages".

    There’s plenty of good info on the web about what monorepos are and how to use them. The team behind Keystone even wrote a guild, which describes some of their specific practices and tools.

    Should I use this as dependency in my local keystonejs framework?

    You mean your local KeystoneJS app? Well, yes, but you should require the @keystone-6/core package from npm, not declare a dependancy on the git repo directly. The example projects show how this is done.

    Alternatively, the Getting Started guide will start you off using the create-keystone-app command. This tool asks you a few questions then creates your initial project files automatically (including a package.json with the the correct dependencies).

    Can we run this project in local?

    You can run Keystone apps (like the examples) directly from the Keystone repo like this:

    # Clone the repo and switch into the dir
    git clone [email protected]:keystonejs/keystone.git
    cd keystone
    
    # Install Keystone's dependencies
    yarn
    
    # Start the "task-manager" example project in dev mode
    # This will create a local SQLite DB with the DB schema for this project 
    # and start a server at localhost:3000
    yarn --cwd examples/task-manager dev
    

    However, unless you’re modifying the Keystone code itself, it’s probably not what you mean to do. See the previous answer for how to create a project that requires Keystone as a package.

    ..or can we create docker image of this?

    As above, it doesn’t really make sense to create a docker image of the Keystone repo itself. You likely want to create a project first, using Keystone, then create an image from that.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search