-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22418fc
commit 843aba5
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const inquirer = require('inquirer') | ||
const path = require('node:path') | ||
const createPackageJson = require('create-package-json') | ||
|
||
async function create (opts) { | ||
const { directory } = opts | ||
let projectPath = directory | ||
|
||
if (!projectPath) { | ||
const res = await inquirer.prompt([ | ||
{ | ||
type: 'input', | ||
name: 'path', | ||
message: 'Where would you like to create your project?', | ||
default: 'statusboard' | ||
} | ||
]) | ||
|
||
projectPath = res.path.trim() | ||
} | ||
|
||
const appPath = path.resolve(projectPath) | ||
let projectName = path.basename(appPath) | ||
|
||
const pkg = await createPackageJson( | ||
{ | ||
name: projectName, | ||
description: '"A dashboard for project status', | ||
version: '1.0.0', | ||
dependencies: ['@pkgjs/statusboard'], | ||
author: null, | ||
keywords: null, | ||
repository: null, | ||
type: 'commonjs', | ||
private: true, | ||
cwd: appPath, | ||
license: 'MIT', | ||
main: 'config.js', | ||
devDependencies: null, | ||
scrips: { | ||
build: 'statusboard build -C ./config', | ||
buildsite: 'npm run clean && statusboard site -C ./config', | ||
buildindex: 'statusboard index -C ./config', | ||
clean: 'rm -rf build/css build/js' | ||
} | ||
}, | ||
{} | ||
) | ||
|
||
console.log(pkg) | ||
console.log(projectPath, projectName) | ||
} | ||
|
||
module.exports = create |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters