create-payload-app 1.0.0 → 3.0.0-alpha.50
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -0
- package/dist/lib/configure-payload-config.d.ts +11 -0
- package/dist/lib/configure-payload-config.d.ts.map +1 -0
- package/dist/lib/configure-payload-config.js +15 -53
- package/dist/lib/configure-payload-config.js.map +1 -0
- package/dist/lib/create-project.d.ts +14 -0
- package/dist/lib/create-project.d.ts.map +1 -0
- package/dist/lib/create-project.js +84 -24
- package/dist/lib/create-project.js.map +1 -0
- package/dist/lib/create-project.spec.d.ts +2 -0
- package/dist/lib/create-project.spec.d.ts.map +1 -0
- package/dist/lib/create-project.spec.js +30 -75
- package/dist/lib/create-project.spec.js.map +1 -0
- package/dist/lib/generate-secret.d.ts +2 -0
- package/dist/lib/generate-secret.d.ts.map +1 -0
- package/dist/lib/generate-secret.js +1 -1
- package/dist/lib/generate-secret.js.map +1 -0
- package/dist/lib/init-next.d.ts +29 -0
- package/dist/lib/init-next.d.ts.map +1 -0
- package/dist/lib/init-next.js +285 -0
- package/dist/lib/init-next.js.map +1 -0
- package/dist/lib/packages.d.ts +9 -0
- package/dist/lib/packages.d.ts.map +1 -0
- package/dist/lib/packages.js +8 -52
- package/dist/lib/packages.js.map +1 -0
- package/dist/lib/parse-project-name.d.ts +3 -0
- package/dist/lib/parse-project-name.d.ts.map +1 -0
- package/dist/lib/parse-project-name.js +53 -12
- package/dist/lib/parse-project-name.js.map +1 -0
- package/dist/lib/parse-template.d.ts +3 -0
- package/dist/lib/parse-template.d.ts.map +1 -0
- package/dist/lib/parse-template.js +50 -20
- package/dist/lib/parse-template.js.map +1 -0
- package/dist/lib/select-db.d.ts +3 -0
- package/dist/lib/select-db.d.ts.map +1 -0
- package/dist/lib/select-db.js +72 -31
- package/dist/lib/select-db.js.map +1 -0
- package/dist/lib/templates.d.ts +4 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +17 -11
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/wrap-next-config.d.ts +12 -0
- package/dist/lib/wrap-next-config.d.ts.map +1 -0
- package/dist/lib/wrap-next-config.js +110 -0
- package/dist/lib/wrap-next-config.js.map +1 -0
- package/dist/lib/wrap-next-config.spec.d.ts +2 -0
- package/dist/lib/wrap-next-config.spec.d.ts.map +1 -0
- package/dist/lib/wrap-next-config.spec.js +98 -0
- package/dist/lib/wrap-next-config.spec.js.map +1 -0
- package/dist/lib/write-env-file.d.ts +10 -0
- package/dist/lib/write-env-file.d.ts.map +1 -0
- package/dist/lib/write-env-file.js +9 -6
- package/dist/lib/write-env-file.js.map +1 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +176 -60
- package/dist/main.js.map +1 -0
- package/dist/scripts/pack-template-files.d.ts +2 -0
- package/dist/scripts/pack-template-files.d.ts.map +1 -0
- package/dist/scripts/pack-template-files.js +43 -0
- package/dist/scripts/pack-template-files.js.map +1 -0
- package/dist/template/src/app/(payload)/admin/[[...segments]]/page.tsx +17 -0
- package/dist/template/src/app/(payload)/api/[...slug]/route.ts +9 -0
- package/dist/template/src/app/(payload)/api/graphql/route.ts +6 -0
- package/dist/template/src/app/(payload)/api/graphql-playground/route.ts +6 -0
- package/dist/template/src/app/(payload)/custom.scss +0 -0
- package/dist/template/src/app/(payload)/layout.tsx +16 -0
- package/dist/template/src/app/my-route/route.ts +14 -0
- package/dist/template/src/collections/Users.ts +13 -0
- package/dist/template/src/payload.config.ts +38 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -0
- package/dist/utils/copy-recursive-sync.d.ts +5 -0
- package/dist/utils/copy-recursive-sync.d.ts.map +1 -0
- package/dist/utils/copy-recursive-sync.js +34 -0
- package/dist/utils/copy-recursive-sync.js.map +1 -0
- package/dist/utils/log.d.ts +6 -0
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/log.js +62 -15
- package/dist/utils/log.js.map +1 -0
- package/dist/utils/messages.d.ts +11 -0
- package/dist/utils/messages.d.ts.map +1 -0
- package/dist/utils/messages.js +47 -16
- package/dist/utils/messages.js.map +1 -0
- package/package.json +27 -10
package/dist/types.d.ts
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
import type arg from 'arg';
|
2
|
+
export interface Args extends arg.Spec {
|
3
|
+
'--beta': BooleanConstructor;
|
4
|
+
'--db': StringConstructor;
|
5
|
+
'--db-accept-recommended': BooleanConstructor;
|
6
|
+
'--db-connection-string': StringConstructor;
|
7
|
+
'--debug': BooleanConstructor;
|
8
|
+
'--dry-run': BooleanConstructor;
|
9
|
+
'--help': BooleanConstructor;
|
10
|
+
'--init-next': BooleanConstructor;
|
11
|
+
'--local-template': StringConstructor;
|
12
|
+
'--name': StringConstructor;
|
13
|
+
'--no-deps': BooleanConstructor;
|
14
|
+
'--secret': StringConstructor;
|
15
|
+
'--template': StringConstructor;
|
16
|
+
'--template-branch': StringConstructor;
|
17
|
+
'--use-npm': BooleanConstructor;
|
18
|
+
'--use-pnpm': BooleanConstructor;
|
19
|
+
'--use-yarn': BooleanConstructor;
|
20
|
+
'-h': string;
|
21
|
+
'-n': string;
|
22
|
+
'-t': string;
|
23
|
+
}
|
24
|
+
export type CliArgs = arg.Result<Args>;
|
25
|
+
export type ProjectTemplate = GitTemplate | PluginTemplate;
|
26
|
+
/**
|
27
|
+
* Template that is cloned verbatim from a git repo
|
28
|
+
* Performs .env manipulation based upon input
|
29
|
+
*/
|
30
|
+
export interface GitTemplate extends Template {
|
31
|
+
type: 'starter';
|
32
|
+
url: string;
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* Type specifically for the plugin template
|
36
|
+
* No .env manipulation is done
|
37
|
+
*/
|
38
|
+
export interface PluginTemplate extends Template {
|
39
|
+
type: 'plugin';
|
40
|
+
url: string;
|
41
|
+
}
|
42
|
+
interface Template {
|
43
|
+
description?: string;
|
44
|
+
name: string;
|
45
|
+
type: ProjectTemplate['type'];
|
46
|
+
}
|
47
|
+
export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
|
48
|
+
export type DbType = 'mongodb' | 'postgres';
|
49
|
+
export type DbDetails = {
|
50
|
+
dbUri: string;
|
51
|
+
type: DbType;
|
52
|
+
};
|
53
|
+
export type EditorType = 'lexical' | 'slate';
|
54
|
+
export {};
|
55
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAE1B,MAAM,WAAW,IAAK,SAAQ,GAAG,CAAC,IAAI;IACpC,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,MAAM,EAAE,iBAAiB,CAAA;IACzB,yBAAyB,EAAE,kBAAkB,CAAA;IAC7C,wBAAwB,EAAE,iBAAiB,CAAA;IAC3C,SAAS,EAAE,kBAAkB,CAAA;IAC7B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,QAAQ,EAAE,kBAAkB,CAAA;IAC5B,aAAa,EAAE,kBAAkB,CAAA;IACjC,kBAAkB,EAAE,iBAAiB,CAAA;IACrC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,WAAW,EAAE,kBAAkB,CAAA;IAC/B,UAAU,EAAE,iBAAiB,CAAA;IAC7B,YAAY,EAAE,iBAAiB,CAAA;IAC/B,mBAAmB,EAAE,iBAAiB,CAAA;IACtC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,YAAY,EAAE,kBAAkB,CAAA;IAChC,YAAY,EAAE,kBAAkB,CAAA;IAIhC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAEtC,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,cAAc,CAAA;AAE1D;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,QAAQ;IAC3C,IAAI,EAAE,SAAS,CAAA;IACf,GAAG,EAAE,MAAM,CAAA;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,IAAI,EAAE,QAAQ,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,UAAU,QAAQ;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;CAC9B;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAE5D,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;AAE3C,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA"}
|
package/dist/types.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"copy-recursive-sync.d.ts","sourceRoot":"","sources":["../../src/utils/copy-recursive-sync.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,QAY3E"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "copyRecursiveSync", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return copyRecursiveSync;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
13
|
+
function _interop_require_default(obj) {
|
14
|
+
return obj && obj.__esModule ? obj : {
|
15
|
+
default: obj
|
16
|
+
};
|
17
|
+
}
|
18
|
+
function copyRecursiveSync(src, dest, debug) {
|
19
|
+
const exists = _fs.default.existsSync(src);
|
20
|
+
const stats = exists && _fs.default.statSync(src);
|
21
|
+
const isDirectory = exists && stats !== false && stats.isDirectory();
|
22
|
+
if (isDirectory) {
|
23
|
+
_fs.default.mkdirSync(dest, {
|
24
|
+
recursive: true
|
25
|
+
});
|
26
|
+
_fs.default.readdirSync(src).forEach((childItemName)=>{
|
27
|
+
copyRecursiveSync(_path.default.join(src, childItemName), _path.default.join(dest, childItemName));
|
28
|
+
});
|
29
|
+
} else {
|
30
|
+
_fs.default.copyFileSync(src, dest);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
//# sourceMappingURL=copy-recursive-sync.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/utils/copy-recursive-sync.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\n\n/**\n * Recursively copy files from src to dest\n */\nexport function copyRecursiveSync(src: string, dest: string, debug?: boolean) {\n const exists = fs.existsSync(src)\n const stats = exists && fs.statSync(src)\n const isDirectory = exists && stats !== false && stats.isDirectory()\n if (isDirectory) {\n fs.mkdirSync(dest, { recursive: true })\n fs.readdirSync(src).forEach((childItemName) => {\n copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName))\n })\n } else {\n fs.copyFileSync(src, dest)\n }\n}\n"],"names":["copyRecursiveSync","src","dest","debug","exists","fs","existsSync","stats","statSync","isDirectory","mkdirSync","recursive","readdirSync","forEach","childItemName","path","join","copyFileSync"],"mappings":";;;;+BAMgBA;;;eAAAA;;;2DAND;6DACE;;;;;;AAKV,SAASA,kBAAkBC,GAAW,EAAEC,IAAY,EAAEC,KAAe;IAC1E,MAAMC,SAASC,WAAE,CAACC,UAAU,CAACL;IAC7B,MAAMM,QAAQH,UAAUC,WAAE,CAACG,QAAQ,CAACP;IACpC,MAAMQ,cAAcL,UAAUG,UAAU,SAASA,MAAME,WAAW;IAClE,IAAIA,aAAa;QACfJ,WAAE,CAACK,SAAS,CAACR,MAAM;YAAES,WAAW;QAAK;QACrCN,WAAE,CAACO,WAAW,CAACX,KAAKY,OAAO,CAAC,CAACC;YAC3Bd,kBAAkBe,aAAI,CAACC,IAAI,CAACf,KAAKa,gBAAgBC,aAAI,CAACC,IAAI,CAACd,MAAMY;QACnE;IACF,OAAO;QACLT,WAAE,CAACY,YAAY,CAAChB,KAAKC;IACvB;AACF"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
export declare const warning: (message: string) => void;
|
2
|
+
export declare const info: (message: string) => void;
|
3
|
+
export declare const error: (message: string) => void;
|
4
|
+
export declare const debug: (message: string) => void;
|
5
|
+
export declare const log: (message: string) => void;
|
6
|
+
//# sourceMappingURL=log.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/utils/log.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,YAAa,MAAM,KAAG,IAEzC,CAAA;AAED,eAAO,MAAM,IAAI,YAAa,MAAM,KAAG,IAEtC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,KAAK,YAAa,MAAM,KAAG,IAEvC,CAAA;AAED,eAAO,MAAM,GAAG,YAAa,MAAM,KAAG,IAErC,CAAA"}
|
package/dist/utils/log.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";
|
1
|
+
/* eslint-disable no-console */ "use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
@@ -9,37 +9,84 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
|
13
|
-
return
|
12
|
+
debug: function() {
|
13
|
+
return debug;
|
14
14
|
},
|
15
|
-
|
16
|
-
return
|
15
|
+
error: function() {
|
16
|
+
return error;
|
17
17
|
},
|
18
18
|
info: function() {
|
19
19
|
return info;
|
20
20
|
},
|
21
|
-
|
22
|
-
return
|
21
|
+
log: function() {
|
22
|
+
return log;
|
23
|
+
},
|
24
|
+
warning: function() {
|
25
|
+
return warning;
|
23
26
|
}
|
24
27
|
});
|
28
|
+
const _prompts = /*#__PURE__*/ _interop_require_wildcard(require("@clack/prompts"));
|
25
29
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
26
|
-
const _figures = /*#__PURE__*/ _interop_require_default(require("figures"));
|
27
30
|
function _interop_require_default(obj) {
|
28
31
|
return obj && obj.__esModule ? obj : {
|
29
32
|
default: obj
|
30
33
|
};
|
31
34
|
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
+
function _getRequireWildcardCache(nodeInterop) {
|
36
|
+
if (typeof WeakMap !== "function") return null;
|
37
|
+
var cacheBabelInterop = new WeakMap();
|
38
|
+
var cacheNodeInterop = new WeakMap();
|
39
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
40
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
41
|
+
})(nodeInterop);
|
42
|
+
}
|
43
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
44
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
45
|
+
return obj;
|
46
|
+
}
|
47
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
48
|
+
return {
|
49
|
+
default: obj
|
50
|
+
};
|
51
|
+
}
|
52
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
53
|
+
if (cache && cache.has(obj)) {
|
54
|
+
return cache.get(obj);
|
55
|
+
}
|
56
|
+
var newObj = {
|
57
|
+
__proto__: null
|
58
|
+
};
|
59
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
60
|
+
for(var key in obj){
|
61
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
62
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
63
|
+
if (desc && (desc.get || desc.set)) {
|
64
|
+
Object.defineProperty(newObj, key, desc);
|
65
|
+
} else {
|
66
|
+
newObj[key] = obj[key];
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
newObj.default = obj;
|
71
|
+
if (cache) {
|
72
|
+
cache.set(obj, newObj);
|
73
|
+
}
|
74
|
+
return newObj;
|
75
|
+
}
|
35
76
|
const warning = (message)=>{
|
36
|
-
|
77
|
+
_prompts.log.warn(_chalk.default.yellow('? ') + _chalk.default.bold(message));
|
37
78
|
};
|
38
79
|
const info = (message)=>{
|
39
|
-
|
80
|
+
_prompts.log.step(_chalk.default.bold(message));
|
40
81
|
};
|
41
82
|
const error = (message)=>{
|
42
|
-
|
83
|
+
_prompts.log.error(_chalk.default.bold(message));
|
84
|
+
};
|
85
|
+
const debug = (message)=>{
|
86
|
+
_prompts.log.step(`${_chalk.default.bgGray('[DEBUG]')} ${_chalk.default.gray(message)}`);
|
87
|
+
};
|
88
|
+
const log = (message)=>{
|
89
|
+
_prompts.log.message(message);
|
43
90
|
};
|
44
91
|
|
45
|
-
//# sourceMappingURL=
|
92
|
+
//# sourceMappingURL=log.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/utils/log.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport * as p from '@clack/prompts'\nimport chalk from 'chalk'\n\nexport const warning = (message: string): void => {\n p.log.warn(chalk.yellow('? ') + chalk.bold(message))\n}\n\nexport const info = (message: string): void => {\n p.log.step(chalk.bold(message))\n}\n\nexport const error = (message: string): void => {\n p.log.error(chalk.bold(message))\n}\n\nexport const debug = (message: string): void => {\n p.log.step(`${chalk.bgGray('[DEBUG]')} ${chalk.gray(message)}`)\n}\n\nexport const log = (message: string): void => {\n p.log.message(message)\n}\n"],"names":["debug","error","info","log","warning","message","p","warn","chalk","yellow","bold","step","bgGray","gray"],"mappings":"AAAA,6BAA6B;;;;;;;;;;;IAgBhBA,KAAK;eAALA;;IAJAC,KAAK;eAALA;;IAJAC,IAAI;eAAJA;;IAYAC,GAAG;eAAHA;;IAhBAC,OAAO;eAAPA;;;iEAHM;8DACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEX,MAAMA,UAAU,CAACC;IACtBC,SAAEH,GAAG,CAACI,IAAI,CAACC,cAAK,CAACC,MAAM,CAAC,QAAQD,cAAK,CAACE,IAAI,CAACL;AAC7C;AAEO,MAAMH,OAAO,CAACG;IACnBC,SAAEH,GAAG,CAACQ,IAAI,CAACH,cAAK,CAACE,IAAI,CAACL;AACxB;AAEO,MAAMJ,QAAQ,CAACI;IACpBC,SAAEH,GAAG,CAACF,KAAK,CAACO,cAAK,CAACE,IAAI,CAACL;AACzB;AAEO,MAAML,QAAQ,CAACK;IACpBC,SAAEH,GAAG,CAACQ,IAAI,CAAC,CAAC,EAAEH,cAAK,CAACI,MAAM,CAAC,WAAW,CAAC,EAAEJ,cAAK,CAACK,IAAI,CAACR,SAAS,CAAC;AAChE;AAEO,MAAMF,MAAM,CAACE;IAClBC,SAAEH,GAAG,CAACE,OAAO,CAACA;AAChB"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { PackageManager } from '../types.js';
|
2
|
+
export declare const welcomeMessage: string;
|
3
|
+
export declare function helpMessage(): void;
|
4
|
+
export declare function successMessage(projectDir: string, packageManager: PackageManager): string;
|
5
|
+
export declare function successfulNextInit(): string;
|
6
|
+
export declare function moveMessage(args: {
|
7
|
+
nextAppDir: string;
|
8
|
+
projectDir: string;
|
9
|
+
}): string;
|
10
|
+
export declare function feedbackOutro(): string;
|
11
|
+
//# sourceMappingURL=messages.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/utils/messages.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAMjD,eAAO,MAAM,cAAc,QAE1B,CAAA;AAID,wBAAgB,WAAW,IAAI,IAAI,CAsBlC;AAQD,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,GAAG,MAAM,CAsBzF;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAO3C;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAapF;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/utils/messages.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";
|
1
|
+
/* eslint-disable no-console */ "use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
@@ -9,39 +9,47 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
|
13
|
-
return
|
12
|
+
feedbackOutro: function() {
|
13
|
+
return feedbackOutro;
|
14
14
|
},
|
15
15
|
helpMessage: function() {
|
16
16
|
return helpMessage;
|
17
17
|
},
|
18
|
+
moveMessage: function() {
|
19
|
+
return moveMessage;
|
20
|
+
},
|
18
21
|
successMessage: function() {
|
19
22
|
return successMessage;
|
23
|
+
},
|
24
|
+
successfulNextInit: function() {
|
25
|
+
return successfulNextInit;
|
26
|
+
},
|
27
|
+
welcomeMessage: function() {
|
28
|
+
return welcomeMessage;
|
20
29
|
}
|
21
30
|
});
|
22
31
|
const _chalk = /*#__PURE__*/ _interop_require_default(require("chalk"));
|
23
|
-
const _figures = /*#__PURE__*/ _interop_require_default(require("figures"));
|
24
32
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
25
33
|
const _terminallink = /*#__PURE__*/ _interop_require_default(require("terminal-link"));
|
26
|
-
const _templates = require("../lib/templates");
|
34
|
+
const _templates = require("../lib/templates.js");
|
27
35
|
function _interop_require_default(obj) {
|
28
36
|
return obj && obj.__esModule ? obj : {
|
29
37
|
default: obj
|
30
38
|
};
|
31
39
|
}
|
32
|
-
const header = (message)
|
40
|
+
const header = (message)=>_chalk.default.bold(message);
|
33
41
|
const welcomeMessage = (0, _chalk.default)`
|
34
42
|
{green Welcome to Payload. Let's create a project! }
|
35
43
|
`;
|
36
44
|
const spacer = ' '.repeat(8);
|
37
45
|
function helpMessage() {
|
38
46
|
const validTemplates = (0, _templates.getValidTemplates)();
|
39
|
-
|
47
|
+
console.log((0, _chalk.default)`
|
40
48
|
{bold USAGE}
|
41
49
|
|
42
50
|
{dim $} {bold npx create-payload-app}
|
43
51
|
{dim $} {bold npx create-payload-app} my-project
|
44
|
-
{dim $} {bold npx create-payload-app} -n my-project -t
|
52
|
+
{dim $} {bold npx create-payload-app} -n my-project -t template-name
|
45
53
|
|
46
54
|
{bold OPTIONS}
|
47
55
|
|
@@ -55,25 +63,48 @@ function helpMessage() {
|
|
55
63
|
--use-pnpm Use pnpm to install dependencies
|
56
64
|
--no-deps Do not install any dependencies
|
57
65
|
-h Show help
|
58
|
-
|
66
|
+
`);
|
59
67
|
}
|
60
68
|
function formatTemplates(templates) {
|
61
69
|
return `\n\n${spacer}${templates.map((t)=>`${t.name}${' '.repeat(28 - t.name.length)}${t.description}`).join(`\n${spacer}`)}`;
|
62
70
|
}
|
63
71
|
function successMessage(projectDir, packageManager) {
|
72
|
+
const relativePath = _path.default.relative(process.cwd(), projectDir);
|
73
|
+
return `
|
74
|
+
${header('Launch Application:')}
|
75
|
+
|
76
|
+
- cd ./${relativePath}
|
77
|
+
- ${packageManager === 'npm' ? 'npm run' : packageManager} dev or follow directions in ${createTerminalLink('README.md', `file://${_path.default.resolve(projectDir, 'README.md')}`)}
|
78
|
+
|
79
|
+
${header('Documentation:')}
|
80
|
+
|
81
|
+
- ${createTerminalLink('Getting Started', 'https://payloadcms.com/docs/getting-started/what-is-payload')}
|
82
|
+
- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}
|
83
|
+
|
84
|
+
`;
|
85
|
+
}
|
86
|
+
function successfulNextInit() {
|
87
|
+
return `- ${createTerminalLink('Getting Started', 'https://payloadcms.com/docs/getting-started/what-is-payload')}
|
88
|
+
- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}
|
89
|
+
`;
|
90
|
+
}
|
91
|
+
function moveMessage(args) {
|
92
|
+
const relativePath = _path.default.relative(process.cwd(), args.nextAppDir);
|
64
93
|
return `
|
65
|
-
|
94
|
+
${header('Next Steps:')}
|
66
95
|
|
67
|
-
|
68
|
-
- ${packageManager === 'yarn' ? 'yarn' : 'npm run'} dev or follow directions in ${createTerminalLink('README.md', `file://${_path.default.resolve(projectDir, 'README.md')}`)}
|
96
|
+
Payload does not support a top-level layout.tsx file in the app directory.
|
69
97
|
|
70
|
-
|
98
|
+
${_chalk.default.bold('To continue:')}
|
71
99
|
|
72
|
-
|
73
|
-
- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}
|
100
|
+
Move all files from ./${relativePath} to a named directory such as ./${relativePath}/${_chalk.default.bold('(app)')}
|
74
101
|
|
102
|
+
Once moved, rerun the create-payload-app command again.
|
75
103
|
`;
|
76
104
|
}
|
105
|
+
function feedbackOutro() {
|
106
|
+
return `${_chalk.default.bgCyan(_chalk.default.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`;
|
107
|
+
}
|
77
108
|
// Create terminalLink with fallback for unsupported terminals
|
78
109
|
function createTerminalLink(text, url) {
|
79
110
|
return (0, _terminallink.default)(text, url, {
|
@@ -81,4 +112,4 @@ function createTerminalLink(text, url) {
|
|
81
112
|
});
|
82
113
|
}
|
83
114
|
|
84
|
-
//# sourceMappingURL=
|
115
|
+
//# sourceMappingURL=messages.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/utils/messages.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport chalk from 'chalk'\nimport path from 'path'\nimport terminalLink from 'terminal-link'\n\nimport type { ProjectTemplate } from '../types.js'\nimport type { PackageManager } from '../types.js'\n\nimport { getValidTemplates } from '../lib/templates.js'\n\nconst header = (message: string): string => chalk.bold(message)\n\nexport const welcomeMessage = chalk`\n {green Welcome to Payload. Let's create a project! }\n`\n\nconst spacer = ' '.repeat(8)\n\nexport function helpMessage(): void {\n const validTemplates = getValidTemplates()\n console.log(chalk`\n {bold USAGE}\n\n {dim $} {bold npx create-payload-app}\n {dim $} {bold npx create-payload-app} my-project\n {dim $} {bold npx create-payload-app} -n my-project -t template-name\n\n {bold OPTIONS}\n\n -n {underline my-payload-app} Set project name\n -t {underline template_name} Choose specific template\n\n {dim Available templates: ${formatTemplates(validTemplates)}}\n\n --use-npm Use npm to install dependencies\n --use-yarn Use yarn to install dependencies\n --use-pnpm Use pnpm to install dependencies\n --no-deps Do not install any dependencies\n -h Show help\n`)\n}\n\nfunction formatTemplates(templates: ProjectTemplate[]) {\n return `\\n\\n${spacer}${templates\n .map((t) => `${t.name}${' '.repeat(28 - t.name.length)}${t.description}`)\n .join(`\\n${spacer}`)}`\n}\n\nexport function successMessage(projectDir: string, packageManager: PackageManager): string {\n const relativePath = path.relative(process.cwd(), projectDir)\n return `\n${header('Launch Application:')}\n\n - cd ./${relativePath}\n - ${\n packageManager === 'npm' ? 'npm run' : packageManager\n } dev or follow directions in ${createTerminalLink(\n 'README.md',\n `file://${path.resolve(projectDir, 'README.md')}`,\n )}\n\n${header('Documentation:')}\n\n - ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n - ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n\n`\n}\n\nexport function successfulNextInit(): string {\n return `- ${createTerminalLink(\n 'Getting Started',\n 'https://payloadcms.com/docs/getting-started/what-is-payload',\n )}\n- ${createTerminalLink('Configuration', 'https://payloadcms.com/docs/configuration/overview')}\n`\n}\n\nexport function moveMessage(args: { nextAppDir: string; projectDir: string }): string {\n const relativePath = path.relative(process.cwd(), args.nextAppDir)\n return `\n${header('Next Steps:')}\n\nPayload does not support a top-level layout.tsx file in the app directory.\n\n${chalk.bold('To continue:')}\n\nMove all files from ./${relativePath} to a named directory such as ./${relativePath}/${chalk.bold('(app)')}\n\nOnce moved, rerun the create-payload-app command again.\n`\n}\n\nexport function feedbackOutro(): string {\n return `${chalk.bgCyan(chalk.black(' Have feedback? '))} Visit us on ${createTerminalLink('GitHub', 'https://github.com/payloadcms/payload')}.`\n}\n\n// Create terminalLink with fallback for unsupported terminals\nfunction createTerminalLink(text: string, url: string) {\n return terminalLink(text, url, {\n fallback: (text, url) => `${text}: ${url}`,\n })\n}\n"],"names":["feedbackOutro","helpMessage","moveMessage","successMessage","successfulNextInit","welcomeMessage","header","message","chalk","bold","spacer","repeat","validTemplates","getValidTemplates","console","log","formatTemplates","templates","map","t","name","length","description","join","projectDir","packageManager","relativePath","path","relative","process","cwd","createTerminalLink","resolve","args","nextAppDir","bgCyan","black","text","url","terminalLink","fallback"],"mappings":"AAAA,6BAA6B;;;;;;;;;;;IAgGbA,aAAa;eAAbA;;IA9EAC,WAAW;eAAXA;;IA+DAC,WAAW;eAAXA;;IAjCAC,cAAc;eAAdA;;IAwBAC,kBAAkB;eAAlBA;;IA5DHC,cAAc;eAAdA;;;8DAXK;6DACD;qEACQ;2BAKS;;;;;;AAElC,MAAMC,SAAS,CAACC,UAA4BC,cAAK,CAACC,IAAI,CAACF;AAEhD,MAAMF,iBAAiBG,IAAAA,cAAK,CAAA,CAAC;;AAEpC,CAAC;AAED,MAAME,SAAS,IAAIC,MAAM,CAAC;AAEnB,SAASV;IACd,MAAMW,iBAAiBC,IAAAA,4BAAiB;IACxCC,QAAQC,GAAG,CAACP,IAAAA,cAAK,CAAA,CAAC;;;;;;;;;;;;kCAYc,EAAEQ,gBAAgBJ,gBAAgB;;;;;;;AAOpE,CAAC;AACD;AAEA,SAASI,gBAAgBC,SAA4B;IACnD,OAAO,CAAC,IAAI,EAAEP,OAAO,EAAEO,UACpBC,GAAG,CAAC,CAACC,IAAM,CAAC,EAAEA,EAAEC,IAAI,CAAC,EAAE,IAAIT,MAAM,CAAC,KAAKQ,EAAEC,IAAI,CAACC,MAAM,EAAE,EAAEF,EAAEG,WAAW,CAAC,CAAC,EACvEC,IAAI,CAAC,CAAC,EAAE,EAAEb,OAAO,CAAC,EAAE,CAAC;AAC1B;AAEO,SAASP,eAAeqB,UAAkB,EAAEC,cAA8B;IAC/E,MAAMC,eAAeC,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAIN;IAClD,OAAO,CAAC;AACV,EAAElB,OAAO,uBAAuB;;SAEvB,EAAEoB,aAAa;IACpB,EACAD,mBAAmB,QAAQ,YAAYA,eACxC,6BAA6B,EAAEM,mBAC9B,aACA,CAAC,OAAO,EAAEJ,aAAI,CAACK,OAAO,CAACR,YAAY,aAAa,CAAC,EACjD;;AAEJ,EAAElB,OAAO,kBAAkB;;IAEvB,EAAEyB,mBACF,mBACA,+DACA;IACA,EAAEA,mBAAmB,iBAAiB,sDAAsD;;AAEhG,CAAC;AACD;AAEO,SAAS3B;IACd,OAAO,CAAC,EAAE,EAAE2B,mBACV,mBACA,+DACA;EACF,EAAEA,mBAAmB,iBAAiB,sDAAsD;AAC9F,CAAC;AACD;AAEO,SAAS7B,YAAY+B,IAAgD;IAC1E,MAAMP,eAAeC,aAAI,CAACC,QAAQ,CAACC,QAAQC,GAAG,IAAIG,KAAKC,UAAU;IACjE,OAAO,CAAC;AACV,EAAE5B,OAAO,eAAe;;;;AAIxB,EAAEE,cAAK,CAACC,IAAI,CAAC,gBAAgB;;sBAEP,EAAEiB,aAAa,gCAAgC,EAAEA,aAAa,CAAC,EAAElB,cAAK,CAACC,IAAI,CAAC,SAAS;;;AAG3G,CAAC;AACD;AAEO,SAAST;IACd,OAAO,CAAC,EAAEQ,cAAK,CAAC2B,MAAM,CAAC3B,cAAK,CAAC4B,KAAK,CAAC,qBAAqB,aAAa,EAAEL,mBAAmB,UAAU,yCAAyC,CAAC,CAAC;AACjJ;AAEA,8DAA8D;AAC9D,SAASA,mBAAmBM,IAAY,EAAEC,GAAW;IACnD,OAAOC,IAAAA,qBAAY,EAACF,MAAMC,KAAK;QAC7BE,UAAU,CAACH,MAAMC,MAAQ,CAAC,EAAED,KAAK,EAAE,EAAEC,IAAI,CAAC;IAC5C;AACF"}
|
package/package.json
CHANGED
@@ -1,42 +1,59 @@
|
|
1
1
|
{
|
2
2
|
"name": "create-payload-app",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0-alpha.50",
|
4
4
|
"license": "MIT",
|
5
|
+
"type": "module",
|
6
|
+
"homepage": "https://payloadcms.com",
|
5
7
|
"bin": {
|
6
8
|
"create-payload-app": "bin/cli.js"
|
7
9
|
},
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "https://github.com/payloadcms/payload.git",
|
13
|
+
"directory": "packages/create-payload-app"
|
14
|
+
},
|
8
15
|
"files": [
|
9
16
|
"package.json",
|
10
17
|
"dist",
|
11
18
|
"bin"
|
12
19
|
],
|
13
20
|
"dependencies": {
|
21
|
+
"@clack/prompts": "^0.7.0",
|
14
22
|
"@sindresorhus/slugify": "^1.1.0",
|
15
23
|
"arg": "^5.0.0",
|
16
24
|
"chalk": "^4.1.0",
|
17
25
|
"command-exists": "^1.2.9",
|
26
|
+
"comment-json": "^4.2.3",
|
18
27
|
"degit": "^2.8.4",
|
28
|
+
"detect-package-manager": "^3.0.1",
|
29
|
+
"esprima": "^4.0.1",
|
19
30
|
"execa": "^5.0.0",
|
20
|
-
"figures": "^
|
31
|
+
"figures": "^6.1.0",
|
21
32
|
"fs-extra": "^9.0.1",
|
22
|
-
"
|
23
|
-
"ora": "^5.1.0",
|
24
|
-
"prompts": "^2.4.2",
|
33
|
+
"globby": "11.1.0",
|
25
34
|
"terminal-link": "^2.1.1"
|
26
35
|
},
|
27
36
|
"devDependencies": {
|
28
37
|
"@types/command-exists": "^1.2.0",
|
29
38
|
"@types/degit": "^2.8.3",
|
39
|
+
"@types/esprima": "^4.0.6",
|
30
40
|
"@types/fs-extra": "^9.0.12",
|
31
41
|
"@types/jest": "^27.0.3",
|
32
|
-
"@types/node": "^16.6.2"
|
33
|
-
|
34
|
-
|
42
|
+
"@types/node": "^16.6.2"
|
43
|
+
},
|
44
|
+
"exports": {
|
45
|
+
"./commands": {
|
46
|
+
"import": "./src/lib/init-next.ts",
|
47
|
+
"require": "./src/lib/init-next.ts",
|
48
|
+
"types": "./src/lib/init-next.ts"
|
49
|
+
}
|
35
50
|
},
|
36
51
|
"scripts": {
|
37
|
-
"build": "pnpm build:swc",
|
52
|
+
"build": "pnpm pack-template-files && pnpm typecheck && pnpm build:swc",
|
53
|
+
"typecheck": "tsc",
|
54
|
+
"pack-template-files": "tsx src/scripts/pack-template-files.ts",
|
38
55
|
"build:swc": "swc ./src -d ./dist --config-file .swcrc",
|
39
|
-
"clean": "rimraf dist",
|
56
|
+
"clean": "rimraf {dist,*.tsbuildinfo}",
|
40
57
|
"test": "jest"
|
41
58
|
}
|
42
59
|
}
|