-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba40fd2
commit d44780c
Showing
65 changed files
with
4,829 additions
and
7 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/.env.local.sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
#create environment file name as .env.local | ||
#and place following configuration data. | ||
|
||
CONTENTSTACK_API_KEY=YOUR_API_KEY | ||
CONTENTSTACK_DELIVERY_TOKEN=YOUR_DELIVERY_TOKEN | ||
CONTENTSTACK_ENVIRONMENT=YOUR_PUBLISHING_ENVIRONMENT | ||
|
||
# For live preview | ||
CONTENTSTACK_MANAGEMENT_TOKEN= | ||
CONTENTSTACK_API_HOST=api.contentstack.io | ||
CONTENTSTACK_APP_HOST=app.contentstack.com | ||
CONTENTSTACK_LIVE_PREVIEW=true | ||
CONTENTSTACK_LIVE_EDIT_TAGS=false | ||
|
||
#site-map | ||
NEXT_PUBLIC_HOSTED_URL=http://localhost:3000 | ||
# Requires host url for sitemap. Localhost:3000 is set as default value | ||
|
||
# For Live preview default value is to true to disable live preview set CONTENTSTACK_LIVE_PREVIEW=false | ||
# For live edit tags default value is set to false to enable live edit tag set CONTENTSTACK_LIVE_EDIT_TAGS=true | ||
# For NA region add CONTENTSTACK_APP_HOST=app.contentstack.com | ||
# For EU region add CONTENTSTACK_APP_HOST=eu-app.contentstack.com | ||
|
||
# For setting custom host add CONTENTSTACK_API_HOST=for(NA: api.contentstack.io, EU: eu-api.contentstack.com) |
26 changes: 26 additions & 0 deletions
26
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/.eslintrc.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"extends: next/core-web-vitals" | ||
], | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"react" | ||
], | ||
"rules": { | ||
"react/prop-types":0, | ||
"no-undef":"off", | ||
"no-unused-vars": "off" | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
...tentstack-bootstrap/contentstack-nextjs-starter-app/.github/workflows/codeql-analysis.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: '*' | ||
pull_request: | ||
# The branches below must be a subset of the branches above | ||
branches: '*' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
language: [ 'javascript' ] | ||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] | ||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
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. | ||
|
||
# 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 | ||
|
||
|
||
# Autobuild attempts to build any compiled languages (C/C++, C#, 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@v2 | ||
|
||
# ℹ️ 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. | ||
|
||
# - run: | | ||
# echo "Run, Build Application using script" | ||
# ./location_of_script_within_repo/buildscript.sh | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
14 changes: 14 additions & 0 deletions
14
...es/contentstack-bootstrap/contentstack-nextjs-starter-app/.github/workflows/sast-scan.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: SAST Scan | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
security: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Horusec Scan | ||
run: docker run -v /var/run/docker.sock:/var/run/docker.sock -v $(pwd):/src horuszup/horusec-cli:latest horusec start -p /src -P $(pwd) |
13 changes: 13 additions & 0 deletions
13
.../contentstack-bootstrap/contentstack-nextjs-starter-app/.github/workflows/sca-monitor.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Source Composition Analysis Monitor | ||
on: push | ||
jobs: | ||
security: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Run Snyk to check for vulnerabilities | ||
uses: snyk/actions/node@master | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
with: | ||
command: monitor |
16 changes: 16 additions & 0 deletions
16
...ges/contentstack-bootstrap/contentstack-nextjs-starter-app/.github/workflows/sca-scan.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Source Composition Analysis Scan | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
security: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Run Snyk to check for vulnerabilities | ||
uses: snyk/actions/node@master | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} |
14 changes: 14 additions & 0 deletions
14
...contentstack-bootstrap/contentstack-nextjs-starter-app/.github/workflows/secrets-scan.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Secrets Scan | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
security: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Gittyleaks | ||
uses: gupy-io/[email protected] |
35 changes: 35 additions & 0 deletions
35
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
.pnpm-debug.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo |
2 changes: 2 additions & 0 deletions
2
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/CODEOWNERS
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
* @contentstack/security-admin @contentstack/ecosystem-admin |
21 changes: 21 additions & 0 deletions
21
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/LICENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Contentstack | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
32 changes: 32 additions & 0 deletions
32
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[![Contentstack Logo](/public/contentstack-readme-logo.png)](https://www.contentstack.com/) | ||
|
||
|
||
# Build a Starter Website with Next.js and Contentstack | ||
|
||
About Contentstack: Contentstack is a headless CMS with an API-first approach that puts content at the centre. It is designed to simplify the process of publication by separating code from content. | ||
|
||
About this project: Next.js is a minimalistic framework for server-rendered React applications.This guide will help you create a starter website built on top of Next.js with minimal steps. | ||
|
||
|
||
|
||
![Contentstack-Nextjs-starter-app](/public/starter-app.png) | ||
|
||
## Live Demo | ||
|
||
You can check the [live demo](https://contentstack-nextjs-starter-app.vercel.app) to get first-hand experience of the website. | ||
|
||
|
||
## Tutorial | ||
|
||
We have created an in-depth tutorial on how you can create a Next.js starter website using Contentstack's Node.js SDK and its fetch content from Contentstack. | ||
|
||
[Build Website using Next.js and Contentstack](https://www.contentstack.com/docs/developers/sample-apps/build-a-starter-website-using-next-js-and-contentstack/) | ||
|
||
|
||
**More Resources** | ||
|
||
Read Contentstack [docs](https://www.contentstack.com/docs/) | ||
|
||
Region support [docs](https://www.contentstack.com/docs/developers/selecting-region-in-contentstack-starter-apps) | ||
|
||
Learn about [Next.js](https://learnnextjs.com/) |
27 changes: 27 additions & 0 deletions
27
packages/contentstack-bootstrap/contentstack-nextjs-starter-app/SECURITY.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Security | ||
|
||
Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations. | ||
|
||
If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below. | ||
|
||
## Reporting Security Issues | ||
|
||
**Please do not report security vulnerabilities through public GitHub issues.** | ||
|
||
Send email to [[email protected]](mailto:[email protected]). | ||
|
||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. | ||
|
||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: | ||
|
||
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) | ||
* Full paths of source file(s) related to the manifestation of the issue | ||
* The location of the affected source code (tag/branch/commit or direct URL) | ||
* Any special configuration required to reproduce the issue | ||
* Step-by-step instructions to reproduce the issue | ||
* Proof-of-concept or exploit code (if possible) | ||
* Impact of the issue, including how an attacker might exploit the issue | ||
|
||
This information will help us triage your report more quickly. | ||
|
||
[https://www.contentstack.com/trust/](https://www.contentstack.com/trust/) |
82 changes: 82 additions & 0 deletions
82
...ontentstack-bootstrap/contentstack-nextjs-starter-app/components/about-section-bucket.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import React from 'react'; | ||
import parse from 'html-react-parser'; | ||
import { Action,Image } from '../typescript/action'; | ||
|
||
type AdditionalParam = { | ||
title_h2?: string; | ||
title_h3?: string; | ||
description?: string; | ||
} | ||
|
||
type Bucket = { | ||
title_h3: string; | ||
description: string; | ||
icon: Image; | ||
$: AdditionalParam; | ||
url: string; | ||
} | ||
|
||
type BucketsList = { | ||
title_h3: string; | ||
description: string; | ||
url: string; | ||
call_to_action: Action; | ||
icon: Image; | ||
$: AdditionalParam; | ||
} | ||
|
||
type BucketProps = { | ||
title_h2: string; | ||
buckets:[BucketsList]; | ||
$: AdditionalParam; | ||
} | ||
|
||
export default function AboutSectionBucket({ sectionWithBuckets }: {sectionWithBuckets:BucketProps}) { | ||
function bucketContent(bucket: Bucket, index: number) { | ||
return ( | ||
<div className='mission-content-section' key={index}> | ||
{bucket.icon && ( | ||
<img | ||
className='mission-icon' | ||
{...bucket.icon.$?.url} | ||
src={bucket.icon.url} | ||
alt='art work' | ||
/> | ||
)} | ||
|
||
<div className='mission-section-content'> | ||
{bucket.title_h3 && ( | ||
<h3 {...bucket.$?.title_h3}>{bucket.title_h3}</h3> | ||
)} | ||
{typeof bucket.description === 'string' && ( | ||
<div {...bucket.$?.description}> {parse(bucket.description)}</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<div className='member-main-section'> | ||
<div className='member-head'> | ||
{sectionWithBuckets.title_h2 && ( | ||
<h2 {...sectionWithBuckets.$?.title_h2}> | ||
{sectionWithBuckets.title_h2} | ||
</h2> | ||
)} | ||
</div> | ||
<div className='mission-section'> | ||
<div className='mission-content-top'> | ||
{sectionWithBuckets?.buckets.map( | ||
(bucket, index) => index < 2 && bucketContent(bucket, index) | ||
)} | ||
</div> | ||
<div className='mission-content-bottom'> | ||
{sectionWithBuckets.buckets.map( | ||
(bucket, index) => index >= 2 && bucketContent(bucket, index) | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.