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

Commit 2a1ee73

Browse files
authoredAug 9, 2022
feat: add Gatsby logo to returned framework info (#797)
* feat: add Gatsby logo to returned framework info * refactor: rename logos, move them into site * refactor: deploy site containing only logo assets remove react app since we are no longer using it * chore(deps): remove webpack Shouldn't need it anymore with the react example site removed * feat: update gatsby logos to use URL * test(ci): remove command for building browser * test: remove cypress also remove packages that were being used in the original test site, but are now not being used * fix: revert changes that supported use of module in browser there's an area within the netlify UI that uses this package and the earlier changes broke it * feat: allow the use of non-production URLs * style: lint fixes
1 parent 8a4352d commit 2a1ee73

14 files changed

+1029
-3378
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ cypress/screenshots
1010
cypress/support
1111
.DS_Store
1212

13+
# Local Netlify folder
1314
.netlify

‎assets/logos/gatsby/dark.svg

+13
Loading

‎assets/logos/gatsby/default.svg

+17
Loading

‎assets/logos/gatsby/light.svg

+13
Loading

‎index.html

+1-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@
44
<meta charset="utf-8" />
55
<title>Framework Info</title>
66
</head>
7-
<body>
8-
<a href="react">React Site</a>
9-
</body>
7+
<body></body>
108
</html>

‎netlify.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build]
22
command = "npm run build"
3-
publish = "dist"
3+
publish = "assets"
44

55
[build.environment]
66
NODE_VERSION = "12"

‎package-lock.json

+949-3,372
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"build:browser": "run-s build:browser:*",
2222
"build:browser:core": "webpack --config scripts/webpack.config.core.js",
2323
"build:browser:site-root": "cpy index.html ../dist",
24-
"develop:site-react": "webpack serve --config scripts/webpack.config.site.js",
2524
"test": "npm run format && npm run test:dev",
2625
"format": "run-s format:check-fix:*",
2726
"format:ci": "run-s format:check:*",

‎scripts/transform_json.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { promises as fs } from 'fs'
2+
import process from 'process'
23

34
import { FRAMEWORK_NAMES } from '../src/frameworks/main.js'
45

@@ -18,11 +19,25 @@ const transformFrameworks = async function () {
1819
await fs.writeFile(FRAMEWORKS_BUILD, fileContents)
1920
}
2021

22+
const updateLogoUrls = function (contents) {
23+
const updatedContents = contents
24+
const originalLogo = contents.logo
25+
if (originalLogo) {
26+
for (const [theme, urlPath] of Object.entries(originalLogo)) {
27+
updatedContents.logo[theme] = (process.env.DEPLOY_PRIME_URL || 'https://framework-info.netlify.app') + urlPath
28+
}
29+
}
30+
31+
return updatedContents
32+
}
33+
2134
const transformFramework = async function (frameworkName) {
2235
const frameworkUrl = new URL(`${frameworkName}.json`, FRAMEWORKS_DIR)
2336
const jsonContents = await fs.readFile(frameworkUrl)
2437
const contents = JSON.parse(jsonContents)
25-
return contents
38+
39+
const updatedContents = updateLogoUrls(contents)
40+
return updatedContents
2641
}
2742

2843
const FRAMEWORKS_HEADER = `// This file is autogenerated at build time

‎src/core.js

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ const getFrameworkInfo = function (
147147
build: { command: frameworkBuildCommand, directory },
148148
staticAssetsDirectory,
149149
env,
150+
logo,
150151
plugins,
151152
},
152153
{ scripts, runScriptCommand, nodeVersion },
@@ -161,6 +162,7 @@ const getFrameworkInfo = function (
161162
build: { commands: [frameworkBuildCommand], directory },
162163
staticAssetsDirectory,
163164
env,
165+
logo,
164166
plugins: recommendedPlugins,
165167
}
166168
}

‎src/frameworks/gatsby.json

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
"AWS_LAMBDA_JS_RUNTIME": "nodejs14.x",
2424
"NODE_VERSION": "14"
2525
},
26+
"logo": {
27+
"default": "/logos/gatsby/default.svg",
28+
"light": "/logos/gatsby/light.svg",
29+
"dark": "/logos/gatsby/dark.svg"
30+
},
2631
"plugins": [
2732
{
2833
"packageName": "@netlify/plugin-gatsby",

‎test/frameworks.js

+9
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ const FRAMEWORK_JSON_SCHEMA = {
118118
type: 'object',
119119
additionalProperties: { type: 'string' },
120120
},
121+
logo: {
122+
type: 'object',
123+
additionalProperties: false,
124+
properties: {
125+
default: { type: 'string' },
126+
light: { type: 'string' },
127+
dark: { type: 'string' },
128+
},
129+
},
121130
plugins: {
122131
type: 'array',
123132
items: PLUGIN_SCHEMA,

‎test/snapshots/main.js.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Generated by [AVA](https://avajs.dev).
3333
},
3434
env: {},
3535
id: 'sapper',
36+
logo: undefined,
3637
name: 'Sapper',
3738
plugins: [],
3839
staticAssetsDirectory: 'static',
@@ -67,6 +68,7 @@ Generated by [AVA](https://avajs.dev).
6768
},
6869
env: {},
6970
id: 'sapper',
71+
logo: undefined,
7072
name: 'Sapper',
7173
plugins: [],
7274
staticAssetsDirectory: 'static',

‎test/snapshots/main.js.snap

16 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)
This repository has been archived.