@yongdall/create 0.2.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/bin.mjs ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import cli from "#cli/create";
3
+ import cliParse from "@yongdall/cli-parse";
4
+
5
+ //#region cli/create/bin.mjs
6
+ await cli(cliParse(process.argv.slice(2)));
7
+
8
+ //#endregion
9
+ //# sourceMappingURL=bin.mjs.map
package/bin.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.mjs","names":[],"sources":["../../cli/create/bin.mjs"],"sourcesContent":["#!/usr/bin/env node\n\nimport cli from '#cli/create';\nimport cliParse from '@yongdall/cli-parse';\n\nconst env = cliParse(process.argv.slice(2));\nawait cli(env);\n"],"mappings":";;;;;AAMA,MAAM,IADM,SAAS,QAAQ,KAAK,MAAM,EAAE,CAAC,CAC7B"}
package/cli/create.mjs ADDED
@@ -0,0 +1,20 @@
1
+ import { createProject } from "#index";
2
+
3
+ //#region cli/create/cli/create.mjs
4
+ /** @import { Cli } from '@yongdall/cli-parse' */
5
+ /**
6
+ *
7
+ * @param {Cli.Env} env
8
+ */
9
+ async function create_default({ development, options, parameters }) {
10
+ return createProject(parameters[0], {
11
+ development,
12
+ single: Boolean(options.single),
13
+ name: options.name?.find(Boolean) || "",
14
+ title: options.title?.find(Boolean) || ""
15
+ });
16
+ }
17
+
18
+ //#endregion
19
+ export { create_default as default };
20
+ //# sourceMappingURL=create.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.mjs","names":[],"sources":["../../../cli/create/cli/create.mjs"],"sourcesContent":["import {createProject} from '#index';\n/** @import { Cli } from '@yongdall/cli-parse' */\n\n/**\n * \n * @param {Cli.Env} env \n */\nexport default async function ({ development, options, parameters }) {\n\treturn createProject(parameters[0], {\n\t\tdevelopment,\n\t\tsingle: Boolean(options.single),\n\t\tname: options.name?.find(Boolean) || '',\n\t\ttitle: options.title?.find(Boolean) || '',\n\t})\n}\n"],"mappings":";;;;;;;;AAOA,8BAA+B,EAAE,aAAa,SAAS,cAAc;AACpE,QAAO,cAAc,WAAW,IAAI;EACnC;EACA,QAAQ,QAAQ,QAAQ,OAAO;EAC/B,MAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI;EACrC,OAAO,QAAQ,OAAO,KAAK,QAAQ,IAAI;EACvC,CAAC"}
@@ -0,0 +1,4 @@
1
+ commands:
2
+ create:
3
+ exec: ./create.mjs
4
+ description: 创建新项目
package/index.d.mts ADDED
@@ -0,0 +1,36 @@
1
+ //#region cli/create/createProject.d.mts
2
+ /**
3
+ *
4
+ * @param {string} [root]
5
+ * @param {object} [options]
6
+ * @param {string} [options.name]
7
+ * @param {string} [options.title]
8
+ * @param {boolean} [options.development]
9
+ * @param {boolean} [options.single]
10
+ * @param {Record<string, string>} [options.plugins]
11
+ */
12
+ declare function createProject(root?: string, {
13
+ name,
14
+ development,
15
+ plugins: addPlugins,
16
+ title,
17
+ single
18
+ }?: {
19
+ name?: string | undefined;
20
+ title?: string | undefined;
21
+ development?: boolean | undefined;
22
+ single?: boolean | undefined;
23
+ plugins?: Record<string, string> | undefined;
24
+ }): Promise<void>;
25
+ //#endregion
26
+ //#region cli/create/createFiles.d.mts
27
+ /**
28
+ * @template T
29
+ * @param {string} root
30
+ * @param {Record<string, (options: T) => PromiseLike<string | Uint8Array | object>>} files
31
+ * @param {T} options
32
+ * @returns {Promise<void>}
33
+ */
34
+ declare function createFiles<T>(root: string, files: Record<string, (options: T) => PromiseLike<string | Uint8Array | object>>, options: T): Promise<void>;
35
+ //#endregion
36
+ export { createFiles, createProject };
package/index.mjs ADDED
@@ -0,0 +1,247 @@
1
+ import * as pathFn from "node:path";
2
+ import createSalt from "@yongdall/configuration/createSalt.mjs";
3
+ import * as fsPromises from "node:fs/promises";
4
+
5
+ //#region cli/create/npmVersion.mjs
6
+ /**
7
+ * 获取 npm 包版本信息
8
+ * @param {string} packageName
9
+ * @returns {Promise<string>}
10
+ */
11
+ async function npmVersion(packageName) {
12
+ const response = await fetch(`https://registry.npmjs.org/${packageName}`);
13
+ if (!response.ok) return "";
14
+ return (await response.json())["dist-tags"]?.latest || "";
15
+ }
16
+
17
+ //#endregion
18
+ //#region cli/create/file.mjs
19
+ /**
20
+ *
21
+ * @param {string} root
22
+ * @param {string} path
23
+ */
24
+ async function fileType(root, path) {
25
+ return fsPromises.stat(pathFn.resolve(root, path)).then((s) => {
26
+ if (s.isFIFO()) return "fifo";
27
+ if (s.isFile()) return "file";
28
+ if (s.isBlockDevice()) return "device";
29
+ if (s.isCharacterDevice()) return "device";
30
+ if (s.isSocket()) return "socket";
31
+ if (s.isDirectory()) return "dir";
32
+ return "file";
33
+ }, () => "");
34
+ }
35
+ /**
36
+ *
37
+ * @param {string} root
38
+ * @param {string} path
39
+ */
40
+ async function existFile(root, path) {
41
+ return fsPromises.stat(pathFn.resolve(root, path)).then((s) => true, () => false);
42
+ }
43
+ /**
44
+ *
45
+ * @param {string} root
46
+ * @param {string} path
47
+ * @param {string | NodeJS.ArrayBufferView} [data]
48
+ */
49
+ async function createFile(root, path, data) {
50
+ const filename = pathFn.resolve(root, path);
51
+ if (data === void 0) {
52
+ await fsPromises.mkdir(filename, { recursive: true });
53
+ return;
54
+ }
55
+ const dirname = pathFn.dirname(filename);
56
+ await fsPromises.mkdir(dirname, { recursive: true });
57
+ await fsPromises.writeFile(filename, data);
58
+ }
59
+
60
+ //#endregion
61
+ //#region cli/create/createFiles.mjs
62
+ const configExtNames = [
63
+ ".mts",
64
+ ".mjs",
65
+ ".json",
66
+ ".yaml",
67
+ ".yml",
68
+ ".toml"
69
+ ];
70
+ /**
71
+ *
72
+ * @param {string} root
73
+ * @param {string} name
74
+ */
75
+ async function configCreatable(root, name) {
76
+ const ext = new Set(configExtNames);
77
+ for (const e of configExtNames) {
78
+ const type = await fileType(root, name + e);
79
+ if (!type) continue;
80
+ ext.delete(e);
81
+ if (type === "file") return false;
82
+ }
83
+ return ext.has(".json");
84
+ }
85
+ /**
86
+ * @template T
87
+ * @param {string} root
88
+ * @param {Record<string, (options: T) => PromiseLike<string | Uint8Array | object>>} files
89
+ * @param {T} options
90
+ * @returns {Promise<void>}
91
+ */
92
+ async function createFiles(root, files, options) {
93
+ file: for (const [path, f] of Object.entries(files)) {
94
+ const isPackage = path === "package.json";
95
+ if (isPackage && await fileType(root, path)) continue;
96
+ const data = await f(options);
97
+ if (ArrayBuffer.isView(data) || typeof data === "string") {
98
+ if (await fileType(root, path)) continue;
99
+ await createFile(root, path, data);
100
+ continue;
101
+ }
102
+ if (isPackage) {
103
+ await createFile(root, path, JSON.stringify(data, null, 2));
104
+ continue;
105
+ }
106
+ if (!await configCreatable(root, path)) continue;
107
+ await createFile(root, path + ".json", JSON.stringify(data, null, 2));
108
+ }
109
+ }
110
+
111
+ //#endregion
112
+ //#region cli/create/createProject.mjs
113
+ const devDependencies = ["live-server"];
114
+ const projectDependencies = [
115
+ "@yongdall/cli",
116
+ "@yongdall/migrate",
117
+ "@yongdall/assets",
118
+ "@yongdall/configuration",
119
+ "@yongdall/http"
120
+ ];
121
+ const plugins = [
122
+ "@yongdall/web",
123
+ "@yongdall/theme",
124
+ "@yongdall/pages",
125
+ "@yongdall/skin",
126
+ "@yongdall/icons-antd",
127
+ "@yongdall/document",
128
+ "@yongdall/server",
129
+ "@yongdall/api",
130
+ "@yongdall/api-model",
131
+ "@yongdall/fs-s3",
132
+ "@yongdall/tq-redis",
133
+ "@yongdall/rdb-postgres",
134
+ "@yongdall/mq-redis",
135
+ "@yongdall/cache-redis",
136
+ "@yongdall/file",
137
+ "@yongdall/user",
138
+ "@yongdall/permission"
139
+ ];
140
+ const gitignore = `\
141
+ node_modules
142
+ /assets
143
+ /index.html
144
+ /config/salt
145
+ `;
146
+ /**
147
+ * @typedef {object} CreateOptions
148
+ * @property {string} name
149
+ * @property {string} title
150
+ * @property {boolean} development
151
+ * @property {boolean} single
152
+ * @property {Record<string, string>} plugins
153
+ */
154
+ /**
155
+ *
156
+ * @param {Partial<CreateOptions>} [options]
157
+ */
158
+ async function createPackageJson({ name, development } = {}) {
159
+ return {
160
+ name: name || "yongdall-project",
161
+ version: "0.0.0",
162
+ private: true,
163
+ scripts: development ? {
164
+ "migrate": "yongdall --development migrate",
165
+ "start": "yongdall http --port=8090",
166
+ "test:server": "yongdall http --watch --development --port=8090",
167
+ "inspect:server": "yongdall http --watch --inspect --development --port=8090",
168
+ "assets": "yongdall assets",
169
+ "test:web": "live-server --port=8080 --entry-file=assets/index.html --mount=/assets:assets --mount=/:public --proxy=/api:http://127.0.0.1:8090/api/ --proxy=/fileCabinets:http://127.0.0.1:8090/fileCabinets/"
170
+ } : {
171
+ "migrate": "yongdall --development migrate",
172
+ "start": "yongdall http --port=8090",
173
+ "assets": "yongdall assets"
174
+ },
175
+ dependencies: Object.fromEntries([...await Promise.all(projectDependencies.map((v) => Promise.all([v, npmVersion(v)]))), ...await Promise.all(plugins.map((v) => Promise.all([v, npmVersion(v)])))].sort(([a], [b]) => a > b ? 1 : -1).map(([k, v]) => [k, v ? `^${v}` : "*"])),
176
+ devDependencies: Object.fromEntries([...await Promise.all(devDependencies.map((v) => Promise.all([v, npmVersion(v)])))].sort(([a], [b]) => a > b ? 1 : -1).map(([k, v]) => [k, v ? `^${v}` : "*"]))
177
+ };
178
+ }
179
+ /** @type {Record<string, (options: Partial<CreateOptions>) => PromiseLike<string | Uint8Array | object>>} */
180
+ const files = {
181
+ ".gitignore": async () => gitignore,
182
+ "package.json": createPackageJson,
183
+ "yongdall.config": async ({ title, single }) => ({
184
+ title: title || "拥道YongDall",
185
+ single,
186
+ bootName: "yongdallBoot",
187
+ bootModule: "@yongdall/web/boot"
188
+ }),
189
+ "config/boot": async () => ({
190
+ pages: {
191
+ "settings": "@yongdall/pages#settings",
192
+ "todo": "@yongdall/pages#todo",
193
+ "search": "@yongdall/pages#search",
194
+ "status": "@yongdall/pages#status",
195
+ "devtools": "@yongdall/devtools#page",
196
+ "model": "@yongdall/pages#list",
197
+ "modelDetails": "@yongdall/pages#details",
198
+ "modelSetting": "@yongdall/pages#setting",
199
+ "modelInput": "@yongdall/pages#new",
200
+ "modelCopy": "@yongdall/pages#new",
201
+ "modelEdit": "@yongdall/pages#edit"
202
+ },
203
+ configurationPages: { "password": "@yongdall/user#password" },
204
+ theme: "@yongdall/theme#allSider",
205
+ skin: "@yongdall/skin/style.css",
206
+ webRoot: "/workbench/",
207
+ authRequired: true
208
+ }),
209
+ "config/plugins": async ({ plugins: addPlugins }) => ({
210
+ ...Object.fromEntries(plugins.map((v) => [v, true])),
211
+ ...addPlugins
212
+ }),
213
+ "config/providers": async () => ({
214
+ rdb: "postgres://yongdall:yongdall@127.0.0.1:5432/lcp?schema=public",
215
+ tq: "redis://yongdall:yongdall@127.0.0.1:6379/0?prefix=tq:",
216
+ mq: "redis://yongdall:yongdall@127.0.0.1:6379/0?prefix=mq:",
217
+ cache: "redis://yongdall:yongdall@127.0.0.1:6379/0?prefix=cache:"
218
+ }),
219
+ "config/salt": () => createSalt()
220
+ };
221
+ /**
222
+ *
223
+ * @param {string} [root]
224
+ * @param {object} [options]
225
+ * @param {string} [options.name]
226
+ * @param {string} [options.title]
227
+ * @param {boolean} [options.development]
228
+ * @param {boolean} [options.single]
229
+ * @param {Record<string, string>} [options.plugins]
230
+ */
231
+ async function createProject(root, { name, development, plugins: addPlugins, title, single } = {}) {
232
+ const rootPath = pathFn.resolve(root || ".");
233
+ const createOptions = {
234
+ name: name || pathFn.basename(rootPath),
235
+ development,
236
+ plugins: addPlugins,
237
+ title,
238
+ single
239
+ };
240
+ if (await existFile(rootPath, "package.json")) return;
241
+ if (!await configCreatable(rootPath, "yongdall.config")) return;
242
+ await createFiles(rootPath, files, createOptions);
243
+ }
244
+
245
+ //#endregion
246
+ export { createFiles, createProject };
247
+ //# sourceMappingURL=index.mjs.map
package/index.mjs.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../cli/create/npmVersion.mjs","../../cli/create/file.mjs","../../cli/create/createFiles.mjs","../../cli/create/createProject.mjs"],"sourcesContent":["/**\n * 获取 npm 包版本信息\n * @param {string} packageName \n * @returns {Promise<string>}\n */\nexport default async function npmVersion(packageName) {\n\tconst registry = 'https://registry.npmjs.org';\n\tconst response = await fetch(`${registry}/${packageName}`);\n\n\tif (!response.ok) { return ''; }\n\n\tconst data = await response.json();\n\n\treturn data['dist-tags']?.latest || '';\n}\n","import * as fsPromises from 'node:fs/promises';\nimport * as pathFn from 'node:path';\n\n/**\n * \n * @param {string} root \n * @param {string} path \n */\nexport async function fileType(root, path) {\n\treturn fsPromises.stat(pathFn.resolve(root, path)).then(\n\t\t(s) => {\n\t\t\tif (s.isFIFO()) { return 'fifo'; }\n\t\t\tif (s.isFile()) { return 'file'; }\n\t\t\tif (s.isBlockDevice()) { return 'device'; }\n\t\t\tif (s.isCharacterDevice()) { return 'device'; }\n\t\t\tif (s.isSocket()) { return 'socket'; }\n\t\t\tif (s.isDirectory()) { return 'dir'; }\n\t\t\treturn 'file';\n\t\t},\n\t\t() => '',\n\t);\n}\n\n/**\n * \n * @param {string} root \n * @param {string} path \n */\nexport async function existFile(root, path) {\n\treturn fsPromises.stat(pathFn.resolve(root, path)).then(\n\t\t(s) => true,\n\t\t() => false,\n\t);\n}\n/**\n * \n * @param {string} root \n * @param {string} path \n * @param {string | NodeJS.ArrayBufferView} [data] \n */\nexport async function createFile(root, path, data) {\n\tconst filename = pathFn.resolve(root, path);\n\tif (data === undefined) {\n\t\tawait fsPromises.mkdir(filename, { recursive: true });\n\t\treturn;\n\t}\n\tconst dirname = pathFn.dirname(filename);\n\tawait fsPromises.mkdir(dirname, { recursive: true });\n\tawait fsPromises.writeFile(filename, data);\n}\n","import { fileType, createFile } from './file.mjs';\n\nconst configExtNames = ['.mts', '.mjs', '.json', '.yaml', '.yml', '.toml'];\n\n/**\n * \n * @param {string} root \n * @param {string} name \n */\nexport async function configCreatable(root, name) {\n\tconst ext = new Set(configExtNames);\n\tfor (const e of configExtNames) {\n\t\tconst type = await fileType(root, name + e);\n\t\tif (!type) { continue; }\n\t\text.delete(e);\n\t\tif (type === 'file') { return false; }\n\t}\n\treturn ext.has('.json');\n}\n/**\n * @template T\n * @param {string} root\n * @param {Record<string, (options: T) => PromiseLike<string | Uint8Array | object>>} files \n * @param {T} options \n * @returns {Promise<void>}\n */\nexport default async function createFiles(root, files, options) {\n\tfile: for (const [path, f] of Object.entries(files)) {\n\t\tconst isPackage = path === 'package.json';\n\t\tif (isPackage && await fileType(root, path)) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst data = await f(options);\n\t\tif (ArrayBuffer.isView(data) || typeof data === 'string') {\n\t\t\tif (await fileType(root, path)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t// @ts-ignore\n\t\t\tawait createFile(root, path, data);\n\t\t\tcontinue;\n\t\t}\n\t\tif (isPackage) {\n\t\t\tawait createFile(root, path, JSON.stringify(data, null, 2));\n\t\t\tcontinue;\n\n\t\t}\n\t\tif (!await configCreatable(root, path)) { continue; }\n\t\tawait createFile(root, path + '.json', JSON.stringify(data, null, 2));\n\t}\n\n}\n","import * as pathFn from 'node:path';\nimport createSalt from '@yongdall/configuration/createSalt.mjs';\nimport npmVersion from './npmVersion.mjs';\nimport createFiles, { configCreatable } from './createFiles.mjs';\nimport { existFile } from './file.mjs';\n\n\nconst devDependencies = [\n\t'live-server',\n];\nconst projectDependencies = [\n\t'@yongdall/cli',\n\t'@yongdall/migrate',\n\t'@yongdall/assets',\n\t'@yongdall/configuration',\n\t\"@yongdall/http\",\n];\n\nconst plugins = [\n\t'@yongdall/web',\n\t'@yongdall/theme',\n\t'@yongdall/pages',\n\t'@yongdall/skin',\n\t'@yongdall/icons-antd',\n\n\t'@yongdall/document',\n\t'@yongdall/server',\n\t'@yongdall/api',\n\t'@yongdall/api-model',\n\n\t'@yongdall/fs-s3',\n\t'@yongdall/tq-redis',\n\t'@yongdall/rdb-postgres',\n\t'@yongdall/mq-redis',\n\t'@yongdall/cache-redis',\n\n\n\t'@yongdall/file',\n\t'@yongdall/user',\n\t'@yongdall/permission',\n\n\n];\n\nconst gitignore = `\\\nnode_modules\n/assets\n/index.html\n/config/salt\n`;\n\n/**\n * @typedef {object} CreateOptions\n * @property {string} name\n * @property {string} title\n * @property {boolean} development\n * @property {boolean} single\n * @property {Record<string, string>} plugins\n */\n/**\n * \n * @param {Partial<CreateOptions>} [options] \n */\nasync function createPackageJson({ name, development } = {}) {\n\treturn {\n\t\tname: name || 'yongdall-project',\n\t\tversion: '0.0.0',\n\t\tprivate: true,\n\t\tscripts: development ? {\n\t\t\t'migrate': 'yongdall --development migrate',\n\t\t\t'start': 'yongdall http --port=8090',\n\t\t\t'test:server': 'yongdall http --watch --development --port=8090',\n\t\t\t'inspect:server': 'yongdall http --watch --inspect --development --port=8090',\n\t\t\t'assets': 'yongdall assets',\n\t\t\t'test:web': 'live-server --port=8080 --entry-file=assets/index.html --mount=/assets:assets --mount=/:public --proxy=/api:http://127.0.0.1:8090/api/ --proxy=/fileCabinets:http://127.0.0.1:8090/fileCabinets/'\n\t\t} : {\n\t\t\t'migrate': 'yongdall --development migrate',\n\t\t\t'start': 'yongdall http --port=8090',\n\t\t\t'assets': 'yongdall assets',\n\t\t},\n\t\tdependencies: Object.fromEntries([\n\t\t\t...await Promise.all(projectDependencies.map(v => Promise.all([v, npmVersion(v)]))),\n\t\t\t...await Promise.all(plugins.map(v => Promise.all([v, npmVersion(v)]))),\n\t\t].sort(([a], [b]) => a > b ? 1 : -1).map(([k, v]) => [k, v ? `^${v}` : '*'])),\n\t\tdevDependencies: Object.fromEntries([\n\t\t\t...await Promise.all(devDependencies.map(v => Promise.all([v, npmVersion(v)]))),\n\t\t].sort(([a], [b]) => a > b ? 1 : -1).map(([k, v]) => [k, v ? `^${v}` : '*'])),\n\t};\n}\n/** @type {Record<string, (options: Partial<CreateOptions>) => PromiseLike<string | Uint8Array | object>>} */\nconst files = {\n\t'.gitignore': async () => gitignore,\n\t'package.json': createPackageJson,\n\t'yongdall.config': async ({ title, single }) => ({\n\t\ttitle: title || '拥道YongDall',\n\t\tsingle,\n\t\tbootName: 'yongdallBoot',\n\t\tbootModule: '@yongdall/web/boot'\n\t}),\n\t'config/boot': async () => ({\n\t\tpages: {\n\t\t\t'settings': '@yongdall/pages#settings',\n\t\t\t'todo': '@yongdall/pages#todo',\n\t\t\t'search': '@yongdall/pages#search',\n\t\t\t'status': '@yongdall/pages#status',\n\t\t\t'devtools': '@yongdall/devtools#page',\n\n\t\t\t'model': '@yongdall/pages#list',\n\t\t\t'modelDetails': '@yongdall/pages#details',\n\t\t\t'modelSetting': '@yongdall/pages#setting',\n\t\t\t'modelInput': '@yongdall/pages#new',\n\t\t\t'modelCopy': '@yongdall/pages#new',\n\t\t\t'modelEdit': '@yongdall/pages#edit',\n\n\t\t},\n\t\tconfigurationPages: {\n\t\t\t'password': '@yongdall/user#password'\n\t\t},\n\t\ttheme: '@yongdall/theme#allSider',\n\t\tskin: '@yongdall/skin/style.css',\n\t\t// route: '@yongdall/route-symbol',\n\t\twebRoot: '/workbench/',\n\t\tauthRequired: true,\n\n\t}),\n\t'config/plugins': async ({ plugins: addPlugins }) => ({\n\t\t...Object.fromEntries(plugins.map(v => [v, true])),\n\t\t...addPlugins,\n\t}),\n\t'config/providers': async () => ({\n\t\trdb: 'postgres://yongdall:yongdall@127.0.0.1:5432/lcp?schema=public',\n\t\ttq: 'redis://yongdall:yongdall@127.0.0.1:6379/0?prefix=tq:',\n\t\tmq: 'redis://yongdall:yongdall@127.0.0.1:6379/0?prefix=mq:',\n\t\tcache: 'redis://yongdall:yongdall@127.0.0.1:6379/0?prefix=cache:',\n\t}),\n\t'config/salt': () => createSalt(),\n\n};\n\n/**\n * \n * @param {string} [root] \n * @param {object} [options] \n * @param {string} [options.name] \n * @param {string} [options.title] \n * @param {boolean} [options.development] \n * @param {boolean} [options.single] \n * @param {Record<string, string>} [options.plugins] \n */\nexport default async function createProject(\n\troot, { name, development, plugins: addPlugins, title, single } = {}\n) {\n\tconst rootPath = pathFn.resolve(root || '.');\n\tconst createOptions = {\n\t\tname: name || pathFn.basename(rootPath),\n\t\tdevelopment, plugins: addPlugins, title, single,\n\t};\n\tif (await existFile(rootPath, 'package.json')) { return; }\n\tif (!await configCreatable(rootPath, 'yongdall.config')) { return; }\n\n\tawait createFiles(rootPath, files, createOptions);\n\n}\n"],"mappings":";;;;;;;;;;AAKA,eAA8B,WAAW,aAAa;CAErD,MAAM,WAAW,MAAM,MAAM,8BAAe,cAAc;AAE1D,KAAI,CAAC,SAAS,GAAM,QAAO;AAI3B,SAFa,MAAM,SAAS,MAAM,EAEtB,cAAc,UAAU;;;;;;;;;;ACLrC,eAAsB,SAAS,MAAM,MAAM;AAC1C,QAAO,WAAW,KAAK,OAAO,QAAQ,MAAM,KAAK,CAAC,CAAC,MACjD,MAAM;AACN,MAAI,EAAE,QAAQ,CAAI,QAAO;AACzB,MAAI,EAAE,QAAQ,CAAI,QAAO;AACzB,MAAI,EAAE,eAAe,CAAI,QAAO;AAChC,MAAI,EAAE,mBAAmB,CAAI,QAAO;AACpC,MAAI,EAAE,UAAU,CAAI,QAAO;AAC3B,MAAI,EAAE,aAAa,CAAI,QAAO;AAC9B,SAAO;UAEF,GACN;;;;;;;AAQF,eAAsB,UAAU,MAAM,MAAM;AAC3C,QAAO,WAAW,KAAK,OAAO,QAAQ,MAAM,KAAK,CAAC,CAAC,MACjD,MAAM,YACD,MACN;;;;;;;;AAQF,eAAsB,WAAW,MAAM,MAAM,MAAM;CAClD,MAAM,WAAW,OAAO,QAAQ,MAAM,KAAK;AAC3C,KAAI,SAAS,QAAW;AACvB,QAAM,WAAW,MAAM,UAAU,EAAE,WAAW,MAAM,CAAC;AACrD;;CAED,MAAM,UAAU,OAAO,QAAQ,SAAS;AACxC,OAAM,WAAW,MAAM,SAAS,EAAE,WAAW,MAAM,CAAC;AACpD,OAAM,WAAW,UAAU,UAAU,KAAK;;;;;A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;EACT,cAAc;EAEd;CACD,kBAAkB,OAAO,EAAE,SAAS,kBAAkB;EACrD,GAAG,OAAO,YAAY,QAAQ,KAAI,MAAK,CAAC,GAAG,KAAK,CAAC,CAAC;EAClD,GAAG;EACH;CACD,oBAAoB,aAAa;EAChC,KAAK;EACL,IAAI;EACJ,IAAI;EACJ,OAAO;EACP;CACD,qBAAqB,YAAY;CAEjC;;;;;;;;;;;AAYD,eAA8B,cAC7B,MAAM,EAAE,MAAM,aAAa,SAAS,YAAY,OAAO,WAAW,EAAE,EACnE;CACD,MAAM,WAAW,OAAO,QAAQ,QAAQ,IAAI;CAC5C,MAAM,gBAAgB;EACrB,MAAM,QAAQ,OAAO,SAAS,SAAS;EACvC;EAAa,SAAS;EAAY;EAAO;EACzC;AACD,KAAI,MAAM,UAAU,UAAU,eAAe,CAAI;AACjD,KAAI,CAAC,MAAM,gBAAgB,UAAU,kBAAkB,CAAI;AAE3D,OAAM,YAAY,UAAU,OAAO,cAAc"}
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@yongdall/create",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "bin": "./bin.mjs",
6
+ "main": "./index.mjs",
7
+ "imports": {
8
+ "#index": "./index.mjs",
9
+ "#cli/create": "./cli/create.mjs"
10
+ },
11
+ "dependencies": {
12
+ "@yongdall/cli-parse": "^0.2.0",
13
+ "@yongdall/configuration": "^0.2.0"
14
+ },
15
+ "exports": {
16
+ ".": "./index.mjs"
17
+ }
18
+ }