diff --git a/.envrc b/.envrc index a63eb96..5816063 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ -use asdf +export PATH=$PWD/scripts:$PATH +use flake || use nix diff --git a/.gitignore b/.gitignore index b3ac4cd..c531260 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ node_modules/ build/ dist/ lib/ +.direnv/ diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index 19a1fd1..0000000 --- a/.tool-versions +++ /dev/null @@ -1,3 +0,0 @@ -yarn 1.22.10 -nodejs 15.7.0 -python 2.7.18 3.9.0 diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..1080a13 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ["@commitlint/config-conventional"], + rules: { + "body-max-line-length": [0], + }, +}; diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e819c71 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..693034a --- /dev/null +++ b/flake.nix @@ -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 + ]; + }; + }); +} diff --git a/package.json b/package.json index 2736f29..87a96c7 100644 --- a/package.json +++ b/package.json @@ -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": [] } } diff --git a/release.config.js b/release.config.js new file mode 100644 index 0000000..7e45c4d --- /dev/null +++ b/release.config.js @@ -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", + ], +}; diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..627cbed --- /dev/null +++ b/scripts/build.sh @@ -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 diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..cc34fe2 --- /dev/null +++ b/scripts/release.sh @@ -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 diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..3a67cfb --- /dev/null +++ b/scripts/setup.sh @@ -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 diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..b703700 --- /dev/null +++ b/scripts/test.sh @@ -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