mirror of
https://github.com/enso-org/enso.git
synced 2025-01-09 03:57:54 +03:00
Fixes issue with blank screen caused by missing `tailwind.css`.
This commit is contained in:
parent
8c6fd60aaf
commit
d38951d4e9
@ -24,7 +24,7 @@ const NAME = 'enso'
|
||||
* `yargs` and `react-hot-toast` are modules we explicitly want the default imports of.
|
||||
* `node:process` is here because `process.on` does not exist on the namespace import. */
|
||||
const DEFAULT_IMPORT_ONLY_MODULES =
|
||||
'node:process|chalk|string-length|yargs|yargs\\u002Fyargs|sharp|to-ico|connect|morgan|serve-static|create-servers|electron-is-dev|fast-glob|esbuild-plugin-alias|esbuild-plugin-time|esbuild-plugin-yaml|opener'
|
||||
'node:process|chalk|string-length|yargs|yargs\\u002Fyargs|sharp|to-ico|connect|morgan|serve-static|create-servers|electron-is-dev|fast-glob|esbuild-plugin-.+|opener'
|
||||
const ALLOWED_DEFAULT_IMPORT_MODULES = `${DEFAULT_IMPORT_ONLY_MODULES}|react-hot-toast`
|
||||
const OUR_MODULES = 'enso-content-config|enso-common'
|
||||
const RELATIVE_MODULES =
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
import * as childProcess from 'node:child_process'
|
||||
import * as fs from 'node:fs'
|
||||
import * as fs from 'node:fs/promises'
|
||||
import * as path from 'node:path'
|
||||
import * as url from 'node:url'
|
||||
|
||||
@ -28,6 +28,13 @@ import BUILD_INFO from '../../build.json' assert { type: 'json' }
|
||||
|
||||
export const THIS_PATH = path.resolve(path.dirname(url.fileURLToPath(import.meta.url)))
|
||||
|
||||
// =================
|
||||
// === Constants ===
|
||||
// =================
|
||||
|
||||
const TAILWIND_BINARY_PATH = '../../node_modules/.bin/tailwindcss'
|
||||
const TAILWIND_CSS_PATH = path.resolve(THIS_PATH, 'src', 'tailwind.css')
|
||||
|
||||
// =============================
|
||||
// === Environment variables ===
|
||||
// =============================
|
||||
@ -93,12 +100,51 @@ export function alwaysCopiedFiles(wasmArtifacts: string) {
|
||||
export async function* filesToCopyProvider(wasmArtifacts: string, assetsPath: string) {
|
||||
console.log('Preparing a new generator for files to copy.')
|
||||
yield* alwaysCopiedFiles(wasmArtifacts)
|
||||
for (const file of await fs.promises.readdir(assetsPath)) {
|
||||
for (const file of await fs.readdir(assetsPath)) {
|
||||
yield path.resolve(assetsPath, file)
|
||||
}
|
||||
console.log('Generator for files to copy finished.')
|
||||
}
|
||||
|
||||
// ======================
|
||||
// === Inline plugins ===
|
||||
// ======================
|
||||
|
||||
function esbuildPluginGenerateTailwind(args: Pick<Arguments, 'assetsPath'>): esbuild.Plugin {
|
||||
return {
|
||||
name: 'enso-generate-tailwind',
|
||||
setup: build => {
|
||||
// Required since `onStart` is called on every rebuild.
|
||||
let firstRun = true
|
||||
build.onStart(() => {
|
||||
if (firstRun) {
|
||||
const dest = path.join(args.assetsPath, 'tailwind.css')
|
||||
const config = path.resolve(THIS_PATH, 'tailwind.config.ts')
|
||||
console.log(`Generating tailwind css from '${TAILWIND_CSS_PATH}' to '${dest}'.`)
|
||||
const child = childProcess.spawn(`node`, [
|
||||
TAILWIND_BINARY_PATH,
|
||||
'-i',
|
||||
TAILWIND_CSS_PATH,
|
||||
'o',
|
||||
dest,
|
||||
'-c',
|
||||
config,
|
||||
'--minify',
|
||||
])
|
||||
firstRun = false
|
||||
return new Promise(resolve =>
|
||||
child.on('close', () => {
|
||||
resolve({})
|
||||
})
|
||||
)
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// ================
|
||||
// === Bundling ===
|
||||
// ================
|
||||
@ -125,6 +171,8 @@ export function bundlerOptions(args: Arguments) {
|
||||
esbuildPluginNodeGlobals.NodeGlobalsPolyfillPlugin({ buffer: true, process: true }),
|
||||
esbuildPluginAlias({ ensogl_app: ensoglAppPath }),
|
||||
esbuildPluginTime(),
|
||||
// This must run before the copy plugin so that the generated `tailwind.css` is used.
|
||||
esbuildPluginGenerateTailwind({ assetsPath }),
|
||||
esbuildPluginCopy.create(() => filesToCopyProvider(wasmArtifacts, assetsPath)),
|
||||
],
|
||||
define: {
|
||||
|
@ -17,8 +17,8 @@
|
||||
"scripts": {
|
||||
"typecheck": "npx tsc --noEmit",
|
||||
"lint": "npx --yes eslint src",
|
||||
"build": "cd ../dashboard/src/authentication && npx tailwindcss -i src/styles/index.css -o ../../../../../../dist/gui/assets/tailwind.css -c tailwind.config.ts --minify && cd ../../../content && ts-node bundle.ts",
|
||||
"watch": "cd ../dashboard/src/authentication && npx tailwindcss -i src/styles/index.css -o ../../../../../../dist/gui/assets/tailwind.css -c tailwind.config.ts --minify && cd ../../../content && ts-node watch.ts",
|
||||
"build": "ts-node bundle.ts",
|
||||
"watch": "ts-node watch.ts",
|
||||
"start": "ts-node start.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -41,9 +41,9 @@
|
||||
"@types/ws": "^8.5.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"enso-authentication": "^1.0.0",
|
||||
"enso-copy-plugin": "^1.0.0",
|
||||
"enso-gui-server": "^1.0.0",
|
||||
"enso-authentication": "^1.0.0",
|
||||
"esbuild": "^0.15.14",
|
||||
"esbuild-copy-static-files": "^0.1.0",
|
||||
"esbuild-dev-server": "^0.3.0",
|
||||
@ -55,14 +55,15 @@
|
||||
"glob": "^8.0.3",
|
||||
"globals": "^13.20.0",
|
||||
"source-map-loader": "^4.0.1",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"ts-loader": "^9.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.3",
|
||||
"yaml-loader": "^0.8.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"esbuild-darwin-64": "^0.15.18",
|
||||
"esbuild-linux-64": "^0.15.18",
|
||||
"esbuild-windows-64": "^0.15.18",
|
||||
"esbuild-darwin-64": "^0.15.18"
|
||||
"esbuild-windows-64": "^0.15.18"
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
<title>Enso</title>
|
||||
<link rel="stylesheet" href="/style.css" />
|
||||
<link rel="stylesheet" href="/docsStyle.css" />
|
||||
<link rel="stylesheet" href="/tailwind.css" />
|
||||
<script type="module" src="/index.js" defer></script>
|
||||
<script type="module" src="/run.js" defer></script>
|
||||
</head>
|
||||
|
@ -1,7 +1,8 @@
|
||||
/** @file Configuration for Tailwind. */
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: ['./src/**/*.tsx'],
|
||||
// FIXME[sb]: Tailwind building should be in `dashboard/`.
|
||||
content: ['../dashboard/src/authentication/src/**/*.tsx'],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["../types", "."]
|
||||
"include": ["../types", ".", "tailwind.config.ts"]
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
"main": "./src/index.tsx",
|
||||
"exports": "./src/index.tsx",
|
||||
"devDependencies": {
|
||||
"tailwindcss": "^3.2.6",
|
||||
"typescript": "^4.9.3"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -13,7 +13,6 @@
|
||||
import * as React from "react";
|
||||
import * as reactDOM from "react-dom/client";
|
||||
|
||||
import "./styles/index.css";
|
||||
import * as loggerProvider from "./providers/logger";
|
||||
import * as platformModule from "./platform";
|
||||
import App, * as app from "./components/app";
|
||||
|
48
app/ide-desktop/package-lock.json
generated
48
app/ide-desktop/package-lock.json
generated
@ -432,6 +432,7 @@
|
||||
"glob": "^8.0.3",
|
||||
"globals": "^13.20.0",
|
||||
"source-map-loader": "^4.0.1",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"ts-loader": "^9.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.3",
|
||||
@ -593,7 +594,6 @@
|
||||
"ts-results": "^3.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tailwindcss": "^3.2.6",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
},
|
||||
@ -15112,6 +15112,13 @@
|
||||
"url": "https://opencollective.com/immer"
|
||||
}
|
||||
},
|
||||
"node_modules/immutable": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz",
|
||||
"integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
@ -24813,6 +24820,24 @@
|
||||
"resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-13.0.0.tgz",
|
||||
"integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA=="
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.59.3",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.59.3.tgz",
|
||||
"integrity": "sha512-QCq98N3hX1jfTCoUAsF3eyGuXLsY7BCnCEg9qAact94Yc21npG2/mVOqoDvE0fCbWDqiM4WlcJQla0gWG2YlxQ==",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
"immutable": "^4.0.0",
|
||||
"source-map-js": ">=0.6.2 <2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"sass": "sass.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/sass-loader": {
|
||||
"version": "12.6.0",
|
||||
"resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz",
|
||||
@ -37154,7 +37179,6 @@
|
||||
"enso-common": "^1.0.0",
|
||||
"react-hot-toast": "^2.4.0",
|
||||
"react-router-dom": "^6.8.1",
|
||||
"tailwindcss": "^3.2.6",
|
||||
"ts-results": "^3.3.0",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
@ -37198,6 +37222,7 @@
|
||||
"html-loader": "^4.2.0",
|
||||
"mixpanel-browser": "2.45.0",
|
||||
"source-map-loader": "^4.0.1",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"ts-loader": "^9.3.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.9.3",
|
||||
@ -40017,6 +40042,13 @@
|
||||
"resolved": "https://registry.npmjs.org/immer/-/immer-9.0.19.tgz",
|
||||
"integrity": "sha512-eY+Y0qcsB4TZKwgQzLaE/lqYMlKhv5J9dyd2RhhtGhNo2njPXDqU9XPfcNfa3MIDsdtZt5KlkIsirlo4dHsWdQ=="
|
||||
},
|
||||
"immutable": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.0.tgz",
|
||||
"integrity": "sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg==",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"import-fresh": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
@ -47299,6 +47331,18 @@
|
||||
"resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-13.0.0.tgz",
|
||||
"integrity": "sha512-ZRwKbh/eQ6w9vmTjkuG0Ioi3HBwPFce0O+v//ve+aOq1oeCy7jMV2qzzAlpsNuqpqCBjjriM1lbtZbF/Q8jVyA=="
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.59.3",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.59.3.tgz",
|
||||
"integrity": "sha512-QCq98N3hX1jfTCoUAsF3eyGuXLsY7BCnCEg9qAact94Yc21npG2/mVOqoDvE0fCbWDqiM4WlcJQla0gWG2YlxQ==",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"chokidar": ">=3.0.0 <4.0.0",
|
||||
"immutable": "^4.0.0",
|
||||
"source-map-js": ">=0.6.2 <2.0.0"
|
||||
}
|
||||
},
|
||||
"sass-loader": {
|
||||
"version": "12.6.0",
|
||||
"resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-12.6.0.tgz",
|
||||
|
Loading…
Reference in New Issue
Block a user