Skip to content

Commit 75a9553

Browse files
authored
Merge pull request #22 from contentstack/next
Fixes and improvements
2 parents 55a0bc3 + 5c5143f commit 75a9553

29 files changed

+3556
-1909
lines changed

.cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"enabled": true,
88
"words": [],
99
"ignoreWords": [
10-
"contentstack"
10+
"contentstack",
11+
"Backoff"
1112
],
1213
"flagWords": [],
1314
"ignoreRegExpList": [],

.eslintrc.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = {
99
'plugin:promise/recommended',
1010
'plugin:@cspell/recommended',
1111
],
12-
ignorePatterns: ['.eslintrc.js', '*.json', 'jest.config.js', '**/node_modules'],
12+
ignorePatterns: ['.eslintrc.js', '*.json', 'jest.config.js', '**/node_modules', 'dist/*'],
1313
plugins: ['import', 'promise', 'prettier'],
1414
parser: '@typescript-eslint/parser',
1515
settings: {
@@ -28,7 +28,7 @@ module.exports = {
2828
'@typescript-eslint/lines-between-class-members': 'off',
2929
'react/jsx-wrap-multilines': 'off',
3030
'react/jsx-filename-extension': 'off',
31-
'multiline-comment-style': ['error', 'starred-block'],
31+
'multiline-comment-style': 'off',
3232
'promise/catch-or-return': 'off',
3333
'@typescript-eslint/explicit-module-boundary-types': 'off',
3434
'@typescript-eslint/no-unused-expressions': 'off',
@@ -79,13 +79,12 @@ module.exports = {
7979
'error',
8080

8181
{ selector: 'enumMember', format: ['UPPER_CASE'] },
82-
{ selector: 'enum', format: ['PascalCase'], suffix: ['Enum'] },
82+
{ selector: 'enum', format: ['PascalCase'] },
8383
{ selector: 'class', format: ['PascalCase'] },
8484
{ selector: 'variableLike', format: ['camelCase', 'UPPER_CASE'], leadingUnderscore: 'allow' },
8585
{
8686
selector: 'interface',
87-
format: ['PascalCase'],
88-
prefix: ['I'],
87+
format: ['PascalCase']
8988
},
9089
{
9190
selector: ['function'],

.github/workflows/check-branch.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 'Check Branch'
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
check_branch:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Comment PR
11+
if: github.base_ref == 'master' && github.head_ref != 'next'
12+
uses: thollander/actions-comment-pull-request@v2
13+
with:
14+
message: |
15+
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
16+
- name: Check branch
17+
if: github.base_ref == 'master' && github.head_ref != 'next'
18+
run: |
19+
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
20+
exit 1

.github/workflows/codeql-analysis.yml

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: [ 'typescript' ]
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
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/npm-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Publish package to NPM repository
5+
on:
6+
release:
7+
types: [created]
8+
9+
jobs:
10+
publish-npm:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: '12.x'
17+
registry-url: 'https://registry.npmjs.org'
18+
- run: npm ci
19+
- run: npm publish
20+
env:
21+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
22+
publish-git:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-node@v3
27+
with:
28+
node-version: '12.x'
29+
registry-url: 'https://npm.pkg.github.com'
30+
scope: '@contentstack'
31+
- run: npm ci
32+
- run: npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.husky/pre-commit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
CMD="${TALISMAN_HOME}/talisman_hook_script $DEBUG_OPTS --githook pre-commit"
5-
${CMD}
4+
# CMD="${TALISMAN_HOME}/talisman_hook_script $DEBUG_OPTS --githook pre-commit"
5+
# ${CMD}
66

7-
npm run test
7+
# npm run test

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Change log
2+
3+
### Version: 1.0.0
4+
#### Date: December-15-2023
5+
- Initial release of Typescript Core SDK
6+

LICENSE.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
4+
Copyright (c) 2016-2023 Contentstack
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
1-
# contentstack-js-core
1+
[![Contentstack](https://www.contentstack.com/docs/static/images/contentstack.png)](https://www.contentstack.com/)
2+
## TypeScript Core SDK for Contentstack
23

3-
This library was generated with [Nx](https://nx.dev).
4+
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).
45

5-
## Building
6+
### Prerequisite
67

7-
Run `nx build contentstack-js-core` to build the library.
8+
You need Node.js version 4.4.7 or later installed to use the Contentstack TS Core SDK.
89

9-
## Running unit tests
10+
## Installation
1011

11-
Run `nx test contentstack-js-core` to execute the unit tests via [Jest](https://jestjs.io).
12+
```
13+
npm install @contentstack/core
14+
```
15+
16+
## Use case
17+
18+
This package contains some core modules and utilities used by the [Contentstack Typescript Delivery SDK](https://github.com/contentstack/contentstack-javascript/) SDK.
19+
20+
## Development
21+
22+
### Create the build:
23+
24+
```
25+
npm run build
26+
```
27+
28+
### Run Scripts:
29+
30+
Run the unit tests:
31+
32+
```
33+
npm run test
34+
```
35+
36+
Run the lint tests:
37+
38+
```
39+
npm run lint
40+
```
41+
42+
Pack the SDK:
43+
44+
```
45+
npm run package
46+
```

SECURITY.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## Security
2+
3+
Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations.
4+
5+
If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below.
6+
7+
## Reporting Security Issues
8+
9+
**Please do not report security vulnerabilities through public GitHub issues.**
10+
11+
Send email to [[email protected]](mailto:[email protected]).
12+
13+
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.
14+
15+
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:
16+
17+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
18+
* Full paths of source file(s) related to the manifestation of the issue
19+
* The location of the affected source code (tag/branch/commit or direct URL)
20+
* Any special configuration required to reproduce the issue
21+
* Step-by-step instructions to reproduce the issue
22+
* Proof-of-concept or exploit code (if possible)
23+
* Impact of the issue, including how an attacker might exploit the issue
24+
25+
This information will help us triage your report more quickly.
26+
27+
[https://www.contentstack.com/trust/](https://www.contentstack.com/trust/)

0 commit comments

Comments
 (0)