Skip to content

Commit

Permalink
feat: add last commit info to banner
Browse files Browse the repository at this point in the history
  • Loading branch information
NateScarlet committed Feb 24, 2021
1 parent ff2add0 commit 404023e
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,8 @@ build/

/lib/validation.py

# Node packages
node_modules

#worktree
/docs
28 changes: 28 additions & 0 deletions .versionrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const URL = "https://github.com/WuLiFang/Nuke";

/**
* @type {import("standard-version").Options}
* @link https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/master/versions/2.1.0/README.md#compareurlformat-string
*/
module.exports = {
types: [
{ type: "feat", section: "Features" },
{ type: "fix", section: "Bug Fixes" },
{ type: "chore", hidden: true },
{ type: "docs", hidden: true },
{ type: "style", hidden: true },
{ type: "refactor", hidden: true },
{ type: "perf", section: "Performance" },
{ type: "test", hidden: true },
],
commitUrlFormat: `${URL}/commit/{{hash}}`,
compareUrlFormat: `${URL}/compare/{{previousTag}}...{{currentTag}}`,
issueUrlFormat: `${URL}/issues/{{id}}`,
userUrlFormat: `https://github.com//{{user}}`,
bumpFiles: [
{
filename: "lib/__version__.py",
updater: "scripts/python-version-updater.js",
},
],
};
4 changes: 0 additions & 4 deletions lib/__about__.py

This file was deleted.

20 changes: 20 additions & 0 deletions lib/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding=UTF-8 -*-
# Code generated by scripts\python-version-updater.js, DO NOT EDIT
"""
version info.
"""

from __future__ import (absolute_import, division, print_function,
unicode_literals)

from datetime import datetime

VERSION = '0.20.14'
RELEASE_DATE = datetime.fromtimestamp(1614134854)
LAST_GIT_COMMIT_DESCRIBE = 'v0.20.13-2-gff2add0'
LAST_GIT_COMMIT_HASH = 'ff2add0f6cc751d66ca65eb2d047520b890b8f89'
LAST_GIT_COMMIT_AUTHOR_NAME = 'NateScarlet'
LAST_GIT_COMMIT_AUTHOR_EMAIL = 'NateScarlet@Gmail.com'
LAST_GIT_COMMIT_AUTHOR_DATE = datetime.fromtimestamp(1614068255)
LAST_GIT_COMMIT_SUBJECT = 'docs: update README.md'
LAST_GIT_COMMIT_BODY = ''
1 change: 0 additions & 1 deletion lib/comp/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import nuke
from jinja2 import Environment, FileSystemLoader

import __about__
from comp.__main__ import __path__
from comp.config import (IGNORE_EXISTED, MULTI_THREADING, START_MESSAGE,
BatchCompConfig)
Expand Down
4 changes: 2 additions & 2 deletions lib/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from Qt.QtWidgets import QFileDialog

import wlf.config
from __about__ import __version__
import __version__


class Config(wlf.config.Config):
Expand Down Expand Up @@ -99,7 +99,7 @@ def _set_config(k, v):
self.reset_status_bar,
)
self._config = Config()
self.labelVersion.setText('v{}'.format(__version__))
self.labelVersion.setText('v{}'.format(__version__.VERSION))
self.setWindowTitle(u'空文件夹扫描')
self.resize(500, 600)

Expand Down
Binary file modified lib/validation.py.gpg
Binary file not shown.
Binary file modified lib/validation.pyc
Binary file not shown.
36 changes: 36 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 65 additions & 0 deletions scripts/python-version-updater.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const { execSync, exec } = require("child_process");
const { relative, dirname } = require("path");

const workspaceFolder = dirname(__dirname);

/**
*
* @param {string} command
* @returns {string}
*/
function shell(command) {
return execSync(command).toString().trimEnd();
}

/**
*
* @param {string} text
* @return {string}
*/
function quotePython(text) {
return text.replace(/\\/, "\\\\").replace(/'/g, `\\'`);
}

/**
* @type {{
* readVersion: (content: string) => string,
* writeVersion: (content: string, version: string) => string,
* }}
* @link https://github.com/conventional-changelog/standard-version#custom-updaters
*/
module.exports = {
readVersion(content) {
return /VERSION = '(.+)'/.exec(content)[1];
},
writeVersion(content, version) {
return `\
# -*- coding=UTF-8 -*-
# Code generated by ${relative(workspaceFolder, __filename)}, DO NOT EDIT
"""
version info.
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from datetime import datetime
VERSION = '${version}'
RELEASE_DATE = datetime.fromtimestamp(${(Date.now() / 1e3).toFixed()})
LAST_GIT_COMMIT_DESCRIBE = '${shell("git describe --always --match v*.*.*")}'
LAST_GIT_COMMIT_HASH = '${shell("git log -1 --pretty=%H")}'
LAST_GIT_COMMIT_AUTHOR_NAME = '${quotePython(
shell('git log -1 "--pretty=%an"')
)}'
LAST_GIT_COMMIT_AUTHOR_EMAIL = '${quotePython(
shell('git log -1 "--pretty=%ae"')
)}'
LAST_GIT_COMMIT_AUTHOR_DATE = datetime.fromtimestamp(${shell(
'git log -1 "--pretty=%at"'
)})
LAST_GIT_COMMIT_SUBJECT = '${quotePython(shell('git log -1 "--pretty=%s'))}'
LAST_GIT_COMMIT_BODY = '${quotePython(shell('git log -1 "--pretty=%b'))}'
`;
},
};
11 changes: 11 additions & 0 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "CommonJS",
"target": "ES2018",
"forceConsistentCasingInFileNames": true,
"types": ["node"],
"noEmit": true,
"allowJs": true
},
"include": ["**/*.js", "**/*.ts"]
}

0 comments on commit 404023e

Please sign in to comment.