@yongdall/create 0.6.0 → 0.6.2
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/index.mjs +2 -2
- package/index.mjs.map +1 -1
- package/package.json +3 -3
package/index.mjs
CHANGED
|
@@ -180,7 +180,7 @@ async function createPackageJson({ name, development } = {}) {
|
|
|
180
180
|
const files = {
|
|
181
181
|
".gitignore": async () => gitignore,
|
|
182
182
|
"package.json": createPackageJson,
|
|
183
|
-
"yongdall.
|
|
183
|
+
"yongdall.project": async ({ title, single }) => ({
|
|
184
184
|
title: title || "拥道YongDall",
|
|
185
185
|
single,
|
|
186
186
|
bootName: "yongdallBoot",
|
|
@@ -238,7 +238,7 @@ async function createProject(root, { name, development, plugins: addPlugins, tit
|
|
|
238
238
|
single
|
|
239
239
|
};
|
|
240
240
|
if (await existFile(rootPath, "package.json")) return;
|
|
241
|
-
if (!await configCreatable(rootPath, "yongdall.
|
|
241
|
+
if (!await configCreatable(rootPath, "yongdall.project")) return;
|
|
242
242
|
await createFiles(rootPath, files, createOptions);
|
|
243
243
|
}
|
|
244
244
|
|
package/index.mjs.map
CHANGED
|
@@ -1 +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'@yongdall/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/standard',\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': 'yongdall live-server --port=8080 --server=8090',\n\t\t\t'test': 'yongdall live-server --port=8080',\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\tcontinuations: {\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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AI;AACjD,KAAI,CAAC,MAAM,gBAAgB,UAAU,kBAAkB,CAAI;AAE3D,OAAM,YAAY,UAAU,OAAO,cAAc"}
|
|
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'@yongdall/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/standard',\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': 'yongdall live-server --port=8080 --server=8090',\n\t\t\t'test': 'yongdall live-server --port=8080',\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.project': 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\tcontinuations: {\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.project')) { 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,SAA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aAAa;GAEb;EACD,eAAe,EACd,YAAY,2BACZ;EACD,OAAO;EACP,MAAM;EAEN,SAAS;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,mBAAmB,CAAI;AAE5D,OAAM,YAAY,UAAU,OAAO,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yongdall/create",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "./bin.mjs",
|
|
6
6
|
"main": "./index.mjs",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"#cli/create": "./cli/create.mjs"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@yongdall/cli-parse": "^0.
|
|
13
|
-
"@yongdall/configuration": "^0.
|
|
12
|
+
"@yongdall/cli-parse": "^0.6.2",
|
|
13
|
+
"@yongdall/configuration": "^0.6.2"
|
|
14
14
|
},
|
|
15
15
|
"exports": {
|
|
16
16
|
".": "./index.mjs"
|