From d38da4cd6a05f11dec44719c96ab11e212e5a5d6 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 22 Dec 2021 14:04:06 +0100 Subject: [PATCH 001/130] refactor: convert to monorepo --- packages/ui-templates/CHANGELOG.md | 73 +++++++++++ packages/ui-templates/README.md | 12 ++ packages/ui-templates/index.html | 14 +++ packages/ui-templates/lib/dev.ts | 32 +++++ packages/ui-templates/lib/prerender.ts | 21 ++++ packages/ui-templates/lib/render.ts | 105 ++++++++++++++++ packages/ui-templates/package.json | 42 +++++++ packages/ui-templates/public | 1 + packages/ui-templates/styles.ts | 1 + .../templates/error-404/index.html | 72 +++++++++++ .../templates/error-404/messages.json | 6 + .../templates/error-500/index.html | 49 ++++++++ .../templates/error-500/messages.json | 5 + .../templates/error-dev/index.html | 45 +++++++ .../templates/error-dev/messages.json | 5 + .../ui-templates/templates/loading/index.html | 119 ++++++++++++++++++ .../templates/loading/messages.json | 3 + packages/ui-templates/templates/messages.json | 3 + .../ui-templates/templates/welcome/index.html | 93 ++++++++++++++ .../templates/welcome/messages.json | 6 + packages/ui-templates/vite.config.ts | 41 ++++++ packages/ui-templates/windi.config.js | 77 ++++++++++++ 22 files changed, 825 insertions(+) create mode 100644 packages/ui-templates/CHANGELOG.md create mode 100644 packages/ui-templates/README.md create mode 100644 packages/ui-templates/index.html create mode 100644 packages/ui-templates/lib/dev.ts create mode 100644 packages/ui-templates/lib/prerender.ts create mode 100644 packages/ui-templates/lib/render.ts create mode 100644 packages/ui-templates/package.json create mode 120000 packages/ui-templates/public create mode 100644 packages/ui-templates/styles.ts create mode 100644 packages/ui-templates/templates/error-404/index.html create mode 100644 packages/ui-templates/templates/error-404/messages.json create mode 100644 packages/ui-templates/templates/error-500/index.html create mode 100644 packages/ui-templates/templates/error-500/messages.json create mode 100644 packages/ui-templates/templates/error-dev/index.html create mode 100644 packages/ui-templates/templates/error-dev/messages.json create mode 100644 packages/ui-templates/templates/loading/index.html create mode 100644 packages/ui-templates/templates/loading/messages.json create mode 100644 packages/ui-templates/templates/messages.json create mode 100644 packages/ui-templates/templates/welcome/index.html create mode 100644 packages/ui-templates/templates/welcome/messages.json create mode 100644 packages/ui-templates/vite.config.ts create mode 100644 packages/ui-templates/windi.config.js diff --git a/packages/ui-templates/CHANGELOG.md b/packages/ui-templates/CHANGELOG.md new file mode 100644 index 0000000000..e04d247057 --- /dev/null +++ b/packages/ui-templates/CHANGELOG.md @@ -0,0 +1,73 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +### [0.1.5](https://github.com/nuxt/ui/compare/v0.1.4...v0.1.5) (2021-11-10) + + +### Bug Fixes + +* don't include `const` declaration in `.d.ts` ([#40](https://github.com/nuxt/ui/issues/40)) ([75a5eae](https://github.com/nuxt/ui/commit/75a5eae76b797a9f49e30ec5469056d093a3a302)) + +### [0.1.4](https://github.com/nuxt/ui/compare/v0.1.3...v0.1.4) (2021-10-20) + + +### Bug Fixes + +* add button background on dark media ([#36](https://github.com/nuxt/ui/issues/36)) ([de0a759](https://github.com/nuxt/ui/commit/de0a75959d06e90239b5a203eeb9e9be6031f0c2)) +* add missing `rel="noopener` on some links([#34](https://github.com/nuxt/ui/issues/34)) ([8f18183](https://github.com/nuxt/ui/commit/8f18183f1d6cca49753e3b0a6a1da0aa8e0c9c83)) + +### [0.1.3](https://github.com/nuxt/ui/compare/v0.1.2...v0.1.3) (2021-10-12) + + +### Bug Fixes + +* updates colors and templates ([e5691b0](https://github.com/nuxt/ui/commit/e5691b049b684ae98a04c5a324679d0b1f34053b)) + +### [0.1.2](https://github.com/nuxt/ui/compare/v0.1.0...v0.1.2) (2021-10-12) + + +### Features + +* add welcome page template ([d7f95db](https://github.com/nuxt/ui/commit/d7f95db8c3344a2a05f91fb332f0f5ab1908b780)) + + +### Bug Fixes + +* add rootdir to vite fs.allow ([02da788](https://github.com/nuxt/ui/commit/02da78871564c5128b435694daa62c02b3acbef0)) + +### [0.1.1](https://github.com/nuxt/ui/compare/v0.1.0...v0.1.1) (2021-10-07) + +## [0.1.0](https://github.com/nuxt/ui/compare/v0.0.6...v0.1.0) (2021-09-23) + +### [0.0.6](https://github.com/nuxt/ui/compare/v0.0.5...v0.0.6) (2021-09-23) + +### [0.0.5](https://github.com/nuxt/ui/compare/v0.0.3...v0.0.5) (2021-07-20) + + +### Bug Fixes + +* correct color for the logo in dark mode ([408e6aa](https://github.com/nuxt/ui/commit/408e6aa22c0ba4920dadfa4f2eae9391d2862111)) + +### [0.0.4](https://github.com/nuxt/ui/compare/v0.0.3...v0.0.4) (2021-07-14) + +### [0.0.3](https://github.com/nuxt/ui/compare/v0.0.2...v0.0.3) (2021-07-14) + + +### Bug Fixes + +* use statusCode not message for 500 dev ([#19](https://github.com/nuxt/ui/issues/19)) ([a910883](https://github.com/nuxt/ui/commit/a910883024b2280770cbe985092153666eb17790)) + +### 0.0.2 (2021-07-14) + + +### Features + +* add prerender script to preview ([4721560](https://github.com/nuxt/ui/commit/4721560e969ce52d29107546aae2fef9a6e6224f)) +* loading page ([#18](https://github.com/nuxt/ui/issues/18)) ([78799fb](https://github.com/nuxt/ui/commit/78799fb695a896f6a992f28225b99283a38503ff)) +* update new structure (closes [#14](https://github.com/nuxt/ui/issues/14)) ([631c740](https://github.com/nuxt/ui/commit/631c740396736e124c3cea288c0bcc22545d4269)) + + +### Bug Fixes + +* fix prerender and strict context ([ae26e1f](https://github.com/nuxt/ui/commit/ae26e1f21e85155595cfd861d20cddeff858ad5f)) diff --git a/packages/ui-templates/README.md b/packages/ui-templates/README.md new file mode 100644 index 0000000000..457515b537 --- /dev/null +++ b/packages/ui-templates/README.md @@ -0,0 +1,12 @@ +# `@nuxt/ui-templates` + +Pre-compiled html templates used for Nuxt. + +## Development + +- Clone the repository +- Install dependencies with `yarn install` +- Start development server with `yarn dev` +- Open `http://localhost:3000/` for a list of all the templates + +To add a new template, simply create a new file: `./templates//index.html`. diff --git a/packages/ui-templates/index.html b/packages/ui-templates/index.html new file mode 100644 index 0000000000..bbc8e5c373 --- /dev/null +++ b/packages/ui-templates/index.html @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/packages/ui-templates/lib/dev.ts b/packages/ui-templates/lib/dev.ts new file mode 100644 index 0000000000..881b20a664 --- /dev/null +++ b/packages/ui-templates/lib/dev.ts @@ -0,0 +1,32 @@ +import { resolve, join } from 'path' +import { promises as fsp } from 'fs' +import type { Plugin } from 'vite' +import template from 'lodash.template' +import genericMessages from '../templates/messages.json' + +const r = (...path: string[]) => resolve(join(__dirname, '..', ...path)) + +export const DevRenderingPlugin = () => { + return { + name: 'dev-rendering', + async transformIndexHtml (html: string, context) { + const page = context.originalUrl || '/' + + if (page === '/') { + const templateNames = await fsp.readdir(r('templates')) + const serializedData = JSON.stringify({ templateNames }) + return html.replace('{{ data }}', serializedData) + } + + const contents = await fsp.readFile(r(page, 'index.html'), 'utf-8') + + const messages = JSON.parse(await fsp.readFile(r(page, 'messages.json'), 'utf-8')) + + return template(contents, { + interpolate: /{{([\s\S]+?)}}/g + })({ + messages: { ...genericMessages, ...messages } + }) + } + } +} diff --git a/packages/ui-templates/lib/prerender.ts b/packages/ui-templates/lib/prerender.ts new file mode 100644 index 0000000000..6114ad5c8c --- /dev/null +++ b/packages/ui-templates/lib/prerender.ts @@ -0,0 +1,21 @@ +import { resolve, join } from 'path' +import { promises as fsp } from 'fs' +import glob from 'globby' + +const r = (...path: string[]) => resolve(join(__dirname, '..', ...path)) + +async function main () { + const templates = await glob(r('dist/templates/*.mjs')) + for (const file of templates) { + const { template } = await import(file) + const updated = template({ + // messages: {}, + name: '{{ name }}' // TODO + }) + await fsp.mkdir(file.replace('.mjs', '')) + await fsp.writeFile(file.replace('.mjs', '/index.html'), updated) + } +} + +// eslint-disable-next-line no-console +main().catch(console.error) diff --git a/packages/ui-templates/lib/render.ts b/packages/ui-templates/lib/render.ts new file mode 100644 index 0000000000..e2808fc4bf --- /dev/null +++ b/packages/ui-templates/lib/render.ts @@ -0,0 +1,105 @@ +import { promises as fsp } from 'fs' +import { resolve, join, dirname, basename } from 'upath' +import type { Plugin } from 'vite' +import Critters from 'critters' +import glob from 'globby' +import template from 'lodash.template' +import htmlMinifier from 'html-minifier' +import { camelCase } from 'scule' +import genericMessages from '../templates/messages.json' + +const r = (...path: string[]) => resolve(join(__dirname, '..', ...path)) + +const replaceAll = (input, search, replace) => input.split(search).join(replace) + +export const RenderPlugin = () => { + return { + name: 'render', + enforce: 'post', + async writeBundle () { + const distDir = r('dist') + const critters = new Critters({ path: distDir }) + const htmlFiles = await glob(r('dist/templates/**/*.html')) + + const templateExports = [] + + for (const fileName of htmlFiles) { + // Infer template name + const templateName = basename(dirname(fileName)) + + // eslint-disable-next-line no-console + console.log('Processing', templateName) + + // Read source template + let html = await fsp.readFile(fileName, 'utf-8') + + // Apply criters to inline styles + html = await critters.process(html) + // We no longer need references to external CSS + html = html.replace(/]*>/g, '') + + // Inline SVGs + const svgSources = Array.from(html.matchAll(/src="([^"]+)"|url([^)]+)/g)) + .map(m => m[1]) + .filter(src => src?.match(/\.svg$/)) + + for (const src of svgSources) { + const svg = await fsp.readFile(r('dist', src), 'utf-8') + const base64Source = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}` + html = replaceAll(html, src, base64Source) + } + + // Inline our scripts + const scriptSources = Array.from(html.matchAll(/]*src="(.*)"[^>]*>[\s\S]*?<\/script>/g)) + .filter(([_block, src]) => src?.match(/^\/.*\.js$/)) + + for (const [scriptBlock, src] of scriptSources) { + let contents = await fsp.readFile(r('dist', src), 'utf-8') + contents = replaceAll(contents, '/* empty css */', '').trim() + html = html.replace(scriptBlock, contents.length ? `` : '') + } + + // Minify HTML + html = htmlMinifier.minify(html, { collapseWhitespace: true }) + + // Load messages + const messages = JSON.parse(await fsp.readFile(r(`templates/${templateName}/messages.json`), 'utf-8')) + + // Serialize into a js function + const jsCode = [ + `const _messages = ${JSON.stringify({ ...genericMessages, ...messages })}`, + `const _render = ${template(html, { variable: '__var__', interpolate: /{{([\s\S]+?)}}/g }).toString().replace('__var__', '{ messages }')}`, + 'const _template = (messages) => _render({ messages: { ..._messages, ...messages } })' + ].join('\n').trim() + + // Generate types + const types = [ + `export type DefaultMessages = Record<${Object.keys(messages).map(a => `"${a}"`).join(' | ')}, string | boolean | number >`, + 'declare const template: (data: Partial) => string', + 'export { template }' + ].join('\n') + + // Register exports + templateExports.push({ + exportName: camelCase(templateName), + templateName, + types + }) + + // Write new template + await fsp.writeFile(fileName.replace('/index.html', '.mjs'), `${jsCode}\nexport const template = _template`) + await fsp.writeFile(fileName.replace('/index.html', '.d.ts'), `${types}`) + + // Remove original html file + await fsp.unlink(fileName) + await fsp.rmdir(dirname(fileName)) + } + + // Write an index file with named exports for each template + const contents = templateExports.map(exp => `export { template as ${exp.exportName} } from './templates/${exp.templateName}.mjs'`).join('\n') + await fsp.writeFile(r('dist/index.mjs'), contents, 'utf8') + + await fsp.writeFile(r('dist/index.d.ts'), replaceAll(contents, /\.mjs/g, ''), 'utf8') + } + } +} diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json new file mode 100644 index 0000000000..2e9e94f212 --- /dev/null +++ b/packages/ui-templates/package.json @@ -0,0 +1,42 @@ +{ + "name": "@nuxt/ui-templates", + "version": "0.1.5", + "repository": "nuxt/ui", + "license": "CC-BY-ND-4.0", + "exports": { + "./templates/*": "./dist/templates/*.mjs", + ".": "./dist/index.mjs", + "./*": "./dist/*" + }, + "main": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "files": [ + "dist/templates", + "dist/index.*" + ], + "scripts": { + "dev": "vite", + "build": "vite build", + "lint": "eslint --ext .ts,.js .", + "test": "yarn lint && yarn build", + "prepack": "yarn build", + "release": "yarn test && standard-version && npm publish && git push --follow-tags", + "optimize-assets": "npx svgo public/assets/**/*.svg", + "prerender": "yarn build && jiti ./lib/prerender" + }, + "devDependencies": { + "@nuxt/ui-assets": "^0.1.0", + "@types/html-minifier": "^4.0.1", + "@types/lodash.template": "^4.5.0", + "critters": "^0.0.14", + "globby": "^11.0.4", + "html-minifier": "^4.0.0", + "lodash.template": "^4.5.0", + "scule": "^0.2.1", + "standard-version": "^9.3.2", + "upath": "^2.0.1", + "vite": "^2.6.14", + "vite-plugin-windicss": "^1.5.1", + "windicss": "^3.2.1" + } +} diff --git a/packages/ui-templates/public b/packages/ui-templates/public new file mode 120000 index 0000000000..ec2e4be2f8 --- /dev/null +++ b/packages/ui-templates/public @@ -0,0 +1 @@ +../assets \ No newline at end of file diff --git a/packages/ui-templates/styles.ts b/packages/ui-templates/styles.ts new file mode 100644 index 0000000000..0de9720127 --- /dev/null +++ b/packages/ui-templates/styles.ts @@ -0,0 +1 @@ +import 'virtual:windi.css' diff --git a/packages/ui-templates/templates/error-404/index.html b/packages/ui-templates/templates/error-404/index.html new file mode 100644 index 0000000000..7bd1def561 --- /dev/null +++ b/packages/ui-templates/templates/error-404/index.html @@ -0,0 +1,72 @@ + + + + {{ messages.statusCode }} - {{ messages.statusMessage }} | {{ messages.appName }} + + + + + + +
+
+
+
+ {{ messages.statusCode }} +
+
+

+ {{ messages.description }} +

+ + {{ messages.backHome }} + +
+
+
+ +
+
+ + diff --git a/packages/ui-templates/templates/error-404/messages.json b/packages/ui-templates/templates/error-404/messages.json new file mode 100644 index 0000000000..713d7d646b --- /dev/null +++ b/packages/ui-templates/templates/error-404/messages.json @@ -0,0 +1,6 @@ +{ + "statusCode": "404", + "statusMessage": "Not Found", + "description": "Sorry, the page you are looking for could not be found.", + "backHome": "Go back home" +} diff --git a/packages/ui-templates/templates/error-500/index.html b/packages/ui-templates/templates/error-500/index.html new file mode 100644 index 0000000000..6f769a7d17 --- /dev/null +++ b/packages/ui-templates/templates/error-500/index.html @@ -0,0 +1,49 @@ + + + + + {{ messages.statusCode }} - {{ messages.statusMessage }} | {{ messages.appName }} + + + + + + +
+
+
+
+ {{ messages.statusCode }} +
+
+

+ {{ messages.description }} +

+
+
+
+ +
+
+ + + diff --git a/packages/ui-templates/templates/error-500/messages.json b/packages/ui-templates/templates/error-500/messages.json new file mode 100644 index 0000000000..3ce7d78762 --- /dev/null +++ b/packages/ui-templates/templates/error-500/messages.json @@ -0,0 +1,5 @@ +{ + "statusCode": "500", + "statusMessage": "Server error", + "description": "This page is temporarily unavailable." +} diff --git a/packages/ui-templates/templates/error-dev/index.html b/packages/ui-templates/templates/error-dev/index.html new file mode 100644 index 0000000000..3ee5b34947 --- /dev/null +++ b/packages/ui-templates/templates/error-dev/index.html @@ -0,0 +1,45 @@ + + + + {{ messages.statusCode }} - {{ messages.statusMessage }} | {{ messages.appName }} + + + + + +
+
+
+
+ {{ messages.statusCode }} +
+
+

+ {{ messages.description }} +

+
+
+
+ + diff --git a/packages/ui-templates/templates/error-dev/messages.json b/packages/ui-templates/templates/error-dev/messages.json new file mode 100644 index 0000000000..051a3cd15b --- /dev/null +++ b/packages/ui-templates/templates/error-dev/messages.json @@ -0,0 +1,5 @@ +{ + "statusCode": "500", + "statusMessage": "Server error", + "description": "An error occurred in the application and the page could not be served. If you are the application owner, check your server logs for details." +} diff --git a/packages/ui-templates/templates/loading/index.html b/packages/ui-templates/templates/loading/index.html new file mode 100644 index 0000000000..7e6e11f65f --- /dev/null +++ b/packages/ui-templates/templates/loading/index.html @@ -0,0 +1,119 @@ + + + + {{ messages.loading }} | {{ messages.appName }} + + + + + + + + + + + + + + + + +
+
+
+ + + + diff --git a/packages/ui-templates/templates/loading/messages.json b/packages/ui-templates/templates/loading/messages.json new file mode 100644 index 0000000000..53151fbbab --- /dev/null +++ b/packages/ui-templates/templates/loading/messages.json @@ -0,0 +1,3 @@ +{ + "loading": "Loading" +} diff --git a/packages/ui-templates/templates/messages.json b/packages/ui-templates/templates/messages.json new file mode 100644 index 0000000000..7063043212 --- /dev/null +++ b/packages/ui-templates/templates/messages.json @@ -0,0 +1,3 @@ +{ + "appName": "Nuxt" +} diff --git a/packages/ui-templates/templates/welcome/index.html b/packages/ui-templates/templates/welcome/index.html new file mode 100644 index 0000000000..0b08ff8af8 --- /dev/null +++ b/packages/ui-templates/templates/welcome/index.html @@ -0,0 +1,93 @@ + + + + {{ messages.title }} + + + + + +
+
+
+ + + + + + + + + + +
+
+
+
+ +
+
+ {{ messages.readDocs }}
+ + {{ messages.documentation }} + +
+
+
+
+
+ + + +
+ Twitter +
+
+
+
+ {{ messages.followTwitter }}
+ @nuxt_js +
+
+
+
+
+
+

To remove this welcome page, you have 2 options:

+
    +
  • Create an app.vue
  • +
  • Create a pages/index.vue
  • +
+
+
+
+ + diff --git a/packages/ui-templates/templates/welcome/messages.json b/packages/ui-templates/templates/welcome/messages.json new file mode 100644 index 0000000000..8aa3a8c741 --- /dev/null +++ b/packages/ui-templates/templates/welcome/messages.json @@ -0,0 +1,6 @@ +{ + "title": "Welcome to Nuxt 3!", + "documentation": "Documentation", + "readDocs": "We highly recommend you take a look at the Nuxt documentation, whether you are new or have previous experience with the framework.", + "followTwitter": "Follow the Nuxt Twitter account to get latest news about releases, new modules, tutorials and tips." +} diff --git a/packages/ui-templates/vite.config.ts b/packages/ui-templates/vite.config.ts new file mode 100644 index 0000000000..83657d4c11 --- /dev/null +++ b/packages/ui-templates/vite.config.ts @@ -0,0 +1,41 @@ +import { resolve } from 'path' +import { readdirSync } from 'fs' + +import { defineConfig } from 'vite' +import WindiCSS from 'vite-plugin-windicss' + +import { DevRenderingPlugin } from './lib/dev' +import { RenderPlugin } from './lib/render' + +const r = (...path: string[]) => resolve(__dirname, ...path) + +export default defineConfig({ + build: { + rollupOptions: { + input: { + ...Object.fromEntries( + readdirSync(r('templates')).filter(dir => dir !== 'messages.json').map(dir => [ + dir, + r('templates', dir, 'index.html') + ]) + ), + index: r('index.html') + } + } + }, + plugins: [ + WindiCSS({ + scan: { + dirs: ['templates'], + fileExtensions: ['html'] + } + }), + DevRenderingPlugin(), + RenderPlugin() + ], + server: { + fs: { + allow: ['./templates', __dirname] + } + } +}) diff --git a/packages/ui-templates/windi.config.js b/packages/ui-templates/windi.config.js new file mode 100644 index 0000000000..245a9a98c6 --- /dev/null +++ b/packages/ui-templates/windi.config.js @@ -0,0 +1,77 @@ +const colors = require('windicss/colors') + +module.exports = { + purge: ['./src/**/*.html'], + darkMode: 'media', + theme: { + colors: { + white: 'white', + black: 'black', + transparent: 'transparent', + current: 'currentColor', + primary: { + 50: '#F2FDF9', + 100: '#E6FCF3', + 200: '#BFF6E0', + 300: '#99F1CD', + 400: '#4DE7A8', + DEFAULT: '#00DC82', + 600: '#00C675', + 700: '#00844E', + 800: '#00633B', + 900: '#004227' + }, + 'secondary-surface': '#E5F9FF', + 'secondary-lightest': '#B7E1ED', + 'secondary-lighter': '#95CDDE', + 'secondary-light': '#71A2B0', + secondary: '#497A87', + 'secondary-dark': '#255461', + 'secondary-darker': '#003543', + 'secondary-darkest': '#012A35', + 'secondary-black': '#001E26', + tertiary: '#B2CCCC', // cloud + 'cloud-surface': '#E6F0F0', + 'cloud-lightest': '#D1E2E2', + 'cloud-lighter': '#B2CCCC', + 'cloud-light': '#92ADAD', + cloud: '#688282', + 'cloud-dark': '#566B6B', + 'cloud-darker': '#334040', + 'cloud-darkest': '#273131', + 'cloud-black': '#1A2121', + blue: colors.sky, + green: { + // 50: "#eefdf2", + 50: '#d0fcde', + 100: '#b0fccb', + 200: '#8cfab7', + 300: '#64f4a3', + 400: '#37e990', + 500: '#00d77d', + 600: '#00bb6a', + 700: '#009956', + 800: '#047342', + 900: '#134d2e' + // 950: "#132a1c", + }, + red: colors.red, + rose: colors.rose, + yellow: colors.amber, + orange: colors.orange, + gray: colors.gray, + purple: colors.purple, + sky: { + surface: '#E5F9FF', + lightest: '#B7E1ED', + lighter: '#95CDDE', + light: '#71A2B0', + DEFAULT: '#497A87', + dark: '#255461', + darker: '#003543', + darkest: '#012A35', + black: '#001E26' + } + } + } +} From e750f66215bfd8f70dfa3c926989a59c311026b5 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 22 Dec 2021 20:54:18 +0100 Subject: [PATCH 002/130] chore: update repository --- packages/ui-templates/README.md | 4 + packages/ui-templates/package.json | 18 +++-- .../templates/error-404/index.html | 73 ++++++++----------- .../templates/error-500/index.html | 2 +- 4 files changed, 47 insertions(+), 50 deletions(-) diff --git a/packages/ui-templates/README.md b/packages/ui-templates/README.md index 457515b537..36bb1fafc4 100644 --- a/packages/ui-templates/README.md +++ b/packages/ui-templates/README.md @@ -10,3 +10,7 @@ Pre-compiled html templates used for Nuxt. - Open `http://localhost:3000/` for a list of all the templates To add a new template, simply create a new file: `./templates//index.html`. + +# License + +Creative Commons License
Nuxt UI by Nuxt Team is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.
Based on a work at https://github.com/nuxt/ui. diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 2e9e94f212..177580329d 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -1,6 +1,6 @@ { "name": "@nuxt/ui-templates", - "version": "0.1.5", + "version": "0.0.0", "repository": "nuxt/ui", "license": "CC-BY-ND-4.0", "exports": { @@ -15,28 +15,30 @@ "dist/index.*" ], "scripts": { - "dev": "vite", "build": "vite build", + "dev": "vite", "lint": "eslint --ext .ts,.js .", - "test": "yarn lint && yarn build", - "prepack": "yarn build", - "release": "yarn test && standard-version && npm publish && git push --follow-tags", "optimize-assets": "npx svgo public/assets/**/*.svg", - "prerender": "yarn build && jiti ./lib/prerender" + "prepack": "yarn build", + "prerender": "yarn build && jiti ./lib/prerender", + "test": "yarn lint && yarn build" }, "devDependencies": { - "@nuxt/ui-assets": "^0.1.0", + "@nuxt/ui-assets": "*", "@types/html-minifier": "^4.0.1", "@types/lodash.template": "^4.5.0", "critters": "^0.0.14", "globby": "^11.0.4", "html-minifier": "^4.0.0", + "jiti": "^1.12.9", "lodash.template": "^4.5.0", "scule": "^0.2.1", - "standard-version": "^9.3.2", "upath": "^2.0.1", "vite": "^2.6.14", "vite-plugin-windicss": "^1.5.1", "windicss": "^3.2.1" + }, + "publishConfig": { + "access": "public" } } diff --git a/packages/ui-templates/templates/error-404/index.html b/packages/ui-templates/templates/error-404/index.html index 7bd1def561..01734da310 100644 --- a/packages/ui-templates/templates/error-404/index.html +++ b/packages/ui-templates/templates/error-404/index.html @@ -1,47 +1,40 @@ - - {{ messages.statusCode }} - {{ messages.statusMessage }} | {{ messages.appName }} - - - - - + + + + + + "> -
-
-
-
- {{ messages.statusCode }} -
-
-

+

+
+
+ {{ messages.statusCode }} +
+
+

- {{ messages.description }} -

- + {{ messages.description }} +

+
- {{ messages.backHome }} - -
+ "> + {{ messages.backHome }} +
-
- -
+ "> +
- +
+ + diff --git a/packages/ui-templates/templates/error-500/index.html b/packages/ui-templates/templates/error-500/index.html index 6f769a7d17..cb49c8ce32 100644 --- a/packages/ui-templates/templates/error-500/index.html +++ b/packages/ui-templates/templates/error-500/index.html @@ -41,7 +41,7 @@ pb-full md:flex md:pb-0 md:min-h-screen md:w-1/2 "> - +
From a2e70eff956e11a83f3cbd9bef241d3e924a0ab4 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 22 Dec 2021 22:15:35 +0100 Subject: [PATCH 003/130] chore: update readme --- packages/ui-templates/README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/ui-templates/README.md b/packages/ui-templates/README.md index 36bb1fafc4..0eb922e19c 100644 --- a/packages/ui-templates/README.md +++ b/packages/ui-templates/README.md @@ -1,16 +1,11 @@ # `@nuxt/ui-templates` -Pre-compiled html templates used for Nuxt. + -## Development +Pre-compiled html templates for internal pages. -- Clone the repository -- Install dependencies with `yarn install` -- Start development server with `yarn dev` -- Open `http://localhost:3000/` for a list of all the templates - -To add a new template, simply create a new file: `./templates//index.html`. +🏀 [Online Playground](https://templates.ui.nuxtjs.org) # License -Creative Commons License
Nuxt UI by Nuxt Team is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.
Based on a work at https://github.com/nuxt/ui. +Creative Commons License
Nuxt UI by Nuxt Project is licensed under a Creative Commons Attribution-NoDerivatives 4.0 International License.
Based on a work at https://github.com/nuxt/ui. From 865e1a92069b78fdab6d24699a9154be01dc1527 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Dec 2021 22:16:20 +0100 Subject: [PATCH 004/130] chore(deps): update all non-major dependencies (#41) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 177580329d..3294224e17 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -27,16 +27,16 @@ "@nuxt/ui-assets": "*", "@types/html-minifier": "^4.0.1", "@types/lodash.template": "^4.5.0", - "critters": "^0.0.14", + "critters": "^0.0.15", "globby": "^11.0.4", "html-minifier": "^4.0.0", "jiti": "^1.12.9", "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.6.14", - "vite-plugin-windicss": "^1.5.1", - "windicss": "^3.2.1" + "vite": "^2.7.6", + "vite-plugin-windicss": "^1.6.1", + "windicss": "^3.4.0" }, "publishConfig": { "access": "public" From e3c4578a7fbbe4cbefc225fe1e2e63e8e061cbc9 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 22 Dec 2021 22:27:23 +0100 Subject: [PATCH 005/130] chore(deps): update eslint-config and globby --- packages/ui-templates/lib/prerender.ts | 4 ++-- packages/ui-templates/lib/render.ts | 4 ++-- packages/ui-templates/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/ui-templates/lib/prerender.ts b/packages/ui-templates/lib/prerender.ts index 6114ad5c8c..8de94df8e8 100644 --- a/packages/ui-templates/lib/prerender.ts +++ b/packages/ui-templates/lib/prerender.ts @@ -1,11 +1,11 @@ import { resolve, join } from 'path' import { promises as fsp } from 'fs' -import glob from 'globby' +import { globby } from 'globby' const r = (...path: string[]) => resolve(join(__dirname, '..', ...path)) async function main () { - const templates = await glob(r('dist/templates/*.mjs')) + const templates = await globby(r('dist/templates/*.mjs')) for (const file of templates) { const { template } = await import(file) const updated = template({ diff --git a/packages/ui-templates/lib/render.ts b/packages/ui-templates/lib/render.ts index e2808fc4bf..09f778957c 100644 --- a/packages/ui-templates/lib/render.ts +++ b/packages/ui-templates/lib/render.ts @@ -2,7 +2,6 @@ import { promises as fsp } from 'fs' import { resolve, join, dirname, basename } from 'upath' import type { Plugin } from 'vite' import Critters from 'critters' -import glob from 'globby' import template from 'lodash.template' import htmlMinifier from 'html-minifier' import { camelCase } from 'scule' @@ -19,7 +18,8 @@ export const RenderPlugin = () => { async writeBundle () { const distDir = r('dist') const critters = new Critters({ path: distDir }) - const htmlFiles = await glob(r('dist/templates/**/*.html')) + const globby = await import('globby').then(r => r.globby) + const htmlFiles = await globby(r('dist/templates/**/*.html')) const templateExports = [] diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 3294224e17..52a9bb99b2 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -28,7 +28,7 @@ "@types/html-minifier": "^4.0.1", "@types/lodash.template": "^4.5.0", "critters": "^0.0.15", - "globby": "^11.0.4", + "globby": "^12.0.2", "html-minifier": "^4.0.0", "jiti": "^1.12.9", "lodash.template": "^4.5.0", From a83f786d18e26b535218ab4d57c4681d49c43350 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 24 Dec 2021 10:22:07 +0800 Subject: [PATCH 006/130] chore(deps): update all non-major dependencies (#45) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 52a9bb99b2..a088bc5b25 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -25,7 +25,7 @@ }, "devDependencies": { "@nuxt/ui-assets": "*", - "@types/html-minifier": "^4.0.1", + "@types/html-minifier": "^4.0.2", "@types/lodash.template": "^4.5.0", "critters": "^0.0.15", "globby": "^12.0.2", From 10b1ffa5a067fd049d233115a4e598637a92169a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 Dec 2021 22:29:48 +0800 Subject: [PATCH 007/130] chore(deps): update all non-major dependencies (#46) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index a088bc5b25..b5d37b6ac9 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -34,7 +34,7 @@ "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.7.6", + "vite": "^2.7.7", "vite-plugin-windicss": "^1.6.1", "windicss": "^3.4.0" }, From 54d64243dd5fe55f5dd05e858528c77f8d212296 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 28 Dec 2021 15:35:30 +0800 Subject: [PATCH 008/130] chore: update deps --- packages/ui-templates/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index b5d37b6ac9..d2e612f0dd 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -36,7 +36,7 @@ "upath": "^2.0.1", "vite": "^2.7.7", "vite-plugin-windicss": "^1.6.1", - "windicss": "^3.4.0" + "windicss": "^3.4.1" }, "publishConfig": { "access": "public" From e127b478a0b1ecb0a0b6a75e8eec60d5413026fe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 30 Dec 2021 21:10:27 +0800 Subject: [PATCH 009/130] chore(deps): update all non-major dependencies (#47) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index d2e612f0dd..a60ed74417 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -34,9 +34,9 @@ "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.7.7", + "vite": "^2.7.10", "vite-plugin-windicss": "^1.6.1", - "windicss": "^3.4.1" + "windicss": "^3.4.2" }, "publishConfig": { "access": "public" From 7a48967561315496c61515e693b4b1a938ee265a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 13 Jan 2022 13:09:55 +0800 Subject: [PATCH 010/130] chore(deps): update all non-major dependencies (#51) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index a60ed74417..16ae139b4c 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -27,7 +27,7 @@ "@nuxt/ui-assets": "*", "@types/html-minifier": "^4.0.2", "@types/lodash.template": "^4.5.0", - "critters": "^0.0.15", + "critters": "^0.0.16", "globby": "^12.0.2", "html-minifier": "^4.0.0", "jiti": "^1.12.9", @@ -35,7 +35,7 @@ "scule": "^0.2.1", "upath": "^2.0.1", "vite": "^2.7.10", - "vite-plugin-windicss": "^1.6.1", + "vite-plugin-windicss": "^1.6.2", "windicss": "^3.4.2" }, "publishConfig": { From 8acde2c2bcab0473be7e25920a51064d31a9367c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 17 Jan 2022 18:16:20 +0800 Subject: [PATCH 011/130] chore(deps): update all non-major dependencies (#52) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 16ae139b4c..8721360473 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -28,15 +28,15 @@ "@types/html-minifier": "^4.0.2", "@types/lodash.template": "^4.5.0", "critters": "^0.0.16", - "globby": "^12.0.2", + "globby": "^12.2.0", "html-minifier": "^4.0.0", "jiti": "^1.12.9", "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.7.10", + "vite": "^2.7.12", "vite-plugin-windicss": "^1.6.2", - "windicss": "^3.4.2" + "windicss": "^3.4.3" }, "publishConfig": { "access": "public" From f6558a9a1521bb8b2b82f4b6acf22f61f64736c9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 21 Jan 2022 04:54:34 +0800 Subject: [PATCH 012/130] chore(deps): update all non-major dependencies (#53) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 8721360473..03b668655b 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -34,8 +34,8 @@ "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.7.12", - "vite-plugin-windicss": "^1.6.2", + "vite": "^2.7.13", + "vite-plugin-windicss": "^1.6.3", "windicss": "^3.4.3" }, "publishConfig": { From 5db3d608a1758335ebf65673296ee4c03f342cd6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 11:01:26 +0800 Subject: [PATCH 013/130] chore(deps): update devdependency globby to v13 (#55) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 03b668655b..c8fab6c5a0 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -28,7 +28,7 @@ "@types/html-minifier": "^4.0.2", "@types/lodash.template": "^4.5.0", "critters": "^0.0.16", - "globby": "^12.2.0", + "globby": "^13.1.1", "html-minifier": "^4.0.0", "jiti": "^1.12.9", "lodash.template": "^4.5.0", From f5aa641342c09686d7bd7ab88104a122d56ecd2c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 11:01:36 +0800 Subject: [PATCH 014/130] chore(deps): update all non-major dependencies (#56) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index c8fab6c5a0..0e5dd936e6 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -30,7 +30,7 @@ "critters": "^0.0.16", "globby": "^13.1.1", "html-minifier": "^4.0.0", - "jiti": "^1.12.9", + "jiti": "^1.12.15", "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", From d3ab7fdf8e43fc87ae0dad3f7e583a4fc055e831 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 16 Feb 2022 15:24:36 +0800 Subject: [PATCH 015/130] chore(deps): update all non-major dependencies (#57) Co-authored-by: Renovate Bot Co-authored-by: Anthony Fu --- packages/ui-templates/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 0e5dd936e6..d0649d270e 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -34,8 +34,8 @@ "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.7.13", - "vite-plugin-windicss": "^1.6.3", + "vite": "^2.8.3", + "vite-plugin-windicss": "^1.7.0", "windicss": "^3.4.3" }, "publishConfig": { From d7121f637ce66e1c8a2fd91e257a983386e76b47 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 13:10:44 +0800 Subject: [PATCH 016/130] chore(deps): update devdependency vite-plugin-windicss to ^1.7.1 (#60) Co-authored-by: Renovate Bot --- packages/ui-templates/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index d0649d270e..76a7d3989b 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -35,7 +35,7 @@ "scule": "^0.2.1", "upath": "^2.0.1", "vite": "^2.8.3", - "vite-plugin-windicss": "^1.7.0", + "vite-plugin-windicss": "^1.7.1", "windicss": "^3.4.3" }, "publishConfig": { From 1428c46e9681373e987e6b7e22dbba15b90b28cd Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 1 Mar 2022 01:25:51 +0800 Subject: [PATCH 017/130] feat(ui): enable transformers for unocss --- packages/ui-templates/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index 76a7d3989b..ec8a617f6a 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -30,13 +30,13 @@ "critters": "^0.0.16", "globby": "^13.1.1", "html-minifier": "^4.0.0", - "jiti": "^1.12.15", + "jiti": "^1.13.0", "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", - "vite": "^2.8.3", - "vite-plugin-windicss": "^1.7.1", - "windicss": "^3.4.3" + "vite": "^2.8.5", + "vite-plugin-windicss": "^1.8.1", + "windicss": "^3.5.0" }, "publishConfig": { "access": "public" From 62e2f94fcd2d846fca039520a10bcdd0f685ee36 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 10 Mar 2022 20:25:58 +0000 Subject: [PATCH 018/130] feat!: generate vue sfcs as part of build (#67) --- packages/ui-templates/lib/render.ts | 32 +++++++++++++++++++ packages/ui-templates/package.json | 3 +- .../templates/error-dev/messages.json | 3 +- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/packages/ui-templates/lib/render.ts b/packages/ui-templates/lib/render.ts index 09f778957c..985107a291 100644 --- a/packages/ui-templates/lib/render.ts +++ b/packages/ui-templates/lib/render.ts @@ -3,6 +3,7 @@ import { resolve, join, dirname, basename } from 'upath' import type { Plugin } from 'vite' import Critters from 'critters' import template from 'lodash.template' +import { genObjectFromRawEntries } from 'knitwork' import htmlMinifier from 'html-minifier' import { camelCase } from 'scule' import genericMessages from '../templates/messages.json' @@ -72,6 +73,36 @@ export const RenderPlugin = () => { 'const _template = (messages) => _render({ messages: { ..._messages, ...messages } })' ].join('\n').trim() + const templateContent = html + .match(/([\s\S]*)<\/body>/)?.[0] + .replace(/(?<=<|<\/)body/g, 'div') + .replace(/messages\./g, '') + .replace(/]*)>([\s\S]*)<\/a>/g, '$3') + .replace(/>{{\s*([\s\S]+?)\s*}}<\/[\w-]*>/g, ' v-html="$1" />') + // We are not matching ', + '', + '' + ].filter(Boolean).join('\n').trim() + // Generate types const types = [ `export type DefaultMessages = Record<${Object.keys(messages).map(a => `"${a}"`).join(' | ')}, string | boolean | number >`, @@ -88,6 +119,7 @@ export const RenderPlugin = () => { // Write new template await fsp.writeFile(fileName.replace('/index.html', '.mjs'), `${jsCode}\nexport const template = _template`) + await fsp.writeFile(fileName.replace('/index.html', '.vue'), vueCode) await fsp.writeFile(fileName.replace('/index.html', '.d.ts'), `${types}`) // Remove original html file diff --git a/packages/ui-templates/package.json b/packages/ui-templates/package.json index ec8a617f6a..3e4f92367a 100644 --- a/packages/ui-templates/package.json +++ b/packages/ui-templates/package.json @@ -4,7 +4,7 @@ "repository": "nuxt/ui", "license": "CC-BY-ND-4.0", "exports": { - "./templates/*": "./dist/templates/*.mjs", + "./templates/*": "./dist/templates/*", ".": "./dist/index.mjs", "./*": "./dist/*" }, @@ -31,6 +31,7 @@ "globby": "^13.1.1", "html-minifier": "^4.0.0", "jiti": "^1.13.0", + "knitwork": "^0.1.1", "lodash.template": "^4.5.0", "scule": "^0.2.1", "upath": "^2.0.1", diff --git a/packages/ui-templates/templates/error-dev/messages.json b/packages/ui-templates/templates/error-dev/messages.json index 051a3cd15b..a26fd4f13f 100644 --- a/packages/ui-templates/templates/error-dev/messages.json +++ b/packages/ui-templates/templates/error-dev/messages.json @@ -1,5 +1,6 @@ { "statusCode": "500", "statusMessage": "Server error", - "description": "An error occurred in the application and the page could not be served. If you are the application owner, check your server logs for details." + "description": "An error occurred in the application and the page could not be served. If you are the application owner, check your server logs for details.", + "stack": "" } From 2d0f988ed1b566ddf3992d5f1c0ea0e582369528 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 10 Mar 2022 20:26:33 +0000 Subject: [PATCH 019/130] fix: improve design of error pages (#68) --- .../templates/error-500/index.html | 25 ++++--- .../templates/error-dev/index.html | 75 +++++++++++-------- 2 files changed, 55 insertions(+), 45 deletions(-) diff --git a/packages/ui-templates/templates/error-500/index.html b/packages/ui-templates/templates/error-500/index.html index cb49c8ce32..2454ae1682 100644 --- a/packages/ui-templates/templates/error-500/index.html +++ b/packages/ui-templates/templates/error-500/index.html @@ -17,22 +17,23 @@ dark:text-sky-surface ">
-
-
-
+
+
+
{{ messages.statusCode }}
-

+

{{ messages.description }} -

+
- - - - + + + + + -
-
-
-
- {{ messages.statusCode }} -
-
-

- {{ messages.description }} -

+ "> +
+
+
+
+ {{ messages.statusCode }} +
+
+
+ {{ messages.description }} +
+
+ {{ messages.stack }}
- +
+ + From ecbf8a9ddba0a869997379ec72e0f4813ef3a2f3 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 10 Mar 2022 20:29:10 +0000 Subject: [PATCH 020/130] fix: only convert app links to `` --- packages/ui-templates/lib/render.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-templates/lib/render.ts b/packages/ui-templates/lib/render.ts index 985107a291..371f74b448 100644 --- a/packages/ui-templates/lib/render.ts +++ b/packages/ui-templates/lib/render.ts @@ -77,7 +77,7 @@ export const RenderPlugin = () => { .match(/([\s\S]*)<\/body>/)?.[0] .replace(/(?<=<|<\/)body/g, 'div') .replace(/messages\./g, '') - .replace(/]*)>([\s\S]*)<\/a>/g, '$3') + .replace(/]*)>([\s\S]*)<\/a>/g, '$3') .replace(/>{{\s*([\s\S]+?)\s*}}<\/[\w-]*>/g, ' v-html="$1" />') // We are not matching ', '