feat: add Filesystem util and load env util (#7487)

This commit is contained in:
Harminder Virk
2024-05-28 15:31:13 +05:30
committed by GitHub
parent 164bb988e7
commit ef6d748784
24 changed files with 389 additions and 194 deletions

View File

@@ -36,7 +36,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
node-version: 20
cache: "yarn"
- name: Assert changed

View File

@@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
node-version: 20
cache: "yarn"
- name: Install dependencies

View File

@@ -1,5 +1,5 @@
name: Documentation Tests
on:
on:
pull_request:
paths:
- www/**
@@ -22,7 +22,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: 20
cache: "yarn"
- name: Install dependencies
@@ -44,7 +44,7 @@ jobs:
# TODO change once we have actual URLs
NEXT_PUBLIC_RESOURCES_URL: "http://example.com"
NEXT_PUBLIC_USER_GUIDE_URL: "http://example.com"
vale-book:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -75,7 +75,7 @@ jobs:
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: 'yarn check:pr-files-count ${{ github.ref_name }}'
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
@@ -90,13 +90,13 @@ jobs:
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: '--minAlertLevel=error'
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-resources:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -127,7 +127,7 @@ jobs:
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: 'yarn check:pr-files-count ${{ github.ref_name }}'
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
@@ -141,13 +141,13 @@ jobs:
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: '--minAlertLevel=error'
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-user-guide:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -178,7 +178,7 @@ jobs:
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: 'yarn check:pr-files-count ${{ github.ref_name }}'
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
@@ -192,13 +192,13 @@ jobs:
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: '--minAlertLevel=error'
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-ui:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -229,7 +229,7 @@ jobs:
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: 'yarn check:pr-files-count ${{ github.ref_name }}'
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
@@ -244,13 +244,13 @@ jobs:
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: '--minAlertLevel=error'
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-api:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -281,7 +281,7 @@ jobs:
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: 'yarn check:pr-files-count ${{ github.ref_name }}'
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
@@ -296,13 +296,13 @@ jobs:
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: '--minAlertLevel=error'
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: diff_context
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
content-eslint:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -324,7 +324,7 @@ jobs:
- name: Run Eslint
working-directory: www
run: yarn lint:content
code-docs-eslint:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
@@ -352,4 +352,4 @@ jobs:
- name: Run Eslint
working-directory: www
run: yarn lint
run: yarn lint

View File

@@ -9,9 +9,9 @@ on:
workflow_dispatch:
inputs:
referenceName:
description: 'Reference to Generate. Use either `all` or a name of a config file in `www/utils/packages/typedoc-config` such as `product`.'
description: "Reference to Generate. Use either `all` or a name of a config file in `www/utils/packages/typedoc-config` such as `product`."
required: false
default: 'all'
default: "all"
jobs:
references:
@@ -31,7 +31,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
node-version: 20
cache: "yarn"
- name: Install dependencies
@@ -83,4 +83,4 @@ jobs:
add-paths: www/apps/resources/references/**
branch: "docs/generate-reference"
branch-suffix: "timestamp"
body: ${{ steps.pr-message.outputs.body }}
body: ${{ steps.pr-message.outputs.body }}

View File

@@ -14,10 +14,10 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 18
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: Install Dependencies
run: yarn
@@ -70,10 +70,10 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 18
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: Install Dependencies
run: yarn

View File

@@ -3,9 +3,9 @@ on:
workflow_dispatch:
inputs:
referenceName:
description: 'Reference to Generate. Use either `all` to generate all references, `api` to generate the API reference, or `ui` to generate UI reference.'
description: "Reference to Generate. Use either `all` to generate all references, `api` to generate the API reference, or `ui` to generate UI reference."
required: false
default: 'all'
default: "all"
release:
types: [published]
@@ -28,7 +28,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
node-version: 20
cache: "yarn"
- name: Install dependencies
@@ -78,7 +78,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
node-version: 20
cache: "yarn"
- name: Install dependencies
@@ -114,4 +114,4 @@ jobs:
labels: "type: chore"
add-paths: www/apps/ui/src/specs
branch: "docs/generate-ui-ref"
branch-suffix: "timestamp"
branch-suffix: "timestamp"

View File

@@ -20,7 +20,7 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: "16.10.0"
node-version: 20
cache: "yarn"
- name: Post to Slack channel

View File

@@ -15,10 +15,10 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 16
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
- name: Creating .npmrc
run: |
@@ -37,4 +37,4 @@ jobs:
- name: Create Release Pull Request
uses: changesets/action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -12,7 +12,7 @@ jobs:
snapshot:
name: Snapshot Release
if: |
github.event.issue.pull_request &&
github.event.issue.pull_request &&
github.event.comment.body == '/snapshot-this'
runs-on: ubuntu-latest
steps:
@@ -79,7 +79,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20
cache: "yarn"
- name: Install dependencies
@@ -120,7 +120,7 @@ jobs:
'```sh\n' +
`yarn add ${tag}\n` +
'```'
)).join('\n') +
)).join('\n') +
`\n\n> Latest commit: ${context.sha}`
)

View File

@@ -1,82 +1,82 @@
name: CLI Pipeline
on:
pull_request:
pull_request:
jobs:
test-cli-with-database:
env:
NODE_ENV: CI
REDIS_URL: redis://localhost:6379
DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
test-cli-with-database:
env:
NODE_ENV: CI
REDIS_URL: redis://localhost:6379
DATABASE_URL: "postgres://postgres:postgres@localhost/cli-test"
POSTGRES_URL: "postgres://postgres:postgres@localhost/cli-test"
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: cli-test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: cli-test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup development server
uses: ./.github/actions/setup-server
with:
cache-extension: "cli-test"
node-version: 18
- name: Setup development server
uses: ./.github/actions/setup-server
with:
cache-extension: "cli-test"
node-version: 20
- name: Install Medusa cli
run: npm i -g @medusajs/medusa-cli@preview
- name: Install Medusa cli
run: npm i -g @medusajs/medusa-cli@preview
- name: Create Medusa project
run: |
medusa new cli-test --skip-db --v2 --branch feat/v2-ci
working-directory: ..
- name: Create Medusa project
run: |
medusa new cli-test --skip-db --v2 --branch feat/v2-ci
working-directory: ..
- name: run medusa dev
run: medusa-dev --force-install
working-directory: ../cli-test
- name: run medusa dev
run: medusa-dev --force-install
working-directory: ../cli-test
- name: Run migrations
run: medusa migrations run
working-directory: ../cli-test
- name: Run migrations
run: medusa migrations run
working-directory: ../cli-test
- name: Create admin user
run: medusa user -e test@test.com -p password -i admin_123
working-directory: ../cli-test
- name: Create admin user
run: medusa user -e test@test.com -p password -i admin_123
working-directory: ../cli-test
- name: Run development server
run: medusa develop &
working-directory: ../cli-test
- name: Run development server
run: medusa develop &
working-directory: ../cli-test
- name: Testing development server
uses: ./.github/actions/test-server
- name: Testing development server
uses: ./.github/actions/test-server
- name: Starting medusa
run: medusa start &
working-directory: ../cli-test
- name: Starting medusa
run: medusa start &
working-directory: ../cli-test
- name: Testing server
uses: ./.github/actions/test-server
- name: Testing server
uses: ./.github/actions/test-server

View File

@@ -5,14 +5,14 @@ on:
inputs:
version:
type: choice
default: 'preview'
default: "preview"
description: What tag do you want to release?
required: true
options:
- preview
- next
- snapshot
- canary
options:
- preview
- next
- snapshot
- canary
branches:
- develop
paths-ignore:
@@ -32,10 +32,10 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 16.x
- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20
- name: Creating .npmrc
run: |
@@ -44,8 +44,8 @@ jobs:
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Configure npm node prepend
- name: Configure npm node prepend
run: npm config set scripts-prepend-node-path auto
- name: Install Dependencies
@@ -61,6 +61,6 @@ jobs:
- name: Build all packages
run: yarn build
- name: Publish packages under next tag
run: yarn changeset publish --no-git-tags --snapshot --tag ${{ github.event.inputs.version || 'preview' }}