Skip to content

Commit 5a023e5

Browse files
committed
fix: change executable icon and fix release action
1 parent a0d6ee5 commit 5a023e5

File tree

14 files changed

+156
-19
lines changed

14 files changed

+156
-19
lines changed

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"sourceType": "module",
1010
"ecmaVersion": 12
1111
},
12-
"ignorePatterns": ["rollup.config.js", "build", "bin"],
12+
"ignorePatterns": ["rollup.config.js", "*.json", "build", "bin", "scripts"],
1313
"rules": {
1414
"prettier/prettier": "error",
1515
"no-unused-vars": "warn",

.github/workflows/release.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@ name: Release
22
on: [push]
33

44
jobs:
5+
bundle-javascript-file:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: checkout
9+
uses: actions/checkout@v2
10+
- name: setup node
11+
uses: actions/setup-node@v2
12+
with:
13+
node-version: 14
14+
15+
- name: install dependencies
16+
run: npm ci
17+
- name: bundle javascript files
18+
run: npm run build
19+
20+
- name: upload bundled javascript file
21+
uses: actions/upload-artifact@v2
22+
with:
23+
name: cithak-bundle
24+
path: build/file/cithak.js
25+
retention-days: 1
26+
527
build-and-release:
28+
needs: ['bundle-javascript-file']
629
runs-on: ${{ matrix.os }}
730
strategy:
831
matrix:
@@ -15,13 +38,27 @@ jobs:
1538
uses: actions/setup-node@v2
1639
with:
1740
node-version: 14
41+
42+
- name: download javascript bundle file
43+
uses: actions/download-artifact@v2
44+
with:
45+
name: cithak-bundle
46+
path: build/file/
47+
1848
- name: install dependencies
1949
run: npm ci
2050
- name: install pkg
2151
run: npm install -D pkg
52+
- name: install resourcehacker
53+
if: ${{ matrix.os == 'windows-latest' }}
54+
run: npm install -D node-resourcehacker
2255

23-
- name: build
56+
- name: build executable
2457
run: npm run build-${{ matrix.os }}
58+
- name: change executable icon
59+
if: ${{ matrix.os == 'windows-latest' }}
60+
run: node scripts/setIcon.js
61+
2562
- name: add to release
2663
uses: softprops/action-gh-release@v1
2764
with:

.npmignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ docs
88
test
99
images
1010
build/bin
11+
scripts
1112
CHANGELOG.md
12-
README.md
1313
CONTRIBUTING.md
1414
.prettierignore
1515
.prettierrc

.prettierignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ src/helpers/info.js
22
test/**/*
33
rollup.config.js
44
build
5-
bin
5+
bin
6+
*.json

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cithak
22

3-
![icon](./icon.svg)
3+
![icon](./images/icon.svg)
44

55
---
66

icon.ico

5.3 KB
Binary file not shown.
File renamed without changes.

package-lock.json

Lines changed: 78 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
22
"name": "cithak",
3-
"version": "1.3.1-beta",
3+
"version": "1.3.2-beta",
44
"description": "Simple, Secure yet Powerful template manager",
55
"main": "build/file/cithak.js",
66
"scripts": {
77
"build": "NODE_ENV=production rollup -c",
88
"publish": "npm run build",
99
"dev": "rollup -cw",
10-
"build-ubuntu-latest": "pkg -t linux -c ./package.json -o ./build/bin/cithak-linux ./cithak.js",
11-
"build-windows-latest": "pkg -t win -c ./package.json -o ./build/bin/cithak-win ./cithak.js",
12-
"build-macos-latest": "pkg -t mac -c ./package.json -o ./build/bin/cithak-mac ./cithak.js"
10+
"build-ubuntu-latest": "pkg -t linux -o ./build/bin/cithak-linux ./cithak.js",
11+
"build-windows-latest": "pkg -t win -o ./build/bin/cithak-win ./cithak.js",
12+
"build-macos-latest": "pkg -t mac -o ./build/bin/cithak-mac ./cithak.js"
1313
},
1414
"bin": {
1515
"cithak": "bin/cithak",
1616
"cth": "bin/cithak"
1717
},
18-
"pkg": {
19-
"assets": "./package.json"
20-
},
2118
"publishConfig": {
2219
"access": "public"
2320
},
@@ -52,6 +49,7 @@
5249
},
5350
"devDependencies": {
5451
"@rollup/plugin-eslint": "^8.0.1",
52+
"@rollup/plugin-json": "^4.1.0",
5553
"eslint": "^7.32.0",
5654
"eslint-config-airbnb-base": "^14.2.1",
5755
"eslint-config-node": "^4.1.0",

rollup.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import eslint from '@rollup/plugin-eslint'
2+
import json from '@rollup/plugin-json'
23
import { terser } from 'rollup-plugin-terser'
34

45
const production = process.env.NODE_ENV === 'production'
@@ -18,6 +19,7 @@ const config = {
1819
'shelljs'
1920
],
2021
plugins: [
22+
json(),
2123
eslint(),
2224
production && terser()
2325
],

scripts/setIcon.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const resourceHacker = require('node-resourcehacker')
2+
3+
// Use the beta release of Resource Hacker.
4+
process.env.SOURCE_RESOURCE_HACKER =
5+
'http://www.angusj.com/resourcehacker/resource_hacker.zip'
6+
7+
resourceHacker(
8+
{
9+
operation: 'addoverwrite',
10+
input: '../build/bin/cithak-win.exe',
11+
output: '../build/bin/cithak-win.exe',
12+
resource: '../icon.ico',
13+
resourceType: 'ICONGROUP',
14+
resourceName: '1',
15+
},
16+
(err) => {
17+
if (err) {
18+
console.error(err)
19+
return
20+
}
21+
22+
console.log('Done')
23+
}
24+
)

src/helpers/info.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import chalk from 'chalk'
2-
import fs from 'fs-extra'
3-
import * as paths from './path'
2+
import pkg from '../../package.json'
43

5-
const VERSION = fs.readJSONSync(paths.PACKAGE_JSON).version
4+
const VERSION = pkg.version
65

76
export const stuck = `
87
${chalk.blue.bold('INFO!')} For more info please type ${chalk.yellow('cth --help')}

src/helpers/path.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { join } from 'path'
22
import { homedir } from 'os'
33

4-
export const PACKAGE_JSON = join(__dirname, '../../package.json')
54
export const STORAGE = join(homedir(), '.cithak-templates-storage/templates')
65
export const DATA_JSON = join(homedir(), '.cithak-templates-storage/data.json')
76
export const state = {

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import arg from 'arg'
22
import fs from 'fs-extra'
3+
import pkg from '../package.json'
34

45
import * as pathHelper from './helpers/path'
56
import * as errorHelper from './helpers/error'
@@ -101,7 +102,7 @@ exports.cli = (args) => {
101102
if (options.err) return
102103

103104
if (options.needVersion) {
104-
console.log(`v${fs.readJSONSync(pathHelper.PACKAGE_JSON).version}`)
105+
console.log(`v${pkg.version}`)
105106
} else if (options.action === 'help' || options.needHelp) {
106107
actions.help(options)
107108
} else if (actions[options.action]) {

0 commit comments

Comments
 (0)