aberlaas 2.8.0 → 2.10.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 +1 -1
- package/configs/eslint.js +3 -0
- package/configs/lintstaged.js +2 -24
- package/configs/prettier.js +3 -4
- package/configs/stylelint.js +3 -41
- package/configs/vite.js +2 -41
- package/{main.js → lib/main.js} +26 -30
- package/package.json +37 -45
- package/commands/ci/index.js +0 -47
- package/commands/compress/dummy.js +0 -11
- package/commands/compress/index.js +0 -41
- package/commands/compress/png.js +0 -49
- package/commands/init/helper.js +0 -171
- package/commands/init/index.js +0 -59
- package/commands/init/module.js +0 -111
- package/commands/init/monorepo.js +0 -261
- package/commands/lint/circleci.js +0 -81
- package/commands/lint/css.js +0 -73
- package/commands/lint/helpers/prettier.js +0 -54
- package/commands/lint/index.js +0 -50
- package/commands/lint/js.js +0 -73
- package/commands/lint/json.js +0 -60
- package/commands/lint/yml.js +0 -62
- package/commands/precommit/index.js +0 -33
- package/commands/readme/index.js +0 -181
- package/commands/setup/circleci.js +0 -60
- package/commands/setup/github.js +0 -42
- package/commands/setup/helpers/circleci.js +0 -43
- package/commands/setup/helpers/github.js +0 -72
- package/commands/setup/helpers/npm.js +0 -16
- package/commands/setup/helpers/ssh.js +0 -77
- package/commands/setup/index.js +0 -52
- package/commands/setup/renovate.js +0 -54
- package/commands/test/index.js +0 -124
- package/configs/eslint.cjs +0 -154
- package/configs/node.cjs +0 -9
- package/configs/vite/test/setupFiles/captureOutput.js +0 -4
- package/configs/vite/test/setupFiles/dedent.js +0 -4
- package/configs/vite/test/setupFiles/fit-xit-fdescribe-xdescribe.js +0 -13
- package/configs/vite/test/setupFiles/jest-extended.js +0 -10
- package/configs/vite/test/setupFiles/testName.js +0 -9
- package/helper.js +0 -115
- package/templates/LICENSE +0 -9
- package/templates/_circleci/config.yml +0 -33
- package/templates/_eslintignore.conf +0 -12
- package/templates/_eslintrc.cjs +0 -3
- package/templates/_gitattributes +0 -4
- package/templates/_github/README.template.md +0 -7
- package/templates/_github/renovate.json +0 -3
- package/templates/_gitignore +0 -29
- package/templates/_yarnrc.yml +0 -15
- package/templates/lerna.json +0 -6
- package/templates/lib/__tests__/main.js +0 -13
- package/templates/lib/main.js +0 -5
- package/templates/lintstaged.config.js +0 -5
- package/templates/prettier.config.js +0 -5
- package/templates/scripts/ci +0 -6
- package/templates/scripts/compress +0 -4
- package/templates/scripts/docs/build +0 -4
- package/templates/scripts/docs/build-prod +0 -4
- package/templates/scripts/docs/cms +0 -4
- package/templates/scripts/docs/serve +0 -4
- package/templates/scripts/hooks/pre-commit +0 -11
- package/templates/scripts/lib/release +0 -5
- package/templates/scripts/lib/test +0 -5
- package/templates/scripts/lib/test-watch +0 -5
- package/templates/scripts/lint +0 -4
- package/templates/scripts/lint-fix +0 -4
- package/templates/stylelint.config.js +0 -5
- package/templates/vite.config.js +0 -5
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { _ } from 'golgoth';
|
|
3
|
-
import { exists, mkdirp, read, run, which } from 'firost';
|
|
4
|
-
import helper from '../../../helper.js';
|
|
5
|
-
import githubHelper from './github.js';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
/**
|
|
9
|
-
* Check if ssh-keygen is available
|
|
10
|
-
* @returns {boolean} True if available, false otherwise
|
|
11
|
-
**/
|
|
12
|
-
async hasBinary() {
|
|
13
|
-
const sshKeygenPath = await this.__which('ssh-keygen');
|
|
14
|
-
return !!sshKeygenPath;
|
|
15
|
-
},
|
|
16
|
-
/**
|
|
17
|
-
* Returns SSH keys (generate them if needed)
|
|
18
|
-
* @returns {object} Object with .public, .private and .privateFingerprint
|
|
19
|
-
**/
|
|
20
|
-
async getKeys() {
|
|
21
|
-
const keyPath = helper.hostPath('./tmp/ssh/key');
|
|
22
|
-
|
|
23
|
-
// Generating keys if do not exist
|
|
24
|
-
const keyExists = await exists(keyPath);
|
|
25
|
-
if (!keyExists) {
|
|
26
|
-
await this.generateKeys(keyPath);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const publicKeyPath = `${keyPath}.pub`;
|
|
30
|
-
const publicKey = await read(publicKeyPath);
|
|
31
|
-
const privateKey = await read(keyPath);
|
|
32
|
-
const privateFingerprint = await this.getFingerprint(keyPath);
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
public: publicKey,
|
|
36
|
-
private: privateKey,
|
|
37
|
-
privateFingerprint,
|
|
38
|
-
};
|
|
39
|
-
},
|
|
40
|
-
/**
|
|
41
|
-
* Generate SSH keys
|
|
42
|
-
* @param {string} keyPath Path to the public key
|
|
43
|
-
**/
|
|
44
|
-
async generateKeys(keyPath) {
|
|
45
|
-
const keyDirectory = path.dirname(keyPath);
|
|
46
|
-
await mkdirp(keyDirectory);
|
|
47
|
-
const { email: keyEmail } = await githubHelper.repoData();
|
|
48
|
-
const sshKeygenArguments = [
|
|
49
|
-
'-m PEM',
|
|
50
|
-
'-t rsa',
|
|
51
|
-
`-C ${keyEmail}`,
|
|
52
|
-
`-f ${keyPath}`,
|
|
53
|
-
"-N ''",
|
|
54
|
-
];
|
|
55
|
-
const command = `ssh-keygen ${sshKeygenArguments.join(' ')}`;
|
|
56
|
-
// Need to run in shell mode, otherwise does not understand the empty
|
|
57
|
-
// passphrase
|
|
58
|
-
await this.__run(command, { shell: true, stdout: false });
|
|
59
|
-
},
|
|
60
|
-
/**
|
|
61
|
-
* Returns the md5 fingerprint from a key path
|
|
62
|
-
* @param {string} keyPath Filepath to the key file
|
|
63
|
-
* @returns {string} Fingerprint as used by CircleCI and GitHub
|
|
64
|
-
**/
|
|
65
|
-
async getFingerprint(keyPath) {
|
|
66
|
-
const command = `ssh-keygen -E md5 -l -f ${keyPath}`;
|
|
67
|
-
const result = await this.__run(command, { stdout: false });
|
|
68
|
-
return _.chain(result)
|
|
69
|
-
.get('stdout')
|
|
70
|
-
.split(' ')
|
|
71
|
-
.nth(1)
|
|
72
|
-
.replace('MD5:', '')
|
|
73
|
-
.value();
|
|
74
|
-
},
|
|
75
|
-
__which: which,
|
|
76
|
-
__run: run,
|
|
77
|
-
};
|
package/commands/setup/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { _ } from 'golgoth';
|
|
2
|
-
import github from './github.js';
|
|
3
|
-
import circleci from './circleci.js';
|
|
4
|
-
import renovate from './renovate.js';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
/**
|
|
8
|
-
* Enable external services.
|
|
9
|
-
* Will enable CircleCI, GitHub and Renovate by default.
|
|
10
|
-
* @param {object} cliArgs CLI Argument object, as created by minimist
|
|
11
|
-
**/
|
|
12
|
-
async run(cliArgs = {}) {
|
|
13
|
-
const defaultServices = {
|
|
14
|
-
circleci: true,
|
|
15
|
-
renovate: true,
|
|
16
|
-
github: true,
|
|
17
|
-
};
|
|
18
|
-
const cliServices = _.omit(cliArgs, ['_']);
|
|
19
|
-
const servicesToEnable = {
|
|
20
|
-
...defaultServices,
|
|
21
|
-
...cliServices,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
if (servicesToEnable.github) {
|
|
25
|
-
await this.github();
|
|
26
|
-
}
|
|
27
|
-
if (servicesToEnable.circleci) {
|
|
28
|
-
await this.circleci();
|
|
29
|
-
}
|
|
30
|
-
if (servicesToEnable.renovate) {
|
|
31
|
-
await this.renovate();
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* Configure GitHub
|
|
36
|
-
**/
|
|
37
|
-
async github() {
|
|
38
|
-
await github.enable();
|
|
39
|
-
},
|
|
40
|
-
/**
|
|
41
|
-
* Enable CircleCI
|
|
42
|
-
**/
|
|
43
|
-
async circleci() {
|
|
44
|
-
await circleci.enable();
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* Enable renovate
|
|
48
|
-
**/
|
|
49
|
-
async renovate() {
|
|
50
|
-
await renovate.enable();
|
|
51
|
-
},
|
|
52
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { consoleError, consoleSuccess } from 'firost';
|
|
2
|
-
import githubHelper from './helpers/github.js';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
renovateId: 2471197,
|
|
6
|
-
/**
|
|
7
|
-
* Returns the GitHub repository Id
|
|
8
|
-
* @returns {number} Repository Id
|
|
9
|
-
**/
|
|
10
|
-
async getRepositoryId() {
|
|
11
|
-
const { username, repo } = await githubHelper.repoData();
|
|
12
|
-
const { id } = await githubHelper.octokit('repos.get', {
|
|
13
|
-
owner: username,
|
|
14
|
-
repo,
|
|
15
|
-
});
|
|
16
|
-
return id;
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* Attempt to automatically add the current repo to renovate, otherwise
|
|
20
|
-
* display the link to do it manually
|
|
21
|
-
* @returns {boolean} True if enabled, false otherwise
|
|
22
|
-
**/
|
|
23
|
-
async enable() {
|
|
24
|
-
const { username, repo } = await githubHelper.repoData();
|
|
25
|
-
const manualUrl = `https://github.com/settings/installations/${this.renovateId}`;
|
|
26
|
-
const renovateDashboardUrl = `https://app.renovatebot.com/dashboard#github/${username}/${repo}`;
|
|
27
|
-
|
|
28
|
-
// Fail early if no token available
|
|
29
|
-
if (!githubHelper.hasToken()) {
|
|
30
|
-
this.__consoleError(
|
|
31
|
-
`[renovate]: No GITHUB_TOKEN found, please visit ${manualUrl} to enable manually.`,
|
|
32
|
-
);
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
const repositoryId = await this.getRepositoryId();
|
|
38
|
-
await githubHelper.octokit('apps.addRepoToInstallation', {
|
|
39
|
-
installation_id: this.renovateId,
|
|
40
|
-
repository_id: repositoryId,
|
|
41
|
-
});
|
|
42
|
-
} catch (err) {
|
|
43
|
-
this.__consoleError(
|
|
44
|
-
`Renovate is not installed with this GitHub account, please visit ${manualUrl} to install it first.`,
|
|
45
|
-
);
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
this.__consoleSuccess(`Renovate enabled: ${renovateDashboardUrl}`);
|
|
50
|
-
return true;
|
|
51
|
-
},
|
|
52
|
-
__consoleSuccess: consoleSuccess,
|
|
53
|
-
__consoleError: consoleError,
|
|
54
|
-
};
|
package/commands/test/index.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { createVitest, registerConsoleShortcuts } from 'vitest/node';
|
|
2
|
-
import { firostError, firostImport } from 'firost';
|
|
3
|
-
import { _ } from 'golgoth';
|
|
4
|
-
import helper from '../../helper.js';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
/**
|
|
8
|
-
* Test all files using Vitest
|
|
9
|
-
* Usage:
|
|
10
|
-
* $ aberlaas test # Test all files
|
|
11
|
-
* $ aberlaas test ./path/to/__tests__/file.js # Test specific files
|
|
12
|
-
* $ aberlaas test ./path/to/file.js # Test specific files
|
|
13
|
-
* $ aberlaas test --related # Test all related files
|
|
14
|
-
* $ aberlaas test --failFast # Stop early as soon as one test fails
|
|
15
|
-
* $ aberlaas test --flags # Flags passed to vitest
|
|
16
|
-
* @param {object} cliArgs CLI Argument object, as created by minimist
|
|
17
|
-
* @returns {boolean} true on success
|
|
18
|
-
**/
|
|
19
|
-
async run(cliArgs = {}) {
|
|
20
|
-
const options = await this.vitestOptions(cliArgs);
|
|
21
|
-
const isWatchMode = !!options.watch;
|
|
22
|
-
const isRelatedMode = options.related?.length > 0;
|
|
23
|
-
let files = _.isEmpty(cliArgs._) ? [helper.hostPath()] : cliArgs._;
|
|
24
|
-
// If --related is passed, the list of files will already by in the .related
|
|
25
|
-
// key, and need to be removed from the files
|
|
26
|
-
if (isRelatedMode) files = [];
|
|
27
|
-
|
|
28
|
-
// Vitest will change process.exitCode, so we save it to revert it later
|
|
29
|
-
const initialExitCode = process.exitCode;
|
|
30
|
-
|
|
31
|
-
const vitest = await createVitest('test', options);
|
|
32
|
-
|
|
33
|
-
// Enable keyboard interaction in watch mode
|
|
34
|
-
if (isWatchMode) {
|
|
35
|
-
registerConsoleShortcuts(vitest);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
await vitest.start(files);
|
|
40
|
-
} catch (err) {
|
|
41
|
-
// We can safely swallow the VITEST_FILES_NOT_FOUND error. It's ok to
|
|
42
|
-
// continue if no files are found
|
|
43
|
-
if (err.code != 'VITEST_FILES_NOT_FOUND') {
|
|
44
|
-
throw err;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const testsAreFailing = process.exitCode == 1;
|
|
49
|
-
process.exitCode = initialExitCode;
|
|
50
|
-
|
|
51
|
-
if (isWatchMode) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Stop vitest, it doesn't stop itself by default
|
|
56
|
-
await vitest.close();
|
|
57
|
-
|
|
58
|
-
if (testsAreFailing) {
|
|
59
|
-
throw firostError('ERROR_TEST_FAIL', 'Tests are failing');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return true;
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Transform all aberlaas test cli options into suitable vitest options
|
|
67
|
-
* @param {object} cliArgs CLI Argument object, as created by minimist
|
|
68
|
-
* @returns {Array} Array of options for vitest
|
|
69
|
-
**/
|
|
70
|
-
async vitestOptions(cliArgs = {}) {
|
|
71
|
-
// Options that have special meaning in aberlaas and shouldn't be passed
|
|
72
|
-
// as-is to vitest
|
|
73
|
-
const specialMeaningCliArgs = [
|
|
74
|
-
'_',
|
|
75
|
-
'config',
|
|
76
|
-
'failFast',
|
|
77
|
-
'related',
|
|
78
|
-
'exclude',
|
|
79
|
-
];
|
|
80
|
-
|
|
81
|
-
// Reading base options from the config file
|
|
82
|
-
const configFile = await helper.configFile(
|
|
83
|
-
cliArgs.config,
|
|
84
|
-
'vite.config.js',
|
|
85
|
-
'configs/vite.js',
|
|
86
|
-
);
|
|
87
|
-
const optionsFromConfig = (await firostImport(configFile)).test;
|
|
88
|
-
|
|
89
|
-
// Enhancing options with custom CLI arguments
|
|
90
|
-
const optionsFromAberlaas = {
|
|
91
|
-
// We always allow fit/fdescribe, even in CI. Those errors will be caught
|
|
92
|
-
// by the lint command instead
|
|
93
|
-
allowOnly: true,
|
|
94
|
-
};
|
|
95
|
-
// --failFast stops early as soon as one test fails
|
|
96
|
-
if (cliArgs.failFast) {
|
|
97
|
-
optionsFromAberlaas.bail = 1;
|
|
98
|
-
}
|
|
99
|
-
// --related runs also related files
|
|
100
|
-
// Note (2024-10-01): The related option is not documented, but should
|
|
101
|
-
// contain the list of files.
|
|
102
|
-
if (cliArgs.related) {
|
|
103
|
-
optionsFromAberlaas.related = cliArgs._;
|
|
104
|
-
}
|
|
105
|
-
// --exclude arguments should be added to the existing list of exclude
|
|
106
|
-
// patterns
|
|
107
|
-
// TODO: Add test for that
|
|
108
|
-
if (cliArgs.exclude) {
|
|
109
|
-
optionsFromAberlaas.exclude = [
|
|
110
|
-
...optionsFromConfig.exclude,
|
|
111
|
-
cliArgs.exclude,
|
|
112
|
-
];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Passing other CLI options directly to vitest
|
|
116
|
-
const optionsFromCli = _.omit(cliArgs, specialMeaningCliArgs);
|
|
117
|
-
|
|
118
|
-
return {
|
|
119
|
-
...optionsFromConfig,
|
|
120
|
-
...optionsFromAberlaas,
|
|
121
|
-
...optionsFromCli,
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
};
|
package/configs/eslint.cjs
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// Note: ESLint doesn't support ESM configuration as of 2024-02-19. This file
|
|
2
|
-
// needs to stay as a CommonJS file
|
|
3
|
-
const nodeConfig = require('./node.cjs');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
env: { browser: true, es2023: true, node: true },
|
|
7
|
-
parserOptions: { sourceType: 'module', ecmaVersion: 'latest' },
|
|
8
|
-
extends: [
|
|
9
|
-
'eslint:recommended',
|
|
10
|
-
'plugin:n/recommended',
|
|
11
|
-
'plugin:import/recommended',
|
|
12
|
-
'plugin:prettier/recommended',
|
|
13
|
-
],
|
|
14
|
-
settings: {
|
|
15
|
-
// eslint-plugin-import doesn't currently support the "exports" syntax in
|
|
16
|
-
// package.json. This is supposed to allow mapping between custom
|
|
17
|
-
// entrypoints and files on disk.
|
|
18
|
-
// For example, it doesn't understand "import * from 'vitest/config';" as
|
|
19
|
-
// "vitest/config/" isn't really an existing filepath, but a mapping defined
|
|
20
|
-
// in vitest package.json
|
|
21
|
-
//
|
|
22
|
-
// Until this is fixed (see
|
|
23
|
-
// https://github.com/import-js/eslint-plugin-import/issues/2430)
|
|
24
|
-
// we manually define the most common extensions
|
|
25
|
-
'import/resolver': {
|
|
26
|
-
node: { extensions: ['.js', '.cjs', '.mjs', '.d.ts'] },
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
plugins: ['jsdoc', 'prettier'],
|
|
30
|
-
rules: {
|
|
31
|
-
'dot-notation': ['error'],
|
|
32
|
-
'max-len': [
|
|
33
|
-
'error',
|
|
34
|
-
{
|
|
35
|
-
code: 80,
|
|
36
|
-
ignoreComments: true,
|
|
37
|
-
ignoreRegExpLiterals: true,
|
|
38
|
-
ignoreStrings: true,
|
|
39
|
-
ignoreTemplateLiterals: true,
|
|
40
|
-
ignoreTrailingComments: true,
|
|
41
|
-
ignoreUrls: true,
|
|
42
|
-
// Ignore long lines in test headers, allowing us to write descriptive
|
|
43
|
-
// tests
|
|
44
|
-
ignorePattern: '^\\s*it\\(',
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
'no-console': ['off'],
|
|
48
|
-
'no-irregular-whitespace': ['error', { skipRegExps: true }],
|
|
49
|
-
'no-restricted-properties': [
|
|
50
|
-
'error',
|
|
51
|
-
{
|
|
52
|
-
object: 'module',
|
|
53
|
-
property: 'export',
|
|
54
|
-
message: 'Typo: Use module.exports instead',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
object: '_',
|
|
58
|
-
property: 'contains',
|
|
59
|
-
message: 'Typo: Use _.includes instead',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
'no-unused-vars': [
|
|
63
|
-
'error',
|
|
64
|
-
{ argsIgnorePattern: '^_.', varsIgnorePattern: '^_.' },
|
|
65
|
-
],
|
|
66
|
-
'no-shadow': ['error'],
|
|
67
|
-
'object-shorthand': ['error', 'always'],
|
|
68
|
-
// TODO: Should be updated to consistent-as-needed when
|
|
69
|
-
// https://github.com/prettier/prettier/issues/6064 is fixed
|
|
70
|
-
'quote-props': ['error', 'as-needed'],
|
|
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 }],
|
|
77
|
-
// Node
|
|
78
|
-
'n/no-unsupported-features/es-syntax': [
|
|
79
|
-
'error',
|
|
80
|
-
{ version: `>=${nodeConfig.nodeVersion}` },
|
|
81
|
-
],
|
|
82
|
-
// Import
|
|
83
|
-
'import/first': ['error'],
|
|
84
|
-
'import/no-cycle': ['error'],
|
|
85
|
-
'import/order': ['error'],
|
|
86
|
-
'import/newline-after-import': ['error'],
|
|
87
|
-
// JSDoc
|
|
88
|
-
'jsdoc/check-param-names': ['warn'],
|
|
89
|
-
'jsdoc/check-types': ['warn'],
|
|
90
|
-
'jsdoc/no-undefined-types': ['warn'],
|
|
91
|
-
'jsdoc/check-alignment': ['warn'],
|
|
92
|
-
'jsdoc/check-examples': ['off'],
|
|
93
|
-
'jsdoc/check-syntax': ['warn'],
|
|
94
|
-
'jsdoc/check-tag-names': ['warn'],
|
|
95
|
-
'jsdoc/require-jsdoc': ['warn'],
|
|
96
|
-
'jsdoc/require-param': ['warn'],
|
|
97
|
-
'jsdoc/require-param-description': ['warn'],
|
|
98
|
-
'jsdoc/require-param-name': ['warn'],
|
|
99
|
-
'jsdoc/require-param-type': ['warn'],
|
|
100
|
-
'jsdoc/require-returns': ['warn'],
|
|
101
|
-
'jsdoc/require-returns-check': ['warn'],
|
|
102
|
-
'jsdoc/require-returns-description': ['warn'],
|
|
103
|
-
'jsdoc/require-returns-type': ['warn'],
|
|
104
|
-
'jsdoc/valid-types': ['warn'],
|
|
105
|
-
// Prettier
|
|
106
|
-
'prettier/prettier': 'error',
|
|
107
|
-
},
|
|
108
|
-
overrides: [
|
|
109
|
-
// Vitest
|
|
110
|
-
{
|
|
111
|
-
files: ['**/__tests__/**/*.js'],
|
|
112
|
-
env: { 'vitest-globals/env': true },
|
|
113
|
-
globals: {
|
|
114
|
-
// Test name
|
|
115
|
-
testName: false,
|
|
116
|
-
// Shorter method names
|
|
117
|
-
fit: false,
|
|
118
|
-
fdescribe: false,
|
|
119
|
-
xit: false,
|
|
120
|
-
xdescribe: false,
|
|
121
|
-
|
|
122
|
-
captureOutput: false,
|
|
123
|
-
dedent: false,
|
|
124
|
-
},
|
|
125
|
-
extends: [
|
|
126
|
-
'plugin:vitest/recommended',
|
|
127
|
-
'plugin:vitest-globals/recommended',
|
|
128
|
-
],
|
|
129
|
-
rules: {
|
|
130
|
-
'no-restricted-globals': [
|
|
131
|
-
'error',
|
|
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' },
|
|
136
|
-
],
|
|
137
|
-
// In tests, we like to have the variable 'current' hold the object
|
|
138
|
-
// under test. The import/no-named-as-default-member would have warned
|
|
139
|
-
// us about using current.foo rather than foo directly, so we disable
|
|
140
|
-
// it.
|
|
141
|
-
'import/no-named-as-default-member': ['off'],
|
|
142
|
-
'vitest/consistent-test-it': ['warn', { fn: 'it' }],
|
|
143
|
-
// Disabling vitest/no-identical-title
|
|
144
|
-
// It can make eslint crash when used with fit/xit/fdescribe/xdescribe
|
|
145
|
-
// See: https://github.com/veritem/eslint-plugin-vitest/issues/310
|
|
146
|
-
'vitest/no-identical-title': ['off'],
|
|
147
|
-
'vitest/prefer-to-contain': ['error'],
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
// no-process-exit
|
|
151
|
-
// We need to send clear exit codes in yarn run scripts
|
|
152
|
-
{ files: ['**/scripts/**/*.js'], rules: { 'no-process-exit': ['off'] } },
|
|
153
|
-
],
|
|
154
|
-
};
|
package/configs/node.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Note: This file must still be in .cjs as it is require()d by eslintrc.cjs,
|
|
2
|
-
// which we also have to keep in cjs format
|
|
3
|
-
module.exports = {
|
|
4
|
-
nodeVersion: '18.18.0', // Also see templates/_circleci/config.yml
|
|
5
|
-
yarnVersion: '4.0.2',
|
|
6
|
-
norskaVersion: '2.9.0',
|
|
7
|
-
norskaThemeDocsVersion: '5.0.3',
|
|
8
|
-
lernaVersion: '4.0.0',
|
|
9
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Add faster to type aliases:
|
|
3
|
-
* - fit, ftest, fdescribe: To focus specific tests
|
|
4
|
-
* - xit, xtest, xdescribe: To skip specific tests
|
|
5
|
-
**/
|
|
6
|
-
|
|
7
|
-
globalThis.fit = globalThis.it.only;
|
|
8
|
-
globalThis.ftest = globalThis.test.only;
|
|
9
|
-
globalThis.fdescribe = globalThis.describe.only;
|
|
10
|
-
|
|
11
|
-
globalThis.xit = globalThis.it.skip;
|
|
12
|
-
globalThis.xtest = globalThis.test.skip;
|
|
13
|
-
globalThis.xdescribe = globalThis.describe.skip;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// We use extended matchers from jest-extended in vitest
|
|
2
|
-
// It includes matcher like .toStartWith, .toBeEmpty, etc
|
|
3
|
-
// See: https://github.com/jest-community/jest-extended
|
|
4
|
-
//
|
|
5
|
-
// The expect.extend() from Vitest is compatible with the one from Jest, so
|
|
6
|
-
// setup is straightforward
|
|
7
|
-
import { expect } from 'vitest';
|
|
8
|
-
import * as matchers from 'jest-extended';
|
|
9
|
-
|
|
10
|
-
expect.extend(matchers);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* global beforeEach, expect */
|
|
2
|
-
/**
|
|
3
|
-
* Make the variable `testName` contain the name of the current test in each
|
|
4
|
-
* test
|
|
5
|
-
**/
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
const fullName = expect.getState().currentTestName;
|
|
8
|
-
globalThis.testName = fullName.split(' > ').pop();
|
|
9
|
-
});
|
package/helper.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import * as url from 'url';
|
|
3
|
-
import { _ } from 'golgoth';
|
|
4
|
-
import { glob } from 'firost';
|
|
5
|
-
import findUp from 'find-up';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
/**
|
|
9
|
-
* Return absolute path to the host dir
|
|
10
|
-
* @returns {string} Absolute path to host dir
|
|
11
|
-
**/
|
|
12
|
-
hostRoot() {
|
|
13
|
-
return process.cwd();
|
|
14
|
-
},
|
|
15
|
-
/**
|
|
16
|
-
* Return an absolute path to a file in the host
|
|
17
|
-
* @param {string} relativePath Relative path from the host root
|
|
18
|
-
* @returns {string} Absolute path to the host file
|
|
19
|
-
**/
|
|
20
|
-
hostPath(relativePath = '') {
|
|
21
|
-
return path.resolve(this.hostRoot(), relativePath);
|
|
22
|
-
},
|
|
23
|
-
/**
|
|
24
|
-
* Return absolute path to the aberlaas directory
|
|
25
|
-
* @returns {string} Absolute path to aberlaas dir
|
|
26
|
-
**/
|
|
27
|
-
aberlaasRoot() {
|
|
28
|
-
return url.fileURLToPath(new URL('.', import.meta.url));
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* Return an absolute path to a file in the aberlaas directory
|
|
32
|
-
* @param {string} relativePath Relative path from the aberlaas root
|
|
33
|
-
* @returns {string} Absolute path to the aberlaas file
|
|
34
|
-
**/
|
|
35
|
-
aberlaasPath(relativePath = '') {
|
|
36
|
-
return path.resolve(this.aberlaasRoot(), relativePath);
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* Find files in host directory following glob patterns. Will exclude some
|
|
40
|
-
* directories by default, and allow specifying only specific file extensions
|
|
41
|
-
* @param {Array} userPattern Patterns to match
|
|
42
|
-
* @param {Array} safeExtensions Optional array of extensions to safelist. If
|
|
43
|
-
* set, only files of this extensions will be returned
|
|
44
|
-
* @returns {Array} Array of files matching the patterns
|
|
45
|
-
**/
|
|
46
|
-
async findHostFiles(userPattern, safeExtensions = []) {
|
|
47
|
-
const patterns = _.castArray(userPattern);
|
|
48
|
-
// Making all path relative to the host
|
|
49
|
-
const globs = _.map(patterns, (pattern) => {
|
|
50
|
-
return this.hostPath(pattern);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// Exclude folders that shouldn't be included
|
|
54
|
-
const blockedFolders = [
|
|
55
|
-
'build',
|
|
56
|
-
'dist',
|
|
57
|
-
'fixtures',
|
|
58
|
-
'node_modules',
|
|
59
|
-
'tmp',
|
|
60
|
-
'vendors',
|
|
61
|
-
'.git',
|
|
62
|
-
'.yarn',
|
|
63
|
-
];
|
|
64
|
-
_.each(blockedFolders, (blockedFolder) => {
|
|
65
|
-
const deepFolder = `**/${blockedFolder}/**`;
|
|
66
|
-
globs.push(`!${this.hostPath(deepFolder)}`);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Expanding globs
|
|
70
|
-
let allFiles = await glob(globs, { directories: false });
|
|
71
|
-
|
|
72
|
-
if (_.isEmpty(safeExtensions)) {
|
|
73
|
-
return allFiles;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Keep only files of specified extensions
|
|
77
|
-
allFiles = _.filter(allFiles, (filepath) => {
|
|
78
|
-
const extension = path.extname(filepath);
|
|
79
|
-
const extensionWithoutDot = _.replace(extension, '.', '');
|
|
80
|
-
return (
|
|
81
|
-
_.includes(safeExtensions, extension) ||
|
|
82
|
-
_.includes(safeExtensions, extensionWithoutDot)
|
|
83
|
-
);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
return allFiles;
|
|
87
|
-
},
|
|
88
|
-
/**
|
|
89
|
-
* Guess a path to a config file by first checking the specific path, then the
|
|
90
|
-
* host folder and finally fallbacking on the aberlaas default
|
|
91
|
-
* @param {string} userPath User specific config file
|
|
92
|
-
* @param {string} upFile File to look for up the directory tree
|
|
93
|
-
* @param {string} aberlaasPath Path to the aberlaas default file, relative to the aberlaas directory
|
|
94
|
-
* @returns {string} Path to config file
|
|
95
|
-
**/
|
|
96
|
-
async configFile(userPath, upFile, aberlaasPath) {
|
|
97
|
-
// Taking value from --config in CLI in priority
|
|
98
|
-
if (userPath) {
|
|
99
|
-
return this.hostPath(userPath);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Checking for custom config in the host
|
|
103
|
-
if (upFile) {
|
|
104
|
-
const upPath = await findUp(upFile, {
|
|
105
|
-
cwd: this.hostRoot(),
|
|
106
|
-
});
|
|
107
|
-
if (upPath) {
|
|
108
|
-
return upPath;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Fallback on default config in aberlaas
|
|
113
|
-
return this.aberlaasPath(aberlaasPath);
|
|
114
|
-
},
|
|
115
|
-
};
|
package/templates/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.
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
version: 2.1
|
|
2
|
-
|
|
3
|
-
aliases:
|
|
4
|
-
- &defaults
|
|
5
|
-
docker:
|
|
6
|
-
- image: cimg/node:18.18.0
|
|
7
|
-
- &restore_cache
|
|
8
|
-
restore_cache:
|
|
9
|
-
key: yarn-cache-{{ checksum "yarn.lock" }}
|
|
10
|
-
- &yarn_install
|
|
11
|
-
run: 'yarn install'
|
|
12
|
-
- &save_cache
|
|
13
|
-
save_cache:
|
|
14
|
-
key: yarn-cache-{{ checksum "yarn.lock" }}
|
|
15
|
-
paths:
|
|
16
|
-
- ~/.cache/yarn
|
|
17
|
-
|
|
18
|
-
jobs:
|
|
19
|
-
ci:
|
|
20
|
-
<<: *defaults
|
|
21
|
-
steps:
|
|
22
|
-
- checkout
|
|
23
|
-
- *restore_cache
|
|
24
|
-
- *yarn_install
|
|
25
|
-
- *save_cache
|
|
26
|
-
- run: 'yarn run ci'
|
|
27
|
-
|
|
28
|
-
workflows:
|
|
29
|
-
version: 2
|
|
30
|
-
# On every commit
|
|
31
|
-
commit:
|
|
32
|
-
jobs:
|
|
33
|
-
- ci
|