cleanup javascript build code

build static files allways from source
This commit is contained in:
tuxcoder 2023-12-25 17:48:30 +01:00
parent f858a1a78c
commit 926afee5c5
27 changed files with 62 additions and 105 deletions

1
.gitignore vendored
View file

@ -13,3 +13,4 @@ node_modules
build build
result result
nixos.qcow2 nixos.qcow2
/lenticular_cloud/static

View file

@ -38,3 +38,23 @@ Oauth2 Settings:
---------------- ----------------
callback url: `${domain}/ callback url: `${domain}/
Development
===========
requirements:
* nix package manager
get dev enviroment with `nix develop`
run javascript part with `npm run watch`
run python stuff with `python cli.py run`
run tests with `nix flake check`

View file

@ -31,6 +31,7 @@
];}; ];};
packages.default = pkgs.lenticular-cloud; packages.default = pkgs.lenticular-cloud;
packages.frontend = pkgs.lenticular-cloud-frontend;
checks = { checks = {
package = packages.default; package = packages.default;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,79 +0,0 @@
/*!
* Bootstrap v4.6.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
/*!
* Sizzle CSS Selector Engine v2.3.6
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://js.foundation/
*
* Date: 2021-02-16
*/
/*!
* jQuery Form Plugin
* version: 4.3.0
* Requires jQuery v1.7.2 or later
* Project repository: https://github.com/jquery-form/form
* Copyright 2017 Kevin Morris
* Copyright 2006 M. Alsup
* Dual licensed under the LGPL-2.1+ or MIT licenses
* https://github.com/jquery-form/form#license
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*/
/*!
* jQuery JavaScript Library v3.6.0
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2021-03-02T17:08Z
*/
/*! For license information please see cbor.js.LICENSE.txt */
/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.16.1
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,20 @@
final: prev: final: prev:
let let
pkgs = final.pkgs; pkgs = final.pkgs;
version = "2.4";
frontend = pkgs.buildNpmPackage {
pname = "lenticular_cloud_js";
version = version;
src = ./.;
npmDepsHash = "sha256-L0EZHY1WN0zlnlUVm6d/EJIlC3Z/lod5d8dPNMsuw50=";
installPhase = ''
npm run build
mkdir -p $out
cp -r lenticular_cloud/static $out/
'';
};
in { in {
python3 = prev.python3.override { python3 = prev.python3.override {
packageOverrides = final: prev: with final; { packageOverrides = final: prev: with final; {
@ -69,8 +83,11 @@ in {
}); });
lenticular-cloud = buildPythonPackage { lenticular-cloud = buildPythonPackage {
pname = "lenticular_cloud"; pname = "lenticular_cloud";
version = "0.3"; version = version;
src = ./.; src = ./.;
postPatch = ''
cp -r ${frontend}/static ./lenticular_cloud/
'';
propagatedBuildInputs = [ propagatedBuildInputs = [
flask flask
flask-restful flask-restful
@ -120,4 +137,5 @@ in {
}; };
}; };
lenticular-cloud = final.python3.pkgs.lenticular-cloud; lenticular-cloud = final.python3.pkgs.lenticular-cloud;
lenticular-cloud-frontend = frontend;
} }

17
package-lock.json generated
View file

@ -10,6 +10,7 @@
"license": "GPLv3", "license": "GPLv3",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^6.1.1", "@fortawesome/fontawesome-free": "^6.1.1",
"@simplewebauthn/browser": "^8.3.4",
"bootstrap": "^4.6.1", "bootstrap": "^4.6.1",
"cbor-web": "*", "cbor-web": "*",
"css-loader": "^6.7.1", "css-loader": "^6.7.1",
@ -30,8 +31,7 @@
"url-loader": "*", "url-loader": "*",
"webpack": "^5.72.1", "webpack": "^5.72.1",
"webpack-cli": "*" "webpack-cli": "*"
}, }
"devDependencies": {}
}, },
"node_modules/@discoveryjs/json-ext": { "node_modules/@discoveryjs/json-ext": {
"version": "0.5.7", "version": "0.5.7",
@ -129,6 +129,19 @@
"@jridgewell/sourcemap-codec": "^1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"node_modules/@simplewebauthn/browser": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-8.3.4.tgz",
"integrity": "sha512-rO0hZ0ESD28bZl6Qe8k7RUuYvDLbsS6oPezkMMTtZ5vC80U07j4qBELKBzojDD6BsdL3dIJ9SExVp8E7pqQ5fA==",
"dependencies": {
"@simplewebauthn/typescript-types": "^8.3.4"
}
},
"node_modules/@simplewebauthn/typescript-types": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/@simplewebauthn/typescript-types/-/typescript-types-8.3.4.tgz",
"integrity": "sha512-38xtca0OqfRVNloKBrFB5LEM6PN5vzFbJG6rAutPVrtGHFYxPdiV3btYWq0eAZAZmP+dqFPYJxJWeJrGfmYHng=="
},
"node_modules/@sinclair/typebox": { "node_modules/@sinclair/typebox": {
"version": "0.27.8", "version": "0.27.8",
"resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",

View file

@ -3,12 +3,14 @@
"version": "2.0.0", "version": "2.0.0",
"description": "Lenticular Cloud ================", "description": "Lenticular Cloud ================",
"scripts": { "scripts": {
"build": "webpack-cli --mode production" "build": "webpack-cli --mode production",
"watch": "webpack-cli --mode development -w"
}, },
"author": "TuxCoder", "author": "TuxCoder",
"license": "GPLv3", "license": "GPLv3",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^6.1.1", "@fortawesome/fontawesome-free": "^6.1.1",
"@simplewebauthn/browser": "^8.3.4",
"bootstrap": "^4.6.1", "bootstrap": "^4.6.1",
"cbor-web": "*", "cbor-web": "*",
"css-loader": "^6.7.1", "css-loader": "^6.7.1",
@ -22,13 +24,12 @@
"qrcode-svg": "~1.1.0", "qrcode-svg": "~1.1.0",
"sass": "^1.52.1", "sass": "^1.52.1",
"sass-loader": "^13.0.0", "sass-loader": "^13.0.0",
"simple-form-submit": "*",
"style-loader": "*", "style-loader": "*",
"terser-webpack-plugin": "*", "terser-webpack-plugin": "*",
"ts-loader": "^9.3.0", "ts-loader": "^9.3.0",
"url-loader": "*", "url-loader": "*",
"webpack": "^5.72.1", "webpack": "^5.72.1",
"webpack-cli": "*", "webpack-cli": "*"
"simple-form-submit": "*" }
},
"devDependencies": {}
} }