aberlaas 2.11.0 → 2.13.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.
Files changed (2) hide show
  1. package/lib/main.js +40 -14
  2. package/package.json +20 -18
package/lib/main.js CHANGED
@@ -1,25 +1,33 @@
1
1
  import path from 'path';
2
2
  import minimist from 'minimist';
3
- import { absolute, consoleError, env, exit, firostImport } from 'firost';
3
+ import {
4
+ absolute,
5
+ consoleError,
6
+ consoleInfo,
7
+ env,
8
+ exit,
9
+ firostImport,
10
+ packageRoot,
11
+ readJson,
12
+ } from 'firost';
4
13
  import { _ } from 'golgoth';
5
14
 
6
15
  export default {
16
+ availableCommands: {
17
+ ci: 'aberlaas-ci',
18
+ compress: 'aberlaas-compress',
19
+ init: 'aberlaas-init',
20
+ lint: 'aberlaas-lint',
21
+ precommit: 'aberlaas-precommit',
22
+ readme: 'aberlaas-readme',
23
+ setup: 'aberlaas-setup',
24
+ test: 'aberlaas-test',
25
+ },
7
26
  async getCommand(commandName) {
8
- const mapping = {
9
- ci: 'aberlaas-ci',
10
- compress: 'aberlaas-compress',
11
- init: 'aberlaas-init',
12
- lint: 'aberlaas-lint',
13
- precommit: 'aberlaas-precommit',
14
- readme: 'aberlaas-readme',
15
- setup: 'aberlaas-setup',
16
- test: 'aberlaas-test',
17
- };
18
- const commandModuleName = mapping[commandName];
27
+ const commandModuleName = this.availableCommands[commandName];
19
28
  if (!commandModuleName) {
20
29
  return false;
21
30
  }
22
-
23
31
  return await firostImport(commandModuleName);
24
32
  },
25
33
  /**
@@ -57,11 +65,15 @@ export default {
57
65
  boolean: true,
58
66
  });
59
67
 
60
- const commandName = args._[0];
68
+ const commandName = args._[0] || '';
61
69
  const command = await this.getCommand(commandName);
62
70
 
63
71
  if (!command) {
64
72
  this.__consoleError(`Unknown command ${commandName}`);
73
+ this.__consoleInfo('Available commands:');
74
+ _.each(this.availableCommands, (value, key) => {
75
+ this.__consoleInfo(`- ${key}`);
76
+ });
65
77
  this.__exit(1);
66
78
  return;
67
79
  }
@@ -73,6 +85,16 @@ export default {
73
85
  args._ = this.convertFilepathsToAbsolute(args._);
74
86
 
75
87
  try {
88
+ // We need to set ABERLAAS_VERSION for "aberlaas init" as we need to
89
+ // hardcode the currently used aberlaas version in the package.json and
90
+ // there is no reliable way to get it from the init command
91
+ if (commandName == 'init') {
92
+ const packagePath = absolute(packageRoot(), './package.json');
93
+ const packageContent = await readJson(packagePath);
94
+ const packageVersion = packageContent.version;
95
+ this.__setEnv('ABERLAAS_VERSION', packageVersion);
96
+ }
97
+
76
98
  await command.run(args);
77
99
  } catch (err) {
78
100
  this.__consoleError(err.message);
@@ -80,6 +102,10 @@ export default {
80
102
  }
81
103
  },
82
104
  __env: env,
105
+ __setEnv(key, value) {
106
+ process.env[key] = value;
107
+ },
83
108
  __consoleError: consoleError,
109
+ __consoleInfo: consoleInfo,
84
110
  __exit: exit,
85
111
  };
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "aberlaas",
3
- "type": "module",
3
+ "version": "2.13.0",
4
+ "author": "Tim Carry (@pixelastic)",
4
5
  "description": "Scaffold your JavaScript projects with tests, lint and release scripts",
5
- "version": "2.11.0",
6
+ "keywords": [],
6
7
  "repository": "pixelastic/aberlaas",
7
8
  "homepage": "https://projects.pixelastic.com/aberlaas/",
8
- "author": "Tim Carry (@pixelastic)",
9
+ "type": "module",
10
+ "sideEffects": false,
9
11
  "license": "MIT",
12
+ "engines": {
13
+ "node": ">=18.18.0"
14
+ },
10
15
  "files": [
11
16
  "bin/",
12
17
  "commands/ci/*.js",
@@ -35,26 +40,23 @@
35
40
  "main": "./lib/main.js",
36
41
  "bin": "bin/aberlaas.js",
37
42
  "dependencies": {
38
- "aberlaas-ci": "^2.11.0",
39
- "aberlaas-compress": "^2.10.0",
40
- "aberlaas-helper": "^2.10.0",
41
- "aberlaas-init": "^2.10.0",
42
- "aberlaas-lint": "^2.11.0",
43
- "aberlaas-precommit": "^2.10.0",
44
- "aberlaas-readme": "^2.10.0",
45
- "aberlaas-setup": "^2.11.0",
46
- "aberlaas-test": "^2.10.0",
47
- "aberlaas-versions": "^2.10.0",
43
+ "aberlaas-ci": "^2.13.0",
44
+ "aberlaas-compress": "^2.13.0",
45
+ "aberlaas-helper": "^2.13.0",
46
+ "aberlaas-init": "^2.13.0",
47
+ "aberlaas-lint": "^2.13.0",
48
+ "aberlaas-precommit": "^2.13.0",
49
+ "aberlaas-readme": "^2.13.0",
50
+ "aberlaas-setup": "^2.13.0",
51
+ "aberlaas-test": "^2.13.0",
52
+ "aberlaas-versions": "^2.13.0",
48
53
  "dedent": "1.5.3",
49
- "firost": "4.3.0",
54
+ "firost": "4.8.0",
50
55
  "gilmore": "1.0.0",
51
56
  "golgoth": "2.4.0",
52
57
  "minimist": "1.2.8",
53
58
  "std-mocks": "2.0.0"
54
59
  },
55
- "engines": {
56
- "node": ">=18.18.0"
57
- },
58
60
  "scripts": {
59
61
  "build": "../../scripts/local/build",
60
62
  "build:prod": "../../scripts/local/build-prod",
@@ -70,5 +72,5 @@
70
72
  "lint": "../../scripts/local/lint",
71
73
  "lint:fix": "../../scripts/local/lint-fix"
72
74
  },
73
- "gitHead": "ae26d72ed4782af9545d664b65c7eb5305a88335"
75
+ "gitHead": "a8a1ee486fa1faeac6b7a524e7a6e41d5503dbc0"
74
76
  }