Unverified Commit 324cc975 authored by Christian Merten's avatar Christian Merten

oMerge remote-tracking branch 'gitlab/dev' into cm/update-corpus-button

parents 992654e3 f3a3eb98
use nix
#use nix
use flake
......@@ -11,6 +11,7 @@ reports
node_modules
.DS_Store
/.direnv/
/bower_components/
/node_modules/
/.cache/
......
# Thanks to:
# https://vadosware.io/post/zero-to-continuous-integrated-testing-a-haskell-project-with-gitlab/
#
#
image: nixos/nix:latest
variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root"
STACK_OPTS: "--system-ghc"
# Fixing the nixos image saves CI time so it doesn't have to pull new
#image every time (nixos/nix updates quite often).
# image: nixos/nix:latest
image: nixos/nix:2.24.8
#before_script:
#- nix-env -iA nixpkgs.nix nixpkgs.cacert
#- apt-get update
#- apt-get install make xz-utils
stages:
- deps
# - deps
- compile
- test
deps:
# deps:
# stage: deps
# cache:
# paths:
# - /nix/store
# #- node_modules/
# script:
# - nix-shell shell.nix --run 'bun install --skip-builds'
compile:
stage: compile
cache:
paths:
- /nix/store
- node_modules/
- output/
- .spago/
script:
- nix-env -i git
- nix-shell shell.nix --run 'yarn --skip-builds'
- nix --extra-experimental-features "nix-command flakes" run .#ci
- nix --extra-experimental-features "nix-command flakes" run .#compile
test:
stage: test
cache:
# cache per branch name
# key: ${CI_COMMIT_REF_SLUG}
paths:
- /nix/store
- node_modules/
- output/
- .spago/
script:
# find 0.14.5 purescript version here:
# https://lazamar.co.uk/nix-versions/
- nix-env -i git
- nix-shell shell.nix --run 'yarn --skip-builds'
- nix-shell shell.nix --run test-ps
- nix --extra-experimental-features "nix-command flakes" run .#compile
- nix --extra-experimental-features "nix-command flakes" run .#test-ps
- nix-collect-garbage --delete-older-than 14d
## Summary
(Summarize the bug encountered concisely with the version of code)
## Steps to reproduce
(How one can reproduce the issue - this is very important)
## What is the current bug behavior?
(What actually happens)
## What is the expected correct behavior?
(What you should see instead)
## Relevant logs and/or screenshots
(Paste any relevant logs - use code blocks (```) to format console output, logs, and code, as
it's very hard to read otherwise.)
## Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
......@@ -52,13 +52,23 @@ $ nix-env --version
nix-env (Nix) 2.11.0
```
To build the frontend just execute the install script at the root at the project:
Enable de flake experimental feature :
```shell
mkdir ~/.config/nix
echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf
```
To build the frontend just execute the install script at the root at the project:
```shell
./install
```
**Local instance is ready!** (Example: http://localhost:8000/)
```shell
nix -L develop
```
**Local instance is ready!** (Example: http://localhost:8000/)
### 2. Use Docker setup
......@@ -101,6 +111,6 @@ nix-shell --run build
To compile CSS (Sass):
```shell
nix-shell --run "yarn css"
nix-shell --run "npm run css"
```
#!/bin/bash
# To get infos
# nix-shell -p nix-info --run "nix-info -m"
# nix-channel --update
# nix-env -iA nixpkgs.nix nixpkgs.cacert
# nix-shell --show-trace --option build-fallback true --run 'bun install'
# nix-shell --show-trace --option build-fallback true --run fix-bun
# nix-shell --show-trace --option build-fallback true --run build
nix run .#install
nix run .#build
nix run .#build-css
# nix-shell --run "npm run css-default-theme"
# nix-shell --run "npm run css-dark-theme"
# nix-shell --run "npm run css-herbie-theme"
# nix-shell --run "npm run css-monotony-theme"
# nix-shell --run "npm run css-greyson-theme"
#!/bin/bash
nix run .#repl
with (import <nixpkgs> {});
let
nodejs-with-packages = with nodePackages; [
bower
yarn
]; in
stdenv.mkDerivation rec {
name = "env";
env = buildEnv {
name = name;
paths = buildInputs;
};
buildInputs = [
nodejs-with-packages
yarn
yarn2nix
];
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
touch $out
'';
}
......@@ -14,6 +14,6 @@
<div id="portal"></div>
<script src="js/jquery@3.5.1/jquery.slim.min.js"></script>
<script src="js/bootstrap@4.6.2/bootstrap.bundle.min.js"></script>
<script src="bundle.js"></script>
<script src="bundle.min.js"></script>
</body>
</html>
// Main Gargantext scripts
$(function () {
$('[data-toggle="tooltip"]').tooltip()
console.log("Gargantext is ready.");
})
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1717179513,
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"purescript-overlay": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": [
"nixpkgs"
],
"slimlock": "slimlock"
},
"locked": {
"lastModified": 1727269424,
"narHash": "sha256-uoVjAkKbuJSA7++kyBjxLozICDdukZ+Mjj5Z/K5qMak=",
"owner": "thomashoneyman",
"repo": "purescript-overlay",
"rev": "5a28abe663758634b1e5ca7053e08af62fd3be80",
"type": "github"
},
"original": {
"owner": "thomashoneyman",
"repo": "purescript-overlay",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"purescript-overlay": "purescript-overlay"
}
},
"slimlock": {
"inputs": {
"nixpkgs": [
"purescript-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1688756706,
"narHash": "sha256-xzkkMv3neJJJ89zo3o2ojp7nFeaZc2G0fYwNXNJRFlo=",
"owner": "thomashoneyman",
"repo": "slimlock",
"rev": "cf72723f59e2340d24881fd7bf61cb113b4c407c",
"type": "github"
},
"original": {
"owner": "thomashoneyman",
"repo": "slimlock",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
{
description = "Gargantext PureScript fronetnd";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs?ref=24.05";
inputs.purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, flake-utils, purescript-overlay }:
flake-utils.lib.eachDefaultSystem (system:
#let pkgs = nixpkgs.legacyPackages.${system};
let
pkgs = import nixpkgs {
inherit system;
overlays = builtins.attrValues { purescript = purescript-overlay.overlays.default; };
};
dependencies = with pkgs; [
purs-bin.purs-0_15_16-1 # from the purescript-overlay
spago-bin.spago-0_93_37
#purescript
#spago-unstable
esbuild
nodejs
nodePackages.npm
];
serve = pkgs.writeShellScriptBin "serve" ''
set -e
npm run server
'';
build-watch = pkgs.writeShellScriptBin "build-watch" ''
set -e
echo "Build watch"
npm spago build -w --then browserify
'';
build-zephyr = pkgs.writeShellScriptBin "build-zephyr" ''
set -e
npm spago build --purs-args '--codegen corefn,js'
zephyr -f Main.main
browserify-zephyr
'';
minify-bundle = pkgs.writeShellScriptBin "minify-bundle" ''
set -e
npm run minify
'';
in
{
packages = rec {
ci = pkgs.writeShellApplication {
name = "install";
runtimeInputs = dependencies;
text = ''
set -e
echo "Installing JS Dependencies (CI)"
# https://docs.npmjs.com/cli/v9/commands/npm-ci
npm ci
'';
};
install = pkgs.writeShellApplication {
name = "install";
runtimeInputs = dependencies;
text = ''
set -e
echo "Installing JS Dependencies"
npm install
# https://docs.npmjs.com/cli/v9/commands/npm-ci
#npm ci
#npm/bin/npm install --dev
'';
};
compile = pkgs.writeShellApplication {
name = "compile";
runtimeInputs = dependencies;
text = ''
set -e
#echo "Installing JS Dependencies"
#npm install
# https://docs.npmjs.com/cli/v9/commands/npm-ci
#npm ci
#npm/bin/npm install --dev
echo "Compiling"
npm run build
'';
};
build = pkgs.writeShellApplication {
name = "build";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
set -e
# compile
echo "Bundling"
npm run bundle
'';
};
test-ps = pkgs.writeShellApplication {
name = "test-ps";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
set -e
compile
echo "Testing"
npm run test
'';
};
repl = pkgs.writeShellApplication {
name = "repl";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
npm run repl
'';
};
build-css = pkgs.writeShellApplication {
name = "build-css";
runtimeInputs = [ compile ] ++ dependencies;
text = ''
set -e
npm run css
'';
};
};
devShells.default = pkgs.mkShell {
name = "purescript-gargantext";
#inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = with pkgs; (dependencies ++ [
# scripts
self.packages.${system}.build
self.packages.${system}.build-css
self.packages.${system}.compile
self.packages.${system}.test-ps
self.packages.${system}.repl
build-watch
build-zephyr
minify-bundle
serve
]);
};
}
);
}
......@@ -15,6 +15,6 @@
<body>
<div id="app"></div>
<div id="portal"></div>
<script src="bundle.js"></script>
<script src="bundle.min.js"></script>
</body>
</html>
#!/bin/bash
# To get infos
# nix-shell -p nix-info --run "nix-info -m"
nix-channel --update
nix-env -iA nixpkgs.nix nixpkgs.cacert
nix-shell --show-trace --option build-fallback true --run build
......@@ -5,8 +5,8 @@ import
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "easy-purescript-nix";
rev = "11d3bd58ce6e32703bf69cec04dc7c38eabe14ba";
sha256 = "tESal32bcqqdZO+aKnBzc1GoL2mtnaDtj2y7ociCRGA=";
rev = "117fd96acb69d7d1727df95b6fde9d8715e031fc";
sha256 = "lcIRIOFCdIWEGyKyG/tB4KvxM9zoWuBRDxW+T+mvIb0=";
}
) {
inherit pkgs;
......
Avoids needing xcrun or xcodebuild in PATH for native package builds
diff --git a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
index a75d8ee..476440d 100644
--- a/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
+++ b/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py
@@ -522,7 +522,13 @@ class XcodeSettings:
# Since the CLT has no SDK paths anyway, returning None is the
# most sensible route and should still do the right thing.
try:
- return GetStdoutQuiet(["xcrun", "--sdk", sdk, infoitem])
+ #return GetStdoutQuiet(["xcrun", "--sdk", sdk, infoitem])
+ return {
+ "--show-sdk-platform-path": "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform",
+ "--show-sdk-path": "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk",
+ "--show-sdk-build-version": "19A547",
+ "--show-sdk-version": "10.15"
+ }[infoitem]
except GypError:
pass
@@ -1499,7 +1505,8 @@ def XcodeVersion():
version = ""
build = ""
try:
- version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines()
+ #version_list = GetStdoutQuiet(["xcodebuild", "-version"]).splitlines()
+ version_list = []
# In some circumstances xcodebuild exits 0 but doesn't return
# the right results; for example, a user on 10.7 or 10.8 with
# a bogus path set via xcode-select
@@ -1510,7 +1517,8 @@ def XcodeVersion():
version = version_list[0].split()[-1] # Last word on first line
build = version_list[-1].split()[-1] # Last word on last line
except GypError: # Xcode not installed so look for XCode Command Line Tools
- version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322
+ #version = CLTVersion() # macOS Catalina returns 11.0.0.0.1.1567737322
+ version = "11.0.0.0.1.1567737322"
if not version:
raise GypError("No Xcode or CLT version detected!")
# Be careful to convert "4.2.3" to "0423" and "11.0.0" to "1100":
Disable v8 system instrumentation on Darwin
On Darwin, the v8 system instrumentation requires the header "os/signpost.h"
which is available since apple_sdk 11+. See: https://github.com/nodejs/node/issues/39584
--- old/tools/v8_gypfiles/features.gypi
+++ new/tools/v8_gypfiles/features.gypi
@@ -62,7 +62,7 @@
}, {
'is_component_build': 0,
}],
- ['OS == "win" or OS == "mac"', {
+ ['OS == "win"', {
# Sets -DENABLE_SYSTEM_INSTRUMENTATION. Enables OS-dependent event tracing
'v8_enable_system_instrumentation': 1,
}, {
This patch is based off of npm tag v9.1.5.
This introduces fixes for 4 issues:
1. When node-gyp is included as a dependency in a project, any scripts that run it will not use the copy included in Node. This is problematic because we patch node-gyp to work without xcbuild on Darwin, leading to these packages failing to build with a sandbox on Darwin.
2. When a Git dependency contains install scripts, it has to be built just like any other package. Thus, we need to patch shebangs appropriately, just like in npmConfigHook.
3. We get useless warnings that clog up logs when using a v1 lockfile, so we silence them.
4. npm looks at a hidden lockfile to determine if files have binaries to link into `node_modules/.bin`. When using a v1 lockfile offline, this lockfile does not contain enough info, leading to binaries for packages such as Webpack not being available to scripts. We used to work around this by making npm ignore the hidden lockfile by creating a file, but now we just disable the code path entirely.
To update:
1. Run `git diff` from an npm checkout
2. Run `fix-npm-patch-paths.sh`
3. Include/update this frontmatter, please!
diff --git a/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js b/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js
index c59c270d9..98785192f 100644
--- a/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js
+++ b/deps/npm/node_modules/@npmcli/run-script/lib/set-path.js
@@ -12,7 +12,10 @@ const setPATH = (projectPath, binPaths, env) => {
.reduce((set, p) => set.concat(p.filter(concatted => !set.includes(concatted))), [])
.join(delimiter)
- const pathArr = []
+ // Ensure when using buildNpmPackage hooks that Node.js'
+ // bundled copy of node-gyp is used, instead of any copy
+ // pulled in as a dependency.
+ const pathArr = process.env['NIX_NODEJS_BUILDNPMPACKAGE'] ? [nodeGypPath, PATH] : [];
if (binPaths) {
pathArr.push(...binPaths)
}
@@ -26,7 +29,8 @@ const setPATH = (projectPath, binPaths, env) => {
pp = p
p = dirname(p)
} while (p !== pp)
- pathArr.push(nodeGypPath, PATH)
+ if (!process.env['NIX_NODEJS_BUILDNPMPACKAGE']) { pathArr.push(nodeGypPath, PATH) }
+
const pathVal = pathArr.join(delimiter)
diff --git a/deps/npm/node_modules/pacote/lib/git.js b/deps/npm/node_modules/pacote/lib/git.js
index 1fa8b1f96..a026bb50d 100644
--- a/deps/npm/node_modules/pacote/lib/git.js
+++ b/deps/npm/node_modules/pacote/lib/git.js
@@ -188,6 +188,24 @@ class GitFetcher extends Fetcher {
}
noPrepare.push(this.resolved)
+ if (process.env['NIX_NODEJS_BUILDNPMPACKAGE']) {
+ const spawn = require('@npmcli/promise-spawn')
+
+ const npmWithNixFlags = (args, cmd) => spawn('bash', ['-c', 'npm ' + args + ` $npm${cmd}Flags "$\{npm${cmd}FlagsArray[@]}" $npmFlags "$\{npmFlagsArray[@]}"`], { cwd: dir, env: { ...process.env, _PACOTE_NO_PREPARE_: noPrepare.join('\n') } }, { message: `\`npm ${args}\` failed` })
+ const patchShebangs = () => spawn('bash', ['-c', 'source $stdenv/setup; patchShebangs node_modules'], { cwd: dir })
+
+ // the DirFetcher will do its own preparation to run the prepare scripts
+ // All we have to do is put the deps in place so that it can succeed.
+ //
+ // We ignore this.npmConfig to maintain an environment that's as close
+ // to the rest of the build as possible.
+ return spawn('bash', ['-c', '$prefetchNpmDeps --fixup-lockfile package-lock.json'], { cwd: dir })
+ .then(() => npmWithNixFlags('ci --ignore-scripts', 'Install'))
+ .then(patchShebangs)
+ .then(() => npmWithNixFlags('rebuild', 'Rebuild'))
+ .then(patchShebangs)
+ }
+
// the DirFetcher will do its own preparation to run the prepare scripts
// All we have to do is put the deps in place so that it can succeed.
return npm(
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
index 2ea66ac33..25e671318 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js
@@ -740,7 +740,7 @@ This is a one-time fix-up, please be patient...
node.package = { ...mani, _id: `${mani.name}@${mani.version}` }
} catch (er) {
const warning = `Could not fetch metadata for ${name}@${id}`
- log.warn(heading, warning, er)
+ if (!process.env['NIX_NODEJS_BUILDNPMPACKAGE']) { log.warn(heading, warning, er) }
}
this.finishTracker(t)
})
diff --git a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
index 6c3f917c6..ec21d2cc4 100644
--- a/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
+++ b/deps/npm/node_modules/@npmcli/arborist/lib/arborist/load-actual.js
@@ -147,7 +147,7 @@ module.exports = cls => class ActualLoader extends cls {
this[_actualTree].assertRootOverrides()
// if forceActual is set, don't even try the hidden lockfile
- if (!forceActual) {
+ if (!forceActual && !process.env['NIX_NODEJS_BUILDNPMPACKAGE']) {
// Note: hidden lockfile will be rejected if it's not the latest thing
// in the folder, or if any of the entries in the hidden lockfile are
// missing.
Fixes cross compilation to aarch64-linux by reverting
https://github.com/nodejs/node/pull/43200
--- old/configure.py
+++ new/configure.py
@@ -1236,7 +1236,6 @@
# Enable branch protection for arm64
if target_arch == 'arm64':
- o['cflags']+=['-msign-return-address=all']
o['variables']['arm_fpu'] = options.arm_fpu or 'neon'
if options.node_snapshot_main is not None:
{ callPackage, openssl, python3, enableNpm ? true, nodejs, path }:
let
buildNodejs = callPackage "${path}/pkgs/development/web/nodejs/nodejs.nix" {
inherit openssl;
python = python3;
};
in
buildNodejs {
inherit enableNpm;
version = "20.3.1";
sha256 = "sha256-EqgtswZpeVm0OJs1Gl+XhImGsTE/mQGw4LPYz08/mZE=";
patches = [
./nodejs-patches/revert-arm64-pointer-auth.patch
./nodejs-patches/disable-darwin-v8-system-instrumentation-node19.patch
./nodejs-patches/bypass-darwin-xcrun-node16.patch
./nodejs-patches/node-npm-build-npm-package-logic.patch
];
}
import (
builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/23.05.tar.gz";
url = "https://github.com/NixOS/nixpkgs/archive/23.11.tar.gz";
}
)
......@@ -2,51 +2,46 @@
let
easy-ps = import ./nix/easy-ps.nix { inherit pkgs; };
purs-packages = import ./purs-packages.nix { inherit pkgs; };
purs-project = import ./nix/purs-project.nix { inherit pkgs; };
build-purs = pkgs.writeShellScriptBin "build-purs" ''
# sometimes bun is broken because of better-sqlite3
fix-bun = pkgs.writeShellScriptBin "fix-bun" ''
#!/usr/bin/env bash
purs compile ${toString purs-project.sourceGlobs} "src/**/*.purs" "test/**/*.purs"
'';
set -e
build = pkgs.writeShellScriptBin "build" ''
cd ./node_modules/better-sqlite3
bun install
'';
compile = pkgs.writeShellScriptBin "compile" ''
#!/usr/bin/env bash
set -e
echo "Installing JS Dependencies"
yarn
#yarn
bun install
bun install --dev
echo "Compiling"
#build-purs
#spago build
#echo "Bundling"
#pulp browserify --skip-compile -t dist/bundle.js --src-path output
#browserify
bun run build
'';
build = pkgs.writeShellScriptBin "build" ''
#!/usr/bin/env bash
set -e
# 0.15
spago bundle-app --main Main --to dist/bundle.js
echo "Bundling"
bun run bundle
'';
build-suggestions = pkgs.writeShellScriptBin "build-suggestions" ''
#!/usr/bin/env bash
set -e
echo "Installing JS Dependencies"
yarn
rm -rf ./output
echo "Compiling"
#build-purs
#spago build
#echo "Bundling"
#pulp browserify --skip-compile -t dist/bundle.js --src-path output
#browserify
# 0.15
spago bundle-app --main Main --to dist/bundle.js --purs-args "--json-errors" | jq -r '.warnings | map(select(.errorCode | test("UnusedDctorExplicitImport|UnusedDctorImport|UnusedDeclaration|UnusedExplicitImport|UnusedImport|UnusedName|UnusedTypeVar"))) | map(select(.filename | test("^.spago") | not)) | map("[\(.filename)::\(.position.startLine)] \(.message)\n \(.suggestion)") | join("\n----------\n")'
echo "Bundling"
bun spago bundle --module Main --outfile dist/bundle.js --purs-args "--json-errors" | jq -r '.warnings | map(select(.errorCode | test("UnusedDctorExplicitImport|UnusedDctorImport|UnusedDeclaration|UnusedExplicitImport|UnusedImport|UnusedName|UnusedTypeVar"))) | map(select(.filename | test("^.spago") | not)) | map("[\(.filename)::\(.position.startLine)] \(.message)\n \(.suggestion)") | join("\n----------\n")'
'';
......@@ -54,15 +49,16 @@ let
#!/usr/bin/env bash
set -e
yarn css
#yarn css
bun run css
'';
serve = pkgs.writeShellScriptBin "serve" ''
#!/usr/bin/env bash
set -e
yarn server
#yarn server
bun run server
'';
......@@ -71,101 +67,74 @@ let
set -e
echo "Build watch"
spago build -w --then browserify
bun spago build -w --then browserify
'';
build-zephyr = pkgs.writeShellScriptBin "build-zephyr" ''
#!/usr/bin/env bash
set -e
spago build --purs-args '--codegen corefn,js'
bun spago build --purs-args '--codegen corefn,js'
zephyr -f Main.main
browserify-zephyr
'';
browserify = pkgs.writeShellScriptBin "browserify" ''
#!/usr/bin/env bash
set -e
pulp browserify --skip-compile -t dist/bundle.js --src-path output
'';
browserify-zephyr = pkgs.writeShellScriptBin "browserify-zephyr" ''
#!/usr/bin/env bash
set -e
pulp browserify --skip-compile -t dist/bundle.js -o dce-output
#purs bundle -o dist/bundle.js -m Main dce-output/**/*.js
'';
minify-bundle = pkgs.writeShellScriptBin "minify-bundle" ''
#!/usr/bin/env bash
set -e
minify dist/bundle.js > dist/bundle.min.js
bun run minify
'';
repl = pkgs.writeShellScriptBin "repl" ''
#!/usr/bin/env bash
spago repl
bun run repl
'';
test-ps = pkgs.writeShellScriptBin "test-ps" ''
#!/usr/bin/env bash
set -e
echo "Compiling"
yarn
#spago build
#build-purs
compile
echo "Testing"
spago -v -x test.dhall test --main Test.Main
# spago -x test.dhall bundle-app --main Test.Main --to dist/test-bundle.js --platform node
# pulp browserify --skip-compile -t dist/bundle.js --src-path output
# pulp test --src-path output --test-path output
#NODE_PATH=output node -e "require('Test.Main').main();"
bun run test
'';
# TODO: Remove this when nixpkgs is updated to newer version (23.05
# has nodejs 20.2.1 and we need >= 20.3.1 for crypto to work)
#nodejs_20_3_1 = pkgs.callPackage ./nix/nodejs-v20.nix {};
in
pkgs.mkShell {
buildInputs = [
easy-ps.purs-0_15_7
easy-ps.psc-package
easy-ps.dhall-json-simple
easy-ps.purs-0_15_15
easy-ps.zephyr
browserify
browserify-zephyr
pkgs.ijq
pkgs.jq
#pkgs.esbuild
pkgs.nodejs
#pkgs.yarn
pkgs.bun
pkgs.sqlite
# scripts
build-css
build-purs
build-suggestions
build-watch
build-zephyr
build
pkgs.ijq
pkgs.jq
compile
fix-bun
minify-bundle
#pkgs.closurecompiler
pkgs.esbuild
pkgs.minify
pkgs.nodejs
#pkgs.nodePackages.purescript-language-server
#pkgs.python # needed for msgpack etc
#nodejs_20_3_1
repl
serve
pkgs.pulp
pkgs.spago
pkgs.yarn
test-ps
];
shellHook = ''
export PURS_IDE_SOURCES='${toString purs-project.unquotedSourceGlobs}'
'';
#shellHook = ''
# export PURS_IDE_SOURCES='${toString purs-project.unquotedSourceGlobs}'
#'';
}
## how to build the project with nix dependencies:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
nix-shell --run repl
cd dist/ && python3 -mhttp.server
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -140,6 +140,12 @@ component = R.memo' $ R.hooksComponent componentName cpt where
then showModal window selector modalEvents
else hideModal window selector
-- | When box is true, show the modal immediately
R.useEffectOnce' $ do
if isVisible
then showModal window selector modalEvents
else hideModal window selector
-- | Behaviors
-- |
let
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment