Skip to content

Commit 943f443

Browse files
committed
first commit
1 parent 6d8de9a commit 943f443

490 files changed

Lines changed: 117390 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "contentstack/cli-plugins" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": [],
11+
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
12+
"onlyUpdatePeerDependentsWhenOutOfRange": true
13+
}
14+
}

.github/config/release.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"releaseAll": true,
3+
"plugins": {
4+
"variants": false,
5+
"audit": false,
6+
"export": false,
7+
"import": false,
8+
"clone": false
9+
}
10+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup pnpm
21+
uses: pnpm/action-setup@v4
22+
with:
23+
version: 10
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '22.x'
29+
registry-url: 'https://registry.npmjs.org'
30+
cache: 'pnpm'
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Build variants first
36+
run: pnpm --filter @contentstack/cli-variants compile
37+
38+
- name: Build all packages
39+
run: pnpm --filter './packages/*' -w build
40+
41+
- name: Check prerelease mode
42+
id: prerelease
43+
run: |
44+
if [ -f ".changeset/pre.json" ]; then
45+
echo "mode=beta" >> $GITHUB_OUTPUT
46+
echo "tag=beta" >> $GITHUB_OUTPUT
47+
else
48+
echo "mode=stable" >> $GITHUB_OUTPUT
49+
echo "tag=latest" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Create Release Pull Request or Publish
53+
uses: changesets/action@v1
54+
with:
55+
publish: pnpm release:publish
56+
version: pnpm release:version
57+
title: "Release: Version Packages"
58+
commit: "chore: version packages"
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
pull_request:
16+
# The branches below must be a subset of the branches above
17+
branches: '*'
18+
19+
jobs:
20+
analyze:
21+
name: Analyze
22+
runs-on: ubuntu-latest
23+
permissions:
24+
actions: read
25+
contents: read
26+
security-events: write
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: [ 'javascript' ]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
33+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v3.5.3
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v2
42+
with:
43+
languages: ${{ matrix.language }}
44+
# If you wish to specify custom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
48+
# 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
49+
# queries: security-extended,security-and-quality
50+
51+
52+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53+
# If this step fails, then you should remove it and run the build manually (see below)
54+
- name: Autobuild
55+
uses: github/codeql-action/autobuild@v2
56+
57+
# ℹ️ Command-line programs to run using the OS shell.
58+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
59+
60+
# If the Autobuild fails above, remove it and uncomment the following three lines.
61+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
62+
63+
# - run: |
64+
# echo "Run, Build Application using script"
65+
# ./location_of_script_within_repo/buildscript.sh
66+
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v2

.github/workflows/issues-jira.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create Jira Ticket for Github Issue
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
issue-jira:
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Login to Jira
13+
uses: atlassian/gajira-login@master
14+
env:
15+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
16+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
17+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
18+
19+
- name: Create Jira Issue
20+
id: create_jira
21+
uses: atlassian/gajira-create@master
22+
with:
23+
project: ${{ secrets.JIRA_PROJECT }}
24+
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
25+
summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
26+
description: |
27+
*GitHub Issue:* ${{ github.event.issue.html_url }}
28+
29+
*Description:*
30+
${{ github.event.issue.body }}
31+
fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"

.github/workflows/policy-scan.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Checks the security policy and configurations
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-policy:
7+
if: github.event.repository.visibility == 'public'
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
shell: bash
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Checks for SECURITY.md policy file
15+
run: |
16+
if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi
17+
security-license:
18+
if: github.event.repository.visibility == 'public'
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: bash
23+
steps:
24+
- uses: actions/checkout@master
25+
- name: Checks for License file
26+
run: |
27+
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
28+
license_file_found=false
29+
current_year=$(date +"%Y")
30+
31+
for license_file in "${expected_license_files[@]}"; do
32+
if [ -f "$license_file" ]; then
33+
license_file_found=true
34+
# check the license file for the current year, if not exists, exit with error
35+
if ! grep -q "$current_year" "$license_file"; then
36+
echo "License file $license_file does not contain the current year."
37+
exit 2
38+
fi
39+
break
40+
fi
41+
done
42+
43+
if [ "$license_file_found" = false ]; then
44+
echo "No license file found. Please add a license file to the repository."
45+
exit 1
46+
fi

.github/workflows/release.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Release CLI Plugin Packages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- uses: pnpm/action-setup@v4
14+
with:
15+
version: 10
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '22.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
cache: 'pnpm'
22+
23+
- name: Install dependencies
24+
run: pnpm install --frozen-lockfile
25+
26+
- name: Build all packages
27+
run: |
28+
pnpm --filter @contentstack/cli-variants compile
29+
pnpm --filter './packages/*' -w build
30+
31+
- name: Reading Configuration
32+
id: release_config
33+
uses: rgarcia-phi/json-to-variables@v1.1.0
34+
with:
35+
filename: .github/config/release.json
36+
prefix: release
37+
38+
- name: Prepare for publishing
39+
run: node scripts/prepare-publish.js
40+
41+
# Publish variants (base dependency for plugins)
42+
- name: Publishing variants
43+
uses: JS-DevTools/npm-publish@v3
44+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_variants == 'true'}}
45+
with:
46+
token: ${{ secrets.NPM_TOKEN }}
47+
package: ./packages/contentstack-variants/package.json
48+
access: public
49+
50+
# Publish audit
51+
- name: Publishing audit
52+
uses: JS-DevTools/npm-publish@v3
53+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_audit == 'true'}}
54+
with:
55+
token: ${{ secrets.NPM_TOKEN }}
56+
package: ./packages/contentstack-audit/package.json
57+
access: public
58+
59+
# Publish export (depends on variants)
60+
- name: Publishing export
61+
uses: JS-DevTools/npm-publish@v3
62+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_export == 'true'}}
63+
with:
64+
token: ${{ secrets.NPM_TOKEN }}
65+
package: ./packages/contentstack-export/package.json
66+
67+
# Publish import (depends on variants and audit)
68+
- name: Publishing import
69+
uses: JS-DevTools/npm-publish@v3
70+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_import == 'true'}}
71+
with:
72+
token: ${{ secrets.NPM_TOKEN }}
73+
package: ./packages/contentstack-import/package.json
74+
75+
# Publish clone (depends on export and import)
76+
- name: Publishing clone
77+
id: publish-clone
78+
uses: JS-DevTools/npm-publish@v3
79+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_clone == 'true'}}
80+
with:
81+
token: ${{ secrets.NPM_TOKEN }}
82+
package: ./packages/contentstack-clone/package.json
83+
84+
# Restore workspace protocol after publishing
85+
- name: Restore workspace protocol
86+
if: always()
87+
run: git restore packages/*/package.json
88+
89+
# Create release on success
90+
- name: Create Release
91+
if: ${{ steps.publish-clone.conclusion == 'success' }}
92+
id: create_release
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95+
VERSION: ${{ steps.publish-clone.outputs.version }}
96+
run: gh release create v"$VERSION" --title "Release $VERSION" --generate-notes

.github/workflows/sca-scan.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Source Composition Analysis Scan
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-sca:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@master
10+
11+
- name: Setup pnpm
12+
uses: pnpm/action-setup@v4
13+
with:
14+
version: 10
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '22.x'
20+
cache: 'pnpm'
21+
22+
- name: Install dependencies
23+
run: pnpm install --frozen-lockfile
24+
25+
- name: Run Snyk to check for vulnerabilities
26+
uses: snyk/actions/node@master
27+
env:
28+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
29+
with:
30+
args: --all-projects --fail-on=all

0 commit comments

Comments
 (0)