@frakjs/frak 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.prettierrc CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "tabSize": 4,
2
+ "tabWidth": 4,
3
3
  "singleQuote": true,
4
4
  "semi": true,
5
5
  "trailingComma": "es5",
package/bin/frak.js CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { execSync, spawn } from 'node:child_process';
4
- import { writeFileSync, existsSync } from 'node:fs';
4
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
5
5
  import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
6
7
  import * as ansi from '../src/ansi.js';
7
8
  import * as cli from '../src/cli.js';
8
9
  import config, { load as loadConfig } from '../src/config.js';
@@ -14,6 +15,9 @@ import * as rsync from '../src/rsync.js';
14
15
  import * as ssh from '../src/ssh.js';
15
16
  import * as date from '../src/date.js';
16
17
 
18
+ const __filename = fileURLToPath(import.meta.url);
19
+ const __dirname = path.dirname(__filename);
20
+
17
21
  /**
18
22
  * Try to load config. If it fails, print error message in red.
19
23
  *
@@ -39,6 +43,19 @@ function usage() {
39
43
  console.log(' pull Download the remote file(s)');
40
44
  console.log(' push Deploy website via rsync');
41
45
  console.log(' backups:list List backups on the server');
46
+ console.log('');
47
+ console.log('Options:');
48
+ console.log(' --help Display the command usage');
49
+ console.log(' --version Show the current version');
50
+ }
51
+
52
+ /**
53
+ * Print the current version
54
+ */
55
+ function version() {
56
+ const { version } = JSON.parse(readFileSync(path.join(__dirname, '../package.json')));
57
+
58
+ console.log('Version:', version);
42
59
  }
43
60
 
44
61
  /**
@@ -225,6 +242,8 @@ async function main(args) {
225
242
  });
226
243
 
227
244
  table.print();
245
+ } else if (command === '--version' || command === 'version') {
246
+ version();
228
247
  } else {
229
248
  usage();
230
249
 
package/package.json CHANGED
@@ -1,40 +1,40 @@
1
1
  {
2
- "name": "@frakjs/frak",
3
- "version": "0.3.0",
4
- "description": "A commandline deployment tool for syncing files to remote servers.",
5
- "main": "index.js",
6
- "engines": {
7
- "node": ">=12"
8
- },
9
- "bin": {
10
- "frak": "bin/frak.js"
11
- },
12
- "type": "module",
13
- "scripts": {
14
- "eslint": "eslint",
15
- "test": "node --experimental-test-coverage tests/index.test.js"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/frakjs/frak.git"
20
- },
21
- "keywords": [
22
- "rsync",
23
- "deployment",
24
- "ssh"
25
- ],
26
- "author": "Frank Strube <contact@frakjs.com>",
27
- "license": "MIT",
28
- "bugs": {
29
- "url": "https://github.com/frakjs/frak/issues"
30
- },
31
- "homepage": "https://github.com/frakjs/frak#readme",
32
- "devDependencies": {
33
- "@eslint/js": "^9.33.0",
34
- "eslint": "^9.33.0",
35
- "globals": "^16.3.0"
36
- },
37
- "dependencies": {
38
- "yaml": "^1.10.0"
39
- }
2
+ "name": "@frakjs/frak",
3
+ "version": "0.4.0",
4
+ "description": "A commandline deployment tool for syncing files to remote servers.",
5
+ "main": "index.js",
6
+ "engines": {
7
+ "node": ">=12"
8
+ },
9
+ "bin": {
10
+ "frak": "bin/frak.js"
11
+ },
12
+ "type": "module",
13
+ "scripts": {
14
+ "eslint": "eslint",
15
+ "test": "node --experimental-test-coverage tests/index.test.js"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/frakjs/frak.git"
20
+ },
21
+ "keywords": [
22
+ "rsync",
23
+ "deployment",
24
+ "ssh"
25
+ ],
26
+ "author": "Frank Strube <contact@frakjs.com>",
27
+ "license": "MIT",
28
+ "bugs": {
29
+ "url": "https://github.com/frakjs/frak/issues"
30
+ },
31
+ "homepage": "https://github.com/frakjs/frak#readme",
32
+ "devDependencies": {
33
+ "@eslint/js": "^9.33.0",
34
+ "eslint": "^9.33.0",
35
+ "globals": "^16.3.0"
36
+ },
37
+ "dependencies": {
38
+ "yaml": "^1.10.0"
39
+ }
40
40
  }
package/src/config.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
- import * as yaml from 'yaml';
3
+ import yaml from 'yaml';
4
4
 
5
5
  // Cached config object. The config is stored in here so it can
6
6
  // be loaded once and imported across all modules.