Skip to content

Commit

Permalink
Merge branch 'master' into renovate/gatsby-source-drupal-prod-minor
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh authored Oct 23, 2024
2 parents 5203087 + 1b1720b commit 37090d6
Show file tree
Hide file tree
Showing 72 changed files with 234 additions and 1,547 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Gatsby is dedicated to building a welcoming, diverse, safe community. We expect

Whether you're helping us fix bugs, improve the docs, or spread the word, we'd love to have you as part of the Gatsby community!

Check out our [**Contributing Guide**](https://www.gatsbyjs.com/contributing/how-to-contribute/) for ideas on contributing and setup steps for getting our repositories up and running on your local machine.
Check out our [**Contributing Guide**](https://www.gatsbyjs.com/contributing/) for ideas on contributing and setup steps for getting our repositories up and running on your local machine.

### A note on how this repository is organized

Expand Down
5 changes: 3 additions & 2 deletions integration-tests/gatsby-cli/__tests__/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ jest.setTimeout(MAX_TIMEOUT)

describe(`gatsby options`, () => {
it(`Prints the options`, () => {
const [status, logs] = GatsbyCLI.from(`gatsby-sites/gatsby-build`).invoke(`options`)
const [status, logs] = GatsbyCLI.from(`gatsby-sites/gatsby-build`).invoke(
`options`
)

logs.should.contain(`Package Manager`)
logs.should.contain(`Telemetry enabled`)
expect(status).toBe(0)
})
})
41 changes: 0 additions & 41 deletions packages/create-gatsby/src/__tests__/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import path from "path"
import { reporter } from "../utils/reporter"
import { initStarter } from "../init-starter"
import { setSiteMetadata } from "../utils/site-metadata"
import { trackCli } from "../tracking"
import { run, DEFAULT_STARTERS } from "../index"

jest.mock(`../utils/parse-args`)
Expand Down Expand Up @@ -35,11 +34,6 @@ jest.mock(`enquirer`, () => {
return MockedEnquirer
})
jest.mock(`../utils/reporter`)
jest.mock(`../tracking`, () => {
return {
trackCli: jest.fn(),
}
})
jest.mock(`../init-starter`, () => {
return {
initStarter: jest.fn(),
Expand All @@ -57,12 +51,6 @@ jest.mock(`../utils/site-metadata`, () => {
setSiteMetadata: jest.fn(),
}
})
jest.mock(`../utils/hash`, () => {
return {
sha256: jest.fn(args => args),
md5: jest.fn(args => args),
}
})

jest.mock(`../utils/question-helpers`, () => {
const originalQuestionHelpers = jest.requireActual(
Expand Down Expand Up @@ -185,13 +173,6 @@ describe(`run`, () => {
dirName
)
})
it(`should track JS was selected as language`, async () => {
await run()
expect(trackCli).toHaveBeenCalledWith(`CREATE_GATSBY_SELECT_OPTION`, {
name: `LANGUAGE`,
valueString: `js`,
})
})
})

describe(`no ts flag`, () => {
Expand All @@ -211,13 +192,6 @@ describe(`run`, () => {
siteName
)
})
it(`should track JS was selected as language`, async () => {
await run()
expect(trackCli).toHaveBeenCalledWith(`CREATE_GATSBY_SELECT_OPTION`, {
name: `LANGUAGE`,
valueString: `js`,
})
})
})

describe(`ts flag`, () => {
Expand All @@ -237,14 +211,6 @@ describe(`run`, () => {
siteName
)
})

it(`should track TS was selected as language`, async () => {
await run()
expect(trackCli).toHaveBeenCalledWith(`CREATE_GATSBY_SELECT_OPTION`, {
name: `LANGUAGE`,
valueString: `ts`,
})
})
})
})

Expand All @@ -265,11 +231,4 @@ describe(`skip and ts flag`, () => {
dirName
)
})
it(`should track TS was selected as language`, async () => {
await run()
expect(trackCli).toHaveBeenCalledWith(`CREATE_GATSBY_SELECT_OPTION`, {
name: `LANGUAGE`,
valueString: `ts`,
})
})
})
61 changes: 0 additions & 61 deletions packages/create-gatsby/src/__tests__/tracking.ts

This file was deleted.

43 changes: 0 additions & 43 deletions packages/create-gatsby/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import { plugin } from "./components/plugin"
import { makePluginConfigQuestions } from "./plugin-options-form"
import { center, wrap } from "./components/utils"
import { stripIndent } from "common-tags"
import { trackCli } from "./tracking"
import { reporter } from "./utils/reporter"
import { setSiteMetadata } from "./utils/site-metadata"
import { makeNpmSafe } from "./utils/make-npm-safe"
import {
generateQuestions,
validateProjectName,
} from "./utils/question-helpers"
import { sha256, md5 } from "./utils/hash"
import { maybeUseEmoji } from "./utils/emoji"
import { parseArgs } from "./utils/parse-args"

Expand Down Expand Up @@ -75,8 +73,6 @@ export type PluginConfigMap = Record<string, Record<string, unknown>>
export async function run(): Promise<void> {
const { flags, dirName } = parseArgs(process.argv.slice(2))

trackCli(`CREATE_GATSBY_START`)

const { version } = require(`../package.json`)

reporter.info(colors.grey(`create-gatsby version ${version}`))
Expand Down Expand Up @@ -149,28 +145,6 @@ ${center(colors.blueBright.bold.underline(`Welcome to Gatsby!`))}
answers.language = `ts`
}

// Telemetry
trackCli(`CREATE_GATSBY_SELECT_OPTION`, {
name: `project_name`,
valueString: sha256(answers.project),
})
trackCli(`CREATE_GATSBY_SELECT_OPTION`, {
name: `LANGUAGE`,
valueString: answers.language,
})
trackCli(`CREATE_GATSBY_SELECT_OPTION`, {
name: `CMS`,
valueString: answers.cms || `none`,
})
trackCli(`CREATE_GATSBY_SELECT_OPTION`, {
name: `CSS_TOOLS`,
valueString: answers.styling || `none`,
})
trackCli(`CREATE_GATSBY_SELECT_OPTION`, {
name: `PLUGIN`,
valueStringArray: answers.features || [],
})

// Collect a report of things we will do to present to the user once the questions are complete
const messages: Array<string> = [
`${maybeUseEmoji(
Expand Down Expand Up @@ -263,14 +237,10 @@ ${center(colors.blueBright.bold.underline(`Welcome to Gatsby!`))}
`\nGreat! A few of the selections you made need to be configured. Please fill in the options for each plugin now:\n`
)

trackCli(`CREATE_GATSBY_SET_PLUGINS_START`)

const enquirer = new Enquirer<Record<string, Record<string, unknown>>>()
enquirer.use(plugin)

pluginConfig = { ...pluginConfig, ...(await enquirer.prompt(config)) }

trackCli(`CREATE_GATSBY_SET_PLUGINS_STOP`)
}

// If we're not skipping prompts, give the user a report of what we're about to do
Expand All @@ -291,8 +261,6 @@ ${colors.bold(`Thanks! Here's what we'll now do:`)}
})

if (!confirm) {
trackCli(`CREATE_GATSBY_CANCEL`)

reporter.info(`OK, bye!`)
return
}
Expand Down Expand Up @@ -349,15 +317,4 @@ ${colors.bold(`Thanks! Here's what we'll now do:`)}
reporter.info(`See all commands at\n
${colors.blueBright(`https://www.gatsbyjs.com/docs/reference/gatsby-cli/`)}
`)

const siteHash = md5(fullPath)
trackCli(`CREATE_GATSBY_SUCCESS`, { siteHash })
}

process.on(`exit`, exitCode => {
trackCli(`CREATE_GATSBY_END`, { exitCode })

if (exitCode === -1) {
trackCli(`CREATE_GATSBY_ERROR`)
}
})
81 changes: 0 additions & 81 deletions packages/create-gatsby/src/tracking.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/create-gatsby/src/utils/hash.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"fs-exists-cached": "^1.0.0",
"fs-extra": "^11.2.0",
"gatsby-core-utils": "^4.14.0-next.2",
"gatsby-telemetry": "^4.14.0-next.2",
"hosted-git-info": "^3.0.8",
"is-valid-path": "^0.1.1",
"joi": "^17.9.2",
Expand Down Expand Up @@ -69,7 +68,7 @@
"npm-run-all": "4.1.5",
"react": "^18.2.0",
"rimraf": "^3.0.2",
"rollup": "^2.79.1",
"rollup": "^2.79.2",
"rollup-plugin-auto-external": "^2.0.0",
"rollup-plugin-internal": "^1.0.4",
"typescript": "^5.1.6"
Expand Down
Loading

0 comments on commit 37090d6

Please sign in to comment.