aberlaas 2.19.0 → 2.20.1

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/README.md CHANGED
@@ -1,14 +1,13 @@
1
1
  <!--
2
- This page was automatically generated by aberlaas readme.
3
- DO NOT EDIT IT MANUALLY.
2
+ This file was automatically generated by 'aberlaas readme' from .README.template.md
3
+ DO NOT EDIT MANUALLY
4
4
  -->
5
-
6
5
  # aberlaas
7
6
 
8
7
  <div class="lead">Scaffold your JavaScript projects with consistent config for tests, lint, release and CI.</div>
9
8
 
10
9
  `aberlaas` is a wrapper around Jest, ESLint, Prettier, etc and their plugins so
11
- you only install one package in your `devDependencies` instead of dozens.
10
+ you only install one package in your `devDependencies` instead of dozens.
12
11
 
13
12
  I created this module because I got tired of copy-pasting the same configuration
14
13
  files from project to project. With one _meta_ module to handle all the tooling,
package/bin/aberlaas.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import aberlaas from '../lib/main.js';
2
+ import { run } from '../lib/main.js';
3
3
 
4
4
  (async () => {
5
- await aberlaas.run(process.argv.slice(2));
5
+ await run(process.argv.slice(2));
6
6
  })();
package/lib/main.js CHANGED
@@ -1,111 +1,71 @@
1
- import path from 'node:path';
2
- import minimist from 'minimist';
3
- import {
4
- absolute,
5
- consoleError,
6
- consoleInfo,
7
- env,
8
- exit,
9
- firostImport,
10
- packageRoot,
11
- readJson,
12
- } from 'firost';
13
1
  import { _ } from 'golgoth';
2
+ import { consoleError, consoleInfo, env, exit, firostImport } from 'firost';
3
+ import minimist from 'minimist';
14
4
 
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
- },
26
- async getCommand(commandName) {
27
- const commandModuleName = this.availableCommands[commandName];
28
- if (!commandModuleName) {
29
- return false;
30
- }
31
- return await firostImport(commandModuleName);
32
- },
33
- /**
34
- * Converts a list of filepaths to absolute filepaths
35
- * Note: We want to be able to call commands like "aberlaas lint" from the
36
- * workspace root or any child workspace. We also want to be able to use
37
- * relative or absolute filepaths as arguments.
38
- * Yarn always sets INIT_CWD to the directory where the command was called,
39
- * but because scripts in child workspaces are actually calling scripts in the
40
- * root workspace, through the g: syntax, that value is overwritten. This is
41
- * why we save the original calling directory in ABERLAAS_CWD, in our
42
- * package.json script definitions and use that value if available.
43
- * @param {Array} filepaths Array of filepaths
44
- * @returns {Array} Array of absolute filepaths
45
- */
46
- convertFilepathsToAbsolute(filepaths) {
47
- const callingDirectory =
48
- this.__env('ABERLAAS_CWD') || this.__env('INIT_CWD');
49
- return _.map(filepaths, (inputFilepath) => {
50
- const filepath =
51
- inputFilepath[0] == '/'
52
- ? inputFilepath
53
- : path.resolve(callingDirectory, inputFilepath);
5
+ const availableCommands = {
6
+ ci: 'aberlaas-ci',
7
+ compress: 'aberlaas-compress',
8
+ init: 'aberlaas-init',
9
+ lint: 'aberlaas-lint',
10
+ precommit: 'aberlaas-precommit',
11
+ readme: 'aberlaas-readme',
12
+ release: 'aberlaas-release',
13
+ setup: 'aberlaas-setup',
14
+ test: 'aberlaas-test',
54
15
 
55
- return absolute(filepath);
56
- });
57
- },
58
- /**
59
- * Run the command specified on the command-line, along with specific
60
- * arguments
61
- * @param {Array} rawArgs CLI args
62
- */
63
- async run(rawArgs) {
64
- const args = minimist(rawArgs, {
65
- boolean: true,
66
- });
16
+ // Only used internally, for tests
17
+ debug: 'aberlaas-helper',
18
+ };
67
19
 
68
- const commandName = args._[0] || '';
69
- const command = await this.getCommand(commandName);
20
+ export let __;
70
21
 
71
- if (!command) {
72
- this.__consoleError(`Unknown command ${commandName}`);
73
- this.__consoleInfo('Available commands:');
74
- _.each(this.availableCommands, (value, key) => {
75
- this.__consoleInfo(`- ${key}`);
76
- });
77
- this.__exit(1);
78
- return;
79
- }
22
+ /**
23
+ * Run the command specified on the command-line, along with specific
24
+ * arguments
25
+ * @param {Array} rawArgs CLI args
26
+ */
27
+ export async function run(rawArgs) {
28
+ const args = minimist(rawArgs, {
29
+ boolean: true,
30
+ });
80
31
 
81
- // Remove the initial method from args passed to the command
82
- args._ = _.drop(args._, 1);
32
+ const commandName = args._[0] || '';
33
+ const command = await __.getCommand(commandName);
83
34
 
84
- // Make all filepaths absolute
85
- args._ = this.convertFilepathsToAbsolute(args._);
35
+ if (!command) {
36
+ __.consoleError(`Unknown command ${commandName}`);
37
+ __.consoleInfo('Available commands:');
38
+ _.each(availableCommands, (value, key) => {
39
+ __.consoleInfo(`- ${key}`);
40
+ });
41
+ __.exit(1);
42
+ return;
43
+ }
44
+
45
+ // Remove the initial method from args passed to the command
46
+ args._ = _.drop(args._, 1);
86
47
 
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
- }
48
+ try {
49
+ await command.run(args);
50
+ } catch (err) {
51
+ __.consoleError(err.message);
52
+ __.exit(1);
53
+ }
54
+ }
97
55
 
98
- await command.run(args);
99
- } catch (err) {
100
- this.__consoleError(err.message);
101
- this.__exit(1);
56
+ __ = {
57
+ async getCommand(commandName) {
58
+ const commandModuleName = availableCommands[commandName];
59
+ if (!commandModuleName) {
60
+ return false;
102
61
  }
62
+ return await firostImport(commandModuleName);
103
63
  },
104
- __env: env,
105
- __setEnv(key, value) {
64
+ env,
65
+ setEnv(key, value) {
106
66
  process.env[key] = value;
107
67
  },
108
- __consoleError: consoleError,
109
- __consoleInfo: consoleInfo,
110
- __exit: exit,
68
+ consoleError,
69
+ consoleInfo,
70
+ exit,
111
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aberlaas",
3
- "version": "2.19.0",
3
+ "version": "2.20.1",
4
4
  "author": "Tim Carry (@pixelastic)",
5
5
  "description": "Scaffold your JavaScript projects with tests, lint and release scripts",
6
6
  "keywords": [],
@@ -40,37 +40,32 @@
40
40
  "main": "./lib/main.js",
41
41
  "bin": "bin/aberlaas.js",
42
42
  "dependencies": {
43
- "aberlaas-ci": "^2.19.0",
44
- "aberlaas-compress": "^2.18.1",
45
- "aberlaas-helper": "^2.18.1",
46
- "aberlaas-init": "^2.18.1",
47
- "aberlaas-lint": "^2.19.0",
48
- "aberlaas-precommit": "^2.18.1",
49
- "aberlaas-readme": "^2.18.1",
50
- "aberlaas-setup": "^2.18.1",
51
- "aberlaas-test": "^2.18.1",
52
- "aberlaas-versions": "^2.15.0",
53
- "dedent": "1.5.3",
54
- "firost": "5.2.1",
55
- "gilmore": "1.0.0",
43
+ "aberlaas-ci": "workspace:*",
44
+ "aberlaas-compress": "workspace:*",
45
+ "aberlaas-helper": "workspace:*",
46
+ "aberlaas-init": "workspace:*",
47
+ "aberlaas-lint": "workspace:*",
48
+ "aberlaas-precommit": "workspace:*",
49
+ "aberlaas-readme": "workspace:*",
50
+ "aberlaas-release": "workspace:*",
51
+ "aberlaas-setup": "workspace:*",
52
+ "aberlaas-test": "workspace:*",
53
+ "aberlaas-versions": "workspace:*",
54
+ "firost": "5.5.1",
56
55
  "golgoth": "3.0.0",
57
- "minimist": "1.2.8",
58
- "std-mocks": "2.0.0"
56
+ "minimist": "1.2.8"
59
57
  },
60
58
  "scripts": {
61
- "build": "../../scripts/local/build",
62
- "build:prod": "../../scripts/local/build-prod",
63
- "cms": "../../scripts/local/cms",
64
- "serve": "../../scripts/local/serve",
65
- "ci": "../../scripts/local/ci",
66
- "release": "../../scripts/local/release",
67
- "update-dependencies": "node ../../scripts/meta/update-dependencies.js",
68
- "test:meta": "../../scripts/local/test-meta",
69
- "test": "../../scripts/local/test",
70
- "test:watch": "../../scripts/local/test-watch",
71
- "compress": "../../scripts/local/compress",
72
- "lint": "../../scripts/local/lint",
73
- "lint:fix": "../../scripts/local/lint-fix"
74
- },
75
- "gitHead": "11175e8d126f535dc73a3aa942acd79f450d74c4"
59
+ "build": "cd ../docs && yarn run build",
60
+ "build:prod": "cd ../docs && yarn run build:prod",
61
+ "cms": "cd ../docs && yarn run cms",
62
+ "serve": "cd ../docs && yarn run serve",
63
+ "release": "cd ../.. && ./scripts/release",
64
+ "test:meta": "cd ../.. && ./scripts/test-meta",
65
+ "test": "cd ../.. && ./scripts/test",
66
+ "test:watch": "cd ../.. && ./scripts/test-watch",
67
+ "compress": "cd ../.. && ./scripts/compress",
68
+ "lint": "cd ../.. && ./scripts/lint",
69
+ "lint:fix": "cd ../.. && ./scripts/lint-fix"
70
+ }
76
71
  }
package/LICENSE DELETED
@@ -1,9 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) {author}
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.