From 7fb45e3b4dc23317327d4ccf4f1cc0b1dd32273b Mon Sep 17 00:00:00 2001 From: Shedrack akintayo Date: Mon, 24 Oct 2022 21:11:33 +0100 Subject: [PATCH 01/26] start fix for cp bug on windows --- index.js | 193 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 105 insertions(+), 88 deletions(-) diff --git a/index.js b/index.js index a75f688..7f87669 100755 --- a/index.js +++ b/index.js @@ -1,50 +1,50 @@ #!/usr/bin/env node -import chalk from "chalk"; -import { exec } from "child_process"; -import fs from "fs"; -import path from "path"; -import readline from "readline"; -import util from "util"; -import yargs from "yargs"; -import { hideBin } from "yargs/helpers"; +import chalk from 'chalk' +import { exec } from 'child_process' +import fs from 'fs-extra' +import path from 'path' +import readline from 'readline' +import util from 'util' +import yargs from 'yargs' +import { hideBin } from 'yargs/helpers' -import config from "./config.js"; +import config from './config.js' /* --- Helpers --- */ -const run = util.promisify(exec); +const run = util.promisify(exec) const rl = readline.createInterface({ input: process.stdin, output: process.stdout, -}); +}) function prompt(question, defaultAnswer) { return new Promise((resolve) => { - rl.question(question, (input) => resolve(input || defaultAnswer)); - }); + rl.question(question, (input) => resolve(input || defaultAnswer)) + }) } function getDirName(defaultDirName) { - let dirName = args._[0] ?? defaultDirName; - if (fs.existsSync(dirName)) dirName += `-${timestamp}`; - return dirName; + let dirName = args._[0] ?? defaultDirName + if (fs.existsSync(dirName)) dirName += `-${timestamp}` + return dirName } async function installDependencies(dirName) { - console.log(`Installing dependencies ...`); - await run(`cd ${dirName} && npm install`); + console.log(`Installing dependencies ...`) + await run(`cd ${dirName} && npm install`) } async function initGit(dirName) { - console.log(`Setting up Git ...`); - await run(`rm -rf ${dirName}/.git`); - await run( - `cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"` - ); + console.log(`Setting up Git ...`) + await fs.remove(`${dirName} / .git`, { recursive: true }, async () => { + await run( + `cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"` + ) + }) } - /** * Given a version string, compare it to a control version. Returns: * @@ -57,131 +57,148 @@ async function initGit(dirName) { */ function compareVersion(version, control) { // References - let returnValue = 0; + let returnValue = 0 // Return 0 if the versions match. - if (version === control) return returnValue; + if (version === control) return returnValue // Break the versions into arrays of integers. - const getVersionParts = (str) => str.split(".").map((v) => parseInt(v)); - const versionParts = getVersionParts(version); - const controlParts = getVersionParts(control); + const getVersionParts = (str) => str.split('.').map((v) => parseInt(v)) + const versionParts = getVersionParts(version) + const controlParts = getVersionParts(control) // Loop and compare each item. controlParts.every((controlPart, idx) => { // If the versions are equal at this part, we move on to the next part. - if (versionParts[idx] === controlPart) return true; + if (versionParts[idx] === controlPart) return true // Otherwise, set the return value, then break out of the loop. - returnValue = versionParts[idx] > controlPart ? 1 : -1; - return false; - }); - return returnValue; + returnValue = versionParts[idx] > controlPart ? 1 : -1 + return false + }) + return returnValue } /* --- Parse CLI Arguments */ const args = yargs(hideBin(process.argv)) - .option("starter", { - alias: "s", - describe: "Choose a starter", + .option('starter', { + alias: 's', + describe: 'Choose a starter', choices: config.starters.map((s) => s.name), }) - .option("example", { - alias: "e", - describe: "Start from an example", + .option('example', { + alias: 'e', + describe: 'Start from an example', choices: config.examples.directories, }) .help() - .parse(); + .parse() /* --- References --- */ const starter = config.starters.find( (s) => s.name === (args.starter ?? config.defaults.starter.name) -); +) // Current time in seconds. -const timestamp = Math.round(new Date().getTime() / 1000); +const timestamp = Math.round(new Date().getTime() / 1000) /* --- New Project from Starter --- */ async function cloneStarter() { // Set references - const dirName = getDirName(config.defaults.dirName); + const dirName = getDirName(config.defaults.dirName) // Clone repo - const cloneCommand = `git clone --depth=1 ${starter.repoUrl} ${dirName}`; - console.log(`\nCreating new project in ${dirName} ...`); - await run(cloneCommand); + const cloneCommand = `git clone --depth=1 ${starter.repoUrl} ${dirName}` + console.log(`\nCreating new project in ${dirName} ...`) + await run(cloneCommand) // Project Setup - await installDependencies(dirName); - await initGit(dirName); + await installDependencies(dirName) + await initGit(dirName) // Output next steps: console.log(` -๐ŸŽ‰ ${chalk.bold("Welcome to Stackbit!")} ๐ŸŽ‰ +๐ŸŽ‰ ${chalk.bold('Welcome to Stackbit!')} ๐ŸŽ‰ Follow the instructions for getting Started here: ${starter.repoUrl}#readme - `); + `) } /* --- New Project from Example --- */ async function cloneExample() { - const gitResult = await run("git --version"); - const gitVersionMatch = gitResult.stdout.match(/\d+\.\d+\.\d+/); + const gitResult = await run('git --version') + const gitVersionMatch = gitResult.stdout.match(/\d+\.\d+\.\d+/) if (!gitVersionMatch || !gitVersionMatch[0]) { console.error( `Cannot determine git version, which is required for starting from an example.`, `\nPlease report this:`, chalk.underline( - "https://github.com/stackbit/create-stackbit-app/issues/new" + 'https://github.com/stackbit/create-stackbit-app/issues/new' ) - ); - process.exit(1); + ) + process.exit(1) } if (compareVersion(gitVersionMatch[0], config.minGitVersion) < 0) { console.error( `Starting from an example requires git version ${config.minGitVersion} or later.`, - "Please upgrade" - ); - process.exit(1); + 'Please upgrade' + ) + process.exit(1) } - const dirName = getDirName(args.example); - const tmpDir = `__tmp${timestamp}__`; - console.log(`\nCreating new project in ${dirName} ...`); + const dirName = getDirName(args.example) + const tmpDir = `__tmp${timestamp}__` + console.log(`\nCreating new project in ${dirName} ...`) try { // Sparse clone the monorepo. await run( `git clone --depth 1 --filter=blob:none --sparse ${config.examples.repoUrl} ${tmpDir}` - ); + ) // Checkout just the example dir. - await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`); + await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`) + // Copy out into a new directory within current working directory. - await run(`cp -R ${tmpDir}/${args.example} ${dirName}`); - // Delete the clone. - await run(`rm -rf ${tmpDir}`); + await fs.copy(`${tmpDir}/${args.example}`, dirName, async (err) => { + if (err) { + console.log(err) + } + }) + // Delete the clone. + await fs.remove(tmpDir, { recursive: true }, (err) => { + if (err) { + console.log(err) + } + }) + + if (fs.existsSync(path.join(process.cwd(), dirName))) + await installDependencies(path.join(process.cwd(), dirName)) // Project Setup - await installDependencies(dirName); - await initGit(dirName); + // await + // await initGit(prestineFolder) } catch (err) { - console.error(err); - if (fs.existsSync(dirName)) await run(`rm -rf ${dirName}`); - if (fs.existsSync(tmpDir)) await run(`rm -rf ${tmpDir}`); - process.exit(1); + + if (fs.existsSync(dirName)) await fs.remove(dirName) + if (fs.existsSync(tmpDir)) + await fs.remove(tmpDir, (err) => { + if (err) { + console.log(err) + } + }) + process.exit(1) } // Output next steps: console.log(` -๐ŸŽ‰ ${chalk.bold("Your example project is ready!")} ๐ŸŽ‰ +๐ŸŽ‰ ${chalk.bold('Your example project is ready!')} ๐ŸŽ‰ Follow the instructions and learn more about the example here: ${config.examples.repoUrl}/tree/main/${args.example}#readme - `); + `) } /* --- Existing Project --- */ @@ -190,17 +207,17 @@ async function integrateStackbit() { return new Promise(async (resolve) => { const integrate = await prompt(` This looks like an existing project. - ${chalk.bold("Would you like to install Stackbit in this project?")} [Y/n] `); + ${chalk.bold('Would you like to install Stackbit in this project?')} [Y/n] `) - if (!["yes", "y"].includes(integrate?.toLowerCase())) return resolve(false); + if (!['yes', 'y'].includes(integrate?.toLowerCase())) return resolve(false) console.log(` Visit the following URL to learn more about the integration process: https://docs.stackbit.com/how-to-guides/site-management/integrate-stackbit/ -`); - return resolve(true); - }); +`) + return resolve(true) + }) } /* --- Run --- */ @@ -208,19 +225,19 @@ Visit the following URL to learn more about the integration process: async function doCreate() { // If the current directory has a package.json file, we assume we're in an // active project, and will not create a new project. - const packageJsonFilePath = path.join(process.cwd(), "package.json"); - if (fs.existsSync(packageJsonFilePath)) return integrateStackbit(); + const packageJsonFilePath = path.join(process.cwd(), 'package.json') + if (fs.existsSync(packageJsonFilePath)) return integrateStackbit() // If both starter and example were specified, throw an error message. if (args.starter && args.example) { - console.error("[ERROR] Cannot specify a starter and an example."); - process.exit(1); + console.error('[ERROR] Cannot specify a starter and an example.') + process.exit(1) } // Start from an example if specified. - if (args.example) return cloneExample(); + if (args.example) return cloneExample() // Otherwise, use a starter, which falls back to the default if not set. - return cloneStarter(); + return cloneStarter() } -await doCreate(); +await doCreate() -rl.close(); +rl.close() From bfc7e77cccdd8fc2eb3fc6a7d84cef34192d3a9d Mon Sep 17 00:00:00 2001 From: Shedrack akintayo Date: Mon, 24 Oct 2022 22:28:55 +0100 Subject: [PATCH 02/26] finish up hot fix --- index.js | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/index.js b/index.js index 7f87669..81247b8 100755 --- a/index.js +++ b/index.js @@ -39,11 +39,11 @@ async function installDependencies(dirName) { async function initGit(dirName) { console.log(`Setting up Git ...`) - await fs.remove(`${dirName} / .git`, { recursive: true }, async () => { - await run( - `cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"` - ) - }) + // remove .git folder + await fs.removeSync(`${dirName} / .git`) + await run( + `cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"` + ) } /** * Given a version string, compare it to a control version. Returns: @@ -160,29 +160,19 @@ async function cloneExample() { // Checkout just the example dir. await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`) - // Copy out into a new directory within current working directory. - await fs.copy(`${tmpDir}/${args.example}`, dirName, async (err) => { - if (err) { - console.log(err) - } - }) + // move out into a new directory. + await fs.moveSync(`${tmpDir}/${args.example}`, dirName) // Delete the clone. - await fs.remove(tmpDir, { recursive: true }, (err) => { - if (err) { - console.log(err) - } - }) - - if (fs.existsSync(path.join(process.cwd(), dirName))) - await installDependencies(path.join(process.cwd(), dirName)) + await fs.removeSync(tmpDir) + + await installDependencies(dirName) // Project Setup - // await - // await initGit(prestineFolder) + await initGit(dirName) } catch (err) { - if (fs.existsSync(dirName)) await fs.remove(dirName) if (fs.existsSync(tmpDir)) + // remove temp directory await fs.remove(tmpDir, (err) => { if (err) { console.log(err) From f1ddc6a0bcf5ea25eab88b7c4a7fce78b3ea28e5 Mon Sep 17 00:00:00 2001 From: Shedrack akintayo Date: Mon, 24 Oct 2022 22:34:18 +0100 Subject: [PATCH 03/26] lint --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 81247b8..1bfaa16 100755 --- a/index.js +++ b/index.js @@ -172,7 +172,7 @@ async function cloneExample() { } catch (err) { if (fs.existsSync(dirName)) await fs.remove(dirName) if (fs.existsSync(tmpDir)) - // remove temp directory + // remove temp directory await fs.remove(tmpDir, (err) => { if (err) { console.log(err) From b7c76a2727985e7b234db735443bbb10ea7354c8 Mon Sep 17 00:00:00 2001 From: Shedrack akintayo Date: Mon, 24 Oct 2022 22:40:23 +0100 Subject: [PATCH 04/26] move install dependencies function --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 1bfaa16..a3378a1 100755 --- a/index.js +++ b/index.js @@ -166,8 +166,8 @@ async function cloneExample() { // Delete the clone. await fs.removeSync(tmpDir) - await installDependencies(dirName) // Project Setup + await installDependencies(dirName) await initGit(dirName) } catch (err) { if (fs.existsSync(dirName)) await fs.remove(dirName) From 3f6e96eb0000105fe38e2b0c8d1413a39a957f0c Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Tue, 25 Oct 2022 09:39:33 -0400 Subject: [PATCH 05/26] Formatting --- index.js | 168 +++++++++++++++++++++++++++---------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/index.js b/index.js index a3378a1..5027610 100755 --- a/index.js +++ b/index.js @@ -1,49 +1,49 @@ #!/usr/bin/env node -import chalk from 'chalk' -import { exec } from 'child_process' -import fs from 'fs-extra' -import path from 'path' -import readline from 'readline' -import util from 'util' -import yargs from 'yargs' -import { hideBin } from 'yargs/helpers' +import chalk from "chalk"; +import { exec } from "child_process"; +import fs from "fs-extra"; +import path from "path"; +import readline from "readline"; +import util from "util"; +import yargs from "yargs"; +import { hideBin } from "yargs/helpers"; -import config from './config.js' +import config from "./config.js"; /* --- Helpers --- */ -const run = util.promisify(exec) +const run = util.promisify(exec); const rl = readline.createInterface({ input: process.stdin, output: process.stdout, -}) +}); function prompt(question, defaultAnswer) { return new Promise((resolve) => { - rl.question(question, (input) => resolve(input || defaultAnswer)) - }) + rl.question(question, (input) => resolve(input || defaultAnswer)); + }); } function getDirName(defaultDirName) { - let dirName = args._[0] ?? defaultDirName - if (fs.existsSync(dirName)) dirName += `-${timestamp}` - return dirName + let dirName = args._[0] ?? defaultDirName; + if (fs.existsSync(dirName)) dirName += `-${timestamp}`; + return dirName; } async function installDependencies(dirName) { - console.log(`Installing dependencies ...`) - await run(`cd ${dirName} && npm install`) + console.log(`Installing dependencies ...`); + await run(`cd ${dirName} && npm install`); } async function initGit(dirName) { - console.log(`Setting up Git ...`) + console.log(`Setting up Git ...`); // remove .git folder - await fs.removeSync(`${dirName} / .git`) + await fs.removeSync(`${dirName} / .git`); await run( `cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"` - ) + ); } /** * Given a version string, compare it to a control version. Returns: @@ -57,138 +57,138 @@ async function initGit(dirName) { */ function compareVersion(version, control) { // References - let returnValue = 0 + let returnValue = 0; // Return 0 if the versions match. - if (version === control) return returnValue + if (version === control) return returnValue; // Break the versions into arrays of integers. - const getVersionParts = (str) => str.split('.').map((v) => parseInt(v)) - const versionParts = getVersionParts(version) - const controlParts = getVersionParts(control) + const getVersionParts = (str) => str.split(".").map((v) => parseInt(v)); + const versionParts = getVersionParts(version); + const controlParts = getVersionParts(control); // Loop and compare each item. controlParts.every((controlPart, idx) => { // If the versions are equal at this part, we move on to the next part. - if (versionParts[idx] === controlPart) return true + if (versionParts[idx] === controlPart) return true; // Otherwise, set the return value, then break out of the loop. - returnValue = versionParts[idx] > controlPart ? 1 : -1 - return false - }) - return returnValue + returnValue = versionParts[idx] > controlPart ? 1 : -1; + return false; + }); + return returnValue; } /* --- Parse CLI Arguments */ const args = yargs(hideBin(process.argv)) - .option('starter', { - alias: 's', - describe: 'Choose a starter', + .option("starter", { + alias: "s", + describe: "Choose a starter", choices: config.starters.map((s) => s.name), }) - .option('example', { - alias: 'e', - describe: 'Start from an example', + .option("example", { + alias: "e", + describe: "Start from an example", choices: config.examples.directories, }) .help() - .parse() + .parse(); /* --- References --- */ const starter = config.starters.find( (s) => s.name === (args.starter ?? config.defaults.starter.name) -) +); // Current time in seconds. -const timestamp = Math.round(new Date().getTime() / 1000) +const timestamp = Math.round(new Date().getTime() / 1000); /* --- New Project from Starter --- */ async function cloneStarter() { // Set references - const dirName = getDirName(config.defaults.dirName) + const dirName = getDirName(config.defaults.dirName); // Clone repo - const cloneCommand = `git clone --depth=1 ${starter.repoUrl} ${dirName}` - console.log(`\nCreating new project in ${dirName} ...`) - await run(cloneCommand) + const cloneCommand = `git clone --depth=1 ${starter.repoUrl} ${dirName}`; + console.log(`\nCreating new project in ${dirName} ...`); + await run(cloneCommand); // Project Setup - await installDependencies(dirName) - await initGit(dirName) + await installDependencies(dirName); + await initGit(dirName); // Output next steps: console.log(` -๐ŸŽ‰ ${chalk.bold('Welcome to Stackbit!')} ๐ŸŽ‰ +๐ŸŽ‰ ${chalk.bold("Welcome to Stackbit!")} ๐ŸŽ‰ Follow the instructions for getting Started here: ${starter.repoUrl}#readme - `) + `); } /* --- New Project from Example --- */ async function cloneExample() { - const gitResult = await run('git --version') - const gitVersionMatch = gitResult.stdout.match(/\d+\.\d+\.\d+/) + const gitResult = await run("git --version"); + const gitVersionMatch = gitResult.stdout.match(/\d+\.\d+\.\d+/); if (!gitVersionMatch || !gitVersionMatch[0]) { console.error( `Cannot determine git version, which is required for starting from an example.`, `\nPlease report this:`, chalk.underline( - 'https://github.com/stackbit/create-stackbit-app/issues/new' + "https://github.com/stackbit/create-stackbit-app/issues/new" ) - ) - process.exit(1) + ); + process.exit(1); } if (compareVersion(gitVersionMatch[0], config.minGitVersion) < 0) { console.error( `Starting from an example requires git version ${config.minGitVersion} or later.`, - 'Please upgrade' - ) - process.exit(1) + "Please upgrade" + ); + process.exit(1); } - const dirName = getDirName(args.example) - const tmpDir = `__tmp${timestamp}__` - console.log(`\nCreating new project in ${dirName} ...`) + const dirName = getDirName(args.example); + const tmpDir = `__tmp${timestamp}__`; + console.log(`\nCreating new project in ${dirName} ...`); try { // Sparse clone the monorepo. await run( `git clone --depth 1 --filter=blob:none --sparse ${config.examples.repoUrl} ${tmpDir}` - ) + ); // Checkout just the example dir. - await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`) + await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`); // move out into a new directory. - await fs.moveSync(`${tmpDir}/${args.example}`, dirName) + await fs.moveSync(`${tmpDir}/${args.example}`, dirName); // Delete the clone. - await fs.removeSync(tmpDir) + await fs.removeSync(tmpDir); // Project Setup - await installDependencies(dirName) - await initGit(dirName) + await installDependencies(dirName); + await initGit(dirName); } catch (err) { - if (fs.existsSync(dirName)) await fs.remove(dirName) + if (fs.existsSync(dirName)) await fs.remove(dirName); if (fs.existsSync(tmpDir)) // remove temp directory await fs.remove(tmpDir, (err) => { if (err) { - console.log(err) + console.log(err); } - }) - process.exit(1) + }); + process.exit(1); } // Output next steps: console.log(` -๐ŸŽ‰ ${chalk.bold('Your example project is ready!')} ๐ŸŽ‰ +๐ŸŽ‰ ${chalk.bold("Your example project is ready!")} ๐ŸŽ‰ Follow the instructions and learn more about the example here: ${config.examples.repoUrl}/tree/main/${args.example}#readme - `) + `); } /* --- Existing Project --- */ @@ -197,17 +197,17 @@ async function integrateStackbit() { return new Promise(async (resolve) => { const integrate = await prompt(` This looks like an existing project. - ${chalk.bold('Would you like to install Stackbit in this project?')} [Y/n] `) + ${chalk.bold("Would you like to install Stackbit in this project?")} [Y/n] `); - if (!['yes', 'y'].includes(integrate?.toLowerCase())) return resolve(false) + if (!["yes", "y"].includes(integrate?.toLowerCase())) return resolve(false); console.log(` Visit the following URL to learn more about the integration process: https://docs.stackbit.com/how-to-guides/site-management/integrate-stackbit/ -`) - return resolve(true) - }) +`); + return resolve(true); + }); } /* --- Run --- */ @@ -215,19 +215,19 @@ Visit the following URL to learn more about the integration process: async function doCreate() { // If the current directory has a package.json file, we assume we're in an // active project, and will not create a new project. - const packageJsonFilePath = path.join(process.cwd(), 'package.json') - if (fs.existsSync(packageJsonFilePath)) return integrateStackbit() + const packageJsonFilePath = path.join(process.cwd(), "package.json"); + if (fs.existsSync(packageJsonFilePath)) return integrateStackbit(); // If both starter and example were specified, throw an error message. if (args.starter && args.example) { - console.error('[ERROR] Cannot specify a starter and an example.') - process.exit(1) + console.error("[ERROR] Cannot specify a starter and an example."); + process.exit(1); } // Start from an example if specified. - if (args.example) return cloneExample() + if (args.example) return cloneExample(); // Otherwise, use a starter, which falls back to the default if not set. - return cloneStarter() + return cloneStarter(); } -await doCreate() +await doCreate(); -rl.close() +rl.close(); From ee1c6858a154feba14d93d37c3a958db14599e18 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Tue, 25 Oct 2022 09:39:45 -0400 Subject: [PATCH 06/26] Bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6c2d87d..58dabe7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.9", + "version": "0.1.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.9", + "version": "0.1.10", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 2a5750c..388747c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.9", + "version": "0.1.10", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From b0a174a6f2a0073b53998c4b22e41af79483d600 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Tue, 25 Oct 2022 09:42:34 -0400 Subject: [PATCH 07/26] Add prettier --- .prettierrc | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..4b9a2d9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "printWidth": 120, + "singleQuote": true, + "trailingComma": "all" +} From a5be22c8d6fda3d03c400076b692e83ba9673e8b Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Tue, 25 Oct 2022 09:42:42 -0400 Subject: [PATCH 08/26] Format --- config.js | 50 ++++++++++++++++++++--------------------- index.js | 67 +++++++++++++++++++++++-------------------------------- 2 files changed, 53 insertions(+), 64 deletions(-) diff --git a/config.js b/config.js index 4cfe7c1..3af4d85 100644 --- a/config.js +++ b/config.js @@ -1,49 +1,49 @@ const starters = [ { - name: "nextjs", - repoUrl: "https://github.com/stackbit-themes/nextjs-starter", + name: 'nextjs', + repoUrl: 'https://github.com/stackbit-themes/nextjs-starter', }, { - name: "ts-nextjs", - repoUrl: "https://github.com/stackbit-themes/ts-mui-nextjs-starter", + name: 'ts-nextjs', + repoUrl: 'https://github.com/stackbit-themes/ts-mui-nextjs-starter', }, { - name: "contentful", - repoUrl: "https://github.com/stackbit-themes/contentful-starter", + name: 'contentful', + repoUrl: 'https://github.com/stackbit-themes/contentful-starter', }, { - name: "full-nextjs", - repoUrl: "https://github.com/stackbit-themes/starter-nextjs-theme", + name: 'full-nextjs', + repoUrl: 'https://github.com/stackbit-themes/starter-nextjs-theme', }, { - name: "small-biz-nextjs", - repoUrl: "https://github.com/stackbit-themes/small-business-nextjs-theme", + name: 'small-biz-nextjs', + repoUrl: 'https://github.com/stackbit-themes/small-business-nextjs-theme', }, { - name: "personal-nextjs", - repoUrl: "https://github.com/stackbit-themes/personal-nextjs-theme", + name: 'personal-nextjs', + repoUrl: 'https://github.com/stackbit-themes/personal-nextjs-theme', }, ]; const examples = { - repoUrl: "https://github.com/stackbit-themes/stackbit-examples", + repoUrl: 'https://github.com/stackbit-themes/stackbit-examples', directories: [ - "algolia-search", - "angular-contentful", - "chakra-ui", - "cloudinary-contentful", - "hydrogen-contentful-demo-store", - "ninetailed-personalization", - "onboarding-webapp", - "sveltekit-contentful", - "tutorial-nextjs-contentful", - "tutorial-nextjs-files", + 'algolia-search', + 'angular-contentful', + 'chakra-ui', + 'cloudinary-contentful', + 'hydrogen-contentful-demo-store', + 'ninetailed-personalization', + 'onboarding-webapp', + 'sveltekit-contentful', + 'tutorial-nextjs-contentful', + 'tutorial-nextjs-files', ], }; export default { - defaults: { dirName: "my-stackbit-site", starter: starters[0] }, - minGitVersion: "2.25.0", + defaults: { dirName: 'my-stackbit-site', starter: starters[0] }, + minGitVersion: '2.25.0', examples, starters, }; diff --git a/index.js b/index.js index a75f688..38596d8 100755 --- a/index.js +++ b/index.js @@ -1,15 +1,15 @@ #!/usr/bin/env node -import chalk from "chalk"; -import { exec } from "child_process"; -import fs from "fs"; -import path from "path"; -import readline from "readline"; -import util from "util"; -import yargs from "yargs"; -import { hideBin } from "yargs/helpers"; +import chalk from 'chalk'; +import { exec } from 'child_process'; +import fs from 'fs'; +import path from 'path'; +import readline from 'readline'; +import util from 'util'; +import yargs from 'yargs'; +import { hideBin } from 'yargs/helpers'; -import config from "./config.js"; +import config from './config.js'; /* --- Helpers --- */ @@ -40,9 +40,7 @@ async function installDependencies(dirName) { async function initGit(dirName) { console.log(`Setting up Git ...`); await run(`rm -rf ${dirName}/.git`); - await run( - `cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"` - ); + await run(`cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"`); } /** @@ -61,7 +59,7 @@ function compareVersion(version, control) { // Return 0 if the versions match. if (version === control) return returnValue; // Break the versions into arrays of integers. - const getVersionParts = (str) => str.split(".").map((v) => parseInt(v)); + const getVersionParts = (str) => str.split('.').map((v) => parseInt(v)); const versionParts = getVersionParts(version); const controlParts = getVersionParts(control); // Loop and compare each item. @@ -78,14 +76,14 @@ function compareVersion(version, control) { /* --- Parse CLI Arguments */ const args = yargs(hideBin(process.argv)) - .option("starter", { - alias: "s", - describe: "Choose a starter", + .option('starter', { + alias: 's', + describe: 'Choose a starter', choices: config.starters.map((s) => s.name), }) - .option("example", { - alias: "e", - describe: "Start from an example", + .option('example', { + alias: 'e', + describe: 'Start from an example', choices: config.examples.directories, }) .help() @@ -93,9 +91,7 @@ const args = yargs(hideBin(process.argv)) /* --- References --- */ -const starter = config.starters.find( - (s) => s.name === (args.starter ?? config.defaults.starter.name) -); +const starter = config.starters.find((s) => s.name === (args.starter ?? config.defaults.starter.name)); // Current time in seconds. const timestamp = Math.round(new Date().getTime() / 1000); @@ -117,7 +113,7 @@ async function cloneStarter() { // Output next steps: console.log(` -๐ŸŽ‰ ${chalk.bold("Welcome to Stackbit!")} ๐ŸŽ‰ +๐ŸŽ‰ ${chalk.bold('Welcome to Stackbit!')} ๐ŸŽ‰ Follow the instructions for getting Started here: @@ -128,23 +124,18 @@ Follow the instructions for getting Started here: /* --- New Project from Example --- */ async function cloneExample() { - const gitResult = await run("git --version"); + const gitResult = await run('git --version'); const gitVersionMatch = gitResult.stdout.match(/\d+\.\d+\.\d+/); if (!gitVersionMatch || !gitVersionMatch[0]) { console.error( `Cannot determine git version, which is required for starting from an example.`, `\nPlease report this:`, - chalk.underline( - "https://github.com/stackbit/create-stackbit-app/issues/new" - ) + chalk.underline('https://github.com/stackbit/create-stackbit-app/issues/new'), ); process.exit(1); } if (compareVersion(gitVersionMatch[0], config.minGitVersion) < 0) { - console.error( - `Starting from an example requires git version ${config.minGitVersion} or later.`, - "Please upgrade" - ); + console.error(`Starting from an example requires git version ${config.minGitVersion} or later.`, 'Please upgrade'); process.exit(1); } @@ -154,9 +145,7 @@ async function cloneExample() { try { // Sparse clone the monorepo. - await run( - `git clone --depth 1 --filter=blob:none --sparse ${config.examples.repoUrl} ${tmpDir}` - ); + await run(`git clone --depth 1 --filter=blob:none --sparse ${config.examples.repoUrl} ${tmpDir}`); // Checkout just the example dir. await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`); // Copy out into a new directory within current working directory. @@ -176,7 +165,7 @@ async function cloneExample() { // Output next steps: console.log(` -๐ŸŽ‰ ${chalk.bold("Your example project is ready!")} ๐ŸŽ‰ +๐ŸŽ‰ ${chalk.bold('Your example project is ready!')} ๐ŸŽ‰ Follow the instructions and learn more about the example here: @@ -190,9 +179,9 @@ async function integrateStackbit() { return new Promise(async (resolve) => { const integrate = await prompt(` This looks like an existing project. - ${chalk.bold("Would you like to install Stackbit in this project?")} [Y/n] `); + ${chalk.bold('Would you like to install Stackbit in this project?')} [Y/n] `); - if (!["yes", "y"].includes(integrate?.toLowerCase())) return resolve(false); + if (!['yes', 'y'].includes(integrate?.toLowerCase())) return resolve(false); console.log(` Visit the following URL to learn more about the integration process: @@ -208,11 +197,11 @@ Visit the following URL to learn more about the integration process: async function doCreate() { // If the current directory has a package.json file, we assume we're in an // active project, and will not create a new project. - const packageJsonFilePath = path.join(process.cwd(), "package.json"); + const packageJsonFilePath = path.join(process.cwd(), 'package.json'); if (fs.existsSync(packageJsonFilePath)) return integrateStackbit(); // If both starter and example were specified, throw an error message. if (args.starter && args.example) { - console.error("[ERROR] Cannot specify a starter and an example."); + console.error('[ERROR] Cannot specify a starter and an example.'); process.exit(1); } // Start from an example if specified. From 3eef9d3321615ee4fbee236d1da3c1902c57d1ba Mon Sep 17 00:00:00 2001 From: Shedrack akintayo Date: Tue, 25 Oct 2022 16:54:55 +0100 Subject: [PATCH 09/26] fixes --- index.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 7167f54..6672227 100755 --- a/index.js +++ b/index.js @@ -39,8 +39,7 @@ async function installDependencies(dirName) { async function initGit(dirName) { console.log(`Setting up Git ...`); - // remove .git folder - await fs.removeSync(`${dirName} / .git`); + await fs.removeSync(`${dirName}/.git`); await run(`cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"`); } /** @@ -148,10 +147,8 @@ async function cloneExample() { await run(`git clone --depth 1 --filter=blob:none --sparse ${config.examples.repoUrl} ${tmpDir}`); // Checkout just the example dir. await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`); - // move out into a new directory. await fs.moveSync(`${tmpDir}/${args.example}`, dirName); - // Delete the clone. await fs.removeSync(tmpDir); @@ -159,14 +156,9 @@ async function cloneExample() { await installDependencies(dirName); await initGit(dirName); } catch (err) { - if (fs.existsSync(dirName)) await fs.remove(dirName); - if (fs.existsSync(tmpDir)) - // remove temp directory - await fs.remove(tmpDir, (err) => { - if (err) { - console.log(err); - } - }); + console.error(err); + if (fs.existsSync(dirName)) await fs.removeSync(dirName); + if (fs.existsSync(tmpDir)) await fs.removeSync(tmpDir); process.exit(1); } From caea7f2d2aca5d701c010a13417c250c0a71ace2 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Wed, 26 Oct 2022 16:29:43 -0400 Subject: [PATCH 10/26] Make fs-extra a dep --- package-lock.json | 67 +++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 68 insertions(+) diff --git a/package-lock.json b/package-lock.json index 58dabe7..568473f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "license": "MIT", "dependencies": { "chalk": "^5.0.0", + "fs-extra": "^10.1.0", "yargs": "^17.3.1" }, "bin": { @@ -88,6 +89,19 @@ "node": ">=6" } }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -96,6 +110,11 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", @@ -104,6 +123,17 @@ "node": ">=8" } }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -136,6 +166,14 @@ "node": ">=8" } }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -238,16 +276,40 @@ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" }, + "fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" }, + "graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" + }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -271,6 +333,11 @@ "ansi-regex": "^5.0.1" } }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==" + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 388747c..e62de37 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "type": "module", "dependencies": { "chalk": "^5.0.0", + "fs-extra": "^10.1.0", "yargs": "^17.3.1" } } From d4e4b1bf69712b0ae248f95301cfb90334359956 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Wed, 26 Oct 2022 16:29:51 -0400 Subject: [PATCH 11/26] Remove unnecessary awaits --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 6672227..dc5920c 100755 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ async function installDependencies(dirName) { async function initGit(dirName) { console.log(`Setting up Git ...`); - await fs.removeSync(`${dirName}/.git`); + fs.removeSync(`${dirName}/.git`); await run(`cd ${dirName} && git init && git add . && git commit -m "New Stackbit project"`); } /** @@ -148,17 +148,17 @@ async function cloneExample() { // Checkout just the example dir. await run(`cd ${tmpDir} && git sparse-checkout set ${args.example}`); // move out into a new directory. - await fs.moveSync(`${tmpDir}/${args.example}`, dirName); + fs.moveSync(`${tmpDir}/${args.example}`, dirName); // Delete the clone. - await fs.removeSync(tmpDir); + fs.removeSync(tmpDir); // Project Setup await installDependencies(dirName); await initGit(dirName); } catch (err) { console.error(err); - if (fs.existsSync(dirName)) await fs.removeSync(dirName); - if (fs.existsSync(tmpDir)) await fs.removeSync(tmpDir); + if (fs.existsSync(dirName)) fs.removeSync(dirName); + if (fs.existsSync(tmpDir)) fs.removeSync(tmpDir); process.exit(1); } From f7f0dbc43b3b1c692f5150d72584b50adb2d2ac8 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Wed, 16 Nov 2022 11:48:39 -0500 Subject: [PATCH 12/26] Add contentlayer example --- config.js | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index 3af4d85..0fc16f9 100644 --- a/config.js +++ b/config.js @@ -32,6 +32,7 @@ const examples = { 'angular-contentful', 'chakra-ui', 'cloudinary-contentful', + 'contentlayer', 'hydrogen-contentful-demo-store', 'ninetailed-personalization', 'onboarding-webapp', diff --git a/package-lock.json b/package-lock.json index 568473f..907869a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.10", + "version": "0.1.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.10", + "version": "0.1.11", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index e62de37..e160c79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.10", + "version": "0.1.11", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From f415d53cdf90f1645c63c6926dcb1fc1ec3042d5 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Wed, 1 Feb 2023 10:18:28 -0500 Subject: [PATCH 13/26] Add airtable content source example --- config.js | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index 0fc16f9..72fd77c 100644 --- a/config.js +++ b/config.js @@ -28,6 +28,7 @@ const starters = [ const examples = { repoUrl: 'https://github.com/stackbit-themes/stackbit-examples', directories: [ + 'airtable-content-source', 'algolia-search', 'angular-contentful', 'chakra-ui', diff --git a/package-lock.json b/package-lock.json index 907869a..42a540f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.11", + "version": "0.1.12", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.11", + "version": "0.1.12", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index e160c79..76175a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.11", + "version": "0.1.12", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From 839b6296d8a12c65f9afe60d909bab1794be3f5d Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Tue, 14 Feb 2023 20:45:50 -0500 Subject: [PATCH 14/26] Add documentation site example --- README.md | 4 +--- config.js | 1 + package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4c882b1..12b3f94 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ npx create-stackbit-app@latest --starter ts-nextjs If no starter option is provided, [the default starter](https://github.com/stackbit-themes/nextjs-starter) is used. -### Starting from an Example (๐Ÿงช Experimental) +### Starting from an Example Use the `--example` option to start a project from an example. Run the command with the `--help` flag to see a full list of available starters. @@ -42,8 +42,6 @@ npx create-stackbit-app@latest --example algolia-search This will create a new project matching the name of the example, unless overridden (see below). [See here for a full list of starters](https://github.com/stackbit-themes/stackbit-examples). -_Note: This is an experimental feature. Please [report issues](https://github.com/stackbit/create-stackbit-app/issues/new)._ - ### Setting Project Directory Pass a directory name as the only argument when running the command. For example, if you wanted your directory to be name `my-site`, the command would look something like this: diff --git a/config.js b/config.js index 72fd77c..e2ff79c 100644 --- a/config.js +++ b/config.js @@ -34,6 +34,7 @@ const examples = { 'chakra-ui', 'cloudinary-contentful', 'contentlayer', + 'documentation', 'hydrogen-contentful-demo-store', 'ninetailed-personalization', 'onboarding-webapp', diff --git a/package-lock.json b/package-lock.json index 42a540f..1360dc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.12", + "version": "0.1.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.12", + "version": "0.1.13", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 76175a9..6e92243 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.12", + "version": "0.1.13", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From 747b2b3c8ce982e8279c7d75fbaf7d24e32ac16e Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Thu, 23 Mar 2023 11:17:10 -0400 Subject: [PATCH 15/26] Add new tutorials --- config.js | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index e2ff79c..b160a5f 100644 --- a/config.js +++ b/config.js @@ -39,6 +39,8 @@ const examples = { 'ninetailed-personalization', 'onboarding-webapp', 'sveltekit-contentful', + 'tutorial-html-contentful', + 'tutorial-html-json', 'tutorial-nextjs-contentful', 'tutorial-nextjs-files', ], diff --git a/package-lock.json b/package-lock.json index 1360dc9..32b879b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.13", + "version": "0.1.14", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.13", + "version": "0.1.14", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 6e92243..335860a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.13", + "version": "0.1.14", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From 65f223d851a1c65d23667d0e3bcf61906a0362b9 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Wed, 29 Mar 2023 13:18:26 -0400 Subject: [PATCH 16/26] Add gatsby+ctfl projects and bump version --- config.js | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index b160a5f..528c92f 100644 --- a/config.js +++ b/config.js @@ -35,10 +35,12 @@ const examples = { 'cloudinary-contentful', 'contentlayer', 'documentation', + 'gatsby-contentful', 'hydrogen-contentful-demo-store', 'ninetailed-personalization', 'onboarding-webapp', 'sveltekit-contentful', + 'tutorial-gatsby-contentful', 'tutorial-html-contentful', 'tutorial-html-json', 'tutorial-nextjs-contentful', diff --git a/package-lock.json b/package-lock.json index 32b879b..90be93a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.14", + "version": "0.1.15", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.14", + "version": "0.1.15", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 335860a..7868630 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.14", + "version": "0.1.15", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From ea5958813c40430f2d407a9215b33a0752f793d6 Mon Sep 17 00:00:00 2001 From: Elad Rosenheim Date: Mon, 3 Apr 2023 09:56:18 +0300 Subject: [PATCH 17/26] Update repo for contentful-starter --- config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.js b/config.js index b160a5f..e57da94 100644 --- a/config.js +++ b/config.js @@ -9,7 +9,7 @@ const starters = [ }, { name: 'contentful', - repoUrl: 'https://github.com/stackbit-themes/contentful-starter', + repoUrl: 'https://github.com/stackbit-themes/nextjs-contentful-starter', }, { name: 'full-nextjs', From 5c111dc94527244766e8a15bb59408a1ba2c9b3f Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Thu, 6 Apr 2023 09:26:48 -0400 Subject: [PATCH 18/26] Add i18n-nextjs-contentful --- config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config.js b/config.js index a7621a0..8df7b97 100644 --- a/config.js +++ b/config.js @@ -37,6 +37,7 @@ const examples = { 'documentation', 'gatsby-contentful', 'hydrogen-contentful-demo-store', + 'i18n-nextjs-contentful', 'ninetailed-personalization', 'onboarding-webapp', 'sveltekit-contentful', From ec9c788c77dcd81628be2c773268582bdbf21032 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Thu, 6 Apr 2023 09:27:17 -0400 Subject: [PATCH 19/26] Bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 90be93a..a4641e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.15", + "version": "0.1.16", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.15", + "version": "0.1.16", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 7868630..5623320 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.15", + "version": "0.1.16", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From c8e51f0c70bd173610d2f56bccd60bda568becdc Mon Sep 17 00:00:00 2001 From: Elad Rosenheim Date: Mon, 17 Apr 2023 09:48:37 +0300 Subject: [PATCH 20/26] Update config.js --- config.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/config.js b/config.js index e57da94..e47b2d2 100644 --- a/config.js +++ b/config.js @@ -11,18 +11,6 @@ const starters = [ name: 'contentful', repoUrl: 'https://github.com/stackbit-themes/nextjs-contentful-starter', }, - { - name: 'full-nextjs', - repoUrl: 'https://github.com/stackbit-themes/starter-nextjs-theme', - }, - { - name: 'small-biz-nextjs', - repoUrl: 'https://github.com/stackbit-themes/small-business-nextjs-theme', - }, - { - name: 'personal-nextjs', - repoUrl: 'https://github.com/stackbit-themes/personal-nextjs-theme', - }, ]; const examples = { @@ -31,14 +19,20 @@ const examples = { 'airtable-content-source', 'algolia-search', 'angular-contentful', + 'auto-annotated-portfolio, 'chakra-ui', 'cloudinary-contentful', + 'cloudinary-unpic', 'contentlayer', 'documentation', + 'gatsby-contentful', 'hydrogen-contentful-demo-store', + 'i18n-nextjs-contentful', 'ninetailed-personalization', + 'nuxt3-preview', 'onboarding-webapp', 'sveltekit-contentful', + 'tutorial-gatsby-contentful', 'tutorial-html-contentful', 'tutorial-html-json', 'tutorial-nextjs-contentful', From d25afdda5fe101bd8fc9659d5e4dad36466fbbf1 Mon Sep 17 00:00:00 2001 From: Elad Rosenheim Date: Mon, 17 Apr 2023 09:51:45 +0300 Subject: [PATCH 21/26] Typo --- config.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.js b/config.js index e47b2d2..90907a2 100644 --- a/config.js +++ b/config.js @@ -19,7 +19,7 @@ const examples = { 'airtable-content-source', 'algolia-search', 'angular-contentful', - 'auto-annotated-portfolio, + 'auto-annotated-portfolio', 'chakra-ui', 'cloudinary-contentful', 'cloudinary-unpic', diff --git a/package.json b/package.json index 335860a..7868630 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.14", + "version": "0.1.15", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From 0a15e78aba8ff832283e284d7f37ae0e4e98aed8 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Mon, 17 Apr 2023 09:57:18 -0400 Subject: [PATCH 22/26] Bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4641e2..3905c52 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.16", + "version": "0.1.17", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.16", + "version": "0.1.17", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 5623320..585f50e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.16", + "version": "0.1.17", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From c8c46bb897fd9216d466326b2ba6a8a05734da39 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Mon, 17 Apr 2023 10:03:43 -0400 Subject: [PATCH 23/26] Bump version to 0.2.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3905c52..ee6afa6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.1.17", + "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.1.17", + "version": "0.2.0", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 585f50e..959d771 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.1.17", + "version": "0.2.0", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From 3435bed8eade8352ec61cb176c6a977b5af12896 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Fri, 28 Apr 2023 12:06:12 -0400 Subject: [PATCH 24/26] Add unsplash asset source example --- config.js | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index 90907a2..91904bd 100644 --- a/config.js +++ b/config.js @@ -37,6 +37,7 @@ const examples = { 'tutorial-html-json', 'tutorial-nextjs-contentful', 'tutorial-nextjs-files', + 'unsplash-asset-source', ], }; diff --git a/package-lock.json b/package-lock.json index ee6afa6..a6ea450 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 959d771..4e7f1a3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.2.0", + "version": "0.2.1", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": { From b754f97eb3e874175546e4fe9eee3527c404ad42 Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Mon, 8 May 2023 10:31:35 -0400 Subject: [PATCH 25/26] Create dependabot.yml --- .github/dependabot.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f17f51b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + From caf3ebee47bba30f22476ba19bbcd53a6db7814f Mon Sep 17 00:00:00 2001 From: Sean C Davis Date: Thu, 29 Jun 2023 15:34:50 -0400 Subject: [PATCH 26/26] Add ab-testing example --- config.js | 1 + package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.js b/config.js index 91904bd..f02743e 100644 --- a/config.js +++ b/config.js @@ -16,6 +16,7 @@ const starters = [ const examples = { repoUrl: 'https://github.com/stackbit-themes/stackbit-examples', directories: [ + 'ab-testing', 'airtable-content-source', 'algolia-search', 'angular-contentful', diff --git a/package-lock.json b/package-lock.json index a6ea450..7ff3eac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "create-stackbit-app", - "version": "0.2.1", + "version": "0.2.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "create-stackbit-app", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "dependencies": { "chalk": "^5.0.0", diff --git a/package.json b/package.json index 4e7f1a3..85e33e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "create-stackbit-app", - "version": "0.2.1", + "version": "0.2.2", "description": "Create a new Stackbit site, or add Stackbit to an existing site.", "main": "index.js", "scripts": {