create-knit-app
Advanced tools
Comparing version 0.4.0 to 0.5.0
/* @flow weak */ | ||
const fs = require('fs-extra'); | ||
const chalk = require('chalk'); | ||
const pify = require('pify'); | ||
const path = require('path'); | ||
const execa = require('execa'); | ||
const fs = require("fs-extra"); | ||
const chalk = require("chalk"); | ||
const pify = require("pify"); | ||
const path = require("path"); | ||
const execa = require("execa"); | ||
const yarn = require('@knit/yarn-utils'); | ||
const log = require('@knit/logger'); | ||
const yarn = require("@knit/yarn-utils"); | ||
const log = require("@knit/logger"); | ||
@@ -15,69 +15,91 @@ module.exports = argv => { | ||
// check if dir exists | ||
pify(fs.stat)(cwd).then(() => { | ||
console.log(); | ||
log.error(`directory \`${cwd}\` already exists`); | ||
}).catch(() => { | ||
console.log(); | ||
log.info(`creating a new knit app in ${chalk.white(cwd)}`); | ||
console.log(); | ||
pify(fs.stat)(cwd) | ||
.then(() => { | ||
console.log(); | ||
log.error(`directory \`${cwd}\` already exists`); | ||
}) | ||
.catch(() => { | ||
console.log(); | ||
log.info(`creating a new knit app in ${chalk.white(cwd)}`); | ||
console.log(); | ||
log.info('initializing...'); | ||
return pify(fs.mkdir)(cwd) | ||
.then(() => yarn.init({ cwd })) | ||
.then(() => pify(fs.copy)(path.resolve(path.join(__dirname, '..', 'template', 'package.json')), path.join(cwd, 'package.json'))) | ||
.then(() => execa('git', ['init'], { cwd })) | ||
.then(() => { | ||
log.info('installing dependencies...'); | ||
return yarn.add(['react', 'glamor'], { cwd, stdio: 'inherit' }) | ||
.then(() => yarn.addDev([ | ||
'react-dom', | ||
'eslint', | ||
'flow-bin', | ||
'jest', | ||
'babel-jest', | ||
'babel-cli', | ||
], { cwd, stdio: 'inherit' })); | ||
}) | ||
.then(() => { | ||
log.info('installing knit...'); | ||
return yarn.addDev([ | ||
'@knit/knit', | ||
'@knit/eslint-config-socks-react', | ||
'@knit/babel-preset-socks-react', | ||
'@knit/jest-config-socks', | ||
], { cwd, stdio: 'inherit' }); | ||
}) | ||
.then(() => { | ||
console.log(); | ||
log.info('copying template files...'); | ||
console.log(); | ||
return Promise.all([ | ||
'modules', | ||
'_eslintrc', | ||
'_eslintignore', | ||
'_flowconfig', | ||
'_gitignore', | ||
'_npmignore', | ||
'_babelrc', | ||
].map(f => { | ||
const d = f.replace('_', '.'); | ||
return pify(fs.copy)(path.resolve(path.join(__dirname, '..', 'template', f)), path.join(cwd, d)).then(() => { | ||
console.log(chalk.green(`\tcreated\t${d}`)); | ||
}); | ||
log.info("initializing..."); | ||
return pify(fs.mkdir)(cwd) | ||
.then(() => yarn.init({ cwd })) | ||
.then(() => | ||
pify(fs.copy)( | ||
path.resolve( | ||
path.join(__dirname, "..", "template", "package.json") | ||
), | ||
path.join(cwd, "package.json") | ||
) | ||
) | ||
.then(() => execa("git", ["init"], { cwd })) | ||
.then(() => { | ||
log.info("installing dependencies..."); | ||
return yarn | ||
.add(["react", "glamor"], { cwd, stdio: "inherit" }) | ||
.then(() => | ||
yarn.addDev( | ||
[ | ||
"react-dom", | ||
"eslint", | ||
"flow-bin", | ||
"jest", | ||
"babel-jest", | ||
"babel-cli" | ||
], | ||
{ cwd, stdio: "inherit" } | ||
) | ||
); | ||
}) | ||
); | ||
}) | ||
.then(() => { | ||
console.log(); | ||
log.success('finished creating your project!'); | ||
console.log(); | ||
log.info('start exploring by running:'); | ||
console.log(); | ||
console.log(chalk.cyan(`\tcd ${cwd}`)); | ||
console.log(chalk.cyan('\tyarn start')); | ||
console.log(); | ||
log.info('read more about what you can do with knit: '); | ||
log.info(chalk.white('https://github.com/knitjs/knit')); | ||
}); | ||
}); | ||
.then(() => { | ||
log.info("installing knit..."); | ||
return yarn.addDev( | ||
[ | ||
"@knit/knit", | ||
"@knit/eslint-config-socks-react", | ||
"@knit/babel-preset-socks-react", | ||
"@knit/jest-config-socks" | ||
], | ||
{ cwd, stdio: "inherit" } | ||
); | ||
}) | ||
.then(() => { | ||
console.log(); | ||
log.info("copying template files..."); | ||
console.log(); | ||
return Promise.all( | ||
[ | ||
"modules", | ||
"_eslintrc", | ||
"_eslintignore", | ||
"_flowconfig", | ||
"_gitignore", | ||
"_npmignore", | ||
"_babelrc" | ||
].map(f => { | ||
const d = f.replace("_", "."); | ||
return pify(fs.copy)( | ||
path.resolve(path.join(__dirname, "..", "template", f)), | ||
path.join(cwd, d) | ||
).then(() => { | ||
console.log(chalk.green(`\tcreated\t${d}`)); | ||
}); | ||
}) | ||
); | ||
}) | ||
.then(() => { | ||
console.log(); | ||
log.success("finished creating your project!"); | ||
console.log(); | ||
log.info("start exploring by running:"); | ||
console.log(); | ||
console.log(chalk.cyan(`\tcd ${cwd}`)); | ||
console.log(chalk.cyan("\tyarn start")); | ||
console.log(); | ||
log.info("read more about what you can do with knit: "); | ||
log.info(chalk.white("https://github.com/knitjs/knit")); | ||
}); | ||
}); | ||
}; |
29
index.js
#!/usr/bin/env node | ||
const updateNotifier = require('update-notifier'); | ||
const yargs = require('yargs'); | ||
const readPkgUp = require('read-pkg-up'); | ||
const updateNotifier = require("update-notifier"); | ||
const yargs = require("yargs"); | ||
const readPkgUp = require("read-pkg-up"); | ||
const init = require('./bin/cli-init'); | ||
const init = require("./bin/cli-init"); | ||
@@ -15,16 +15,15 @@ const pkg = readPkgUp.sync({ cwd: __dirname }).pkg; | ||
verbose: { | ||
describe: 'Use verbose renderer output', | ||
type: 'boolean', | ||
global: true, | ||
describe: "Use verbose renderer output", | ||
type: "boolean", | ||
global: true | ||
}, | ||
silent: { | ||
describe: 'Use silent renderer output', | ||
type: 'boolean', | ||
global: true, | ||
}, | ||
describe: "Use silent renderer output", | ||
type: "boolean", | ||
global: true | ||
} | ||
}) | ||
.usage('Usage: create-knit-app <project-directory>') | ||
.usage("Usage: create-knit-app <project-directory>") | ||
.demand(1) | ||
.help() | ||
.argv; | ||
.help().argv; | ||
@@ -35,4 +34,4 @@ init(argv); | ||
pkg, | ||
updateCheckInterval: 1000 * 60 * 60 * 24 * 7, // 1 week | ||
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week | ||
}); | ||
notifier.notify(); |
@@ -18,3 +18,3 @@ { | ||
"engines": { | ||
"node": ">=6", | ||
"node": ">=4", | ||
"npm": ">=3" | ||
@@ -28,3 +28,3 @@ }, | ||
"description": "create knit apps", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"bin": { | ||
@@ -34,14 +34,12 @@ "create-knit-app": "./index.js" | ||
"dependencies": { | ||
"@knit/logger": "0.1.6", | ||
"@knit/yarn-utils": "0.4.0", | ||
"@knit/logger": "0.5.0", | ||
"@knit/yarn-utils": "0.5.0", | ||
"chalk": "1.1.3", | ||
"execa": "^0.6.0", | ||
"fs-extra": "^2.0.0", | ||
"fs-extra": "^3.0.1", | ||
"pify": "2.3.0", | ||
"read-pkg-up": "2.0.0", | ||
"update-notifier": "^2.1.0", | ||
"yargs": "^6.6.0" | ||
}, | ||
"peerDependencies": {}, | ||
"optionalDependencies": {} | ||
"yargs": "^8.0.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
886714
244
+ Added@knit/logger@0.5.0(transitive)
+ Added@knit/yarn-utils@0.5.0(transitive)
+ Addeddate-fns@1.30.1(transitive)
+ Addedfs-extra@3.0.1(transitive)
+ Addedjsonfile@3.0.1(transitive)
+ Addedlistr-update-renderer@0.4.0(transitive)
+ Addedlistr-verbose-renderer@0.4.1(transitive)
+ Addedmem@1.1.0(transitive)
+ Addedmimic-fn@1.2.0(transitive)
+ Addedos-locale@2.1.0(transitive)
+ Addeduniversalify@0.1.2(transitive)
+ Addedwhich-module@2.0.1(transitive)
+ Addedyargs@8.0.2(transitive)
+ Addedyargs-parser@7.0.0(transitive)
- Removed@knit/logger@0.1.6(transitive)
- Removed@knit/yarn-utils@0.4.0(transitive)
- Removedcamelcase@3.0.0(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfs-extra@2.1.2(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedjsonfile@2.4.0(transitive)
- Removedlistr-update-renderer@0.1.4(transitive)
- Removedlistr-verbose-renderer@0.2.1(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedos-locale@1.4.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedwhich-module@1.0.0(transitive)
- Removedyargs@6.6.0(transitive)
- Removedyargs-parser@4.2.1(transitive)
Updated@knit/logger@0.5.0
Updated@knit/yarn-utils@0.5.0
Updatedfs-extra@^3.0.1
Updatedyargs@^8.0.1