mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
now version can be set in package.json and is propagated automatically...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
20ded309fe
commit
1ef859573e
@ -152,7 +152,7 @@ VERSION_FALLBACK ?= 4.0.0a
|
||||
# NOTE: we are not using './ig --version 2> /dev/null' because it will
|
||||
# not work before we do 'npm install'...
|
||||
VERSION := $(strip $(shell \
|
||||
echo 'console.log(require("./version").version)' | node - \
|
||||
echo 'console.log(require("./package.json").version)' | node - \
|
||||
|| echo $(VERSION_FALLBACK)))
|
||||
DATE := $(strip $(shell date "+%Y%m%d%H%M"))
|
||||
COMMIT := $(strip $(shell git rev-parse HEAD))
|
||||
@ -293,7 +293,7 @@ PROJECT_FILES = package.json
|
||||
# replace .less with .css making them build targets...
|
||||
CSS_FILES := $(patsubst %.less,%.css,$(wildcard css/*.less))
|
||||
HTML_FILES := $(wildcard *.html)
|
||||
ROOT_JS_FILES := $(wildcard *.js)
|
||||
ROOT_JS_FILES := $(wildcard *.js) version.js
|
||||
# NOTE: this is only used for make change/dependency tracking checking...
|
||||
JS_FILES := $(ROOT_JS_FILES) \
|
||||
$(wildcard $(DOMAIN_DIR)/*.js) \
|
||||
@ -379,6 +379,7 @@ version:
|
||||
@echo $(VERSION)
|
||||
|
||||
|
||||
|
||||
# XXX might be a good idea to print the generated env...
|
||||
#env:
|
||||
|
||||
@ -621,6 +622,12 @@ $(BUILD_INFO): $(CSS_FILES) $(NODE_DIR) $(PROJECT_FILES) \
|
||||
@echo "electron: $(ELECTRON_VERSION)" | tee -a "$@"
|
||||
|
||||
|
||||
version.js: package.json
|
||||
cat version.js.tpl \
|
||||
| sed 's/\$$VERSION/$(VERSION)/' \
|
||||
> version.js
|
||||
|
||||
|
||||
%.css: %.less
|
||||
$(LESSC) $< > $@
|
||||
|
||||
|
||||
@ -26,8 +26,9 @@ var setup = function(require, root){
|
||||
var requirejs = _requirejs
|
||||
|
||||
var requirejs_cfg = {
|
||||
// NOTE: this is really odd: running electron as a packed binary breaks
|
||||
// requirejs' paths...
|
||||
// XXX under electron the path seems to be one level above the
|
||||
// actual base URL, i.e. one level above the $0, hence the
|
||||
// need to correct this...
|
||||
baseUrl: root ?
|
||||
root
|
||||
: typeof(process) != 'undefined'
|
||||
|
||||
@ -3,17 +3,13 @@ Hacks and fixes
|
||||
===============
|
||||
|
||||
20220126:
|
||||
- node_modules/requirejs/bin/r,js
|
||||
node_modules/requirejs/bin/r,js
|
||||
Under Electron v14+ requirejs breaks with a SyntaxError on the
|
||||
first char of r.js ('#!/...') -- a hackish way to fix this is to
|
||||
comment it out, not yet sure why is this happening...
|
||||
STUB: patched by:
|
||||
make node_modules
|
||||
|
||||
- cfg/requirejs.js (FIXED)
|
||||
.baseUrl calculation under U*IX systems needs a '/' prefixed...
|
||||
|
||||
|
||||
|
||||
|
||||
20210122:
|
||||
|
||||
57
Viewer/e.js
57
Viewer/e.js
@ -54,7 +54,11 @@ global.START_GUI = false
|
||||
//
|
||||
// XXX might be nice to show load progress on splash...
|
||||
var SPLASH
|
||||
function createSplash(){
|
||||
function createSplash(force=false){
|
||||
// singleton window...
|
||||
if(!force && SPLASH){
|
||||
return SPLASH }
|
||||
|
||||
// NOTE: this is done here as this does not depend on code loading,
|
||||
// thus showing the splash significantly faster...
|
||||
SPLASH = new BrowserWindow({
|
||||
@ -111,12 +115,18 @@ function createSplash(){
|
||||
|
||||
// Create main window...
|
||||
//
|
||||
// XXX get initial settings from config...
|
||||
// NOTE: initial window metrics are loaded by the app feature...
|
||||
// XXX should this be done here???
|
||||
//
|
||||
// XXX handle maximize corretly...
|
||||
// ...currently it does not differ visually from fullscreen -- either
|
||||
// make them the same or keep them separate visually...
|
||||
var WIN
|
||||
function createWindow(){
|
||||
function createWindow(force=false){
|
||||
// singleton window...
|
||||
if(!force && WIN){
|
||||
return WIN }
|
||||
|
||||
// Create the browser window.
|
||||
WIN = new BrowserWindow({
|
||||
webPreferences: {
|
||||
@ -186,6 +196,9 @@ function createWindow(){
|
||||
return WIN }
|
||||
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// Start the app...
|
||||
//
|
||||
function start(){
|
||||
@ -201,23 +214,7 @@ function start(){
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
// XXX test...
|
||||
app.on('activate', function(){
|
||||
WIN || createWindow() })
|
||||
|
||||
// Quit when all windows are closed.
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
app.on('window-all-closed', function(){
|
||||
process.platform !== 'darwin'
|
||||
&& app.quit() })
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Event handlers...
|
||||
|
||||
// Window states...
|
||||
ipcMain.on('show',
|
||||
@ -245,7 +242,7 @@ ipcMain.on('openSplashScreen',
|
||||
ipcMain.on('closeSplashScreen',
|
||||
function(){ SPLASH && SPLASH.destroy() })
|
||||
|
||||
// devtools...
|
||||
// DevTools...
|
||||
// XXX need to focus devtools here...
|
||||
// see: webContents.getAllWebContents()
|
||||
ipcMain.on('openDevTools',
|
||||
@ -260,6 +257,24 @@ ipcMain.on('closeDevTools',
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Event handlers (macOS)...
|
||||
|
||||
// On macOS it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
// XXX test...
|
||||
app.on('activate', function(){
|
||||
WIN || createWindow() })
|
||||
|
||||
// Quit when all windows are closed.
|
||||
// On macOS it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
app.on('window-all-closed', function(){
|
||||
process.platform !== 'darwin'
|
||||
&& app.quit() })
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// start things up...
|
||||
|
||||
|
||||
@ -42,7 +42,8 @@ actions.Actions({
|
||||
config: {
|
||||
// XXX should this be here???
|
||||
// ...where should this be stored???
|
||||
version: version.version || '4.0.0a',
|
||||
version: version.version
|
||||
|| '4.0.0a',
|
||||
|
||||
'default-direction': 'right',
|
||||
|
||||
@ -71,9 +72,9 @@ actions.Actions({
|
||||
},
|
||||
|
||||
|
||||
// XXX
|
||||
get version(){
|
||||
return this.config.version },
|
||||
return version.version
|
||||
|| '4.0.0a' },
|
||||
|
||||
// basic state...
|
||||
// NOTE: the setters in the following use the appropriate actions
|
||||
|
||||
@ -19,6 +19,7 @@ if(process.env.IMAGEGRID_DEBUG){
|
||||
return res }, {})} }
|
||||
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
require('v8-compile-cache')
|
||||
|
||||
4
Viewer/package-lock.json
generated
4
Viewer/package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "ImageGrid.Viewer.g4",
|
||||
"version": "4.0.0a",
|
||||
"version": "4.0.1a",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "ImageGrid.Viewer.g4",
|
||||
"version": "4.0.0a",
|
||||
"version": "4.0.1a",
|
||||
"dependencies": {
|
||||
"app-module-path": "^1.0.6",
|
||||
"async-json": "0.0.2",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ImageGrid.Viewer.g4",
|
||||
"main": "index.html",
|
||||
"version": "4.0.0a",
|
||||
"version": "4.0.1a",
|
||||
"author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)",
|
||||
"contributors": [],
|
||||
"repository": "github:flynx/ImageGrid",
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* NOTE: version.js is generated automatically by Makefile from a template
|
||||
* do not edit directly.
|
||||
* Edit version.js.tpl instead.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
@ -7,17 +10,16 @@
|
||||
(function(require){ var module={} // make module AMD/node compatible...
|
||||
/*********************************************************************/
|
||||
|
||||
// XXX need to figure out a way to get the version from package.json and
|
||||
// do it in:
|
||||
// - bare nodejs
|
||||
// > node version.js
|
||||
// - browser + requirejs + file://
|
||||
// - browser + requirejs + http*
|
||||
var VERSION = '4.0.1a'
|
||||
// The version lives in package.json
|
||||
//
|
||||
// We need to be able to read the correct version in the folowing
|
||||
// contexts:
|
||||
// - nodejs/electron - can load JSON directly
|
||||
// - browser (remote) - can load json via the require('json!package.json')
|
||||
// - browser (local) - can't get access to .json files
|
||||
// Thus the only way around this is to generate this file from a template.
|
||||
|
||||
//console.log(VERSION)
|
||||
|
||||
module.version = VERSION
|
||||
module.version = '4.0.1a-202201282135-el'
|
||||
|
||||
|
||||
|
||||
|
||||
27
Viewer/version.js.tpl
Normal file
27
Viewer/version.js.tpl
Normal file
@ -0,0 +1,27 @@
|
||||
/**********************************************************************
|
||||
*
|
||||
* NOTE: version.js is generated automatically by Makefile from a template
|
||||
* do not edit directly.
|
||||
* Edit version.js.tpl instead.
|
||||
*
|
||||
*
|
||||
**********************************************************************/
|
||||
((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define)
|
||||
(function(require){ var module={} // make module AMD/node compatible...
|
||||
/*********************************************************************/
|
||||
|
||||
// The version lives in package.json
|
||||
//
|
||||
// We need to be able to read the correct version in the folowing
|
||||
// contexts:
|
||||
// - nodejs/electron - can load JSON directly
|
||||
// - browser (remote) - can load json via the require('json!package.json')
|
||||
// - browser (local) - can't get access to .json files
|
||||
// Thus the only way around this is to generate this file from a template.
|
||||
|
||||
module.version = '$VERSION'
|
||||
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* vim:set ts=4 sw=4 : */ return module })
|
||||
Loading…
x
Reference in New Issue
Block a user