Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

feat: add Gatsby logo to returned framework info #797

Merged
merged 13 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ cypress/videos
cypress/screenshots
cypress/support
.DS_Store

# Local Netlify folder
.netlify
13 changes: 13 additions & 0 deletions assets/logos/gatsby/dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions assets/logos/gatsby/default.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions assets/logos/gatsby/light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build]
command = "npm run build"
publish = "dist"
publish = "assets"

[build.environment]
NODE_VERSION = "12"
17 changes: 3 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,18 @@
"version": "9.1.1",
"description": "Framework detection utility",
"type": "module",
"main": "./dist/index.cjs",
"exports": {
"node": "./src/main.js",
"default": "./dist/index.cjs"
"node": "./src/main.js"
},
"files": [
"build/*.js",
"src/**/*.js",
"dist/index.cjs"
"src/**/*.js"
],
"scripts": {
"prepare": "husky install node_modules/@netlify/eslint-config-node/.husky/",
"prepublishOnly": "npm ci && run-s build test",
"build": "run-s build:*",
"build:json": "node scripts/transform_json.js",
"build:browser": "run-s build:browser:*",
"build:browser:core": "webpack --config scripts/webpack.config.core.js",
"build:browser:site-react": "webpack --config scripts/webpack.config.site.js",
"build:browser:site-root": "cpy --cwd=site index.html ../dist",
"develop:site-react": "webpack serve --config scripts/webpack.config.site.js",
"test": "npm run format && npm run test:dev",
"format": "run-s format:check-fix:*",
"format:ci": "run-s format:check:*",
Expand Down Expand Up @@ -104,10 +96,7 @@
"react": "^18.0.0",
"react-dom": "^18.0.0",
"test-each": "^4.0.0",
"tmp-promise": "^3.0.2",
"webpack": "^5.10.1",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^4.0.0"
"tmp-promise": "^3.0.2"
},
"browserslist": [
"last 2 Chrome versions",
Expand Down
27 changes: 0 additions & 27 deletions scripts/webpack.config.core.js

This file was deleted.

37 changes: 0 additions & 37 deletions scripts/webpack.config.site.js

This file was deleted.

10 changes: 0 additions & 10 deletions site/index.html

This file was deleted.

56 changes: 0 additions & 56 deletions site/react/App.jsx

This file was deleted.

10 changes: 0 additions & 10 deletions site/react/index.html

This file was deleted.

11 changes: 0 additions & 11 deletions site/react/index.jsx

This file was deleted.

2 changes: 2 additions & 0 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const getFrameworkInfo = function (
build: { command: frameworkBuildCommand, directory },
staticAssetsDirectory,
env,
logo,
plugins,
},
{ scripts, runScriptCommand, nodeVersion },
Expand All @@ -161,6 +162,7 @@ const getFrameworkInfo = function (
build: { commands: [frameworkBuildCommand], directory },
staticAssetsDirectory,
env,
logo,
plugins: recommendedPlugins,
}
}
5 changes: 5 additions & 0 deletions src/frameworks/gatsby.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"AWS_LAMBDA_JS_RUNTIME": "nodejs14.x",
"NODE_VERSION": "14"
},
"logo": {
"default": "default.svg",
"light": "light.svg",
"dark": "dark.svg"
},
"plugins": [
{
"packageName": "@netlify/plugin-gatsby",
Expand Down
9 changes: 9 additions & 0 deletions test/frameworks.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ const FRAMEWORK_JSON_SCHEMA = {
type: 'object',
additionalProperties: { type: 'string' },
},
logo: {
type: 'object',
additionalProperties: false,
properties: {
default: { type: 'string' },
light: { type: 'string' },
dark: { type: 'string' },
},
},
plugins: {
type: 'array',
items: PLUGIN_SCHEMA,
Expand Down
2 changes: 2 additions & 0 deletions test/snapshots/main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Generated by [AVA](https://avajs.dev).
},
env: {},
id: 'sapper',
logo: undefined,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why logo is being added here only for Sapper when the PR is adding only Gatsby logos at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's being added here because with the overall set of changes logo is being returned for all frameworks as part of the response body.

This particular snapshot is for a different test, and uses sapper instead of Gatsby, which is why this is appearing

name: 'Sapper',
plugins: [],
staticAssetsDirectory: 'static',
Expand Down Expand Up @@ -67,6 +68,7 @@ Generated by [AVA](https://avajs.dev).
},
env: {},
id: 'sapper',
logo: undefined,
name: 'Sapper',
plugins: [],
staticAssetsDirectory: 'static',
Expand Down
Binary file modified test/snapshots/main.js.snap
Binary file not shown.