diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 74ad56b6..6649f6a9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,6 +2,7 @@ # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +--- version: 2 updates: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 5c595aac..ae362194 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,21 +9,33 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # +--- + name: "CodeQL" -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main", "develop", "feature/*" ] + branches: ["main", "develop", "feature/*"] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ["main"] schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * - cron: '37 19 * * 5' jobs: analyze: name: Analyze - runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + runs-on: + ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} permissions: actions: read contents: read @@ -32,45 +44,50 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'javascript' ] + language: ['javascript'] + # yamllint disable rule:line-length # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Use only 'java' to analyze code written in Java, Kotlin or both # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + # yamllint enable rule:line-length steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # yamllint disable rule:line-length + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + # yamllint enable rule:line-length - # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 + # yamllint disable rule:line-length + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + # yamllint enable rule:line-length - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{matrix.language}}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 62202cfd..c1894d98 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -1,10 +1,12 @@ +--- + name: Docker Image CI -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main", "develop", "feature/*" ] + branches: ["main", "develop", "feature/*"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: @@ -14,28 +16,39 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - name: Build the Docker image - run: make compose/rebuild - - name: Run test in Docker image - run: make compose/run - - name: Tag Docker image - run: docker tag algorithm-exercises-ts:latest algorithm-exercises-ts:${{ github.sha }} + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + - name: Build the Docker image + run: make compose/rebuild + - name: Lint in Docker image + run: make compose/lint + - name: Test in Docker image + run: make compose/test + - name: Run in Docker image + run: make compose/run + - name: Tag Docker image + run: > + docker tag + algorithm-exercises-ts:latest + algorithm-exercises-ts:${{ github.sha }} - - name: Run Snyk to check Docker image for vulnerabilities - # Snyk can be used to break the build when it detects vulnerabilities. - # In this case we want to upload the issues to GitHub Code Scanning - continue-on-error: true - uses: snyk/actions/docker@master - env: - # In order to use the Snyk Action you will need to have a Snyk API token. - # See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token - # or you can sign up for free at https://snyk.io/login - SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} - with: + - name: Run Snyk to check Docker image for vulnerabilities + # Snyk can be used to break the build when it detects vulnerabilities. + # In this case we want to upload the issues to GitHub Code Scanning + continue-on-error: true + uses: snyk/actions/docker@master + env: + # yamllint disable rule:line-length + # In order to use the Snyk Action you will need to have a Snyk API token. + # See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token + # or you can sign up for free at https://snyk.io/login + # yamllint enable rule:line-length + SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} + with: image: algorithm-exercises-ts:latest args: --file=Dockerfile - # - name: Upload result to GitHub Code Scanning - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: snyk.sarif + # yamllint disable rule:comments-indentation + # - name: Upload result to GitHub Code Scanning + # uses: github/codeql-action/upload-sarif@v2 + # with: + # sarif_file: snyk.sarif + # yamllint enable rule:comments-indentation diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index bddddcb1..a1a3593f 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -6,16 +6,26 @@ # found in ECMAScript/JavaScript code. # More details at https://github.com/eslint/eslint # and https://eslint.org +--- name: ESLint -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main", "develop" ] + branches: ["main", "develop"] pull_request: # The branches below must be a subset of the branches above - branches: [ "main" ] + branches: ["main"] schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * - cron: '36 13 * * 1' jobs: @@ -25,7 +35,9 @@ jobs: permissions: contents: read security-events: write - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + # only required for a private repository by + # github/codeql-action/upload-sarif to get the Action run status + actions: read steps: - name: Checkout code uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 diff --git a/.github/workflows/gitleaks.yml b/.github/workflows/gitleaks.yml index 39f6532f..0870c98f 100644 --- a/.github/workflows/gitleaks.yml +++ b/.github/workflows/gitleaks.yml @@ -1,9 +1,21 @@ +--- + name: gitleaks -on: + +on: # yamllint disable-line rule:truthy pull_request: push: workflow_dispatch: schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * - cron: "0 4 * * *" # run once a day at 4 AM jobs: scan: @@ -16,4 +28,5 @@ jobs: - uses: gitleaks/gitleaks-action@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} # Only required for Organizations, not personal accounts. + # Only required for Organizations, not personal accounts. + # GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}} diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index 4793a9af..acbdad2f 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -1,10 +1,12 @@ +--- + name: Markdown Lint -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main", "develop", "feature/*" ] + branches: ["main", "develop", "feature/*"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: @@ -15,20 +17,22 @@ jobs: matrix: os: ["ubuntu-latest"] node-version: [20.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + # See supported Node.js release schedule + # at https://nodejs.org/en/about/releases/ steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - name: Install dependencies - run: npm install -g markdownlint-cli + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} - - name: Lint - run: markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.' + - name: Install dependencies + run: npm install -g markdownlint-cli + - name: Lint + run: > + markdownlint '**/*.md' --ignore node_modules + && echo '✔ Your code looks good.' diff --git a/.github/workflows/node-coverage.js.yml b/.github/workflows/node-coverage.js.yml index 2c694c9f..ba8a3a39 100644 --- a/.github/workflows/node-coverage.js.yml +++ b/.github/workflows/node-coverage.js.yml @@ -1,10 +1,12 @@ +--- + name: Node.js CI Coverage -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main", "develop", "feature/*" ] + branches: ["main", "develop", "feature/*"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: @@ -13,39 +15,38 @@ jobs: strategy: matrix: - os: [ - "ubuntu-latest" - ] node-version: [22.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + # See supported Node.js release schedule + # at https://nodejs.org/en/about/releases/ steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - with: - fetch-depth: 0 - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Install dependencies - run: npm ci --verbose - - - name: Lint - run: npm run lint - - - name: Run the tests - run: npm run jest:ci -- --coverage - - - name: Upload coverage reports to Codecov with GitHub Action - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} # required - verbose: true # optional (default = false) - - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + with: + fetch-depth: 0 + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: npm ci --verbose + + - name: Lint + run: npm run lint + + - name: Run the tests + run: npm run jest:ci -- --coverage + + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} # required + verbose: true # optional (default = false) + + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # Needed to get PR information, if any + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/node-snyk.yml b/.github/workflows/node-snyk.yml index 188e3191..daf35d6a 100644 --- a/.github/workflows/node-snyk.yml +++ b/.github/workflows/node-snyk.yml @@ -1,13 +1,16 @@ +# yamllint disable rule:line-length # This workflow will build a .NET project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net +# yamllint enable rule:line-length +--- name: Snyk Code analysis -on: +on: # yamllint disable-line rule:truthy push: - branches: [ main, develop, feature/* ] + branches: ["main", "develop", "feature/*"] pull_request: - branches: [ main ] + branches: ["main"] jobs: security: diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index ae83b6a5..c690f710 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,10 +1,12 @@ +--- + name: Node.js CI Tests -on: +on: # yamllint disable-line rule:truthy push: - branches: [ "main", "develop", "feature/*" ] + branches: ["main", "develop", "feature/*"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: build: @@ -14,27 +16,28 @@ jobs: strategy: matrix: os: [ - "windows-latest", - "ubuntu-latest", - "macOS-latest" - ] + "windows-latest", + "ubuntu-latest", + "macOS-latest" + ] node-version: [18.x, 20.x, 22.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + # See supported Node.js release schedule + # at https://nodejs.org/en/about/releases/ steps: - - name: Checkout repository - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: npm ci --verbose + - name: Install dependencies + run: npm ci --verbose - - name: Lint - run: npm run lint + - name: Lint + run: npm run lint - - name: Run the tests - run: npm run jest:ci + - name: Run the tests + run: npm run jest:ci diff --git a/.github/workflows/yamllint.yml b/.github/workflows/yamllint.yml new file mode 100644 index 00000000..3f5009c6 --- /dev/null +++ b/.github/workflows/yamllint.yml @@ -0,0 +1,24 @@ +--- + +name: YAML lint + +on: # yamllint disable-line rule:truthy + push: + branches: ["main", "develop", "feature/*"] + pull_request: + branches: ["main"] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 + + - name: Install yamllint + run: pip install yamllint + + - name: Lint YAML files + run: > + yamllint --strict . + && echo '✔ Your code looks good.' diff --git a/.markdownlint.yaml b/.markdownlint.yaml index caa54a79..3fd17fdf 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,3 +1,7 @@ +--- + +# yamllint disable rule:line-length + # Example markdownlint configuration with all properties set to their default value # Default state for all rules @@ -261,3 +265,5 @@ MD053: # Ignored definitions ignored_definitions: - "//" + +# yamllint enable rule:line-length diff --git a/.yamlignore b/.yamlignore new file mode 100644 index 00000000..544b4c7f --- /dev/null +++ b/.yamlignore @@ -0,0 +1 @@ +.trunk/* diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..b6288375 --- /dev/null +++ b/.yamllint @@ -0,0 +1,19 @@ +--- +extends: default + +ignore-from-file: [.gitignore, .yamlignore] + +rules: + comments: + min-spaces-from-content: 1 + +# yamllint disable rule:line-length +# +# References: +# False positive: interpreting GitHub actions "on:" as a truthy value #430 +# https://github.com/adrienverge/yamllint/issues/430 +# +# YAML formatting not compliant with yamllint "spaces before comments" requirement #433 +# https://github.com/redhat-developer/vscode-yaml/issues/433#issuecomment-1235681987 +# +# yamllint enable rule:line-length diff --git a/Dockerfile b/Dockerfile index 9239dc1e..254d03c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,14 +7,20 @@ ENV WORKDIR=/app WORKDIR ${WORKDIR} ############################################################################### -FROM node:20.14.0-alpine3.20 AS lint +FROM base AS lint ENV WORKDIR=/app WORKDIR ${WORKDIR} -COPY ./src ${WORKDIR}/src -RUN apk add --update --no-cache make -RUN npm install -g markdownlint-cli +RUN apk add --update --no-cache make nodejs npm +RUN apk add --update --no-cache yamllint + +RUN npm install -g --ignore-scripts markdownlint-cli + +# [!TIP] Use a bind-mount to "/app" to override following "copys" +# for lint and test against "current" sources in this stage + +CMD ["make", "lint"] ############################################################################### FROM base AS development @@ -28,7 +34,7 @@ COPY ./package-lock.json ${WORKDIR}/package-lock.json COPY ./Makefile ${WORKDIR}/ COPY ./tsconfig.json ${WORKDIR}/tsconfig.json -RUN npm ci --verbose +RUN npm ci --verbose --ignore-scripts ############################################################################### ### In testing stage, can't use USER, due permissions issue diff --git a/Makefile b/Makefile index 3a54bd15..91998795 100644 --- a/Makefile +++ b/Makefile @@ -57,16 +57,25 @@ dependencies: test -x ./node_modules || npm install --verbose @echo "################################################################################" -mdlint: +lint/markdown: markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.' -lint: test/static mdlint +lint/yaml: + yamllint --stric . && echo '✔ Your code looks good.' + +lint: lint/markdown lint/yaml test/styling test/static test/static: dependencies - npm run lint + ${NPM} run lint + +test/styling: dependencies + ${NPM} run style:check -test: env dependencies test/static - npm run jest:ci +format: dependencies + ${NPM} run style:format + +test: env dependencies + ${NPM} run jest:ci coverage: test @@ -81,21 +90,37 @@ update: dependencies outdated upgrade: update compose/build: env + docker-compose --profile lint build docker-compose --profile testing build + docker-compose --profile production build compose/rebuild: env + docker-compose --profile lint build --no-cache docker-compose --profile testing build --no-cache + docker-compose --profile production build --no-cache -compose/mdlint: env +compose/lint/markdown: compose/build docker-compose --profile lint build - docker-compose --profile lint run --rm algorithm-exercises-ts-mdlint make mdlint + docker-compose --profile lint run --rm algorithm-exercises-ts-lint make lint/markdown + +compose/lint/yaml: compose/build + docker-compose --profile lint run --rm algorithm-exercises-ts-lint make lint/yaml + +compose/test/styling: compose/build + docker-compose --profile lint run --rm algorithm-exercises-ts-lint make test/styling compose/test/static: compose/build - docker-compose --profile testing run --rm algorithm-exercises-ts make test/static + docker-compose --profile lint run --rm algorithm-exercises-ts-lint make test/static -compose/lint: compose/test/static compose/mdlint +compose/lint: compose/lint/markdown compose/lint/yaml compose/test/styling compose/test/static + +compose/test: compose/build + docker-compose --profile testing run --rm algorithm-exercises-ts-test make test compose/run: compose/build - docker-compose --profile testing run --rm algorithm-exercises-ts make test + docker-compose --profile production run --rm algorithm-exercises-ts make run all: env dependencies test + +run: + ls -alh diff --git a/compose.yaml b/compose.yaml index ac92e7bc..47be7c55 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,5 +1,6 @@ +--- services: - algorithm-exercises-ts: + algorithm-exercises-ts-test: image: algorithm-exercises-ts:latest build: context: . @@ -11,14 +12,14 @@ services: - ./coverage:/app/coverage profiles: ["testing"] - algorithm-exercises-ts-mdlint: - image: algorithm-exercises-ts:mdlint + algorithm-exercises-ts-lint: + image: algorithm-exercises-ts:lint build: context: . target: lint # environment: - # LOG_LEVEL: ${LOG_LEVEL:-info} ## (1) ## info | debug - # BRUTEFORCE: ${BRUTEFORCE:-false} ## (1) ## true | false + # LOG_LEVEL: ${LOG_LEVEL:-info} ## (1) ## info | debug + # BRUTEFORCE: ${BRUTEFORCE:-false} ## (1) ## true | false volumes: - ./:/app profiles: ["lint"] @@ -35,6 +36,15 @@ services: - ./:/app profiles: ["development"] + algorithm-exercises-ts: + image: algorithm-exercises-ts:latest + build: + context: . + target: production + # volumes: + # - ./:/app + profiles: ["production"] + ## REFERENCES: ## (1) Passing Environment variable with fallback value: ## https://stackoverflow.com/a/70772707/6366150 diff --git a/package.json b/package.json index 3f94a082..bf72ac3b 100644 --- a/package.json +++ b/package.json @@ -26,13 +26,14 @@ }, "scripts": { "start": "npm run test", - "lint": "npx eslint . --color --max-warnings=0 && echo '✔ Your code looks good.'", + "lint": "npx --yes eslint . --color --max-warnings=0 && echo '✔ Your code looks good.'", "jest:ci": "node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug", - "jest:clean": "jest --clearCache && watchman watch-del-all", + "jest:clean": "npx --yes jest --clearCache && npx --yes watchman watch-del-all", "jest:bruteforce": "BRUTEFORCE=true node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug", "jest:watch": "node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug --watchAll", - "prettier": "npx prettier --write 'src/**/*.js'", - "test": "jest", + "style:format": "npx --yes prettier --write 'src/**/*.ts'", + "style:check": "npx --yes prettier --check 'src/**/*.ts'", + "test": "npm run jest:ci", "update-all": "npm install $(npm outdated | cut -d' ' -f 1 | sed '1d' | xargs -I '$' echo '$@latest' | xargs echo)" } }