aberlaas-precommit 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/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Tim Carry (tim@pixelastic.com)
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.
@@ -0,0 +1,25 @@
1
+ const readmeCommands = [
2
+ 'yarn run aberlaas readme',
3
+ 'git add ./README.md ./lib/README.md',
4
+ ];
5
+
6
+ export default {
7
+ // Lint
8
+ '*.css': ['yarn run lint:fix --css'],
9
+ '*.{yml,yaml}': ['yarn run lint:fix --yml'],
10
+ '.circleci/config.yml': ['yarn run lint --circleci'],
11
+ '*.json': ['yarn run lint:fix --json'],
12
+ '*.js': ['yarn run lint:fix --js'],
13
+
14
+ // Test
15
+ './lib/**/*.js': ['FORCE_COLOR=1 yarn run test --failFast --related'],
16
+
17
+ // Compress
18
+ '*.png': ['yarn run compress --png'],
19
+
20
+ // Documentation
21
+ // Update the README whenever the documentation, or the README template
22
+ // changes
23
+ 'docs/src/**/*.md': readmeCommands,
24
+ '.github/README.template.md': readmeCommands,
25
+ };
package/lib/main.js ADDED
@@ -0,0 +1,33 @@
1
+ import lintStaged from 'lint-staged';
2
+ import { firostError } from 'firost';
3
+ import helper from 'aberlaas-helper';
4
+ import lintStagedConfig from '../configs/lintstaged.js';
5
+
6
+ export default {
7
+ async run(cliArgs) {
8
+ // Config
9
+ const config = await helper.getConfig(
10
+ cliArgs.config,
11
+ 'lintstaged.config.js',
12
+ lintStagedConfig,
13
+ );
14
+
15
+ try {
16
+ const result = await lintStaged({
17
+ config,
18
+ // Allow use extended shell syntax in config, like pipes, redirects or
19
+ // env variables
20
+ shell: true,
21
+ });
22
+ // Linting failed
23
+ if (!result) {
24
+ throw firostError(
25
+ 'ERROR_PRECOMMIT_LINT_FAILED',
26
+ 'Precommit linting failed',
27
+ );
28
+ }
29
+ } catch (_error) {
30
+ throw firostError('ERROR_PRECOMMIT', 'Precommit failed');
31
+ }
32
+ },
33
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "aberlaas-precommit",
3
+ "type": "module",
4
+ "description": "aberlaas precommit helper: Sanitize and cleanup on commit",
5
+ "version": "2.10.0",
6
+ "repository": "pixelastic/aberlaas",
7
+ "homepage": "https://projects.pixelastic.com/aberlaas/",
8
+ "author": "Tim Carry (@pixelastic)",
9
+ "license": "MIT",
10
+ "files": [
11
+ "lib/*.js",
12
+ "configs/*.js"
13
+ ],
14
+ "exports": {
15
+ ".": "./lib/main.js",
16
+ "./configs/lintstaged": "./configs/lintstaged.js"
17
+ },
18
+ "main": "./lib/main.js",
19
+ "engines": {
20
+ "node": ">=18.18.0"
21
+ },
22
+ "scripts": {
23
+ "build": "../../scripts/local/build",
24
+ "build:prod": "../../scripts/local/build-prod",
25
+ "cms": "../../scripts/local/cms",
26
+ "serve": "../../scripts/local/serve",
27
+ "ci": "../../scripts/local/ci",
28
+ "release": "../../scripts/local/release",
29
+ "update": "node ../../scripts/meta/update.js",
30
+ "test:meta": "../../scripts/local/test-meta",
31
+ "test": "../../scripts/local/test",
32
+ "test:watch": "../../scripts/local/test-watch",
33
+ "compress": "../../scripts/local/compress",
34
+ "lint": "../../scripts/local/lint",
35
+ "lint:fix": "../../scripts/local/lint-fix"
36
+ },
37
+ "dependencies": {
38
+ "aberlaas-helper": "^2.10.0",
39
+ "firost": "4.3.0",
40
+ "lint-staged": "15.2.10"
41
+ },
42
+ "gitHead": "bcdaf87c198a588e02b5539c222f611e356d3079"
43
+ }