create-fastkit-app
Advanced tools
Comparing version 0.9.0 to 0.10.0
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var path = require('path'); | ||
@@ -12,8 +10,2 @@ var fs = require('fs-extra'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); | ||
var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk); | ||
const PACKAGE_TYPES = ['frontend', 'backend', 'other']; | ||
@@ -37,3 +29,3 @@ const BASE_STYLES = [ | ||
]; | ||
const DEPENDENCIE_VERSION_MAP = require(path__default.resolve(__dirname, '../templates/dependencies.json')); | ||
const DEPENDENCIE_VERSION_MAP = require(path.resolve(__dirname, '../templates/dependencies.json')); | ||
const DEFAULT_DEPENDENCIES = [ | ||
@@ -79,16 +71,16 @@ 'yorkie', | ||
const { version: fastkitVersion } = require('../package.json'); | ||
const TEMPLATES_DIR = path__default.resolve(__dirname, '../templates'); | ||
const PACKAGES_DIR = path__default.join(TEMPLATES_DIR, 'packages'); | ||
const TEMPLATES_DIR = path.resolve(__dirname, '../templates'); | ||
const PACKAGES_DIR = path.join(TEMPLATES_DIR, 'packages'); | ||
async function getAllPackageConfigs() { | ||
const configs = []; | ||
const tmp = (await fs__default.readdir(PACKAGES_DIR)).map((name) => { | ||
const tmp = (await fs.readdir(PACKAGES_DIR)).map((name) => { | ||
return { | ||
name, | ||
path: path__default.join(PACKAGES_DIR, name), | ||
path: path.join(PACKAGES_DIR, name), | ||
}; | ||
}); | ||
await Promise.all(tmp.map(async (dir) => { | ||
const configPath = path__default.join(dir.path, 'app.config.json'); | ||
if (await fs__default.pathExists(configPath)) { | ||
const json = await fs__default.readJSON(configPath); | ||
const configPath = path.join(dir.path, 'app.config.json'); | ||
if (await fs.pathExists(configPath)) { | ||
const json = await fs.readJSON(configPath); | ||
configs.push({ | ||
@@ -136,3 +128,3 @@ name: dir.name, | ||
const results = []; | ||
const files = await fs__default.readdir(_dir); | ||
const files = await fs.readdir(_dir); | ||
for (const file of files) { | ||
@@ -142,4 +134,4 @@ if (GET_FILE_IGNORE.includes(file)) { | ||
} | ||
const fullPath = path__default.join(_dir, file); | ||
const stat = await fs__default.stat(fullPath); | ||
const fullPath = path.join(_dir, file); | ||
const stat = await fs.stat(fullPath); | ||
if (stat.isDirectory()) { | ||
@@ -150,3 +142,3 @@ const children = await getFlatFiles(fullPath, root); | ||
else { | ||
const { ext, dir } = path__default.parse(fullPath); | ||
const { ext, dir } = path.parse(fullPath); | ||
const info = { | ||
@@ -172,7 +164,7 @@ name: file, | ||
const _dir = pkg ? pkg.dest : workspace.dest; | ||
const dest = path__default.join(_dir, relativePath.replace(name, outFileName)); | ||
const destDir = path__default.parse(dest).dir; | ||
await fs__default.ensureDir(destDir); | ||
const dest = path.join(_dir, relativePath.replace(name, outFileName)); | ||
const destDir = path.parse(dest).dir; | ||
await fs.ensureDir(destDir); | ||
if (isTemplate) { | ||
let code = await fs__default.readFile(fullPath, 'utf-8'); | ||
let code = await fs.readFile(fullPath, 'utf-8'); | ||
try { | ||
@@ -186,6 +178,6 @@ const compiled = await eta.render(code, { | ||
code = compiled || ''; | ||
await fs__default.writeFile(dest, code, 'utf-8'); | ||
await fs.writeFile(dest, code, 'utf-8'); | ||
} | ||
catch (_err) { | ||
console.log(chalk__default.red(`Template compile failed. >>> ${fullPath}`)); | ||
console.log(chalk.red(`Template compile failed. >>> ${fullPath}`)); | ||
throw _err; | ||
@@ -195,3 +187,3 @@ } | ||
else { | ||
await fs__default.copy(fullPath, dest); | ||
await fs.copy(fullPath, dest); | ||
} | ||
@@ -201,7 +193,7 @@ } | ||
async function scaffold(config) { | ||
const PACKAGES_DIR = path__default.join(config.dest, 'packages'); | ||
const TEMPLATES_DIR = path__default.resolve(__dirname, '../templates'); | ||
const SHARED_TEMPLATES_DIR = path__default.join(TEMPLATES_DIR, 'shared'); | ||
await fs__default.emptyDir(config.dest); | ||
await fs__default.emptyDir(PACKAGES_DIR); | ||
const PACKAGES_DIR = path.join(config.dest, 'packages'); | ||
const TEMPLATES_DIR = path.resolve(__dirname, '../templates'); | ||
const SHARED_TEMPLATES_DIR = path.join(TEMPLATES_DIR, 'shared'); | ||
await fs.emptyDir(config.dest); | ||
await fs.emptyDir(PACKAGES_DIR); | ||
const { dependencies } = config; | ||
@@ -266,3 +258,3 @@ const keys = Object.keys(dependencies).sort((a, b) => { | ||
}); | ||
await fs__default.writeJSON(path__default.join(config.dest, 'package.json'), pkgJson, { | ||
await fs.writeJSON(path.join(config.dest, 'package.json'), pkgJson, { | ||
spaces: 2, | ||
@@ -276,5 +268,5 @@ }); | ||
} | ||
console.log(chalk__default.green.bold('You have successfully created a workspace.')); | ||
console.log(chalk__default.cyan(` cd ${config.name}`)); | ||
console.log(chalk__default.cyan(` npm install # or yarn or pnpm install`)); | ||
console.log(chalk.green.bold('You have successfully created a workspace.')); | ||
console.log(chalk.cyan(` cd ${config.name}`)); | ||
console.log(chalk.cyan(` npm install # or yarn or pnpm install`)); | ||
} | ||
@@ -288,9 +280,9 @@ | ||
if (workspaceDir) { | ||
workspaceDir = path__default.isAbsolute(workspaceDir) | ||
workspaceDir = path.isAbsolute(workspaceDir) | ||
? workspaceDir | ||
: path__default.resolve(cwd, workspaceDir); | ||
workspaceName = path__default.parse(workspaceDir).name; | ||
: path.resolve(cwd, workspaceDir); | ||
workspaceName = path.parse(workspaceDir).name; | ||
} | ||
else { | ||
workspaceName = path__default.parse(cwd).name; | ||
workspaceName = path.parse(cwd).name; | ||
} | ||
@@ -316,3 +308,3 @@ const appConfig = { | ||
function onCancel() { | ||
console.log(chalk__default.keyword('orange')('canceled...')); | ||
console.log(chalk.keyword('orange')('canceled...')); | ||
process.exit(); | ||
@@ -334,3 +326,3 @@ } | ||
if (!appConfig.dest) { | ||
appConfig.dest = workspaceName === name ? cwd : path__default.resolve(cwd, name); | ||
appConfig.dest = workspaceName === name ? cwd : path.resolve(cwd, name); | ||
} | ||
@@ -498,3 +490,3 @@ }); | ||
}); | ||
pkg.dest = path__default.join(appConfig.dest, `packages/${pkg.dirName}`); | ||
pkg.dest = path.join(appConfig.dest, `packages/${pkg.dirName}`); | ||
const { dependencies: pkgDependencies = [] } = pkg; | ||
@@ -516,10 +508,10 @@ allDependencies.push(...pkgDependencies); | ||
const name = pkg.type === 'other' ? pkg.name : `[${pkg.type}] ${pkg.name}`; | ||
return ` - ${name}: ${chalk__default.bold(pkg.dest)}`; | ||
return ` - ${name}: ${chalk.bold(pkg.dest)}`; | ||
}) | ||
.join('\n'); | ||
console.log(chalk__default | ||
console.log(chalk | ||
.keyword('orange')(` | ||
================================================== | ||
Workspace name: ${chalk__default.bold(appConfig.name)} | ||
Output: ${chalk__default.bold(appConfig.dest)} | ||
Workspace name: ${chalk.bold(appConfig.name)} | ||
Output: ${chalk.bold(appConfig.dest)} | ||
@@ -542,3 +534,3 @@ Packages: | ||
}); | ||
if (await fs__default.pathExists(appConfig.dest)) { | ||
if (await fs.pathExists(appConfig.dest)) { | ||
await enquirer.prompt({ | ||
@@ -545,0 +537,0 @@ type: 'confirm', |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var path = require('path'); | ||
@@ -12,8 +10,2 @@ var fs = require('fs-extra'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; } | ||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); | ||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); | ||
var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk); | ||
const PACKAGE_TYPES = ['frontend', 'backend', 'other']; | ||
@@ -37,3 +29,3 @@ const BASE_STYLES = [ | ||
]; | ||
const DEPENDENCIE_VERSION_MAP = require(path__default.resolve(__dirname, '../templates/dependencies.json')); | ||
const DEPENDENCIE_VERSION_MAP = require(path.resolve(__dirname, '../templates/dependencies.json')); | ||
const DEFAULT_DEPENDENCIES = [ | ||
@@ -79,16 +71,16 @@ 'yorkie', | ||
const { version: fastkitVersion } = require('../package.json'); | ||
const TEMPLATES_DIR = path__default.resolve(__dirname, '../templates'); | ||
const PACKAGES_DIR = path__default.join(TEMPLATES_DIR, 'packages'); | ||
const TEMPLATES_DIR = path.resolve(__dirname, '../templates'); | ||
const PACKAGES_DIR = path.join(TEMPLATES_DIR, 'packages'); | ||
async function getAllPackageConfigs() { | ||
const configs = []; | ||
const tmp = (await fs__default.readdir(PACKAGES_DIR)).map((name) => { | ||
const tmp = (await fs.readdir(PACKAGES_DIR)).map((name) => { | ||
return { | ||
name, | ||
path: path__default.join(PACKAGES_DIR, name), | ||
path: path.join(PACKAGES_DIR, name), | ||
}; | ||
}); | ||
await Promise.all(tmp.map(async (dir) => { | ||
const configPath = path__default.join(dir.path, 'app.config.json'); | ||
if (await fs__default.pathExists(configPath)) { | ||
const json = await fs__default.readJSON(configPath); | ||
const configPath = path.join(dir.path, 'app.config.json'); | ||
if (await fs.pathExists(configPath)) { | ||
const json = await fs.readJSON(configPath); | ||
configs.push({ | ||
@@ -136,3 +128,3 @@ name: dir.name, | ||
const results = []; | ||
const files = await fs__default.readdir(_dir); | ||
const files = await fs.readdir(_dir); | ||
for (const file of files) { | ||
@@ -142,4 +134,4 @@ if (GET_FILE_IGNORE.includes(file)) { | ||
} | ||
const fullPath = path__default.join(_dir, file); | ||
const stat = await fs__default.stat(fullPath); | ||
const fullPath = path.join(_dir, file); | ||
const stat = await fs.stat(fullPath); | ||
if (stat.isDirectory()) { | ||
@@ -150,3 +142,3 @@ const children = await getFlatFiles(fullPath, root); | ||
else { | ||
const { ext, dir } = path__default.parse(fullPath); | ||
const { ext, dir } = path.parse(fullPath); | ||
const info = { | ||
@@ -172,7 +164,7 @@ name: file, | ||
const _dir = pkg ? pkg.dest : workspace.dest; | ||
const dest = path__default.join(_dir, relativePath.replace(name, outFileName)); | ||
const destDir = path__default.parse(dest).dir; | ||
await fs__default.ensureDir(destDir); | ||
const dest = path.join(_dir, relativePath.replace(name, outFileName)); | ||
const destDir = path.parse(dest).dir; | ||
await fs.ensureDir(destDir); | ||
if (isTemplate) { | ||
let code = await fs__default.readFile(fullPath, 'utf-8'); | ||
let code = await fs.readFile(fullPath, 'utf-8'); | ||
try { | ||
@@ -186,6 +178,6 @@ const compiled = await eta.render(code, { | ||
code = compiled || ''; | ||
await fs__default.writeFile(dest, code, 'utf-8'); | ||
await fs.writeFile(dest, code, 'utf-8'); | ||
} | ||
catch (_err) { | ||
console.log(chalk__default.red(`Template compile failed. >>> ${fullPath}`)); | ||
console.log(chalk.red(`Template compile failed. >>> ${fullPath}`)); | ||
throw _err; | ||
@@ -195,3 +187,3 @@ } | ||
else { | ||
await fs__default.copy(fullPath, dest); | ||
await fs.copy(fullPath, dest); | ||
} | ||
@@ -201,7 +193,7 @@ } | ||
async function scaffold(config) { | ||
const PACKAGES_DIR = path__default.join(config.dest, 'packages'); | ||
const TEMPLATES_DIR = path__default.resolve(__dirname, '../templates'); | ||
const SHARED_TEMPLATES_DIR = path__default.join(TEMPLATES_DIR, 'shared'); | ||
await fs__default.emptyDir(config.dest); | ||
await fs__default.emptyDir(PACKAGES_DIR); | ||
const PACKAGES_DIR = path.join(config.dest, 'packages'); | ||
const TEMPLATES_DIR = path.resolve(__dirname, '../templates'); | ||
const SHARED_TEMPLATES_DIR = path.join(TEMPLATES_DIR, 'shared'); | ||
await fs.emptyDir(config.dest); | ||
await fs.emptyDir(PACKAGES_DIR); | ||
const { dependencies } = config; | ||
@@ -266,3 +258,3 @@ const keys = Object.keys(dependencies).sort((a, b) => { | ||
}); | ||
await fs__default.writeJSON(path__default.join(config.dest, 'package.json'), pkgJson, { | ||
await fs.writeJSON(path.join(config.dest, 'package.json'), pkgJson, { | ||
spaces: 2, | ||
@@ -276,5 +268,5 @@ }); | ||
} | ||
console.log(chalk__default.green.bold('You have successfully created a workspace.')); | ||
console.log(chalk__default.cyan(` cd ${config.name}`)); | ||
console.log(chalk__default.cyan(` npm install # or yarn or pnpm install`)); | ||
console.log(chalk.green.bold('You have successfully created a workspace.')); | ||
console.log(chalk.cyan(` cd ${config.name}`)); | ||
console.log(chalk.cyan(` npm install # or yarn or pnpm install`)); | ||
} | ||
@@ -288,9 +280,9 @@ | ||
if (workspaceDir) { | ||
workspaceDir = path__default.isAbsolute(workspaceDir) | ||
workspaceDir = path.isAbsolute(workspaceDir) | ||
? workspaceDir | ||
: path__default.resolve(cwd, workspaceDir); | ||
workspaceName = path__default.parse(workspaceDir).name; | ||
: path.resolve(cwd, workspaceDir); | ||
workspaceName = path.parse(workspaceDir).name; | ||
} | ||
else { | ||
workspaceName = path__default.parse(cwd).name; | ||
workspaceName = path.parse(cwd).name; | ||
} | ||
@@ -316,3 +308,3 @@ const appConfig = { | ||
function onCancel() { | ||
console.log(chalk__default.keyword('orange')('canceled...')); | ||
console.log(chalk.keyword('orange')('canceled...')); | ||
process.exit(); | ||
@@ -334,3 +326,3 @@ } | ||
if (!appConfig.dest) { | ||
appConfig.dest = workspaceName === name ? cwd : path__default.resolve(cwd, name); | ||
appConfig.dest = workspaceName === name ? cwd : path.resolve(cwd, name); | ||
} | ||
@@ -498,3 +490,3 @@ }); | ||
}); | ||
pkg.dest = path__default.join(appConfig.dest, `packages/${pkg.dirName}`); | ||
pkg.dest = path.join(appConfig.dest, `packages/${pkg.dirName}`); | ||
const { dependencies: pkgDependencies = [] } = pkg; | ||
@@ -516,10 +508,10 @@ allDependencies.push(...pkgDependencies); | ||
const name = pkg.type === 'other' ? pkg.name : `[${pkg.type}] ${pkg.name}`; | ||
return ` - ${name}: ${chalk__default.bold(pkg.dest)}`; | ||
return ` - ${name}: ${chalk.bold(pkg.dest)}`; | ||
}) | ||
.join('\n'); | ||
console.log(chalk__default | ||
console.log(chalk | ||
.keyword('orange')(` | ||
================================================== | ||
Workspace name: ${chalk__default.bold(appConfig.name)} | ||
Output: ${chalk__default.bold(appConfig.dest)} | ||
Workspace name: ${chalk.bold(appConfig.name)} | ||
Output: ${chalk.bold(appConfig.dest)} | ||
@@ -542,3 +534,3 @@ Packages: | ||
}); | ||
if (await fs__default.pathExists(appConfig.dest)) { | ||
if (await fs.pathExists(appConfig.dest)) { | ||
await enquirer.prompt({ | ||
@@ -545,0 +537,0 @@ type: 'confirm', |
{ | ||
"name": "create-fastkit-app", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "CLI to generate scaffolding for applications proposed by fastkit.", | ||
@@ -41,4 +41,4 @@ "buildOptions": { | ||
"eta": "^1.12.3", | ||
"fs-extra": "^9.1.0" | ||
"fs-extra": "^11.1.0" | ||
} | ||
} |
{ | ||
"@types/express": "^4.17.13", | ||
"@types/jest": "^27.5.2", | ||
"@types/node": "^16.11.42", | ||
"@typescript-eslint/eslint-plugin": "^4.33.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"@vitejs/plugin-vue": "^1.10.2", | ||
"@vitejs/plugin-vue-jsx": "^1.3.10", | ||
"@vue/compiler-sfc": "^3.2.37", | ||
"@vue/server-renderer": "^3.2.37", | ||
"@vueuse/head": "^0.7.6", | ||
"@types/express": "^4.17.15", | ||
"@types/jest": "^29.2.5", | ||
"@types/node": "^18.11.18", | ||
"@typescript-eslint/eslint-plugin": "^5.48.0", | ||
"@typescript-eslint/parser": "^5.48.0", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"@vitejs/plugin-vue-jsx": "^3.0.0", | ||
"@vue/compiler-sfc": "^3.2.45", | ||
"@vue/server-renderer": "^3.2.45", | ||
"@vueuse/head": "^1.0.22", | ||
"esbuild-jest": "^0.5.0", | ||
"esbuild-register": "^3.3.3", | ||
"eslint": "^7.32.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"esbuild-register": "^3.4.2", | ||
"eslint": "^8.31.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-html-parser": "^6.8.2", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-vue": "^7.20.0", | ||
"express": "^4.18.1", | ||
"jest": "^27.5.1", | ||
"eslint-plugin-vue": "^9.8.0", | ||
"express": "^4.18.2", | ||
"jest": "^29.3.1", | ||
"npm-run-all": "^4.1.5", | ||
"postcss": "^8.4.14", | ||
"prettier": "^2.7.1", | ||
"sass": "^1.53.0", | ||
"stylelint": "^14.9.1", | ||
"stylelint-config-css-modules": "^2.3.0", | ||
"stylelint-config-prettier": "^9.0.3", | ||
"stylelint-config-standard": "^23.0.0", | ||
"stylelint-prettier": "^1.2.0", | ||
"stylelint-scss": "^4.2.0", | ||
"postcss": "^8.4.20", | ||
"prettier": "^2.8.1", | ||
"sass": "^1.57.1", | ||
"stylelint": "^14.16.1", | ||
"stylelint-config-css-modules": "^4.1.0", | ||
"stylelint-config-prettier": "^9.0.4", | ||
"stylelint-config-standard": "^29.0.0", | ||
"stylelint-prettier": "^2.0.0", | ||
"stylelint-scss": "^4.3.0", | ||
"typescript": "^4.8.4", | ||
"vite": "^2.9.13", | ||
"vue": "^3.2.37", | ||
"vue-router": "^4.0.16" | ||
"vite": "^4.0.4", | ||
"vue": "^3.2.45", | ||
"vue-router": "^4.1.6" | ||
} |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
188866
1762
+ Addedfs-extra@11.3.0(transitive)
- Removedat-least-node@1.0.0(transitive)
- Removedfs-extra@9.1.0(transitive)
Updatedfs-extra@^11.1.0