-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: landing page * revert this lol * simplify test cases * chore: add a tutorial link
- Loading branch information
Showing
11 changed files
with
631 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { buildApp } from './app.js' | ||
import { buildApp } from './app' | ||
|
||
const app = buildApp() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src/graphiql-html.ts | ||
src/landing-page-html.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,58 @@ | ||
import { minify } from 'html-minifier-terser' | ||
import { minify as minifyT } from 'html-minifier-terser' | ||
import * as fs from 'fs' | ||
import * as path from 'path' | ||
import { fileURLToPath } from 'url' | ||
|
||
const __dirname = path.dirname(fileURLToPath(import.meta.url)) | ||
|
||
async function main() { | ||
async function minify(str) { | ||
return ( | ||
await minifyT(str, { | ||
minifyJS: true, | ||
useShortDoctype: false, | ||
removeAttributeQuotes: true, | ||
collapseWhitespace: true, | ||
minifyCSS: true, | ||
}) | ||
).toString('utf-8') | ||
} | ||
|
||
async function minifyGraphiQLHTML() { | ||
const graphiqlVersion = JSON.parse( | ||
fs.readFileSync( | ||
path.join(__dirname, '..', '..', 'graphiql', 'package.json'), | ||
'utf-8', | ||
), | ||
).version | ||
|
||
const minified = ( | ||
await minify( | ||
fs | ||
.readFileSync( | ||
path.join(__dirname, '..', 'src', 'graphiql.html'), | ||
'utf-8', | ||
) | ||
.replace(/__GRAPHIQL_VERSION__/g, graphiqlVersion), | ||
{ | ||
minifyJS: true, | ||
useShortDoctype: false, | ||
removeAttributeQuotes: true, | ||
collapseWhitespace: true, | ||
}, | ||
) | ||
).toString('utf-8') | ||
const minified = await minify( | ||
fs | ||
.readFileSync(path.join(__dirname, '..', 'src', 'graphiql.html'), 'utf-8') | ||
.replace(/__GRAPHIQL_VERSION__/g, graphiqlVersion), | ||
) | ||
|
||
fs.writeFileSync( | ||
path.join(__dirname, '../src/graphiqlHTML.ts'), | ||
path.join(__dirname, '../src/graphiql-html.ts'), | ||
`export default ${JSON.stringify(minified)}`, | ||
) | ||
} | ||
|
||
async function minifyLandingPageHTML() { | ||
const minified = await minify( | ||
fs.readFileSync( | ||
path.join(__dirname, '..', 'src', 'landing-page.html'), | ||
'utf-8', | ||
), | ||
) | ||
|
||
fs.writeFileSync( | ||
path.join(__dirname, '../src/landing-page-html.ts'), | ||
`export default ${JSON.stringify(minified)}`, | ||
) | ||
} | ||
|
||
async function main() { | ||
await Promise.all([minifyGraphiQLHTML(), minifyLandingPageHTML()]) | ||
} | ||
|
||
main() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.