create-keystone-app 9.0.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +10 -0
- package/cli.js +2 -0
- package/dist/create-keystone-app.cjs.d.ts +2 -0
- package/dist/create-keystone-app.cjs.dev.js +62 -107
- package/dist/create-keystone-app.cjs.prod.js +62 -107
- package/dist/create-keystone-app.esm.js +120 -0
- package/dist/declarations/src/index.d.ts +2 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/package.json +28 -18
- package/starter/README.md +1 -1
- package/starter/_gitignore +2 -2
- package/starter/auth.ts +9 -9
- package/starter/keystone.ts +4 -4
- package/starter/package.json +6 -6
- package/starter/schema.graphql +13 -6
- package/starter/schema.prisma +0 -1
- package/starter/schema.ts +7 -7
- package/bin.js +0 -3
- package/starter/.keystone/config.js +0 -137
- package/starter/CHANGELOG.md +0 -17
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Thinkmill Labs Pty Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# create-keystone-app
|
|
2
|
+
|
|
3
|
+
<br>
|
|
4
|
+
<p>Keystone helps you build faster and scale further than any other CMS or App Framework. Describe your schema, and get a powerful GraphQL API & beautiful Management UI for your content and data.</p>
|
|
5
|
+
<p>No boilerplate or bootstrapping – just elegant APIs to help you ship the code that matters without sacrificing the flexibility or power of a bespoke back-end.
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
For help with this package join the conversation in [Slack](https://community.keystonejs.com/), or on [GitHub](https://github.com/keystonejs/keystone/).
|
|
9
|
+
|
|
10
|
+
Visit <https://keystonejs.com/> for docs, and [follow @keystonejs on Twitter](https://twitter.com/keystonejs) for the latest updates.
|
package/cli.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export * from "./declarations/src/index";
|
|
2
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlLWtleXN0b25lLWFwcC5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4vZGVjbGFyYXRpb25zL3NyYy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
|
|
@@ -1,102 +1,76 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs = require('fs
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var
|
|
3
|
+
var fs = require('node:fs/promises');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var node_url = require('node:url');
|
|
6
|
+
var c = require('chalk');
|
|
6
7
|
var enquirer = require('enquirer');
|
|
7
8
|
var execa = require('execa');
|
|
8
|
-
var ora = require('ora');
|
|
9
9
|
var getPackageJson = require('package-json');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var terminalLink = require('terminal-link');
|
|
10
|
+
var meow = require('meow');
|
|
11
|
+
var ora = require('ora');
|
|
13
12
|
|
|
14
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
15
14
|
|
|
16
|
-
function _interopNamespace(e) {
|
|
17
|
-
if (e && e.__esModule) return e;
|
|
18
|
-
var n = Object.create(null);
|
|
19
|
-
if (e) {
|
|
20
|
-
Object.keys(e).forEach(function (k) {
|
|
21
|
-
if (k !== 'default') {
|
|
22
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return e[k]; }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
n["default"] = e;
|
|
31
|
-
return Object.freeze(n);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
15
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
35
16
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
36
|
-
var
|
|
17
|
+
var c__default = /*#__PURE__*/_interopDefault(c);
|
|
37
18
|
var enquirer__default = /*#__PURE__*/_interopDefault(enquirer);
|
|
38
19
|
var execa__default = /*#__PURE__*/_interopDefault(execa);
|
|
39
|
-
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
40
20
|
var getPackageJson__default = /*#__PURE__*/_interopDefault(getPackageJson);
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var terminalLink__default = /*#__PURE__*/_interopDefault(terminalLink);
|
|
21
|
+
var meow__default = /*#__PURE__*/_interopDefault(meow);
|
|
22
|
+
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
44
23
|
|
|
45
|
-
var
|
|
24
|
+
var thisPackage = {
|
|
46
25
|
name: "create-keystone-app",
|
|
47
|
-
version: "
|
|
48
|
-
main: "dist/create-keystone-app.cjs.js",
|
|
49
|
-
files: [
|
|
50
|
-
"dist",
|
|
51
|
-
"starter",
|
|
52
|
-
"!dist/**/*.d.ts",
|
|
53
|
-
"!starter/node_modules"
|
|
54
|
-
],
|
|
55
|
-
bin: "./bin.js",
|
|
26
|
+
version: "10.0.0",
|
|
56
27
|
license: "MIT",
|
|
28
|
+
type: "module",
|
|
29
|
+
main: "dist/create-keystone-app.cjs.js",
|
|
30
|
+
module: "dist/create-keystone-app.esm.js",
|
|
31
|
+
repository: "https://github.com/keystonejs/keystone/tree/main/packages/create",
|
|
32
|
+
bin: "./cli.js",
|
|
33
|
+
exports: {
|
|
34
|
+
".": {
|
|
35
|
+
module: "./dist/create-keystone-app.esm.js",
|
|
36
|
+
"default": "./dist/create-keystone-app.cjs.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
preconstruct: {
|
|
41
|
+
entrypoints: [
|
|
42
|
+
"index.ts"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
57
45
|
dependencies: {
|
|
58
|
-
"@babel/runtime": "^7.18.9",
|
|
59
46
|
chalk: "^4.1.2",
|
|
60
|
-
enquirer: "^2.
|
|
47
|
+
enquirer: "^2.4.1",
|
|
61
48
|
execa: "^5.1.1",
|
|
62
|
-
"fs-extra": "^10.1.0",
|
|
63
49
|
meow: "^9.0.0",
|
|
64
|
-
ora: "^
|
|
65
|
-
"package-json": "^
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
ora: "^8.0.1",
|
|
51
|
+
"package-json": "^10.0.0"
|
|
52
|
+
},
|
|
53
|
+
files: [
|
|
54
|
+
"dist",
|
|
55
|
+
"starter",
|
|
56
|
+
"cli.js"
|
|
57
|
+
]
|
|
69
58
|
};
|
|
70
59
|
|
|
71
60
|
async function checkVersion() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
throw new Error('version from package metadata was expected to be a string but was not');
|
|
78
|
-
}
|
|
79
|
-
if (semver__namespace.lt(currentPkgJson.version, version)) {
|
|
80
|
-
console.error(`⚠️ You're running an old version of create-keystone-app, please update to ${version}`);
|
|
81
|
-
}
|
|
82
|
-
} catch (err) {
|
|
83
|
-
console.error('A problem occurred fetching the latest version of create-keystone-app');
|
|
84
|
-
console.error(err);
|
|
85
|
-
}
|
|
61
|
+
const {
|
|
62
|
+
version: upstream
|
|
63
|
+
} = await getPackageJson__default["default"]('create-keystone-app');
|
|
64
|
+
if (upstream === thisPackage.version) return;
|
|
65
|
+
console.error(`⚠️ You're running an old version of create-keystone-app, please update to ${upstream}`);
|
|
86
66
|
}
|
|
87
|
-
|
|
88
67
|
class UserError extends Error {}
|
|
89
|
-
|
|
90
|
-
const starterDir = path__default["default"].normalize(`${__dirname}/../starter`);
|
|
68
|
+
const __dirname$1 = path__default["default"].dirname(node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('dist/create-keystone-app.cjs.dev.js', document.baseURI).href))));
|
|
69
|
+
const starterDir = path__default["default"].normalize(`${__dirname$1}/../starter`);
|
|
91
70
|
const cli = meow__default["default"](`
|
|
92
71
|
Usage
|
|
93
72
|
$ create-keystone-app [directory]
|
|
94
73
|
`);
|
|
95
|
-
const versionInfo = () => {
|
|
96
|
-
process.stdout.write('\n');
|
|
97
|
-
console.log(`✨ You're about to generate a project using ${c__default["default"].bold('Keystone 6')} packages.
|
|
98
|
-
`);
|
|
99
|
-
};
|
|
100
74
|
async function normalizeArgs() {
|
|
101
75
|
let directory = cli.input[0];
|
|
102
76
|
if (!directory) {
|
|
@@ -114,42 +88,25 @@ async function normalizeArgs() {
|
|
|
114
88
|
directory: path__default["default"].resolve(directory)
|
|
115
89
|
};
|
|
116
90
|
}
|
|
117
|
-
|
|
118
|
-
|
|
91
|
+
(async (_process$env$npm_conf, _process$env$npm_conf2) => {
|
|
92
|
+
process.stdout.write('\n');
|
|
93
|
+
console.log(`✨ You're about to generate a project using ${c__default["default"].bold('Keystone 6')} packages.`);
|
|
94
|
+
await checkVersion();
|
|
95
|
+
const normalizedArgs = await normalizeArgs();
|
|
96
|
+
const nextCwd = normalizedArgs.directory;
|
|
97
|
+
await fs__default["default"].mkdir(nextCwd);
|
|
98
|
+
await Promise.all(['_gitignore', 'schema.ts', 'package.json', 'tsconfig.json', 'schema.graphql', 'schema.prisma', 'keystone.ts', 'auth.ts', 'README.md'].map(filename => fs__default["default"].copyFile(path__default["default"].join(starterDir, filename), path__default["default"].join(normalizedArgs.directory, filename.replace(/^_/, '.')))));
|
|
99
|
+
const [packageManager] = (_process$env$npm_conf = (_process$env$npm_conf2 = process.env.npm_config_user_agent) === null || _process$env$npm_conf2 === void 0 ? void 0 : _process$env$npm_conf2.split('/', 1)) !== null && _process$env$npm_conf !== void 0 ? _process$env$npm_conf : ['npm'];
|
|
100
|
+
const spinner = ora__default["default"](`Installing dependencies with ${packageManager}. This may take a few minutes.`).start();
|
|
119
101
|
try {
|
|
120
|
-
await execa__default["default"](
|
|
121
|
-
cwd
|
|
102
|
+
await execa__default["default"](packageManager, ['install'], {
|
|
103
|
+
cwd: nextCwd
|
|
122
104
|
});
|
|
123
|
-
spinner.succeed(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
let err = _err;
|
|
127
|
-
if (err.failed) {
|
|
128
|
-
process.stdout.write('\n');
|
|
129
|
-
spinner.warn('Failed to install with yarn.');
|
|
130
|
-
spinner.start('Installing dependencies with npm. This may take a few minutes.');
|
|
131
|
-
try {
|
|
132
|
-
await execa__default["default"]('npm', ['install'], {
|
|
133
|
-
cwd
|
|
134
|
-
});
|
|
135
|
-
spinner.succeed('Installed dependencies with npm.');
|
|
136
|
-
} catch (npmErr) {
|
|
137
|
-
spinner.fail('Failed to install with npm.');
|
|
138
|
-
throw npmErr;
|
|
139
|
-
}
|
|
140
|
-
process.stdout.write('\n');
|
|
141
|
-
return 'npm';
|
|
142
|
-
}
|
|
105
|
+
spinner.succeed(`Installed dependencies with ${packageManager}.`);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
spinner.fail(`Failed to install with ${packageManager}.`);
|
|
143
108
|
throw err;
|
|
144
109
|
}
|
|
145
|
-
};
|
|
146
|
-
(async () => {
|
|
147
|
-
versionInfo();
|
|
148
|
-
await checkVersion();
|
|
149
|
-
const normalizedArgs = await normalizeArgs();
|
|
150
|
-
await fs__default["default"].mkdir(normalizedArgs.directory);
|
|
151
|
-
await Promise.all([...['_gitignore', 'schema.ts', 'package.json', 'tsconfig.json', 'schema.graphql', 'schema.prisma', 'keystone.ts', 'auth.ts', 'README.md'].map(filename => fs__default["default"].copyFile(path__default["default"].join(starterDir, filename), path__default["default"].join(normalizedArgs.directory, filename.replace(/^_/, '.'))))]);
|
|
152
|
-
const packageManager = await installDeps(normalizedArgs.directory);
|
|
153
110
|
const relativeProjectDir = path__default["default"].relative(process.cwd(), normalizedArgs.directory);
|
|
154
111
|
process.stdout.write('\n');
|
|
155
112
|
console.log(`🎉 Keystone created a starter project in: ${c__default["default"].bold(relativeProjectDir)}
|
|
@@ -157,16 +114,14 @@ const installDeps = async cwd => {
|
|
|
157
114
|
${c__default["default"].bold('To launch your app, run:')}
|
|
158
115
|
|
|
159
116
|
- cd ${relativeProjectDir}
|
|
160
|
-
- ${packageManager
|
|
117
|
+
- ${packageManager} run dev
|
|
161
118
|
|
|
162
119
|
${c__default["default"].bold('Next steps:')}
|
|
163
120
|
|
|
164
121
|
- Read ${c__default["default"].bold(`${relativeProjectDir}${path__default["default"].sep}README.md`)} for additional getting started details.
|
|
165
122
|
- Edit ${c__default["default"].bold(`${relativeProjectDir}${path__default["default"].sep}keystone.ts`)} to customize your app.
|
|
166
|
-
-
|
|
167
|
-
|
|
168
|
-
- ${terminalLink__default["default"]('Read the docs', 'https://next.keystonejs.com')}
|
|
169
|
-
- ${terminalLink__default["default"]('Star Keystone on GitHub', 'https://github.com/keystonejs/keystone')}
|
|
123
|
+
- Star Keystone on GitHub (https://github.com/keystonejs/keystone)
|
|
124
|
+
)}
|
|
170
125
|
`);
|
|
171
126
|
})().catch(err => {
|
|
172
127
|
if (err instanceof UserError) {
|
|
@@ -1,102 +1,76 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var fs = require('fs
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var
|
|
3
|
+
var fs = require('node:fs/promises');
|
|
4
|
+
var path = require('node:path');
|
|
5
|
+
var node_url = require('node:url');
|
|
6
|
+
var c = require('chalk');
|
|
6
7
|
var enquirer = require('enquirer');
|
|
7
8
|
var execa = require('execa');
|
|
8
|
-
var ora = require('ora');
|
|
9
9
|
var getPackageJson = require('package-json');
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var terminalLink = require('terminal-link');
|
|
10
|
+
var meow = require('meow');
|
|
11
|
+
var ora = require('ora');
|
|
13
12
|
|
|
14
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
15
14
|
|
|
16
|
-
function _interopNamespace(e) {
|
|
17
|
-
if (e && e.__esModule) return e;
|
|
18
|
-
var n = Object.create(null);
|
|
19
|
-
if (e) {
|
|
20
|
-
Object.keys(e).forEach(function (k) {
|
|
21
|
-
if (k !== 'default') {
|
|
22
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
23
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
24
|
-
enumerable: true,
|
|
25
|
-
get: function () { return e[k]; }
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
n["default"] = e;
|
|
31
|
-
return Object.freeze(n);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
15
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
35
16
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
36
|
-
var
|
|
17
|
+
var c__default = /*#__PURE__*/_interopDefault(c);
|
|
37
18
|
var enquirer__default = /*#__PURE__*/_interopDefault(enquirer);
|
|
38
19
|
var execa__default = /*#__PURE__*/_interopDefault(execa);
|
|
39
|
-
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
40
20
|
var getPackageJson__default = /*#__PURE__*/_interopDefault(getPackageJson);
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var terminalLink__default = /*#__PURE__*/_interopDefault(terminalLink);
|
|
21
|
+
var meow__default = /*#__PURE__*/_interopDefault(meow);
|
|
22
|
+
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
44
23
|
|
|
45
|
-
var
|
|
24
|
+
var thisPackage = {
|
|
46
25
|
name: "create-keystone-app",
|
|
47
|
-
version: "
|
|
48
|
-
main: "dist/create-keystone-app.cjs.js",
|
|
49
|
-
files: [
|
|
50
|
-
"dist",
|
|
51
|
-
"starter",
|
|
52
|
-
"!dist/**/*.d.ts",
|
|
53
|
-
"!starter/node_modules"
|
|
54
|
-
],
|
|
55
|
-
bin: "./bin.js",
|
|
26
|
+
version: "10.0.0",
|
|
56
27
|
license: "MIT",
|
|
28
|
+
type: "module",
|
|
29
|
+
main: "dist/create-keystone-app.cjs.js",
|
|
30
|
+
module: "dist/create-keystone-app.esm.js",
|
|
31
|
+
repository: "https://github.com/keystonejs/keystone/tree/main/packages/create",
|
|
32
|
+
bin: "./cli.js",
|
|
33
|
+
exports: {
|
|
34
|
+
".": {
|
|
35
|
+
module: "./dist/create-keystone-app.esm.js",
|
|
36
|
+
"default": "./dist/create-keystone-app.cjs.js"
|
|
37
|
+
},
|
|
38
|
+
"./package.json": "./package.json"
|
|
39
|
+
},
|
|
40
|
+
preconstruct: {
|
|
41
|
+
entrypoints: [
|
|
42
|
+
"index.ts"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
57
45
|
dependencies: {
|
|
58
|
-
"@babel/runtime": "^7.18.9",
|
|
59
46
|
chalk: "^4.1.2",
|
|
60
|
-
enquirer: "^2.
|
|
47
|
+
enquirer: "^2.4.1",
|
|
61
48
|
execa: "^5.1.1",
|
|
62
|
-
"fs-extra": "^10.1.0",
|
|
63
49
|
meow: "^9.0.0",
|
|
64
|
-
ora: "^
|
|
65
|
-
"package-json": "^
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
ora: "^8.0.1",
|
|
51
|
+
"package-json": "^10.0.0"
|
|
52
|
+
},
|
|
53
|
+
files: [
|
|
54
|
+
"dist",
|
|
55
|
+
"starter",
|
|
56
|
+
"cli.js"
|
|
57
|
+
]
|
|
69
58
|
};
|
|
70
59
|
|
|
71
60
|
async function checkVersion() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
throw new Error('version from package metadata was expected to be a string but was not');
|
|
78
|
-
}
|
|
79
|
-
if (semver__namespace.lt(currentPkgJson.version, version)) {
|
|
80
|
-
console.error(`⚠️ You're running an old version of create-keystone-app, please update to ${version}`);
|
|
81
|
-
}
|
|
82
|
-
} catch (err) {
|
|
83
|
-
console.error('A problem occurred fetching the latest version of create-keystone-app');
|
|
84
|
-
console.error(err);
|
|
85
|
-
}
|
|
61
|
+
const {
|
|
62
|
+
version: upstream
|
|
63
|
+
} = await getPackageJson__default["default"]('create-keystone-app');
|
|
64
|
+
if (upstream === thisPackage.version) return;
|
|
65
|
+
console.error(`⚠️ You're running an old version of create-keystone-app, please update to ${upstream}`);
|
|
86
66
|
}
|
|
87
|
-
|
|
88
67
|
class UserError extends Error {}
|
|
89
|
-
|
|
90
|
-
const starterDir = path__default["default"].normalize(`${__dirname}/../starter`);
|
|
68
|
+
const __dirname$1 = path__default["default"].dirname(node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('dist/create-keystone-app.cjs.prod.js', document.baseURI).href))));
|
|
69
|
+
const starterDir = path__default["default"].normalize(`${__dirname$1}/../starter`);
|
|
91
70
|
const cli = meow__default["default"](`
|
|
92
71
|
Usage
|
|
93
72
|
$ create-keystone-app [directory]
|
|
94
73
|
`);
|
|
95
|
-
const versionInfo = () => {
|
|
96
|
-
process.stdout.write('\n');
|
|
97
|
-
console.log(`✨ You're about to generate a project using ${c__default["default"].bold('Keystone 6')} packages.
|
|
98
|
-
`);
|
|
99
|
-
};
|
|
100
74
|
async function normalizeArgs() {
|
|
101
75
|
let directory = cli.input[0];
|
|
102
76
|
if (!directory) {
|
|
@@ -114,42 +88,25 @@ async function normalizeArgs() {
|
|
|
114
88
|
directory: path__default["default"].resolve(directory)
|
|
115
89
|
};
|
|
116
90
|
}
|
|
117
|
-
|
|
118
|
-
|
|
91
|
+
(async (_process$env$npm_conf, _process$env$npm_conf2) => {
|
|
92
|
+
process.stdout.write('\n');
|
|
93
|
+
console.log(`✨ You're about to generate a project using ${c__default["default"].bold('Keystone 6')} packages.`);
|
|
94
|
+
await checkVersion();
|
|
95
|
+
const normalizedArgs = await normalizeArgs();
|
|
96
|
+
const nextCwd = normalizedArgs.directory;
|
|
97
|
+
await fs__default["default"].mkdir(nextCwd);
|
|
98
|
+
await Promise.all(['_gitignore', 'schema.ts', 'package.json', 'tsconfig.json', 'schema.graphql', 'schema.prisma', 'keystone.ts', 'auth.ts', 'README.md'].map(filename => fs__default["default"].copyFile(path__default["default"].join(starterDir, filename), path__default["default"].join(normalizedArgs.directory, filename.replace(/^_/, '.')))));
|
|
99
|
+
const [packageManager] = (_process$env$npm_conf = (_process$env$npm_conf2 = process.env.npm_config_user_agent) === null || _process$env$npm_conf2 === void 0 ? void 0 : _process$env$npm_conf2.split('/', 1)) !== null && _process$env$npm_conf !== void 0 ? _process$env$npm_conf : ['npm'];
|
|
100
|
+
const spinner = ora__default["default"](`Installing dependencies with ${packageManager}. This may take a few minutes.`).start();
|
|
119
101
|
try {
|
|
120
|
-
await execa__default["default"](
|
|
121
|
-
cwd
|
|
102
|
+
await execa__default["default"](packageManager, ['install'], {
|
|
103
|
+
cwd: nextCwd
|
|
122
104
|
});
|
|
123
|
-
spinner.succeed(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
let err = _err;
|
|
127
|
-
if (err.failed) {
|
|
128
|
-
process.stdout.write('\n');
|
|
129
|
-
spinner.warn('Failed to install with yarn.');
|
|
130
|
-
spinner.start('Installing dependencies with npm. This may take a few minutes.');
|
|
131
|
-
try {
|
|
132
|
-
await execa__default["default"]('npm', ['install'], {
|
|
133
|
-
cwd
|
|
134
|
-
});
|
|
135
|
-
spinner.succeed('Installed dependencies with npm.');
|
|
136
|
-
} catch (npmErr) {
|
|
137
|
-
spinner.fail('Failed to install with npm.');
|
|
138
|
-
throw npmErr;
|
|
139
|
-
}
|
|
140
|
-
process.stdout.write('\n');
|
|
141
|
-
return 'npm';
|
|
142
|
-
}
|
|
105
|
+
spinner.succeed(`Installed dependencies with ${packageManager}.`);
|
|
106
|
+
} catch (err) {
|
|
107
|
+
spinner.fail(`Failed to install with ${packageManager}.`);
|
|
143
108
|
throw err;
|
|
144
109
|
}
|
|
145
|
-
};
|
|
146
|
-
(async () => {
|
|
147
|
-
versionInfo();
|
|
148
|
-
await checkVersion();
|
|
149
|
-
const normalizedArgs = await normalizeArgs();
|
|
150
|
-
await fs__default["default"].mkdir(normalizedArgs.directory);
|
|
151
|
-
await Promise.all([...['_gitignore', 'schema.ts', 'package.json', 'tsconfig.json', 'schema.graphql', 'schema.prisma', 'keystone.ts', 'auth.ts', 'README.md'].map(filename => fs__default["default"].copyFile(path__default["default"].join(starterDir, filename), path__default["default"].join(normalizedArgs.directory, filename.replace(/^_/, '.'))))]);
|
|
152
|
-
const packageManager = await installDeps(normalizedArgs.directory);
|
|
153
110
|
const relativeProjectDir = path__default["default"].relative(process.cwd(), normalizedArgs.directory);
|
|
154
111
|
process.stdout.write('\n');
|
|
155
112
|
console.log(`🎉 Keystone created a starter project in: ${c__default["default"].bold(relativeProjectDir)}
|
|
@@ -157,16 +114,14 @@ const installDeps = async cwd => {
|
|
|
157
114
|
${c__default["default"].bold('To launch your app, run:')}
|
|
158
115
|
|
|
159
116
|
- cd ${relativeProjectDir}
|
|
160
|
-
- ${packageManager
|
|
117
|
+
- ${packageManager} run dev
|
|
161
118
|
|
|
162
119
|
${c__default["default"].bold('Next steps:')}
|
|
163
120
|
|
|
164
121
|
- Read ${c__default["default"].bold(`${relativeProjectDir}${path__default["default"].sep}README.md`)} for additional getting started details.
|
|
165
122
|
- Edit ${c__default["default"].bold(`${relativeProjectDir}${path__default["default"].sep}keystone.ts`)} to customize your app.
|
|
166
|
-
-
|
|
167
|
-
|
|
168
|
-
- ${terminalLink__default["default"]('Read the docs', 'https://next.keystonejs.com')}
|
|
169
|
-
- ${terminalLink__default["default"]('Star Keystone on GitHub', 'https://github.com/keystonejs/keystone')}
|
|
123
|
+
- Star Keystone on GitHub (https://github.com/keystonejs/keystone)
|
|
124
|
+
)}
|
|
170
125
|
`);
|
|
171
126
|
})().catch(err => {
|
|
172
127
|
if (err instanceof UserError) {
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import c from 'chalk';
|
|
5
|
+
import enquirer from 'enquirer';
|
|
6
|
+
import execa from 'execa';
|
|
7
|
+
import getPackageJson from 'package-json';
|
|
8
|
+
import meow from 'meow';
|
|
9
|
+
import ora from 'ora';
|
|
10
|
+
|
|
11
|
+
var thisPackage = {
|
|
12
|
+
name: "create-keystone-app",
|
|
13
|
+
version: "10.0.0",
|
|
14
|
+
license: "MIT",
|
|
15
|
+
type: "module",
|
|
16
|
+
main: "dist/create-keystone-app.cjs.js",
|
|
17
|
+
module: "dist/create-keystone-app.esm.js",
|
|
18
|
+
repository: "https://github.com/keystonejs/keystone/tree/main/packages/create",
|
|
19
|
+
bin: "./cli.js",
|
|
20
|
+
exports: {
|
|
21
|
+
".": {
|
|
22
|
+
module: "./dist/create-keystone-app.esm.js",
|
|
23
|
+
"default": "./dist/create-keystone-app.cjs.js"
|
|
24
|
+
},
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
preconstruct: {
|
|
28
|
+
entrypoints: [
|
|
29
|
+
"index.ts"
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
dependencies: {
|
|
33
|
+
chalk: "^4.1.2",
|
|
34
|
+
enquirer: "^2.4.1",
|
|
35
|
+
execa: "^5.1.1",
|
|
36
|
+
meow: "^9.0.0",
|
|
37
|
+
ora: "^8.0.1",
|
|
38
|
+
"package-json": "^10.0.0"
|
|
39
|
+
},
|
|
40
|
+
files: [
|
|
41
|
+
"dist",
|
|
42
|
+
"starter",
|
|
43
|
+
"cli.js"
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
async function checkVersion() {
|
|
48
|
+
const {
|
|
49
|
+
version: upstream
|
|
50
|
+
} = await getPackageJson('create-keystone-app');
|
|
51
|
+
if (upstream === thisPackage.version) return;
|
|
52
|
+
console.error(`⚠️ You're running an old version of create-keystone-app, please update to ${upstream}`);
|
|
53
|
+
}
|
|
54
|
+
class UserError extends Error {}
|
|
55
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
56
|
+
const starterDir = path.normalize(`${__dirname}/../starter`);
|
|
57
|
+
const cli = meow(`
|
|
58
|
+
Usage
|
|
59
|
+
$ create-keystone-app [directory]
|
|
60
|
+
`);
|
|
61
|
+
async function normalizeArgs() {
|
|
62
|
+
let directory = cli.input[0];
|
|
63
|
+
if (!directory) {
|
|
64
|
+
({
|
|
65
|
+
directory
|
|
66
|
+
} = await enquirer.prompt({
|
|
67
|
+
type: 'input',
|
|
68
|
+
name: 'directory',
|
|
69
|
+
message: 'What directory should create-keystone-app generate your app into?',
|
|
70
|
+
validate: x => !!x
|
|
71
|
+
}));
|
|
72
|
+
process.stdout.write('\n');
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
directory: path.resolve(directory)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
(async (_process$env$npm_conf, _process$env$npm_conf2) => {
|
|
79
|
+
process.stdout.write('\n');
|
|
80
|
+
console.log(`✨ You're about to generate a project using ${c.bold('Keystone 6')} packages.`);
|
|
81
|
+
await checkVersion();
|
|
82
|
+
const normalizedArgs = await normalizeArgs();
|
|
83
|
+
const nextCwd = normalizedArgs.directory;
|
|
84
|
+
await fs.mkdir(nextCwd);
|
|
85
|
+
await Promise.all(['_gitignore', 'schema.ts', 'package.json', 'tsconfig.json', 'schema.graphql', 'schema.prisma', 'keystone.ts', 'auth.ts', 'README.md'].map(filename => fs.copyFile(path.join(starterDir, filename), path.join(normalizedArgs.directory, filename.replace(/^_/, '.')))));
|
|
86
|
+
const [packageManager] = (_process$env$npm_conf = (_process$env$npm_conf2 = process.env.npm_config_user_agent) === null || _process$env$npm_conf2 === void 0 ? void 0 : _process$env$npm_conf2.split('/', 1)) !== null && _process$env$npm_conf !== void 0 ? _process$env$npm_conf : ['npm'];
|
|
87
|
+
const spinner = ora(`Installing dependencies with ${packageManager}. This may take a few minutes.`).start();
|
|
88
|
+
try {
|
|
89
|
+
await execa(packageManager, ['install'], {
|
|
90
|
+
cwd: nextCwd
|
|
91
|
+
});
|
|
92
|
+
spinner.succeed(`Installed dependencies with ${packageManager}.`);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
spinner.fail(`Failed to install with ${packageManager}.`);
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
const relativeProjectDir = path.relative(process.cwd(), normalizedArgs.directory);
|
|
98
|
+
process.stdout.write('\n');
|
|
99
|
+
console.log(`🎉 Keystone created a starter project in: ${c.bold(relativeProjectDir)}
|
|
100
|
+
|
|
101
|
+
${c.bold('To launch your app, run:')}
|
|
102
|
+
|
|
103
|
+
- cd ${relativeProjectDir}
|
|
104
|
+
- ${packageManager} run dev
|
|
105
|
+
|
|
106
|
+
${c.bold('Next steps:')}
|
|
107
|
+
|
|
108
|
+
- Read ${c.bold(`${relativeProjectDir}${path.sep}README.md`)} for additional getting started details.
|
|
109
|
+
- Edit ${c.bold(`${relativeProjectDir}${path.sep}keystone.ts`)} to customize your app.
|
|
110
|
+
- Star Keystone on GitHub (https://github.com/keystonejs/keystone)
|
|
111
|
+
)}
|
|
112
|
+
`);
|
|
113
|
+
})().catch(err => {
|
|
114
|
+
if (err instanceof UserError) {
|
|
115
|
+
console.error(err.message);
|
|
116
|
+
} else {
|
|
117
|
+
console.error(err);
|
|
118
|
+
}
|
|
119
|
+
process.exit(1);
|
|
120
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"../../../src","sources":["index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-keystone-app",
|
|
3
|
-
"version": "
|
|
4
|
-
"main": "dist/create-keystone-app.cjs.js",
|
|
5
|
-
"files": [
|
|
6
|
-
"dist",
|
|
7
|
-
"starter",
|
|
8
|
-
"!dist/**/*.d.ts",
|
|
9
|
-
"!starter/node_modules"
|
|
10
|
-
],
|
|
11
|
-
"bin": "./bin.js",
|
|
3
|
+
"version": "10.0.0",
|
|
12
4
|
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/create-keystone-app.cjs.js",
|
|
7
|
+
"module": "dist/create-keystone-app.esm.js",
|
|
8
|
+
"repository": "https://github.com/keystonejs/keystone/tree/main/packages/create",
|
|
9
|
+
"bin": "./cli.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"module": "./dist/create-keystone-app.esm.js",
|
|
13
|
+
"default": "./dist/create-keystone-app.cjs.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"preconstruct": {
|
|
18
|
+
"entrypoints": [
|
|
19
|
+
"index.ts"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
13
22
|
"dependencies": {
|
|
14
|
-
"@babel/runtime": "^7.18.9",
|
|
15
23
|
"chalk": "^4.1.2",
|
|
16
|
-
"enquirer": "^2.
|
|
24
|
+
"enquirer": "^2.4.1",
|
|
17
25
|
"execa": "^5.1.1",
|
|
18
|
-
"fs-extra": "^10.1.0",
|
|
19
26
|
"meow": "^9.0.0",
|
|
20
|
-
"ora": "^
|
|
21
|
-
"package-json": "^
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
"ora": "^8.0.1",
|
|
28
|
+
"package-json": "^10.0.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"starter",
|
|
33
|
+
"cli.js"
|
|
34
|
+
]
|
|
35
|
+
}
|
package/starter/README.md
CHANGED
package/starter/_gitignore
CHANGED
package/starter/auth.ts
CHANGED
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
// If you want to learn more about how our out-of-the-box authentication works, please
|
|
16
16
|
// read https://keystonejs.com/docs/apis/auth#authentication-api
|
|
17
17
|
|
|
18
|
-
import { randomBytes } from 'crypto'
|
|
19
|
-
import { createAuth } from '@keystone-6/auth'
|
|
18
|
+
import { randomBytes } from 'node:crypto'
|
|
19
|
+
import { createAuth } from '@keystone-6/auth'
|
|
20
20
|
|
|
21
21
|
// see https://keystonejs.com/docs/apis/session for the session docs
|
|
22
|
-
import { statelessSessions } from '@keystone-6/core/session'
|
|
22
|
+
import { statelessSessions } from '@keystone-6/core/session'
|
|
23
23
|
|
|
24
24
|
// for a stateless session, a SESSION_SECRET should always be provided
|
|
25
25
|
// especially in production (statelessSessions will throw if SESSION_SECRET is undefined)
|
|
26
|
-
let sessionSecret = process.env.SESSION_SECRET
|
|
26
|
+
let sessionSecret = process.env.SESSION_SECRET
|
|
27
27
|
if (!sessionSecret && process.env.NODE_ENV !== 'production') {
|
|
28
|
-
sessionSecret = randomBytes(32).toString('hex')
|
|
28
|
+
sessionSecret = randomBytes(32).toString('hex')
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// withAuth is a function we can use to wrap our base configuration
|
|
@@ -50,17 +50,17 @@ const { withAuth } = createAuth({
|
|
|
50
50
|
// it uses context.sudo() to do this, which bypasses any access control you might have
|
|
51
51
|
// you shouldn't use this in production
|
|
52
52
|
},
|
|
53
|
-
})
|
|
53
|
+
})
|
|
54
54
|
|
|
55
55
|
// statelessSessions uses cookies for session tracking
|
|
56
56
|
// these cookies have an expiry, in seconds
|
|
57
57
|
// we use an expiry of 30 days for this starter
|
|
58
|
-
const sessionMaxAge = 60 * 60 * 24 * 30
|
|
58
|
+
const sessionMaxAge = 60 * 60 * 24 * 30
|
|
59
59
|
|
|
60
60
|
// you can find out more at https://keystonejs.com/docs/apis/session#session-api
|
|
61
61
|
const session = statelessSessions({
|
|
62
62
|
maxAge: sessionMaxAge,
|
|
63
63
|
secret: sessionSecret!,
|
|
64
|
-
})
|
|
64
|
+
})
|
|
65
65
|
|
|
66
|
-
export { withAuth, session }
|
|
66
|
+
export { withAuth, session }
|
package/starter/keystone.ts
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
// Keystone imports the default export of this file, expecting a Keystone configuration object
|
|
6
6
|
// you can find out more at https://keystonejs.com/docs/apis/config
|
|
7
7
|
|
|
8
|
-
import { config } from '@keystone-6/core'
|
|
8
|
+
import { config } from '@keystone-6/core'
|
|
9
9
|
|
|
10
10
|
// to keep this file tidy, we define our schema in a different file
|
|
11
|
-
import { lists } from './schema'
|
|
11
|
+
import { lists } from './schema'
|
|
12
12
|
|
|
13
13
|
// authentication is configured separately here too, but you might move this elsewhere
|
|
14
14
|
// when you write your list-level access control functions, as they typically rely on session data
|
|
15
|
-
import { withAuth, session } from './auth'
|
|
15
|
+
import { withAuth, session } from './auth'
|
|
16
16
|
|
|
17
17
|
export default withAuth(
|
|
18
18
|
config({
|
|
@@ -26,4 +26,4 @@ export default withAuth(
|
|
|
26
26
|
lists,
|
|
27
27
|
session,
|
|
28
28
|
})
|
|
29
|
-
)
|
|
29
|
+
)
|
package/starter/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keystone-app",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "keystone dev",
|
|
7
7
|
"start": "keystone start",
|
|
8
8
|
"build": "keystone build",
|
|
9
|
-
"postinstall": "keystone
|
|
9
|
+
"postinstall": "keystone build --no-ui --frozen"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@keystone-6/auth": "^
|
|
13
|
-
"@keystone-6/core": "^
|
|
14
|
-
"@keystone-6/fields-document": "^
|
|
15
|
-
"typescript": "^
|
|
12
|
+
"@keystone-6/auth": "^8.0.0",
|
|
13
|
+
"@keystone-6/core": "^6.0.0",
|
|
14
|
+
"@keystone-6/fields-document": "^9.0.0",
|
|
15
|
+
"typescript": "^5.5.0"
|
|
16
16
|
}
|
|
17
17
|
}
|
package/starter/schema.graphql
CHANGED
|
@@ -6,7 +6,7 @@ type User {
|
|
|
6
6
|
name: String
|
|
7
7
|
email: String
|
|
8
8
|
password: PasswordState
|
|
9
|
-
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0): [Post!]
|
|
9
|
+
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
|
|
10
10
|
postsCount(where: PostWhereInput! = {}): Int
|
|
11
11
|
createdAt: DateTime
|
|
12
12
|
}
|
|
@@ -139,7 +139,7 @@ type Post {
|
|
|
139
139
|
title: String
|
|
140
140
|
content: Post_content_Document
|
|
141
141
|
author: User
|
|
142
|
-
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0): [Tag!]
|
|
142
|
+
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
|
|
143
143
|
tagsCount(where: TagWhereInput! = {}): Int
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -217,7 +217,7 @@ input TagRelateToManyForCreateInput {
|
|
|
217
217
|
type Tag {
|
|
218
218
|
id: ID!
|
|
219
219
|
name: String
|
|
220
|
-
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0): [Post!]
|
|
220
|
+
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
|
|
221
221
|
postsCount(where: PostWhereInput! = {}): Int
|
|
222
222
|
}
|
|
223
223
|
|
|
@@ -301,13 +301,13 @@ input CreateInitialUserInput {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
type Query {
|
|
304
|
-
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0): [User!]
|
|
304
|
+
users(where: UserWhereInput! = {}, orderBy: [UserOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: UserWhereUniqueInput): [User!]
|
|
305
305
|
user(where: UserWhereUniqueInput!): User
|
|
306
306
|
usersCount(where: UserWhereInput! = {}): Int
|
|
307
|
-
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0): [Post!]
|
|
307
|
+
posts(where: PostWhereInput! = {}, orderBy: [PostOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: PostWhereUniqueInput): [Post!]
|
|
308
308
|
post(where: PostWhereUniqueInput!): Post
|
|
309
309
|
postsCount(where: PostWhereInput! = {}): Int
|
|
310
|
-
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0): [Tag!]
|
|
310
|
+
tags(where: TagWhereInput! = {}, orderBy: [TagOrderByInput!]! = [], take: Int, skip: Int! = 0, cursor: TagWhereUniqueInput): [Tag!]
|
|
311
311
|
tag(where: TagWhereUniqueInput!): Tag
|
|
312
312
|
tagsCount(where: TagWhereInput! = {}): Int
|
|
313
313
|
keystone: KeystoneMeta!
|
|
@@ -352,6 +352,7 @@ type KeystoneAdminUIFieldMeta {
|
|
|
352
352
|
description: String
|
|
353
353
|
isOrderable: Boolean!
|
|
354
354
|
isFilterable: Boolean!
|
|
355
|
+
isNonNull: [KeystoneAdminUIFieldMetaIsNonNull!]
|
|
355
356
|
fieldMeta: JSON
|
|
356
357
|
viewsIndex: Int!
|
|
357
358
|
customViewsIndex: Int
|
|
@@ -361,6 +362,12 @@ type KeystoneAdminUIFieldMeta {
|
|
|
361
362
|
search: QueryMode
|
|
362
363
|
}
|
|
363
364
|
|
|
365
|
+
enum KeystoneAdminUIFieldMetaIsNonNull {
|
|
366
|
+
read
|
|
367
|
+
create
|
|
368
|
+
update
|
|
369
|
+
}
|
|
370
|
+
|
|
364
371
|
type KeystoneAdminUIFieldMetaCreateView {
|
|
365
372
|
fieldMode: KeystoneAdminUIFieldMetaCreateViewFieldMode!
|
|
366
373
|
}
|
package/starter/schema.prisma
CHANGED
package/starter/schema.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// If you want to learn more about how lists are configured, please read
|
|
6
6
|
// - https://keystonejs.com/docs/config/lists
|
|
7
7
|
|
|
8
|
-
import { list } from '@keystone-6/core'
|
|
9
|
-
import { allowAll } from '@keystone-6/core/access'
|
|
8
|
+
import { list } from '@keystone-6/core'
|
|
9
|
+
import { allowAll } from '@keystone-6/core/access'
|
|
10
10
|
|
|
11
11
|
// see https://keystonejs.com/docs/fields/overview for the full list of fields
|
|
12
12
|
// this is a few common fields for an example
|
|
@@ -16,17 +16,17 @@ import {
|
|
|
16
16
|
password,
|
|
17
17
|
timestamp,
|
|
18
18
|
select,
|
|
19
|
-
} from '@keystone-6/core/fields'
|
|
19
|
+
} from '@keystone-6/core/fields'
|
|
20
20
|
|
|
21
21
|
// the document field is a more complicated field, so it has it's own package
|
|
22
|
-
import { document } from '@keystone-6/fields-document'
|
|
22
|
+
import { document } from '@keystone-6/fields-document'
|
|
23
23
|
// if you want to make your own fields, see https://keystonejs.com/docs/guides/custom-fields
|
|
24
24
|
|
|
25
25
|
// when using Typescript, you can refine your types to a stricter subset by importing
|
|
26
26
|
// the generated types from '.keystone/types'
|
|
27
|
-
import type
|
|
27
|
+
import { type Lists } from '.keystone/types'
|
|
28
28
|
|
|
29
|
-
export const lists
|
|
29
|
+
export const lists = {
|
|
30
30
|
User: list({
|
|
31
31
|
// WARNING
|
|
32
32
|
// for this starter project, anyone can create, query, update and delete anything
|
|
@@ -146,4 +146,4 @@ export const lists: Lists = {
|
|
|
146
146
|
posts: relationship({ ref: 'Post.tags', many: true }),
|
|
147
147
|
},
|
|
148
148
|
}),
|
|
149
|
-
}
|
|
149
|
+
} satisfies Lists
|
package/bin.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// keystone.ts
|
|
21
|
-
var keystone_exports = {};
|
|
22
|
-
__export(keystone_exports, {
|
|
23
|
-
default: () => keystone_default
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(keystone_exports);
|
|
26
|
-
var import_core2 = require("@keystone-6/core");
|
|
27
|
-
|
|
28
|
-
// schema.ts
|
|
29
|
-
var import_core = require("@keystone-6/core");
|
|
30
|
-
var import_access = require("@keystone-6/core/access");
|
|
31
|
-
var import_fields = require("@keystone-6/core/fields");
|
|
32
|
-
var import_fields_document = require("@keystone-6/fields-document");
|
|
33
|
-
var lists = {
|
|
34
|
-
User: (0, import_core.list)({
|
|
35
|
-
access: import_access.allowAll,
|
|
36
|
-
fields: {
|
|
37
|
-
name: (0, import_fields.text)({ validation: { isRequired: true } }),
|
|
38
|
-
email: (0, import_fields.text)({
|
|
39
|
-
validation: { isRequired: true },
|
|
40
|
-
isIndexed: "unique"
|
|
41
|
-
}),
|
|
42
|
-
password: (0, import_fields.password)({ validation: { isRequired: true } }),
|
|
43
|
-
posts: (0, import_fields.relationship)({ ref: "Post.author", many: true }),
|
|
44
|
-
createdAt: (0, import_fields.timestamp)({
|
|
45
|
-
defaultValue: { kind: "now" }
|
|
46
|
-
})
|
|
47
|
-
}
|
|
48
|
-
}),
|
|
49
|
-
Post: (0, import_core.list)({
|
|
50
|
-
access: import_access.allowAll,
|
|
51
|
-
fields: {
|
|
52
|
-
title: (0, import_fields.text)({ validation: { isRequired: true } }),
|
|
53
|
-
content: (0, import_fields_document.document)({
|
|
54
|
-
formatting: true,
|
|
55
|
-
layouts: [
|
|
56
|
-
[1, 1],
|
|
57
|
-
[1, 1, 1],
|
|
58
|
-
[2, 1],
|
|
59
|
-
[1, 2],
|
|
60
|
-
[1, 2, 1]
|
|
61
|
-
],
|
|
62
|
-
links: true,
|
|
63
|
-
dividers: true
|
|
64
|
-
}),
|
|
65
|
-
author: (0, import_fields.relationship)({
|
|
66
|
-
ref: "User.posts",
|
|
67
|
-
ui: {
|
|
68
|
-
displayMode: "cards",
|
|
69
|
-
cardFields: ["name", "email"],
|
|
70
|
-
inlineEdit: { fields: ["name", "email"] },
|
|
71
|
-
linkToItem: true,
|
|
72
|
-
inlineConnect: true
|
|
73
|
-
},
|
|
74
|
-
many: false
|
|
75
|
-
}),
|
|
76
|
-
tags: (0, import_fields.relationship)({
|
|
77
|
-
ref: "Tag.posts",
|
|
78
|
-
many: true,
|
|
79
|
-
ui: {
|
|
80
|
-
displayMode: "cards",
|
|
81
|
-
cardFields: ["name"],
|
|
82
|
-
inlineEdit: { fields: ["name"] },
|
|
83
|
-
linkToItem: true,
|
|
84
|
-
inlineConnect: true,
|
|
85
|
-
inlineCreate: { fields: ["name"] }
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
}
|
|
89
|
-
}),
|
|
90
|
-
Tag: (0, import_core.list)({
|
|
91
|
-
access: import_access.allowAll,
|
|
92
|
-
ui: {
|
|
93
|
-
isHidden: true
|
|
94
|
-
},
|
|
95
|
-
fields: {
|
|
96
|
-
name: (0, import_fields.text)(),
|
|
97
|
-
posts: (0, import_fields.relationship)({ ref: "Post.tags", many: true })
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// auth.ts
|
|
103
|
-
var import_crypto = require("crypto");
|
|
104
|
-
var import_auth = require("@keystone-6/auth");
|
|
105
|
-
var import_session = require("@keystone-6/core/session");
|
|
106
|
-
var sessionSecret = process.env.SESSION_SECRET;
|
|
107
|
-
if (!sessionSecret && process.env.NODE_ENV !== "production") {
|
|
108
|
-
sessionSecret = (0, import_crypto.randomBytes)(32).toString("hex");
|
|
109
|
-
}
|
|
110
|
-
var { withAuth } = (0, import_auth.createAuth)({
|
|
111
|
-
listKey: "User",
|
|
112
|
-
identityField: "email",
|
|
113
|
-
sessionData: "name createdAt",
|
|
114
|
-
secretField: "password",
|
|
115
|
-
initFirstItem: {
|
|
116
|
-
fields: ["name", "email", "password"]
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
var sessionMaxAge = 60 * 60 * 24 * 30;
|
|
120
|
-
var session = (0, import_session.statelessSessions)({
|
|
121
|
-
maxAge: sessionMaxAge,
|
|
122
|
-
secret: sessionSecret
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// keystone.ts
|
|
126
|
-
var keystone_default = withAuth(
|
|
127
|
-
(0, import_core2.config)({
|
|
128
|
-
db: {
|
|
129
|
-
provider: "sqlite",
|
|
130
|
-
url: "file:./keystone.db"
|
|
131
|
-
},
|
|
132
|
-
lists,
|
|
133
|
-
session
|
|
134
|
-
})
|
|
135
|
-
);
|
|
136
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
137
|
-
0 && (module.exports = {});
|
package/starter/CHANGELOG.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# keystone-app
|
|
2
|
-
|
|
3
|
-
## 1.0.2
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [`3b4360a`](https://github.com/keystonejs/create-keystone-app/commit/3b4360a114f00094e40fdc89dd4c82e1456b9ae5) Thanks [@dcousens](https://github.com/dcousens)! - Fix graphql@^15.8.0 and next@12.2.4 as pseudo-peer dependencies until next `@keystone-6/core` release
|
|
8
|
-
|
|
9
|
-
## 1.0.1
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- [#278](https://github.com/keystonejs/create-keystone-app/pull/278) [`26f9a79`](https://github.com/keystonejs/create-keystone-app/commit/26f9a79ef913915bac85657884f85ff7e4da46c2) Thanks [@Noviny](https://github.com/Noviny)! - Improve schema options for linking authors to posts:
|
|
14
|
-
- Add `inlineConnect: true` to the post's relationship to users
|
|
15
|
-
- Remove authors from being inline-creatable
|
|
16
|
-
|
|
17
|
-
* [#319](https://github.com/keystonejs/create-keystone-app/pull/319) [`94a859e`](https://github.com/keystonejs/create-keystone-app/commit/94a859e43123d2f348d5e21551d59bd7e257aa81) Thanks [@Achisingh](https://github.com/Achisingh)! - Fix dependencies and update schemas for the latest `keystone-6` release
|