Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-knit-app

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-knit-app - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

166

bin/cli-init.js
/* @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"));
});
});
};
#!/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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc