aberlaas 2.5.0 → 2.7.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/bin/aberlaas.js CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import aberlaas from '../main.js';
3
+
3
4
  (async () => {
4
5
  await aberlaas.run(process.argv.slice(2));
5
6
  })();
@@ -1,8 +1,7 @@
1
1
  import ciInfo from 'ci-info';
2
- import run from 'firost/run.js';
2
+ import { consoleInfo, run } from 'firost';
3
3
  import commandTest from '../test/index.js';
4
4
  import commandLint from '../lint/index.js';
5
- import consoleInfo from 'firost/consoleInfo.js';
6
5
 
7
6
  export default {
8
7
  /**
@@ -1,7 +1,5 @@
1
- import _ from 'golgoth/lodash.js';
2
- import pMap from 'golgoth/pMap.js';
3
- import consoleError from 'firost/consoleError.js';
4
- import firostError from 'firost/error.js';
1
+ import { _, pMap } from 'golgoth';
2
+ import { consoleError, firostError } from 'firost';
5
3
  import compressPng from './png.js';
6
4
  import compressDummy from './dummy.js';
7
5
 
@@ -1,8 +1,6 @@
1
+ import { _ } from 'golgoth';
2
+ import { firostError, run, which } from 'firost';
1
3
  import helper from '../../helper.js';
2
- import _ from 'golgoth/lodash.js';
3
- import run from 'firost/run.js';
4
- import which from 'firost/which.js';
5
- import firostError from 'firost/error.js';
6
4
 
7
5
  export default {
8
6
  /**
@@ -1,18 +1,21 @@
1
- import _ from 'golgoth/lodash.js';
2
- import isFile from 'firost/isFile.js';
3
- import copy from 'firost/copy.js';
4
- import move from 'firost/move.js';
5
- import readJson from 'firost/readJson.js';
6
- import writeJson from 'firost/writeJson.js';
7
- import firostError from 'firost/error.js';
8
- import read from 'firost/read.js';
9
- import write from 'firost/write.js';
10
- import run from 'firost/run.js';
11
- import spinner from 'firost/spinner.js';
1
+ import { _ } from 'golgoth';
2
+ import {
3
+ consoleInfo,
4
+ copy,
5
+ firostError,
6
+ isFile,
7
+ move,
8
+ read,
9
+ readJson,
10
+ run,
11
+ spinner,
12
+ write,
13
+ writeJson,
14
+ } from 'firost';
15
+
16
+ import Gilmore from 'gilmore';
12
17
  import helper from '../../helper.js';
13
18
  import nodeConfig from '../../configs/node.cjs';
14
- import consoleInfo from 'firost/consoleInfo.js';
15
- import Gilmore from 'gilmore';
16
19
 
17
20
  export default {
18
21
  /**
@@ -1,10 +1,7 @@
1
+ import ciInfo from 'ci-info';
2
+ import { exists, firostError, run, which } from 'firost';
1
3
  import helper from '../../helper.js';
2
4
  import lintYml from './yml.js';
3
- import ciInfo from 'ci-info';
4
- import exists from 'firost/exists.js';
5
- import run from 'firost/run.js';
6
- import which from 'firost/which.js';
7
- import firostError from 'firost/error.js';
8
5
 
9
6
  export default {
10
7
  configPath: '.circleci/config.yml',
@@ -1,8 +1,8 @@
1
+ import stylelint from 'stylelint';
2
+ import { _ } from 'golgoth';
3
+ import { firostError, firostImport } from 'firost';
1
4
  import helper from '../../helper.js';
2
5
  import { fix as prettierFix } from './helpers/prettier.js';
3
- import stylelint from 'stylelint';
4
- import _ from 'golgoth/lodash.js';
5
- import firostError from 'firost/error.js';
6
6
 
7
7
  export default {
8
8
  /**
@@ -39,7 +39,7 @@ export default {
39
39
  'stylelint.config.js',
40
40
  'configs/stylelint.js',
41
41
  );
42
- const config = await helper.import(configFile);
42
+ const config = await firostImport(configFile);
43
43
 
44
44
  const result = await stylelint.lint({
45
45
  config,
@@ -1,10 +1,7 @@
1
1
  import * as prettier from 'prettier';
2
+ import { firostError, read, write } from 'firost';
3
+ import { _, pMap } from 'golgoth';
2
4
  import helper from '../../../helper.js';
3
- import firostError from 'firost/error.js';
4
- import write from 'firost/write.js';
5
- import read from 'firost/read.js';
6
- import pMap from 'golgoth/pMap.js';
7
- import _ from 'golgoth/lodash.js';
8
5
 
9
6
  /**
10
7
  * Fix all files using prettier
@@ -1,7 +1,5 @@
1
- import _ from 'golgoth/lodash.js';
2
- import pMap from 'golgoth/pMap.js';
3
- import consoleError from 'firost/consoleError.js';
4
- import firostError from 'firost/error.js';
1
+ import { _, pMap } from 'golgoth';
2
+ import { consoleError, firostError } from 'firost';
5
3
  import linterCircleCI from './circleci.js';
6
4
  import linterCss from './css.js';
7
5
  import linterJson from './json.js';
@@ -1,7 +1,7 @@
1
- import helper from '../../helper.js';
2
- import _ from 'golgoth/lodash.js';
3
- import firostError from 'firost/error.js';
1
+ import { _ } from 'golgoth';
2
+ import { firostError } from 'firost';
4
3
  import { ESLint } from 'eslint';
4
+ import helper from '../../helper.js';
5
5
 
6
6
  export default {
7
7
  /**
@@ -1,10 +1,8 @@
1
+ import path from 'path';
2
+ import { _, pMap } from 'golgoth';
3
+ import { firostError, read } from 'firost';
1
4
  import helper from '../../helper.js';
2
5
  import { fix as prettierFix } from './helpers/prettier.js';
3
- import path from 'path';
4
- import _ from 'golgoth/lodash.js';
5
- import pMap from 'golgoth/pMap.js';
6
- import firostError from 'firost/error.js';
7
- import read from 'firost/read.js';
8
6
 
9
7
  export default {
10
8
  /**
@@ -1,11 +1,9 @@
1
+ import path from 'path';
2
+ import { firostError, read } from 'firost';
3
+ import { _, pMap } from 'golgoth';
4
+ import yamlLint from 'yaml-lint';
1
5
  import helper from '../../helper.js';
2
6
  import { fix as prettierFix } from './helpers/prettier.js';
3
- import firostError from 'firost/error.js';
4
- import read from 'firost/read.js';
5
- import _ from 'golgoth/lodash.js';
6
- import pMap from 'golgoth/pMap.js';
7
- import yamlLint from 'yaml-lint';
8
- import path from 'path';
9
7
 
10
8
  export default {
11
9
  /**
@@ -1,5 +1,5 @@
1
1
  import lintStaged from 'lint-staged';
2
- import firostError from 'firost/error.js';
2
+ import { firostError, firostImport } from 'firost';
3
3
  import helper from '../../helper.js';
4
4
 
5
5
  export default {
@@ -10,7 +10,7 @@ export default {
10
10
  'lintstaged.config.js',
11
11
  'configs/lintstaged.js',
12
12
  );
13
- const config = await helper.import(configPath);
13
+ const config = await firostImport(configPath);
14
14
 
15
15
  try {
16
16
  const result = await lintStaged({
@@ -1,14 +1,8 @@
1
- import helper from '../../helper.js';
2
- import _ from 'golgoth/lodash.js';
3
- import pMap from 'golgoth/pMap.js';
4
- import readJson from 'firost/readJson.js';
5
- import read from 'firost/read.js';
6
- import write from 'firost/write.js';
7
- import glob from 'firost/glob.js';
8
- import exists from 'firost/exists.js';
9
1
  import path from 'path';
2
+ import { _, dedent, pMap } from 'golgoth';
3
+ import { exists, glob, read, readJson, write } from 'firost';
10
4
  import frontMatter from 'front-matter';
11
- import dedent from 'golgoth/dedent.js';
5
+ import helper from '../../helper.js';
12
6
 
13
7
  export default {
14
8
  /**
@@ -1,9 +1,7 @@
1
- import githubHelper from './helpers/github.js';
1
+ import { _ } from 'golgoth';
2
+ import { consoleError, consoleInfo, consoleSuccess } from 'firost';
2
3
  import circleCiHelper from './helpers/circleci.js';
3
- import _ from 'golgoth/lodash.js';
4
- import consoleInfo from 'firost/consoleInfo.js';
5
- import consoleSuccess from 'firost/consoleSuccess.js';
6
- import consoleError from 'firost/consoleError.js';
4
+ import githubHelper from './helpers/github.js';
7
5
 
8
6
  export default {
9
7
  /**
@@ -1,6 +1,5 @@
1
+ import { consoleError, consoleSuccess } from 'firost';
1
2
  import githubHelper from './helpers/github.js';
2
- import consoleSuccess from 'firost/consoleSuccess.js';
3
- import consoleError from 'firost/consoleError.js';
4
3
 
5
4
  export default {
6
5
  /**
@@ -1,6 +1,5 @@
1
- import got from 'golgoth/got.js';
2
- import _ from 'golgoth/lodash.js';
3
- import firostError from 'firost/error.js';
1
+ import { _, got } from 'golgoth';
2
+ import { firostError } from 'firost';
4
3
 
5
4
  export default {
6
5
  /**
@@ -1,7 +1,7 @@
1
- import run from 'firost/run.js';
1
+ import { run } from 'firost';
2
2
  import { Octokit } from '@octokit/rest';
3
3
  import parseGithubUrl from 'parse-github-repo-url';
4
- import _ from 'golgoth/lodash.js';
4
+ import { _ } from 'golgoth';
5
5
 
6
6
  export default {
7
7
  /**
@@ -1,12 +1,8 @@
1
+ import path from 'path';
2
+ import { _ } from 'golgoth';
3
+ import { exists, mkdirp, read, run, which } from 'firost';
1
4
  import helper from '../../../helper.js';
2
5
  import githubHelper from './github.js';
3
- import _ from 'golgoth/lodash.js';
4
- import which from 'firost/which.js';
5
- import exists from 'firost/exists.js';
6
- import read from 'firost/read.js';
7
- import run from 'firost/run.js';
8
- import mkdirp from 'firost/mkdirp.js';
9
- import path from 'path';
10
6
 
11
7
  export default {
12
8
  /**
@@ -1,7 +1,7 @@
1
+ import { _ } from 'golgoth';
1
2
  import github from './github.js';
2
3
  import circleci from './circleci.js';
3
4
  import renovate from './renovate.js';
4
- import _ from 'golgoth/lodash.js';
5
5
 
6
6
  export default {
7
7
  /**
@@ -1,6 +1,5 @@
1
+ import { consoleError, consoleSuccess } from 'firost';
1
2
  import githubHelper from './helpers/github.js';
2
- import consoleSuccess from 'firost/consoleSuccess.js';
3
- import consoleError from 'firost/consoleError.js';
4
3
 
5
4
  export default {
6
5
  renovateId: 2471197,
@@ -1,7 +1,7 @@
1
1
  import { createVitest, registerConsoleShortcuts } from 'vitest/node';
2
+ import { firostError, firostImport } from 'firost';
3
+ import { _ } from 'golgoth';
2
4
  import helper from '../../helper.js';
3
- import firostError from 'firost/error.js';
4
- import _ from 'golgoth/lodash.js';
5
5
 
6
6
  export default {
7
7
  /**
@@ -60,7 +60,7 @@ export default {
60
60
  'vite.config.js',
61
61
  'configs/vite.js',
62
62
  );
63
- const optionsFromConfig = (await helper.import(configFile)).test;
63
+ const optionsFromConfig = (await firostImport(configFile)).test;
64
64
 
65
65
  // Enhancing options with custom CLI arguments
66
66
  const optionsFromAberlaas = {
@@ -1,16 +1,10 @@
1
1
  // Note: ESLint doesn't support ESM configuration as of 2024-02-19. This file
2
2
  // needs to stay as a CommonJS file
3
3
  const nodeConfig = require('./node.cjs');
4
+
4
5
  module.exports = {
5
- env: {
6
- browser: true,
7
- es2023: true,
8
- node: true,
9
- },
10
- parserOptions: {
11
- sourceType: 'module',
12
- ecmaVersion: 'latest',
13
- },
6
+ env: { browser: true, es2023: true, node: true },
7
+ parserOptions: { sourceType: 'module', ecmaVersion: 'latest' },
14
8
  extends: [
15
9
  'eslint:recommended',
16
10
  'plugin:n/recommended',
@@ -29,9 +23,7 @@ module.exports = {
29
23
  // https://github.com/import-js/eslint-plugin-import/issues/2430)
30
24
  // we manually define the most common extensions
31
25
  'import/resolver': {
32
- node: {
33
- extensions: ['.js', '.cjs', '.mjs', '.d.ts'],
34
- },
26
+ node: { extensions: ['.js', '.cjs', '.mjs', '.d.ts'] },
35
27
  },
36
28
  },
37
29
  plugins: ['jsdoc', 'prettier'],
@@ -69,10 +61,7 @@ module.exports = {
69
61
  ],
70
62
  'no-unused-vars': [
71
63
  'error',
72
- {
73
- argsIgnorePattern: '^_.',
74
- varsIgnorePattern: '^_.',
75
- },
64
+ { argsIgnorePattern: '^_.', varsIgnorePattern: '^_.' },
76
65
  ],
77
66
  'no-shadow': ['error'],
78
67
  'object-shorthand': ['error', 'always'],
@@ -80,15 +69,21 @@ module.exports = {
80
69
  // https://github.com/prettier/prettier/issues/6064 is fixed
81
70
  'quote-props': ['error', 'as-needed'],
82
71
  quotes: ['error', 'single', { avoidEscape: true }],
72
+ // Used to sort the members inside an import statement
73
+ // Example:
74
+ // import { foo, bar } from 'something';
75
+ // => import { bar, foo } from 'something'
76
+ 'sort-imports': ['error', { ignoreDeclarationSort: true }],
83
77
  // Node
84
78
  'n/no-unsupported-features/es-syntax': [
85
79
  'error',
86
- {
87
- version: `>=${nodeConfig.nodeVersion}`,
88
- },
80
+ { version: `>=${nodeConfig.nodeVersion}` },
89
81
  ],
90
82
  // Import
83
+ 'import/first': ['error'],
91
84
  'import/no-cycle': ['error'],
85
+ 'import/order': ['error'],
86
+ 'import/newline-after-import': ['error'],
92
87
  // JSDoc
93
88
  'jsdoc/check-param-names': ['warn'],
94
89
  'jsdoc/check-types': ['warn'],
@@ -114,9 +109,7 @@ module.exports = {
114
109
  // Vitest
115
110
  {
116
111
  files: ['**/__tests__/**/*.js'],
117
- env: {
118
- 'vitest-globals/env': true,
119
- },
112
+ env: { 'vitest-globals/env': true },
120
113
  globals: {
121
114
  // Test name
122
115
  testName: false,
@@ -136,22 +129,10 @@ module.exports = {
136
129
  rules: {
137
130
  'no-restricted-globals': [
138
131
  'error',
139
- {
140
- name: 'fit',
141
- message: 'No focused test',
142
- },
143
- {
144
- name: 'fdescribe',
145
- message: 'No focused tests',
146
- },
147
- {
148
- name: 'xit',
149
- message: 'No skipped test',
150
- },
151
- {
152
- name: 'xdescribe',
153
- message: 'No skipped tests',
154
- },
132
+ { name: 'fit', message: 'No focused test' },
133
+ { name: 'fdescribe', message: 'No focused tests' },
134
+ { name: 'xit', message: 'No skipped test' },
135
+ { name: 'xdescribe', message: 'No skipped tests' },
155
136
  ],
156
137
  'vitest/consistent-test-it': ['warn', { fn: 'it' }],
157
138
  // Disabling vitest/no-identical-title
@@ -163,11 +144,6 @@ module.exports = {
163
144
  },
164
145
  // no-process-exit
165
146
  // We need to send clear exit codes in yarn run scripts
166
- {
167
- files: ['**/scripts/**/*.js'],
168
- rules: {
169
- 'no-process-exit': ['off'],
170
- },
171
- },
147
+ { files: ['**/scripts/**/*.js'], rules: { 'no-process-exit': ['off'] } },
172
148
  ],
173
149
  };
@@ -1,4 +1,4 @@
1
1
  // We make captureOutput publicly available inside of tests
2
- import captureOutput from 'firost/captureOutput.js';
2
+ import { captureOutput } from 'firost';
3
3
 
4
4
  globalThis.captureOutput = captureOutput;
package/configs/vite.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { configDefaults, defineConfig } from 'vitest/config';
2
+
2
3
  const configDir = new URL('./vite/', import.meta.url).pathname;
3
4
 
4
5
  export default defineConfig({
package/helper.js CHANGED
@@ -1,9 +1,8 @@
1
1
  import path from 'path';
2
- import _ from 'golgoth/lodash.js';
3
- import glob from 'firost/glob.js';
4
- import exists from 'firost/exists.js';
5
- import findUp from 'find-up';
6
2
  import * as url from 'url';
3
+ import { _ } from 'golgoth';
4
+ import { glob } from 'firost';
5
+ import findUp from 'find-up';
7
6
 
8
7
  export default {
9
8
  /**
@@ -113,54 +112,4 @@ export default {
113
112
  // Fallback on default config in aberlaas
114
113
  return this.aberlaasPath(aberlaasPath);
115
114
  },
116
-
117
- /**
118
- * Returns path to a specific binary.
119
- *
120
- * Knowing the path to a specific binary is not trivial:
121
- * - Aberlaas dependencies should be in node_modules/aberlaas/.bin
122
- * - Host dependencies should be in node_modules/.bin
123
- *
124
- * There are some special cases:
125
- * - If both aberlaas and host use the same dependency version, it will be
126
- * hoisted to the host
127
- * - If they use different versions, priority should be given to the one in
128
- * aberlaas
129
- * - Mono-repo setup and yarn link will move dependencies out of
130
- * node_modules/.bin
131
- *
132
- * For those reasons, we defer to running yarn bin to get the exact path to
133
- * the binary, and check in order of importance in aberlaas first, and then in
134
- * the host
135
- *
136
- * @param {string} bin Binary name
137
- * @returns {string} Path to the binary
138
- **/
139
- async which(bin) {
140
- const binaryPathSuffix = `./node_modules/.bin/${bin}`;
141
- const pathsToTest = [
142
- this.aberlaasPath(binaryPathSuffix),
143
- this.hostPath(binaryPathSuffix),
144
- ];
145
-
146
- for (const binaryPath of pathsToTest) {
147
- if (await exists(binaryPath)) {
148
- return binaryPath;
149
- }
150
- }
151
- return false;
152
- },
153
- /**
154
- * Dynamically import a file
155
- * This is a wrapper around the default import, but bypasses the cache
156
- * It makes sure importing a file several times always loads the last version
157
- * TODO: This should probably be moved in firost once firost is moved to ESM
158
- * @param {string} filepath Path to the file to load
159
- * @returns {object} Content of the loaded file
160
- **/
161
- async import(filepath) {
162
- const content = await import(`${filepath}?cacheBusting=${Date.now()}`);
163
-
164
- return content.default || content;
165
- },
166
115
  };
package/main.js CHANGED
@@ -1,10 +1,7 @@
1
- import minimist from 'minimist';
2
- import consoleError from 'firost/consoleError.js';
3
- import exit from 'firost/exit.js';
4
- import env from 'firost/env.js';
5
- import absolute from 'firost/absolute.js';
6
- import _ from 'golgoth/lodash.js';
7
1
  import path from 'path';
2
+ import minimist from 'minimist';
3
+ import { absolute, consoleError, env, exit } from 'firost';
4
+ import { _ } from 'golgoth';
8
5
  import commandCi from './commands/ci/index.js';
9
6
  import commandCompress from './commands/compress/index.js';
10
7
  import commandInit from './commands/init/index.js';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "aberlaas",
3
3
  "type": "module",
4
4
  "description": "Scaffold your JavaScript projects with tests, lint and release scripts",
5
- "version": "2.5.0",
5
+ "version": "2.7.0",
6
6
  "repository": "pixelastic/aberlaas",
7
7
  "homepage": "https://projects.pixelastic.com/aberlaas/",
8
8
  "author": "Tim Carry (@pixelastic)",
@@ -43,10 +43,10 @@
43
43
  "eslint-plugin-jsdoc": "46.10.1",
44
44
  "eslint-plugin-n": "16.6.2",
45
45
  "eslint-plugin-prettier": "5.1.3",
46
- "eslint-plugin-vitest": "0.3.22",
47
- "eslint-plugin-vitest-globals": "1.4.0",
46
+ "eslint-plugin-vitest": "0.4.1",
47
+ "eslint-plugin-vitest-globals": "1.5.0",
48
48
  "find-up": "5.0.0",
49
- "firost": "3.1.0",
49
+ "firost": "3.5.0",
50
50
  "front-matter": "4.0.2",
51
51
  "gilmore": "0.2.0",
52
52
  "golgoth": "2.1.0",
@@ -58,7 +58,7 @@
58
58
  "prettier": "3.2.5",
59
59
  "std-mocks": "1.0.1",
60
60
  "stylelint": "13.13.1",
61
- "vitest": "1.3.1",
61
+ "vitest": "1.4.0",
62
62
  "yaml-lint": "1.7.0"
63
63
  },
64
64
  "engines": {
@@ -77,5 +77,5 @@
77
77
  "lint:fix": "ABERLAAS_CWD=$INIT_CWD yarn g:lint:fix",
78
78
  "postinstall": "./scripts/postinstall"
79
79
  },
80
- "gitHead": "d8c221450f847e80e4b86783b9291f3e02239a45"
80
+ "gitHead": "901e0aff17a63a548edcba92d984c8610d6e4362"
81
81
  }
@@ -1,4 +1,5 @@
1
1
  import config from 'aberlaas/configs/lintstaged';
2
+
2
3
  export default {
3
4
  ...config,
4
5
  };
@@ -1,4 +1,5 @@
1
1
  import config from 'aberlaas/configs/prettier';
2
+
2
3
  export default {
3
4
  ...config,
4
5
  };
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
  set -e
3
3
 
4
- aberlaas test "${@:-./lib}"
4
+ cd ./lib
5
+ aberlaas test "$@"
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env bash
2
2
  set -e
3
3
 
4
- aberlaas test --watch "${@:-./lib}"
4
+ cd ./lib
5
+ aberlaas test --watch "$@"
@@ -1,4 +1,5 @@
1
1
  import config from 'aberlaas/configs/stylelint';
2
+
2
3
  export default {
3
4
  ...config,
4
5
  };
@@ -1,4 +1,5 @@
1
1
  import config from 'aberlaas/configs/vite';
2
+
2
3
  export default {
3
4
  ...config,
4
5
  };