Clean up dev workflow a bit
This commit is contained in:
parent
689afa04e8
commit
af062715d9
|
@ -6,6 +6,7 @@
|
|||
(pug-mode
|
||||
(tab-width . 2))
|
||||
(scss-mode
|
||||
(css-indent-offset . 2)))
|
||||
(css-indent-offset . 2))
|
||||
(auto-mode-alist . (("update-lockfile" . sh-mode))))
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
"posthtml-favicons": {
|
||||
"root": "src",
|
||||
"outDir": "./dist/browser/",
|
||||
"outDir": "./dist/",
|
||||
"configuration": {
|
||||
"appName": "tlater.net",
|
||||
"appShortName": "tlater.net",
|
||||
|
|
10
README.md
10
README.md
|
@ -4,10 +4,12 @@ Website templates bundled with parcel.
|
|||
|
||||
## Updating
|
||||
|
||||
When adding/removing packages from `package.json`, the corresponding
|
||||
`package-lock.json` needs to be updated. Use `nix/update-lockfile` for
|
||||
this.
|
||||
|
||||
When ignoring semver is desired, use:
|
||||
|
||||
```sh
|
||||
npm-check-updates -u
|
||||
rm node_modules # Yeah, npm gets confused if it can't write here
|
||||
npm install --package-lock-only
|
||||
rm -rf node_modules
|
||||
direnv reload
|
||||
```
|
||||
|
|
46
flake.nix
46
flake.nix
|
@ -25,55 +25,15 @@
|
|||
})
|
||||
];
|
||||
pkgs = import nixpkgs {inherit system overlays;};
|
||||
package = import ./nix/package.nix {inherit self nix-filter pkgs;};
|
||||
in {
|
||||
packages.${system} = rec {
|
||||
tlaternet-templates = pkgs.npmlock2nix.build {
|
||||
src = pkgs.lib.cleanSource self;
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
util-linux
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
cp -r dist $out/
|
||||
'';
|
||||
|
||||
node_modules_attrs = {
|
||||
buildInputs = with pkgs; [
|
||||
pkg-config
|
||||
python3
|
||||
vips
|
||||
glib
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
tlaternet-templates = package.package;
|
||||
default = tlaternet-templates;
|
||||
};
|
||||
|
||||
devShells.${system} = {
|
||||
default = pkgs.npmlock2nix.shell {
|
||||
src = nix-filter.lib {
|
||||
root = self;
|
||||
include = [
|
||||
"package.json"
|
||||
"package-lock.json"
|
||||
];
|
||||
};
|
||||
|
||||
buildInputs = with pkgs.nodePackages; [
|
||||
npm-check-updates
|
||||
];
|
||||
|
||||
node_modules_attrs = {
|
||||
buildInputs = with pkgs; [
|
||||
pkg-config
|
||||
python3
|
||||
vips
|
||||
glib
|
||||
];
|
||||
};
|
||||
};
|
||||
default = package.shell;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
44
nix/package.nix
Normal file
44
nix/package.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
self,
|
||||
nix-filter,
|
||||
pkgs,
|
||||
}: let
|
||||
node_modules_attrs = {
|
||||
# Dependencies that should be available in the node build
|
||||
buildInputs = with pkgs; [
|
||||
pkg-config
|
||||
python3
|
||||
vips
|
||||
glib
|
||||
];
|
||||
};
|
||||
|
||||
# Dependencies that should be available outside of the node build
|
||||
buildInputs = with pkgs; [
|
||||
util-linux
|
||||
];
|
||||
in {
|
||||
package = pkgs.npmlock2nix.build {
|
||||
inherit buildInputs node_modules_attrs;
|
||||
|
||||
src = pkgs.lib.cleanSource self;
|
||||
|
||||
buildCommands = ["npm run build-dist"];
|
||||
|
||||
installPhase = ''
|
||||
cp -r dist $out/
|
||||
'';
|
||||
};
|
||||
|
||||
shell = pkgs.npmlock2nix.shell {
|
||||
inherit buildInputs node_modules_attrs;
|
||||
|
||||
src = nix-filter.lib {
|
||||
root = self;
|
||||
include = [
|
||||
"package.json"
|
||||
"package-lock.json"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
17
nix/update-lockfile
Executable file
17
nix/update-lockfile
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env -S nix run 'github:clhodapp/nix-runner/32a984cfa14e740a34d14fad16fc479dec72bf07'
|
||||
#!pure
|
||||
#!package nixpkgs#bash
|
||||
#!package nixpkgs#coreutils
|
||||
#!package nixpkgs#direnv
|
||||
#!package nixpkgs#git
|
||||
#!package nixpkgs#nodejs-14_x
|
||||
#!command bash
|
||||
# shellcheck shell=bash
|
||||
|
||||
set -eu
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
unlink node_modules
|
||||
npm install --package-lock-only
|
||||
rm -rf node_modules
|
||||
direnv reload
|
2114
package-lock.json
generated
2114
package-lock.json
generated
File diff suppressed because it is too large
Load diff
25
package.json
25
package.json
|
@ -34,23 +34,16 @@
|
|||
"sass": "^1.53.0",
|
||||
"typescript": "^4.7.4",
|
||||
"typescript-language-server": "^0.11.2",
|
||||
"vscode-langservers-extracted": "^4.2.1"
|
||||
"vscode-langservers-extracted": "^4.2.1",
|
||||
"npm-check-updates": "^16.0.5"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "parcel build --no-autoinstall src/index.html && rename '.html' '.html.hbs' dist/browser/*.html",
|
||||
"serve": "parcel serve --no-autoinstall src/index.html",
|
||||
"watch": "parcel watch --no-autoinstall src/index.html",
|
||||
"build-dist": "parcel build --no-cache --no-autoinstall src/index.html && rename '.html' '.html.hbs' dist/browser/*.html"
|
||||
"build": "parcel build --no-autoinstall",
|
||||
"serve": "parcel serve --no-autoinstall",
|
||||
"watch": "parcel watch --no-autoinstall",
|
||||
"build-dist": "parcel build --no-cache --no-autoinstall && rename '.html' '.html.hbs' dist/*.html",
|
||||
"check": "tsc --noEmit"
|
||||
},
|
||||
"targets": {
|
||||
"browser": {
|
||||
"engines": {
|
||||
"browsers": [
|
||||
">1%",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
"distDir": "dist"
|
||||
}
|
||||
}
|
||||
"source": "src/index.html",
|
||||
"browserslist": "> 1%, not dead"
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"strictNullChecks": true,
|
||||
"strictPropertyInitialization": true,
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react"
|
||||
"jsx": "react",
|
||||
"isolatedModules": true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue