Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/policy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
if [ "$license_file_found" = false ]; then
echo "No license file found. Please add a license file to the repository."
exit 1
fi
fi
70 changes: 70 additions & 0 deletions .github/workflows/release-v1-beta-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release CLI Core (v1 Beta)

on:
push:
branches: [v1-beta]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.28.0
- uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: Enable Corepack
run: corepack enable

- name: Install pnpm
run: corepack prepare pnpm@10.28.0 --activate

- name: Install root dependencies
run: pnpm install

- name: Reading Configuration
id: release_config
uses: rgarcia-phi/json-to-variables@v1.1.0
with:
filename: .github/config/release.json
prefix: release

# Core CLI
- name: Installing dependencies of core
id: core-installation
if: ${{env.release_releaseAll == 'true' || env.release_plugins_core == 'true'}}
working-directory: ./packages/contentstack
run: npm install
- name: Compiling core
if: ${{ steps.core-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack
run: npm run prepack
- name: Publishing core (Beta)
id: publish-core
uses: JS-DevTools/npm-publish@v3
if: ${{ steps.core-installation.conclusion == 'success' }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack/package.json
tag: beta

- name: Create Core Beta Release
if: ${{ steps.publish-core.conclusion == 'success' }}
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shafeeqd959 , The SRE team is using PKG_TOKEN instead of GITHUB_TOKEN due to security concerns.

VERSION: ${{ steps.publish-core.outputs.version }}
run: |
# Look for the last release specifically starting with the 'core@v' prefix
PREVIOUS_BETA=$(gh release list --limit 50 | grep 'core@v' | grep 'beta' | head -1 | cut -f1)

if [ -n "$PREVIOUS_BETA" ]; then
# Compare current core version against previous core version
gh release create "core@v$VERSION" --title "Core Beta $VERSION" --notes-from-tag "$PREVIOUS_BETA" --prerelease
else
# Fallback if this is the first core@v release
gh release create "core@v$VERSION" --title "Core Beta $VERSION" --generate-notes --prerelease
fi
141 changes: 141 additions & 0 deletions .github/workflows/release-v1-beta-platform-plugins.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Release CLI Platform Plugins (v1 Beta)

on:
push:
branches: [v1-beta]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 7
- uses: actions/setup-node@v4
with:
node-version: '22.x'

- name: Enable Corepack
run: corepack enable

- name: Install pnpm
run: corepack prepare pnpm@7 --activate

- name: Install root dependencies
run: pnpm install

- name: Reading Configuration
id: release_config
uses: rgarcia-phi/json-to-variables@v1.1.0
with:
filename: .github/config/release.json
prefix: release

# Dev Dependencies
- name: Installing dependencies of dev dependencies
id: dev-dependencies-installation
if: ${{env.release_releaseAll == 'true' || env.release_plugins_dev-dependencies == 'true'}}
working-directory: ./packages/contentstack-dev-dependencies
run: npm install
- name: Compiling dev dependencies
if: ${{ steps.dev-dependencies-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-dev-dependencies
run: npm run prepack
- name: Publishing dev dependencies (Beta)
uses: JS-DevTools/npm-publish@v3
if: ${{ steps.dev-dependencies-installation.conclusion == 'success' }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack-dev-dependencies/package.json
tag: beta

# Utilities
- name: Installing dependencies of utilities
id: utilities-installation
if: ${{env.release_releaseAll == 'true' || env.release_plugins_utilities == 'true'}}
working-directory: ./packages/contentstack-utilities
run: npm install
- name: Compiling utilities
if: ${{ steps.utilities-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-utilities
run: npm run prepack
- name: Publishing utilities (Beta)
uses: JS-DevTools/npm-publish@v3
if: ${{ steps.utilities-installation.conclusion == 'success' }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack-utilities/package.json
tag: beta

# Command
- name: Installing dependencies of command
id: command-installation
if: ${{env.release_releaseAll == 'true' || env.release_plugins_command == 'true'}}
working-directory: ./packages/contentstack-command
run: npm install
- name: Compiling command
if: ${{ steps.command-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-command
run: npm run prepack
- name: Publishing command (Beta)
uses: JS-DevTools/npm-publish@v3
if: ${{ steps.command-installation.conclusion == 'success' }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack-command/package.json
tag: beta

# Config
- name: Installing dependencies of config
id: config-installation
if: ${{env.release_releaseAll == 'true' || env.release_plugins_config == 'true'}}
working-directory: ./packages/contentstack-config
run: npm install
- name: Compiling config
if: ${{ steps.config-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-config
run: npm run prepack
- name: Publishing config (Beta)
uses: JS-DevTools/npm-publish@v3
if: ${{ steps.config-installation.conclusion == 'success' }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack-config/package.json
tag: beta

# Auth
- name: Installing dependencies of auth
id: auth-installation
if: ${{env.release_releaseAll == 'true' || env.release_plugins_auth == 'true'}}
working-directory: ./packages/contentstack-auth
run: npm install
- name: Compiling auth
if: ${{ steps.auth-installation.conclusion == 'success' }}
working-directory: ./packages/contentstack-auth
run: npm run prepack
- name: Publishing auth (Beta)
uses: JS-DevTools/npm-publish@v3
if: ${{ steps.auth-installation.conclusion == 'success' }}
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/contentstack-auth/package.json
tag: beta

- name: Create Platform Plugins Beta Release
# Adjust the ID below to match your actual publishing step ID for plugins
if: ${{ steps.publish-plugins.conclusion == 'success' }}
id: create_release_plugins
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Extract version from the output of your plugin publish step
VERSION: ${{ steps.publish-plugins.outputs.version }}
run: |
# Look for the last release specifically starting with 'plugins@v'
PREVIOUS_BETA=$(gh release list --limit 50 | grep 'platform-plugins@v' | grep 'beta' | head -1 | cut -f1)

if [ -n "$PREVIOUS_BETA" ]; then
gh release create "platform-plugins@v$VERSION" --title "Platform Plugins Beta $VERSION" --notes-from-tag "$PREVIOUS_BETA" --prerelease
else
gh release create "platform-plugins@v$VERSION" --title "Platform Plugins Beta $VERSION" --generate-notes --prerelease
fi
102 changes: 18 additions & 84 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,104 +11,38 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0 # or your local pnpm version

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'pnpm' # optional but recommended

- name: Install dependencies for all plugins
run: |
NODE_ENV=PREPACK_MODE npm run setup-repo-old
- name: Temporarily disable contentstack package
run: mv packages/contentstack/package.json packages/contentstack/package.json.disabled || true

- name: Run tests for Contentstack Command
working-directory: ./packages/contentstack-command
run: npm run test:unit
- name: Install Dependencies (Excluding Contentstack)
run: npm run bootstrap

- name: Run tests for Contentstack Import Plugin
working-directory: ./packages/contentstack-import
run: npm run test:unit
- name: Build all plugins (Excluding Contentstack)
run: |
npm run build

- name: Run tests for Contentstack Export Plugin
working-directory: ./packages/contentstack-export
run: npm run test:unit
- name: Restore contentstack package
run: mv packages/contentstack/package.json.disabled packages/contentstack/package.json || true

- name: Run tests for Audit plugin
working-directory: ./packages/contentstack-audit
- name: Run tests for Contentstack Command
working-directory: ./packages/contentstack-command
run: npm run test:unit

- name: Run tests for Contentstack Config
working-directory: ./packages/contentstack-config
run: npm run test

- name: Run tests for Contentstack Migrate RTE
working-directory: ./packages/contentstack-migrate-rte
run: npm run test

- name: Run tests for Contentstack Migration
working-directory: ./packages/contentstack-migration
run: npm run test

- name: Run tests for Contentstack Export To CSV
working-directory: ./packages/contentstack-export-to-csv
run: npm run test:unit

- name: Run tests for Contentstack Bootstrap
working-directory: ./packages/contentstack-bootstrap
run: npm run test

- name: Run tests for Contentstack Auth
working-directory: ./packages/contentstack-auth
run: npm run test:unit

# - name: Run tests for Contentstack Import Setup
# working-directory: ./packages/contentstack-import-setup
# run: npm run test:unit

- name: Run tests for Contentstack Bulk Publish
working-directory: ./packages/contentstack-bulk-publish
run: npm run test:unit

- name: Run tests for Contentstack Branches
working-directory: ./packages/contentstack-branches
run: npm run test:unit

- name: Run tests for Contentstack Clone
working-directory: ./packages/contentstack-clone
run: npm run test:unit

# - name: Fetch latest references
# run: |
# git fetch --prune

# - name: Identify Changed Plugins
# id: changes
# run: |
# echo "Finding changed files..."
# # Ensure both commit references are valid
# if [[ -z "${{ github.event.before }}" || -z "${{ github.sha }}" ]]; then
# echo "Error: Missing commit references"
# exit 1
# fi

# CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
# echo "Changed files:"
# echo "$CHANGED_FILES"

# # Identify affected plugins
# AFFECTED_PLUGINS=$(echo "$CHANGED_FILES" | grep -oP '(?<=^packages/)([^/]+)' | sort -u | tr '\n' ' ')
# echo "Affected plugins: $AFFECTED_PLUGINS"

# # Set output for the next step
# echo "::set-output name=affected_plugins::$AFFECTED_PLUGINS"

# - name: Run Unit Tests for Affected Plugins
# run: |
# for plugin in ${{ steps.changes.outputs.affected_plugins }}; do
# echo "Checking if tests should run for $plugin..."
# if [[ "$plugin" == "contentstack-audit" ]]; then
# echo "Running tests for contentstack-audit..."
# npm run test:unit --prefix ./packages/contentstack-audit
# else
# echo "contentstack-audit has not changed. Skipping tests."
# fi
# done
run: NODE_ENV=PREPACK_MODE npm run test
10 changes: 9 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# shamefully-hoist=true
# Use workspace protocol for local development
link-workspace-packages=true
prefer-workspace-packages=true

# Hoist dependencies to root node_modules
shamefully-hoist=true

# Use strict peer dependencies
strict-peer-dependencies=false
12 changes: 6 additions & 6 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
fileignoreconfig:
- filename: package-lock.json
checksum: c91b9e5fba1c84c0b6de15ad2f8cce698a5c781c9db31bebb7a3ad63ee88d9e1
- filename: pnpm-lock.yaml
checksum: 8405d813bbcc584a7540542acfdbc27f5b8768da60354b7eff9f6cd93c3d832d
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
checksum: 6e6fb00bb11b03141e5ad27eeaa4af9718dc30520c3e73970bc208cc0ba2a7d2
- filename: package-lock.json
checksum: c91b9e5fba1c84c0b6de15ad2f8cce698a5c781c9db31bebb7a3ad63ee88d9e1
- filename: pnpm-lock.yaml
checksum: 979a1e1bbcbd772d7555db2dfacf2b8eca6b80ce6353ccaad98f19f31e05e9f2
- filename: packages/contentstack-bootstrap/src/bootstrap/utils.ts
checksum: 6e6fb00bb11b03141e5ad27eeaa4af9718dc30520c3e73970bc208cc0ba2a7d2
version: '1.0'
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

echo 'Installing Contentstack CLI'
npm run setup-repo || { echo -e '\e[31mFailed to install root dependencies.' && exit 1; }
npm run setup || { echo -e '\e[31mFailed to install root dependencies.' && exit 1; }
echo 'Installtion, Done!!!'
cd packages/contentstack || { echo -e '\e[31mCould not found the working directory.' && exit 1; }
./bin/run --help
Loading
Loading