Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion angular/dev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.nodejs_20
pkgs.nodePackages.eslint
pkgs.nodePackages.prettier
];
# Sets environment variables in the workspace
env = {};
env = {
NG_CLI_ANALYTICS = "ci";
};
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"angular.ng-template"
"esbenp.prettier-vscode"
"dbaeumer.vscode-eslint"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
Expand Down
29 changes: 28 additions & 1 deletion angular/idx-template.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@
packages = [ pkgs.nodejs_20 ];
bootstrap = ''
npx --prefer-offline -y @angular/cli new --skip-git --defaults --skip-install --directory "$WS_NAME" "$WS_NAME"
cd "$WS_NAME"
npm install eslint@^8.56.0 prettier@^3.2.5 eslint-config-prettier@^9.1.0 @typescript-eslint/parser@^7.0.0 @typescript-eslint/eslint-plugin@^7.0.0 @angular-eslint/builder@^17.0.0 @angular-eslint/eslint-plugin@^17.0.0 @angular-eslint/eslint-plugin-template@^17.0.0 @angular-eslint/template-parser@^17.0.0 --save-dev
echo '{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@angular-eslint/recommended",
"prettier"
],
"rules": {}
}' > .eslintrc.json
node -e '
const fs = require("fs");
const pkg = JSON.parse(fs.readFileSync("package.json", "utf-8"));
pkg.scripts = {
...pkg.scripts,
"lint": "ng lint",
"format": "prettier --write ."
};
fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2));
'
cd ..
mkdir "$WS_NAME"/.idx
cp ${./dev.nix} "$WS_NAME"/.idx/dev.nix && chmod +w "$WS_NAME"/.idx/dev.nix
mv "$WS_NAME" "$out"
Expand All @@ -16,4 +43,4 @@

(cd "$out"; npm install --package-lock-only --ignore-scripts)
'';
}
}