linting
@@ -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": true5
},6
"extends": "eslint:recommended",7
"parserOptions": {8
"ecmaVersion": 12,9
"sourceType": "module"10
},11
"rules": {12
"no-undef": "error", // Disallow the use of undeclared variables13
"no-dupe-keys": "error", // Disallow duplicate keys in object literals14
"curly": [15
"error",16
"all"17
], // Require curly braces for all control statements18
"no-eval": "error", // Disallow the use of eval()19
"no-multi-spaces": "error", // Disallow multiple spaces20
"semi": [21
"error",22
"always"23
], // Require semicolons at the end of statements24
"indent": [25
"error",26
"tab"27
], // Enforce consistent indentation of 2 spaces28
"prefer-const": "error", // Suggest using `const` if a variable is never reassigned29
"no-mixed-spaces-and-tabs": [30
"error",31
"smart-tabs"32
]33
}34
}@@ -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 pipeline3
# Define stages for the pipeline4
stages:4
stages:5
- lint5
- build6
- build6
- release7
- release7
8
9
eslint:10
stage: lint11
image: node:18 # Using an official Node.js Docker image12
script:13
- npm install14
- npx eslint ./**/*.js # Lint all JavaScript files15
only:16
- merge_requests # Run on merge requests17
8
# Define a job that runs when something is pushed to the master branch18
# Define a job that runs when something is pushed to the master branch9
build_job:19
build_job:10
stage: build20
stage: build11
script:21
script:12
- apt-get update -qy22
- apt-get update -qy13
- chmod +x ./glbuild.sh # Ensure the script is executable23
- chmod +x ./glbuild.sh # Ensure the script is executable14
- ./glbuild.sh # Execute the script24
- ./glbuild.sh # Execute the script15
artifacts:25
artifacts:16
paths:26
paths:17
- js/framework.js27
- js/framework.js18
- build_job.env # Ensure the build_job.env file is included in the artifacts28
- build_job.env # Ensure the build_job.env file is included in the artifacts19
reports:29
reports:20
dotenv: build_job.env30
dotenv: build_job.env21
only:31
only:22
- master # Run this job only when changes are pushed to the master branch32
- master # Run this job only when changes are pushed to the master branch23
after_script:33
after_script:24
# Save the job ID in a .env file to be used by the next job34
# Save the job ID in a .env file to be used by the next job25
- echo "BUILD_JOB_ID=$CI_JOB_ID" >> build_job.env35
- echo "BUILD_JOB_ID=$CI_JOB_ID" >> build_job.env26
36
27
release_job:37
release_job:@@ -31,16 +41,16 @@ release_job:31
- build_job41
- build_job32
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 branch54
- master # Run this job only when changes are pushed to the master branch45
before_script:55
before_script:46
- source build_job.env56
- source build_job.env