Skip to content

Commit b6cc591

Browse files
committed
Prepare SDK for public release
1 parent 6b7cc1d commit b6cc591

File tree

7 files changed

+53
-29
lines changed

7 files changed

+53
-29
lines changed

.github/workflows/branch-validations.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ jobs:
5050
if: steps.cache-dependencies.outputs.cache-hit != 'true'
5151
run: npm ci
5252

53-
- run: npm run validate
54-
5553
lint:
5654
runs-on: ubuntu-18.04
5755
steps:

.github/workflows/deploy-published-releases.yaml

+19-7
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,45 @@ jobs:
1919
- uses: actions/setup-node@v1
2020
with:
2121
node-version: 12
22-
registry-url: 'https://npm.pkg.github.com'
2322

2423
- name: Cache dependencies
2524
id: cache-dependencies
2625
uses: actions/cache@v1
2726
with:
2827
path: node_modules
2928
key: node_modules-${{ hashFiles('**/package-lock.json') }}
29+
3030
- name: Install dependencies
3131
if: steps.cache-dependencies.outputs.cache-hit != 'true'
3232
run: npm ci
3333

3434
- name: Build package
3535
run: |-
3636
npm run build
37+
38+
- name: Prepare release
39+
run: |-
40+
cp package.json LICENSE README.md build/
3741
cd build
42+
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json
3843
sed -i -e "s~<@version@>~${GITHUB_REF##*/}~" constants.js
3944
sed -i -e "s~<@trackerEndpointUrl@>~${TRACKER_ENDPOINT}~" constants.js
4045
sed -i -e "s~<@evaluationEndpointUrl@>~${EVALUATION_ENDPOINT}~" constants.js
4146
sed -i -e "s~<@bootstrapEndpointUrl@>~${BOOTSTRAP_ENDPOINT}~" constants.js
4247
sed -i -e "s~<@maxExpressionLength@>~${MAX_EXPRESSION_LENGHT}~" constants.js
4348
44-
- name: Publish to NPM
49+
- name: Publish pre-release to NPM
50+
if: ${{ github.event.release.prerelease }}
4551
run: |-
46-
cp package.json README.md build/
47-
cd build
48-
sed -i -e "s~\"version\": \"0.0.0-dev\"~\"version\": \"${GITHUB_REF##*/}\"~" package.json
49-
npm publish
52+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
53+
npm publish --access public --tag next
54+
env:
55+
NPM_TOKEN: ${{ secrets.BOT_TOKEN }}
56+
57+
- name: Publish release to NPM
58+
if: ${{ !github.event.release.prerelease }}
59+
run: |-
60+
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
61+
npm publish --access public
5062
env:
51-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
NPM_TOKEN: ${{ secrets.BOT_TOKEN }}

LICENSE

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

README.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
<br />
66
<strong>SDK JS</strong>
77
<br />
8-
The official Croct SDK for JavaScript, available for browsers and mobile devices.
8+
The official Croct SDK for JavaScript.
99
</p>
1010
<p align="center">
11+
<a href="https://www.npmjs.com/package/@croct/sdk"><img alt="Version" src="https://img.shields.io/npm/v/@croct/sdk"/></a>
12+
<a href="https://bundlephobia.com/result?p=@croct/sdk"><img alt="Gzipped Size" src="https://img.shields.io/bundlephobia/minzip/@croct/sdk"/></a>
1113
<img alt="Build" src="https://github.com/croct-tech/sdk-js/workflows/Validations/badge.svg" />
1214
<a href="https://codeclimate.com/repos/5e7251b3172af05fe9000e27/maintainability"><img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/c44df78a3ed891af11bb/maintainability" /></a>
1315
<a href="https://codeclimate.com/repos/5e7251b3172af05fe9000e27/test_coverage"><img alt="Coverage" src="https://api.codeclimate.com/v1/badges/c44df78a3ed891af11bb/test_coverage" /></a>
14-
<img alt="License" src="https://img.shields.io/badge/license-proprietary-lightgrey" />
1516
<br />
1617
<br />
1718
<a href="https://github.com/croct-tech/sdk-js/releases">Releases</a>
@@ -23,12 +24,10 @@
2324

2425
## Installation
2526

26-
The SDK can be installed via NPM. Before installing, make sure you are authenticated to the GitHub Packages. For more information, see ["Authenticating to GitHub Packages."](https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-npm-for-use-with-github-packages#authenticating-to-github-packages)
27-
28-
Once authenticated, run the following command to install the latest version of the package:
27+
The preferred way to install the Croct SDK is to use the NPM package manager. Simply enter the following command into a terminal window:
2928

3029
```sh
31-
npm install @croct-tech/sdk
30+
npm install @croct/sdk
3231
```
3332

3433
## Contributing
@@ -52,7 +51,6 @@ Then, to run all tests:
5251
npm test
5352
```
5453

55-
## Copyright Notice
56-
Copyright © 2015-2020 Croct Limited, All Rights Reserved.
54+
## License
5755

58-
All information contained herein is, and remains the property of Croct Limited. The intellectual, design and technical concepts contained herein are proprietary to Croct Limited s and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law. Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained from Croct Limited.
56+
This project is released under the [MIT License](LICENSE).

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "@croct-tech/sdk",
2+
"name": "@croct/sdk",
33
"version": "0.0.0-dev",
44
"description": "Croct SDK for JavaScript.",
5+
"license": "MIT",
56
"author": {
67
"name": "Croct",
78
"email": "sdk-js+lib@croct.com",
89
"url": "https://croct.com"
910
},
10-
"license": "UNLICENSED",
1111
"main": "index.js",
1212
"types": "index.d.ts",
1313
"repository": {
@@ -19,7 +19,6 @@
1919
},
2020
"homepage": "https://github.com/croct-tech/sdk-js#readme",
2121
"scripts": {
22-
"validate": "tsc --noEmit",
2322
"lint": "eslint 'src/**/*.ts' 'test/**/*.ts'",
2423
"lint-fix": "eslint --fix --fix-type suggestion --fix-type problem 'src/**/*.ts' 'test/**/*.ts'",
2524
"test": "jest -c jest.config.js --coverage",
@@ -48,8 +47,5 @@
4847
],
4948
"browserslist": [
5049
"last 1 version"
51-
],
52-
"publishConfig": {
53-
"registry": "https://npm.pkg.github.com/"
54-
}
50+
]
5551
}

tsconfig.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"compilerOptions": {
3-
"module": "es2015",
4-
"target": "es5",
3+
"module": "CommonJS",
4+
"target": "ES5",
55
"moduleResolution": "Node",
66
"allowSyntheticDefaultImports": true,
77
"resolveJsonModule": true,
@@ -13,7 +13,6 @@
1313
"noUnusedParameters": true,
1414
"strictNullChecks": true,
1515
"removeComments": false,
16-
"sourceMap": true,
1716
"outDir": "build",
1817
"downlevelIteration": true,
1918
"declaration": true,

0 commit comments

Comments
 (0)