我努力理解这个keystonejs项目https://github.com/keystonejs/keystone的目标,该项目基于它中的许多模块和大量的package.json。
它也包含根package.json。
它基于react 17和节点14/16以及graphql。
封装结构根

子模块的封装结构

根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"
}
}这个存储库代码keystonejs框架本身是吗?如果是,我应该在本地keystonejs框架中使用它作为依赖项吗?
我们能在当地运行这个项目吗?或者我们能创建码头形象吗?
有人能建议我一些事情,因为我不能理解这个回购背后的主要目的?
甚至我也试图在dockerfile下面创建它的映像,但是没有成功,最终得到了一些与运行纱线的命令有关的问题。
# 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"]错误:
[+] 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 fsevents@2.3.2: The platform "linux" is incompatible with this module.
#11 35.27 info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
#11 35.29 info fsevents@1.2.13: The platform "linux" is incompatible with this module.
#11 35.29 info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
#11 35.30 [4/5] Linking dependencies...
#11 35.30 warning " > babel-plugin-remove-graphql-queries@2.7.2" has unmet peer dependency "gatsby@^2.0.0".
#11 35.30 warning " > babel-plugin-remove-graphql-queries@2.7.2" 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我想知道这次回购的意图.
发布于 2022-01-28 00:43:11
这是Keystone JS的回购,一个无头内容管理系统。
Keystone网站https://keystonejs.com有解释该项目和如何使用它的材料。
发布于 2022-01-28 03:44:31
KeystoneJS将自己描述为“面向开发人员的CMS”。正如@rasterisk在他们的回答中说的那样,官方网站有更多的一般信息,可以帮助您定位自己或查看Keystone文档站点获取详细信息。
这个存储库代码keystonejs框架本身是吗?
是。根据您发布的根package.json中的描述,它是“所有@keystone-6包的KeystoneJS monorepo”。
网络上有很多关于什么是单一操作系统以及如何使用它们的好信息。Keystone甚至写行会背后的团队描述了他们的一些具体实践和工具。
我是否应该在本地keystonejs框架中使用它作为依赖项?
你是说你的本地KeystoneJS应用?是的,但是您应该要求国家预防机制的一揽子方案,而不是直接声明对git的依赖。示例项目展示了如何做到这一点。
或者,入门指南将使用create-keystone-app命令启动您。这个工具会问您几个问题,然后自动创建初始项目文件(包括具有正确依赖项的package.json )。
我们能在当地运行这个项目吗?
您可以直接从Keystone回购系统运行Keystone应用程序(如示例),如下所示:
# Clone the repo and switch into the dir
git clone git@github.com: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但是,除非您正在修改Keystone代码本身,否则这可能不是您想要做的。有关如何创建需要将Keystone作为包的项目,请参阅前面的答案。
..or我们能创建码头形象吗?
如前所述,创建Keystone本身的停靠者形象是没有意义的。您可能希望先创建一个项目,然后使用Keystone创建一个图像。
https://stackoverflow.com/questions/70883220
复制相似问题