build: switching environment to use NixOS flakes

This commit is contained in:
Dylan R. E. Moonfire 2023-01-25 20:28:19 -06:00
parent 1e01da5f52
commit 55d812ea89
12 changed files with 145 additions and 40 deletions

3
.envrc
View File

@ -1 +1,2 @@
use asdf
export PATH=$PWD/scripts:$PATH
use flake || use nix

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ node_modules/
build/
dist/
lib/
.direnv/

View File

@ -1,3 +0,0 @@
yarn 1.22.10
nodejs 15.7.0
python 2.7.18 3.9.0

6
commitlint.config.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"body-max-line-length": [0],
},
};

42
flake.lock Normal file
View File

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1674459583,
"narHash": "sha256-L0UZl/u2H3HGsrhN+by42c5kNYeKtdmJiPzIRvEVeiM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1b1f50645af2a70dc93eae18bfd88d330bfbcf7f",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

24
flake.nix Normal file
View File

@ -0,0 +1,24 @@
{
description =
"A framework for publishing Markdown files in a variety of formats.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
buildInputs = [
pkgs.nodejs-16_x
pkgs.nixfmt
pkgs.python39Full
pkgs.yarn
pkgs.nodePackages.lerna
];
};
});
}

View File

@ -5,13 +5,13 @@
"keywords": [
"markdown"
],
"homepage": "https://gitlab.com/mfgames-writing/markdowny#README",
"homepage": "https://src.mfgames.com/mfgames-writing-js/markdowny#README",
"bugs": {
"url": "https://gitlab.com/mfgames-writing/markdowny/issues"
"url": "https://src.mfgames.com/mfgames-writing-js/markdowny/issues"
},
"repository": {
"type": "git",
"url": "https://gitlab.com/mfgames-writing/markdowny.git"
"url": "https://src.mfgames.com/mfgames-writing-js/markdowny.git"
},
"license": "MIT",
"author": {
@ -40,16 +40,6 @@
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"add-commas": "0.0.4",
"lodash": "^4.16.5",
@ -72,8 +62,6 @@
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"barrelsby": "^1.0.2",
"commitizen": "^2.10.1",
"cz-conventional-changelog": "^2.1.0",
"eslint": "^5.3.0",
"eslint-plugin-typescript": "^0.12.0",
"husky": "^0.14.3",
@ -82,26 +70,5 @@
"semantic-release": "^15.9.8",
"sort-package-json": "^1.48.1",
"typescript": "^4.1.3"
},
"release": {
"branch": "master",
"message": "chore(release): v${nextRelease.version}\n\n${nextRelease.notes}",
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/git"
],
"analyzeCommits": [
"@semantic-release/commit-analyzer"
],
"prepare": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
],
"publish": [
"@semantic-release/npm"
],
"success": [],
"fail": []
}
}

25
release.config.js Normal file
View File

@ -0,0 +1,25 @@
module.exports = {
branches: ["main"],
extends: ["@commitlint/config-conventional"],
message:
"chore(release): v${nextRelease.version} [CI SKIP]\n\n${nextRelease.notes}",
plugins: [
[
"@semantic-release/commit-analyzer",
{
preset: "conventionalcommits",
},
],
"@semantic-release/npm",
[
"@semantic-release/exec",
{
prepareCmd: "npm run build",
},
],
"@semantic-release/changelog",
"@semantic-release/git",
],
};

9
scripts/build.sh Executable file
View File

@ -0,0 +1,9 @@
# !/usr/bin/env bash
#mfgames-project:setup@v0.0.0
log() { echo "🚧 $(basename $0): $@"; }
cd $(dirname $(dirname $0))
#mfgames-project:setup
./scripts/setup.sh || exit 1
yarn run build

10
scripts/release.sh Executable file
View File

@ -0,0 +1,10 @@
# !/usr/bin/env bash
#mfgames-project:setup@v0.0.0
log() { echo "🚢 $(basename $0): $@"; }
cd $(dirname $(dirname $0))
#mfgames-project:setup
./scripts/setup.sh || exit 1
yarn run build
semantic-release --repository-url=https://oauth2:$GITLAB_TOKEN@gitlab.com/mfgames-writing/markdowny.git

14
scripts/setup.sh Executable file
View File

@ -0,0 +1,14 @@
# !/usr/bin/env bash
#mfgames-project:setup@v0.0.0
log() { echo "🌱 $(basename $0): $@"; }
cd $(dirname $(dirname $0))
#mfgames-project:setup
if [ -d node_modules ]
then
log "node_modules exists, not installing Yarn packages"
else
log "installing Yarn packages"
yarn install --frozen-lockfile
fi

9
scripts/test.sh Executable file
View File

@ -0,0 +1,9 @@
# !/usr/bin/env bash
#mfgames-project:setup@v0.0.0
log() { echo "🧪 $(basename $0): $@"; }
cd $(dirname $(dirname $0))
#mfgames-project:setup
./scripts/setup.sh || exit 1
npx commitlint --from=$CI_BUILD_BEFORE_SHA