aberlaas-ci 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.
Files changed (3) hide show
  1. package/LICENSE +9 -0
  2. package/lib/main.js +48 -0
  3. package/package.json +42 -0
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.
package/lib/main.js ADDED
@@ -0,0 +1,48 @@
1
+ import ciInfo from 'ci-info';
2
+ import { firostError, run } from 'firost';
3
+ import commandTest from 'aberlaas-test';
4
+ import commandLint from 'aberlaas-lint';
5
+
6
+ export default {
7
+ /**
8
+ * Checks if currently running on a CI server
9
+ * @returns {boolean} True if on a CI server
10
+ */
11
+ isCI() {
12
+ return ciInfo.isCI;
13
+ },
14
+ /**
15
+ * Run CI scripts and fail the job if any fails
16
+ * Runs lint and test by default, but can be changed with --no-test and
17
+ * --no-lint
18
+ * @param {object} cliArgs CLI Argument object, as created by minimist
19
+ * @returns {boolean} True on success, throws on error
20
+ */
21
+ async run(cliArgs = {}) {
22
+ const args = {
23
+ test: true,
24
+ lint: true,
25
+ ...cliArgs,
26
+ };
27
+
28
+ if (!this.isCI()) {
29
+ throw firostError(
30
+ 'ERROR_CI',
31
+ 'Current system is not a CI. Use CI=1 to force',
32
+ );
33
+ }
34
+
35
+ if (args.test) {
36
+ await this.__runTest();
37
+ }
38
+
39
+ if (args.lint) {
40
+ await this.__runLint();
41
+ }
42
+
43
+ return true;
44
+ },
45
+ __runTest: commandTest.run.bind(commandTest),
46
+ __runLint: commandLint.run.bind(commandLint),
47
+ __run: run,
48
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "aberlaas-ci",
3
+ "type": "module",
4
+ "description": "aberlaas ci command: Run tests and lint on each commit on the CI",
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
+ ],
13
+ "exports": {
14
+ ".": "./lib/main.js"
15
+ },
16
+ "main": "./lib/main.js",
17
+ "engines": {
18
+ "node": ">=18.18.0"
19
+ },
20
+ "scripts": {
21
+ "build": "../../scripts/local/build",
22
+ "build:prod": "../../scripts/local/build-prod",
23
+ "cms": "../../scripts/local/cms",
24
+ "serve": "../../scripts/local/serve",
25
+ "ci": "../../scripts/local/ci",
26
+ "release": "../../scripts/local/release",
27
+ "update": "node ../../scripts/meta/update.js",
28
+ "test:meta": "../../scripts/local/test-meta",
29
+ "test": "../../scripts/local/test",
30
+ "test:watch": "../../scripts/local/test-watch",
31
+ "compress": "../../scripts/local/compress",
32
+ "lint": "../../scripts/local/lint",
33
+ "lint:fix": "../../scripts/local/lint-fix"
34
+ },
35
+ "dependencies": {
36
+ "aberlaas-lint": "^2.10.0",
37
+ "aberlaas-test": "^2.10.0",
38
+ "ci-info": "4.0.0",
39
+ "firost": "4.3.0"
40
+ },
41
+ "gitHead": "bcdaf87c198a588e02b5539c222f611e356d3079"
42
+ }