mirror of
https://github.com/cds-astro/aladin-lite.git
synced 2026-03-12 21:23:10 -07:00
add a prod routine only for internal production deployment on our server. npm run serve should behave like before
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
"dateModified": "2023-01-31",
|
||||
"issueTracker": "https://github.com/cds-astro/aladin-lite/issues",
|
||||
"name": "Aladin Lite",
|
||||
"version": "3.6.5",
|
||||
"softwareVersion": "3.6.5",
|
||||
"version": "3.7.0-beta",
|
||||
"softwareVersion": "3.7.0-beta",
|
||||
"description": "An astronomical HiPS visualizer in the browser.",
|
||||
"identifier": "10.5281/zenodo.7638833",
|
||||
"applicationCategory": "Astronomy, Visualization",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
);
|
||||
|
||||
hips = aladin.newImageSurvey("http://alasky.cds.unistra.fr/HIPS3D/GalfaHI", {
|
||||
hips = aladin.newImageSurvey("http://alasky.cds.unistra.fr/HIPS3D/LGLBSHI16", {
|
||||
successCallback: (hips) => {
|
||||
//hips.setFrequency({value: 6.374279333565797E-7, unit: "m"}) // GALFA
|
||||
}
|
||||
|
||||
16
package.json
16
package.json
@@ -2,7 +2,7 @@
|
||||
"homepage": "https://aladin.u-strasbg.fr/",
|
||||
"name": "aladin-lite",
|
||||
"type": "module",
|
||||
"version": "3.7.0-beta",
|
||||
"version": "3.7.1-beta",
|
||||
"description": "An astronomical HiPS visualizer in the browser",
|
||||
"author": "Thomas Boch and Matthieu Baumann",
|
||||
"license": "GPL-3",
|
||||
@@ -30,13 +30,15 @@
|
||||
"HiPS"
|
||||
],
|
||||
"scripts": {
|
||||
"wasm": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
|
||||
"wasm:prod": "wasm-pack build ./src/core --target web --release --out-name core -- --features \"webgl2 minify_shaders\" && wasm-opt -Oz --strip-debug --strip-producers --dce -o src/core/pkg/core_bg.wasm src/core/pkg/core_bg.wasm",
|
||||
"wasm:dev": "wasm-pack build ./src/core --target web --release --out-name core -- --features webgl2",
|
||||
"wasm:dbg": "wasm-pack build --dev ./src/core --target web --out-name core -- --features=webgl2,dbg",
|
||||
"predeploy": "npm run build && rm -rf aladin-lite*.tgz && npm pack",
|
||||
"deploy": "python3 deploy/deploy.py",
|
||||
"build": "npm run wasm && vite build",
|
||||
"predeploy": "npm run build:prod && rm -rf aladin-lite*.tgz && npm pack",
|
||||
"deploy": "npm run predeploy && python3 deploy/deploy.py",
|
||||
"build:prod": "npm run wasm:prod && vite build",
|
||||
"build:dev": "npm run wasm:dev && vite build",
|
||||
"build:dbg": "npm run wasm:dbg && vite build",
|
||||
"dev": "npm run build && vite",
|
||||
"dev": "npm run build:dev && vite",
|
||||
"dev:dbg": "npm run build:dbg && vite",
|
||||
"serve": "npm run dev",
|
||||
"serve:dbg": "npm run dev:dbg",
|
||||
@@ -51,8 +53,8 @@
|
||||
"@playwright/test": "^1.47.0",
|
||||
"docdash": "^2.0.2",
|
||||
"jsdoc": "^4.0.2",
|
||||
"rollup-plugin-visualizer": "^6.0.3",
|
||||
"vite": "^4.3.8",
|
||||
"vite-plugin-glsl": "^1.1.2",
|
||||
"vite-plugin-top-level-await": "^1.4.1",
|
||||
"vite-plugin-wasm": "^3.2.2",
|
||||
"vite-plugin-wasm-pack": "^0.1.12"
|
||||
|
||||
@@ -3,7 +3,7 @@ name = "aladin-lite"
|
||||
description = "Aladin Lite v3 introduces a new graphical engine written in Rust with the use of WebGL"
|
||||
license = "BSD-3-Clause"
|
||||
repository = "https://github.com/cds-astro/aladin-lite"
|
||||
version = "3.7.0"
|
||||
version = "3.7.1-beta"
|
||||
authors = [ "baumannmatthieu0@gmail.com", "matthieu.baumann@astro.unistra.fr",]
|
||||
edition = "2018"
|
||||
|
||||
@@ -18,12 +18,10 @@ futures = "0.3.12"
|
||||
js-sys = "0.3.47"
|
||||
wasm-bindgen-futures = "0.4.20"
|
||||
cgmath = "*"
|
||||
# url-lite = "0.1.0"
|
||||
serde_json = "1.0.104"
|
||||
serde-wasm-bindgen = "0.5"
|
||||
enum_dispatch = "0.3.8"
|
||||
wasm-bindgen = "=0.2.92"
|
||||
#wasm-streams = "0.3.0"
|
||||
async-channel = "1.8.0"
|
||||
mapproj = "0.3.0"
|
||||
fitsrs = "0.3.4"
|
||||
@@ -33,6 +31,7 @@ colorgrad = "0.6.2"
|
||||
webgl1 = [ "al-core/webgl1", "al-api/webgl1", "web-sys/WebGlRenderingContext", "web-sys/AngleInstancedArrays", "web-sys/ExtSRgb", "web-sys/OesTextureFloat",]
|
||||
webgl2 = [ "al-core/webgl2", "al-api/webgl2", "web-sys/WebGl2RenderingContext", "web-sys/WebGlVertexArrayObject", "web-sys/ExtColorBufferFloat",]
|
||||
dbg = [ "dep:console_error_panic_hook",]
|
||||
minify_shaders = []
|
||||
|
||||
[dev-dependencies]
|
||||
rand = "0.8"
|
||||
@@ -77,14 +76,14 @@ features = [ "jpeg", "png",]
|
||||
debug = true
|
||||
|
||||
[profile.release]
|
||||
opt-level = "z"
|
||||
opt-level = 'z'
|
||||
debug = false
|
||||
debug-assertions = false
|
||||
overflow-checks = false
|
||||
lto = true
|
||||
panic = "abort"
|
||||
incremental = false
|
||||
codegen-units = 16
|
||||
codegen-units = 1
|
||||
rpath = false
|
||||
|
||||
[package.metadata.wasm-pack.profile.release]
|
||||
|
||||
@@ -3,6 +3,8 @@ use walkdir::WalkDir;
|
||||
extern crate walkdir;
|
||||
use std::io::BufRead;
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
// All my shaders reside in the 'src/shaders' directory
|
||||
fn generate_shaders() -> std::result::Result<(), Box<dyn Error>> {
|
||||
println!("generate shaders");
|
||||
@@ -26,9 +28,48 @@ fn generate_shaders() -> std::result::Result<(), Box<dyn Error>> {
|
||||
.into_owned()
|
||||
.replace("/", "_")
|
||||
.replace("\\", "_");
|
||||
//let out_name = format!("{}/{}", OUT_PATH, out_file_name);
|
||||
|
||||
let src = read_shader(path)?;
|
||||
let mut src = read_shader(path)?;
|
||||
|
||||
if std::env::var("CARGO_FEATURE_MINIFY_SHADERS").is_ok() {
|
||||
println!("Feature `minify_shaders` enabled: running shader minifier");
|
||||
|
||||
// save to a minified path
|
||||
let mut tmp_path = PathBuf::from(path);
|
||||
let mut min_path = PathBuf::from(path);
|
||||
|
||||
let stem = path.file_stem().unwrap();
|
||||
// Build new filename: stem + ".min" + extension
|
||||
let tmp_file_name =
|
||||
format!("{}.{}.tmp", stem.to_string_lossy(), ext.to_string_lossy());
|
||||
tmp_path.set_file_name(tmp_file_name);
|
||||
|
||||
let min_file_name =
|
||||
format!("{}.{}.min", stem.to_string_lossy(), ext.to_string_lossy());
|
||||
min_path.set_file_name(min_file_name);
|
||||
|
||||
fs::write(tmp_path.clone(), &src)?;
|
||||
|
||||
Command::new("mono")
|
||||
.args(&[
|
||||
"/Users/matthieubaumann/Downloads/shader_minifier.exe",
|
||||
"--format",
|
||||
"text",
|
||||
"--aggressive-inlining",
|
||||
"--preserve-externals",
|
||||
"--move-declarations",
|
||||
"-o",
|
||||
min_path.as_os_str().to_str().expect("Invalid UTF-8!"),
|
||||
tmp_path.as_os_str().to_str().expect("Invalid UTF-8!"),
|
||||
])
|
||||
.status()
|
||||
.expect("Failed to run shader_minifier");
|
||||
|
||||
src = read_shader(min_path)?;
|
||||
} else {
|
||||
println!("Feature `minify_shaders` not enabled: skipping");
|
||||
}
|
||||
|
||||
shaders.insert(out_file_name, src);
|
||||
|
||||
println!("cargo:rerun-if-changed=src/shaders/{file_name}");
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
//extern crate num;
|
||||
//extern crate num_traits;
|
||||
//use crate::time::Time;
|
||||
|
||||
#[cfg(feature = "dbg")]
|
||||
use std::panic;
|
||||
|
||||
|
||||
@@ -8,9 +8,12 @@ import topLevelAwait from "vite-plugin-top-level-await";
|
||||
// For wasm generated by wasm-pack
|
||||
import wasmPack from 'vite-plugin-wasm-pack';
|
||||
// To include and minify glsl into the bundle
|
||||
import glsl from 'vite-plugin-glsl';
|
||||
//import glsl from 'vite-plugin-glsl';
|
||||
// To include css into the bundle
|
||||
//import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
|
||||
//import fs from 'fs';
|
||||
|
||||
import { visualizer } from "rollup-plugin-visualizer";
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
@@ -35,9 +38,16 @@ export default defineConfig({
|
||||
wasm(),
|
||||
wasmPack(resolve(__dirname, 'src/core')),
|
||||
topLevelAwait(),
|
||||
glsl({
|
||||
compress: true,
|
||||
}),
|
||||
/*glsl({
|
||||
minify: true
|
||||
}),*/
|
||||
/*visualizer({
|
||||
filename: 'stats.html', // output file
|
||||
template: 'treemap', // "sunburst", "treemap", "network"
|
||||
gzipSize: true, // show gzip sizes
|
||||
brotliSize: true, // show brotli sizes
|
||||
open: true // open stats.html automatically
|
||||
}),*/
|
||||
],
|
||||
resolve: {
|
||||
alias: [
|
||||
|
||||
Reference in New Issue
Block a user