@constructor-io/constructorio-connect-cli 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/boilerplate-repo/.github/workflows/deploy.yml +53 -0
- package/boilerplate-repo/README.md +9 -0
- package/boilerplate-repo/connectrc.js +8 -0
- package/boilerplate-repo/package.json +1 -2
- package/dist/http/http-client.d.ts.map +1 -1
- package/dist/http/http-client.js +5 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# === Deploy workflow ===
|
|
2
|
+
#
|
|
3
|
+
# This workflow allows you to deploy your templates to a desired environment.
|
|
4
|
+
# The outcome should be similar to running `npm run deploy` with the correct credentials.
|
|
5
|
+
#
|
|
6
|
+
# This workflow can be triggered from the GitHub Actions tab. Just open the actions tab,
|
|
7
|
+
# select the workflow, and click the "Run workflow" button. Then, select your desired
|
|
8
|
+
# environment and confirm the deployment.
|
|
9
|
+
#
|
|
10
|
+
# Only one deployment per environment can run at a time. If a deployment is already in
|
|
11
|
+
# progress, triggering a new deployment will cancel the previous one.
|
|
12
|
+
#
|
|
13
|
+
# ❗️ To use this, ensure you have the `CONNECT_AUTH_TOKEN` GitHub secret configured
|
|
14
|
+
# with the correct auth token you used during the CLI initialization.
|
|
15
|
+
|
|
16
|
+
name: Deploy
|
|
17
|
+
|
|
18
|
+
on:
|
|
19
|
+
workflow_dispatch:
|
|
20
|
+
inputs:
|
|
21
|
+
environment:
|
|
22
|
+
description: Environment to deploy to
|
|
23
|
+
required: true
|
|
24
|
+
type: choice
|
|
25
|
+
options:
|
|
26
|
+
- development
|
|
27
|
+
- qa
|
|
28
|
+
- production
|
|
29
|
+
- demo
|
|
30
|
+
|
|
31
|
+
concurrency:
|
|
32
|
+
group: deploy-${{ github.event.inputs.environment }}
|
|
33
|
+
cancel-in-progress: true
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
deploy:
|
|
37
|
+
name: Deploy to ${{ github.event.inputs.environment }}
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
|
|
42
|
+
- name: Setup node
|
|
43
|
+
uses: actions/setup-node@v4
|
|
44
|
+
with:
|
|
45
|
+
node-version: 18
|
|
46
|
+
|
|
47
|
+
- name: Install dependencies
|
|
48
|
+
run: npm ci
|
|
49
|
+
|
|
50
|
+
- name: Deploy
|
|
51
|
+
run: npm run deploy ${{ github.event.inputs.environment }}
|
|
52
|
+
env:
|
|
53
|
+
CONNECT_AUTH_TOKEN: ${{ secrets.CONNECT_AUTH_TOKEN }}
|
|
@@ -13,6 +13,7 @@ This repository was created using the [constructorio-connect-cli CLI](https://ww
|
|
|
13
13
|
- [`npm run execute [FLAGS]`](#npm-run-execute-flags)
|
|
14
14
|
- [Testing templates](#testing-templates)
|
|
15
15
|
- [Deploying Templates](#deploying-templates)
|
|
16
|
+
- [Deploying via GitHub Actions](#deploying-via-github-actions)
|
|
16
17
|
- [`npm run deploy ENV`](#npm-run-deploy-env)
|
|
17
18
|
- [Developing Templates](#developing-templates)
|
|
18
19
|
- [➡️ Expected Transformer Implementation](#️-expected-transformer-implementation)
|
|
@@ -94,6 +95,14 @@ _This section is under active development and will be updated soon. Keep an eye
|
|
|
94
95
|
|
|
95
96
|
Once you have developed and tested your templates, you can deploy them to the Constructor Connect platform. To do this, you can use the `deploy` command.
|
|
96
97
|
|
|
98
|
+
## Deploying via GitHub Actions
|
|
99
|
+
|
|
100
|
+
This repository is pre-configured to deploy templates to Constructor Connect using GitHub Actions. To do this, you will need to set up the following secrets in your GitHub repository:
|
|
101
|
+
|
|
102
|
+
- `CONNECT_AUTH_TOKEN`: Your Constructor Connect Auth token. It's the same used to initialize this repo.
|
|
103
|
+
|
|
104
|
+
After setting up the secrets, you can run the `Deploy` workflow from the Actions tab in your repository.
|
|
105
|
+
|
|
97
106
|
## `npm run deploy ENV`
|
|
98
107
|
|
|
99
108
|
```
|
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const connections = "{{REPLACE_CONNECTIONS}}";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Defines your CLI configuration.
|
|
7
|
+
*
|
|
8
|
+
* This object maps your Constructor indexes to your templates, effectively enabling you to have
|
|
9
|
+
* multiple environments, multiple templates per environment and per index.
|
|
10
|
+
*
|
|
11
|
+
* @type {import("@constructor-io/constructorio-connect-cli/dist/types").Config}
|
|
12
|
+
*/
|
|
5
13
|
const config = "{{REPLACE_CONFIG}}";
|
|
6
14
|
|
|
7
15
|
module.exports = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/http/http-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAK5C;;GAEG;AACH,wBAAsB,aAAa,iCAkClC"}
|
package/dist/http/http-client.js
CHANGED
|
@@ -22,11 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.getHttpClient = void 0;
|
|
27
30
|
const errors_1 = require("@oclif/core/lib/errors");
|
|
28
31
|
const axios_1 = __importStar(require("axios"));
|
|
29
32
|
const get_connect_token_1 = require("../customer/get-connect-token");
|
|
33
|
+
const version_1 = __importDefault(require("../version"));
|
|
30
34
|
/**
|
|
31
35
|
* @returns An axios instance with the correct base URL and auth token.
|
|
32
36
|
*/
|
|
@@ -37,6 +41,7 @@ async function getHttpClient() {
|
|
|
37
41
|
baseURL,
|
|
38
42
|
headers: {
|
|
39
43
|
Authorization: `Bearer ${token}`,
|
|
44
|
+
"X-CLI-Version": version_1.default,
|
|
40
45
|
},
|
|
41
46
|
});
|
|
42
47
|
instance.interceptors.response.use((response) => response, async (error) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";AAAA,wBAAuB"}
|
package/dist/version.js
ADDED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-connect-cli",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI tool to enable users to interface with the Constructor Connect Ecosystem",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@oclif/plugin-help": "^6.0.21",
|
|
66
66
|
"axios": "^1.6.8",
|
|
67
67
|
"cli-highlight": "^2.1.11",
|
|
68
|
+
"dotenv": "^16.4.5",
|
|
68
69
|
"fs-extra": "^11.2.0",
|
|
69
70
|
"json-stringify-pretty-compact": "^3.0.0",
|
|
70
71
|
"kleur": "^4.1.5",
|
|
@@ -75,7 +76,6 @@
|
|
|
75
76
|
"@types/fs-extra": "^11.0.4",
|
|
76
77
|
"@types/jest": "^29.5.12",
|
|
77
78
|
"@types/mock-fs": "^4.13.4",
|
|
78
|
-
"dotenv": "^16.4.5",
|
|
79
79
|
"eslint": "^8.57.0",
|
|
80
80
|
"eslint-config-prettier": "^9.1.0",
|
|
81
81
|
"eslint-config-standard-with-typescript": "^43.0.1",
|