BlueGit

timfa frameworkv3

linting

timfa Tim Falken · pushed by timfa

Authored 2024-08-22 · 2 years ago

Hash
a0e2dc06e68304a189ec027b54b477a5161ddfd2
Parent
a97cda44
2 files changed +57 −13
.eslintrc.json added +34 −0
@@ -0,0 +1,34 @@
1 {
2 "env": {
3 "browser": true,
4 "es2021": true
5 },
6 "extends": "eslint:recommended",
7 "parserOptions": {
8 "ecmaVersion": 12,
9 "sourceType": "module"
10 },
11 "rules": {
12 "no-undef": "error", // Disallow the use of undeclared variables
13 "no-dupe-keys": "error", // Disallow duplicate keys in object literals
14 "curly": [
15 "error",
16 "all"
17 ], // Require curly braces for all control statements
18 "no-eval": "error", // Disallow the use of eval()
19 "no-multi-spaces": "error", // Disallow multiple spaces
20 "semi": [
21 "error",
22 "always"
23 ], // Require semicolons at the end of statements
24 "indent": [
25 "error",
26 "tab"
27 ], // Enforce consistent indentation of 2 spaces
28 "prefer-const": "error", // Suggest using `const` if a variable is never reassigned
29 "no-mixed-spaces-and-tabs": [
30 "error",
31 "smart-tabs"
32 ]
33 }
34 }
@@ -0,0 +1,34 @@
1{
2 "env": {
3 "browser": true,
4 "es2021": true
5 },
6 "extends": "eslint:recommended",
7 "parserOptions": {
8 "ecmaVersion": 12,
9 "sourceType": "module"
10 },
11 "rules": {
12 "no-undef": "error", // Disallow the use of undeclared variables
13 "no-dupe-keys": "error", // Disallow duplicate keys in object literals
14 "curly": [
15 "error",
16 "all"
17 ], // Require curly braces for all control statements
18 "no-eval": "error", // Disallow the use of eval()
19 "no-multi-spaces": "error", // Disallow multiple spaces
20 "semi": [
21 "error",
22 "always"
23 ], // Require semicolons at the end of statements
24 "indent": [
25 "error",
26 "tab"
27 ], // Enforce consistent indentation of 2 spaces
28 "prefer-const": "error", // Suggest using `const` if a variable is never reassigned
29 "no-mixed-spaces-and-tabs": [
30 "error",
31 "smart-tabs"
32 ]
33 }
34}
.gitlab-ci.yml +23 −13
@@ -2,26 +2,36 @@
2 2
3 3 # Define stages for the pipeline
4 4 stages:
5 - lint
5 6 - build
6 7 - release
7 8
9 eslint:
10 stage: lint
11 image: node:18 # Using an official Node.js Docker image
12 script:
13 - npm install
14 - npx eslint ./**/*.js # Lint all JavaScript files
15 only:
16 - merge_requests # Run on merge requests
17
8 18 # Define a job that runs when something is pushed to the master branch
9 19 build_job:
10 20 stage: build
11 21 script:
12 22 - apt-get update -qy
13 - chmod +x ./glbuild.sh # Ensure the script is executable
14 - ./glbuild.sh # Execute the script
23 - chmod +x ./glbuild.sh # Ensure the script is executable
24 - ./glbuild.sh # Execute the script
15 25 artifacts:
16 26 paths:
17 27 - js/framework.js
18 - build_job.env # Ensure the build_job.env file is included in the artifacts
28 - build_job.env # Ensure the build_job.env file is included in the artifacts
19 29 reports:
20 30 dotenv: build_job.env
21 31 only:
22 - master # Run this job only when changes are pushed to the master branch
32 - master # Run this job only when changes are pushed to the master branch
23 33 after_script:
24 # Save the job ID in a .env file to be used by the next job
34 # Save the job ID in a .env file to be used by the next job
25 35 - echo "BUILD_JOB_ID=$CI_JOB_ID" >> build_job.env
26 36
27 37 release_job:
@@ -31,16 +41,16 @@ release_job:
31 41 - build_job
32 42 script:
33 43 - echo "running release_job for $TAG"
34 release:
35 name: 'v0.$CI_PIPELINE_IID'
36 tag_name: 'v0.$CI_PIPELINE_IID' # The version is incremented per pipeline.
37 description: 'v0.$CI_PIPELINE_IID'
38 ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA.
44 release:
45 name: "v0.$CI_PIPELINE_IID"
46 tag_name: "v0.$CI_PIPELINE_IID" # The version is incremented per pipeline.
47 description: "v0.$CI_PIPELINE_IID"
48 ref: "$CI_COMMIT_SHA" # The tag is created from the pipeline SHA.
39 49 assets:
40 50 links:
41 - name: 'framework.js'
51 - name: "framework.js"
42 52 url: "https://gitlab.com/${CI_PROJECT_PATH}/-/jobs/$BUILD_JOB_ID/artifacts/raw/js/framework.js"
43 53 only:
44 - master # Run this job only when changes are pushed to the master branch
54 - master # Run this job only when changes are pushed to the master branch
45 55 before_script:
46 - source build_job.env
56 - source build_job.env
@@ -2,26 +2,36 @@
2
2
3# Define stages for the pipeline
3# Define stages for the pipeline
4stages:
4stages:
5 - lint
5 - build
6 - build
6 - release
7 - release
7
8
9eslint:
10 stage: lint
11 image: node:18 # Using an official Node.js Docker image
12 script:
13 - npm install
14 - npx eslint ./**/*.js # Lint all JavaScript files
15 only:
16 - merge_requests # Run on merge requests
17
8# Define a job that runs when something is pushed to the master branch
18# Define a job that runs when something is pushed to the master branch
9build_job:
19build_job:
10 stage: build
20 stage: build
11 script:
21 script:
12 - apt-get update -qy
22 - apt-get update -qy
13 - chmod +x ./glbuild.sh # Ensure the script is executable
23 - chmod +x ./glbuild.sh # Ensure the script is executable
14 - ./glbuild.sh # Execute the script
24 - ./glbuild.sh # Execute the script
15 artifacts:
25 artifacts:
16 paths:
26 paths:
17 - js/framework.js
27 - js/framework.js
18 - build_job.env # Ensure the build_job.env file is included in the artifacts
28 - build_job.env # Ensure the build_job.env file is included in the artifacts
19 reports:
29 reports:
20 dotenv: build_job.env
30 dotenv: build_job.env
21 only:
31 only:
22 - master # Run this job only when changes are pushed to the master branch
32 - master # Run this job only when changes are pushed to the master branch
23 after_script:
33 after_script:
24 # Save the job ID in a .env file to be used by the next job
34 # Save the job ID in a .env file to be used by the next job
25 - echo "BUILD_JOB_ID=$CI_JOB_ID" >> build_job.env
35 - echo "BUILD_JOB_ID=$CI_JOB_ID" >> build_job.env
26
36
27release_job:
37release_job:
@@ -31,16 +41,16 @@ release_job:
31 - build_job
41 - build_job
32 script:
42 script:
33 - echo "running release_job for $TAG"
43 - echo "running release_job for $TAG"
34 release:
44 release:
35 name: 'v0.$CI_PIPELINE_IID'
45 name: "v0.$CI_PIPELINE_IID"
36 tag_name: 'v0.$CI_PIPELINE_IID' # The version is incremented per pipeline.
46 tag_name: "v0.$CI_PIPELINE_IID" # The version is incremented per pipeline.
37 description: 'v0.$CI_PIPELINE_IID'
47 description: "v0.$CI_PIPELINE_IID"
38 ref: '$CI_COMMIT_SHA' # The tag is created from the pipeline SHA.
48 ref: "$CI_COMMIT_SHA" # The tag is created from the pipeline SHA.
39 assets:
49 assets:
40 links:
50 links:
41 - name: 'framework.js'
51 - name: "framework.js"
42 url: "https://gitlab.com/${CI_PROJECT_PATH}/-/jobs/$BUILD_JOB_ID/artifacts/raw/js/framework.js"
52 url: "https://gitlab.com/${CI_PROJECT_PATH}/-/jobs/$BUILD_JOB_ID/artifacts/raw/js/framework.js"
43 only:
53 only:
44 - master # Run this job only when changes are pushed to the master branch
54 - master # Run this job only when changes are pushed to the master branch
45 before_script:
55 before_script:
46 - source build_job.env
56 - source build_job.env