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

create-gatsby

Package Overview
Dependencies
Maintainers
16
Versions
350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-gatsby - npm Package Compare versions

Comparing version 0.0.0-create-gatsby.17114 to 0.0.0-create-gatsby.17120

lib/plugin-options-form.js

2

lib/cmses.json
{
"none": "No (or I'll add it later)",
"gatsby-source-wordpress": "WordPress",
"gatsby-source-wordpress-experimental": "WordPress",
"gatsby-source-contentful": "Contentful",

@@ -5,0 +5,0 @@ "gatsby-source-datocms": "DatoCMS",

@@ -20,3 +20,2 @@ "use strict";

const features_json_1 = __importDefault(require("./features.json"));
const plugin_schemas_json_1 = __importDefault(require("./plugin-schemas.json"));
const init_starter_1 = require("./init-starter");

@@ -27,4 +26,3 @@ const install_plugins_1 = require("./install-plugins");

const fs_1 = __importDefault(require("fs"));
const common_tags_1 = require("common-tags");
const terminal_link_1 = __importDefault(require("terminal-link"));
const plugin_options_form_1 = require("./plugin-options-form");
// eslint-disable-next-line no-control-regex

@@ -79,56 +77,7 @@ const INVALID_FILENAMES = /[<>:"/\\|?*\u0000-\u001F]/g;

];
const supportedOptionTypes = [`string`, `boolean`, `number`];
function getName(key) {
const plugins = [cmses_json_1.default, styles_json_1.default]; // "features" doesn't map to names
for (const types of plugins) {
if (key in types) {
return types[key];
}
}
return key;
}
function docsLink(pluginName) {
return ansi_colors_1.default.blueBright(terminal_link_1.default(`the plugin docs`, `https://www.gatsbyjs.com/plugins/${pluginName}/`, { fallback: (_, url) => url }));
}
const makePluginConfigQuestions = (selectedPlugins) => {
const formPrompts = [];
selectedPlugins.forEach((pluginName) => {
const schema = plugin_schemas_json_1.default[pluginName];
if (typeof schema === `string` || !(`keys` in schema)) {
return;
}
const options = schema === null || schema === void 0 ? void 0 : schema.keys;
const choices = [];
Object.entries(options).forEach(([name, option]) => {
var _a, _b, _c, _d;
if (((_a = option === null || option === void 0 ? void 0 : option.flags) === null || _a === void 0 ? void 0 : _a.presence) !== `required`) {
return;
}
choices.push({
name,
initial: ((_b = option.flags) === null || _b === void 0 ? void 0 : _b.default) &&
supportedOptionTypes.includes(typeof ((_c = option.flags) === null || _c === void 0 ? void 0 : _c.default))
? (_d = option.flags) === null || _d === void 0 ? void 0 : _d.default.toString() : undefined,
message: name,
});
});
if (choices.length) {
formPrompts.push({
type: `form`,
name: `config-${pluginName}`,
multiple: true,
message: common_tags_1.stripIndent `
Configure the ${getName(pluginName)} plugin.
See ${docsLink(pluginName)} for help.
`,
choices,
});
}
});
return formPrompts;
};
function run() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const { version } = require(`../package.json`);
console.log(ansi_colors_1.default.grey.italic(`create-gatsby version ${version}`));
console.log(`

@@ -163,3 +112,3 @@

}
const config = makePluginConfigQuestions(plugins);
const config = plugin_options_form_1.makePluginConfigQuestions(plugins);
let pluginConfig;

@@ -169,3 +118,2 @@ if (config.length) {

pluginConfig = yield enquirer_1.prompt(config);
console.log(pluginConfig);
}

@@ -180,5 +128,6 @@ console.log(`

type: `confirm`,
choices: [`Yes`, `No`],
name: `confirm`,
initial: `Yes`,
message: `Shall we do this?`,
format: value => (value ? ansi_colors_1.default.greenBright(`Yes`) : ansi_colors_1.default.red(`No`)),
});

@@ -190,8 +139,14 @@ if (!confirm) {

yield init_starter_1.initStarter(DEFAULT_STARTER, data.project);
console.log(ansi_colors_1.default.green(`✔ `) + ansi_colors_1.default.bold(`Created site in `) + ansi_colors_1.default.green.bold(data.project));
if (plugins.length) {
console.log(ansi_colors_1.default.bold.green(`Installing plugins...`));
console.log(ansi_colors_1.default.bold(`🔌 Installing plugins...`));
yield install_plugins_1.installPlugins(plugins, pluginConfig, path_1.default.resolve(data.project));
}
console.log(ansi_colors_1.default.bold(`✨ Your new Gatsby site is ready! Start developing it by running:`));
console.log(`
cd ${data.project}
gatsby develop
`);
});
}
exports.run = run;

@@ -23,2 +23,4 @@ "use strict";

const gatsby_core_utils_2 = require("gatsby-core-utils");
const stream_filter_1 = __importDefault(require("stream-filter"));
const spin_1 = require("./spin");
const packageMangerConfigKey = `cli.packageManager`;

@@ -88,4 +90,5 @@ exports.getPackageManager = () => gatsby_core_utils_2.getConfigStore().get(packageMangerConfigKey);

const install = (rootPath) => __awaiter(void 0, void 0, void 0, function* () {
var _b, _c;
const prevDir = process.cwd();
reporter_1.reporter.info(`Installing packages...`);
const stop = spin_1.spin(`Installing packages...`);
process.chdir(rootPath);

@@ -109,7 +112,19 @@ const npmConfigUserAgent = process.env.npm_config_user_agent;

}
yield spawn(`yarnpkg --silent`);
const childProcess = spawn(`yarnpkg --silent`, {
all: true,
stdio: `pipe`,
});
// eslint-disable-next-line no-unused-expressions
(_b = childProcess.all) === null || _b === void 0 ? void 0 : _b.pipe(stream_filter_1.default((data) => !data.toString().startsWith(`warning`))).pipe(process.stderr);
yield childProcess;
}
else {
yield fs_extra_1.default.remove(`yarn.lock`);
yield spawn(`npm install --silent`);
const childProcess = spawn(`npm install --silent`, {
all: true,
stdio: `pipe`,
});
// eslint-disable-next-line no-unused-expressions
(_c = childProcess.all) === null || _c === void 0 ? void 0 : _c.pipe(stream_filter_1.default((data) => !data.toString().startsWith(`npm WARN`))).pipe(process.stderr);
yield childProcess;
}

@@ -122,2 +137,4 @@ }

process.chdir(prevDir);
stop();
reporter_1.reporter.success(`Installed packages`);
}

@@ -128,3 +145,3 @@ });

const branchProps = branch ? [`-b`, branch] : [];
reporter_1.reporter.info(`Creating new site from git: ${url}`);
const stop = spin_1.spin(`Cloning site template`);
const args = [

@@ -137,5 +154,7 @@ `clone`,

`--depth=1`,
`--quiet`,
].filter(arg => Boolean(arg));
yield spawnWithArgs(`git`, args);
reporter_1.reporter.success(`Created starter directory layout`);
stop();
reporter_1.reporter.success(`Created site from template`);
yield fs_extra_1.default.remove(path_1.default.join(rootPath, `.git`));

@@ -152,9 +171,2 @@ yield install(rootPath);

});
const successMessage = (rootPath) => {
reporter_1.reporter.info(`
Your new Gatsby site has been successfully bootstrapped. Start developing it by running:
cd ${rootPath}
gatsby develop
`);
};
/**

@@ -177,3 +189,2 @@ * Main function that clones or copies the starter.

}, false);
successMessage(rootPath);
// trackCli(`NEW_PROJECT_END`);

@@ -180,0 +191,0 @@ });

{
"gatsby-source-wordpress": "TODO: no schema in https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/blob/master/plugin/gatsby-node.js",
"gatsby-source-wordpress-experimental": "TODO: no schema in https://github.com/gatsbyjs/gatsby-source-wordpress-experimental/blob/master/plugin/gatsby-node.js",
"gatsby-source-contentful": {

@@ -115,3 +115,3 @@ "type": "object",

"gatsby-plugin-sass": {},
"gatsby-plugin-themeui": {},
"gatsby-plugin-theme-ui": {},
"gatsby-plugin-google-analytics": {

@@ -118,0 +118,0 @@ "type": "object",

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.reporter = void 0;
const ansi_colors_1 = __importDefault(require("ansi-colors"));
// We don't want to depend on the whole of gatsby-cli, so we can't use reporter

@@ -9,4 +13,4 @@ exports.reporter = {

log: (message) => console.log(message),
success: (message) => console.log(message),
error: (message) => console.error(message),
success: (message) => console.log(ansi_colors_1.default.green(`✔ `) + message),
error: (message) => console.error(ansi_colors_1.default.red(`✘ `) + message),
panic: (message) => {

@@ -13,0 +17,0 @@ console.error(message);

@@ -7,3 +7,3 @@ {

"gatsby-plugin-sass": "Sass",
"gatsby-plugin-themeui": "Theme-UI"
"gatsby-plugin-theme-ui": "Theme-UI"
}
{
"name": "create-gatsby",
"version": "0.0.0-create-gatsby.17114+43cffa94ea",
"version": "0.0.0-create-gatsby.17120+a995905373",
"main": "lib/index.js",

@@ -10,3 +10,4 @@ "bin": "lib/cli.js",

"watch": "tsc --watch",
"prepare": "yarn build"
"prepare": "yarn build",
"import-plugin-options": "node ./scripts/import-options-schema.js"
},

@@ -20,2 +21,3 @@ "homepage": "https://github.com/gatsbyjs/gatsby/tree/master/packages/create-gatsby#readme",

"gatsby-core-utils": "1.3.23",
"stream-filter": "^2.1.0",
"terminal-link": "^2.1.1"

@@ -43,3 +45,3 @@ },

"author": "Matt Kane <matt@gatsbyjs.com>",
"gitHead": "43cffa94ea0ebc7e48b06faea8e0363fbd90de84"
"gitHead": "a995905373752265e71178b33ef0a62bf3211695"
}
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