antelope-cli 1.2.0 → 1.2.1
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/ansible/onboarding-ca/README.md +72 -72
- package/ansible/onboarding-ca/onboard-ca.yml +41 -41
- package/ansible/onboarding-ca/roles/onboard_ca/defaults/main.yml +24 -24
- package/ansible/onboarding-ca/roles/onboard_ca/meta/main.yml +10 -10
- package/ansible/onboarding-ca/roles/onboard_ca/tasks/main.yml +76 -76
- package/ansible/onboarding-ca/roles/onboard_ca/tasks/per_branch.yml +106 -106
- package/ansible/onboarding-ca/roles/onboard_ca/vars/main.yml +6 -6
- package/index.js +2 -0
- package/onboarding-ca/brand.js +13 -13
- package/onboarding-ca/index.js +94 -94
- package/onboarding-ca/riskDisclaimer.js +27 -27
- package/onboarding-ca/scss.js +24 -24
- package/onboarding-ca/templates/risk-disclaimer.html +12 -12
- package/onboarding-crm/brand.js +21 -0
- package/onboarding-crm/createConfig.js +38 -0
- package/onboarding-crm/index.js +157 -0
- package/onboarding-crm/themes.js +92 -0
- package/onboarding-crm/translations.js +37 -0
- package/onboarding-crm/variablesColors.js +54 -0
- package/package.json +1 -1
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Runs once per destination branch. `dest_branch` is the loop var.
|
|
3
|
-
|
|
4
|
-
- name: "[{{ dest_branch }}] Compose source branch name"
|
|
5
|
-
ansible.builtin.set_fact:
|
|
6
|
-
branch_prefix: "{{ 'hotfix' if dest_branch is match('(master|release)') else 'feature' }}"
|
|
7
|
-
|
|
8
|
-
- name: "[{{ dest_branch }}] Set source branch"
|
|
9
|
-
ansible.builtin.set_fact:
|
|
10
|
-
source_branch: "{{ branch_prefix }}/{{ jira_key }}-onboarding-{{ brand_assets_folder }}"
|
|
11
|
-
|
|
12
|
-
- name: "[{{ dest_branch }}] Fetch all remote branches"
|
|
13
|
-
ansible.builtin.command:
|
|
14
|
-
cmd: git fetch origin --prune
|
|
15
|
-
chdir: "{{ work_dir }}"
|
|
16
|
-
changed_when: false
|
|
17
|
-
|
|
18
|
-
- name: "[{{ dest_branch }}] Does the source branch already exist on origin?"
|
|
19
|
-
ansible.builtin.command:
|
|
20
|
-
cmd: "git ls-remote --exit-code --heads origin {{ source_branch }}"
|
|
21
|
-
chdir: "{{ work_dir }}"
|
|
22
|
-
register: remote_src
|
|
23
|
-
failed_when: false
|
|
24
|
-
changed_when: false
|
|
25
|
-
|
|
26
|
-
# Base the working branch on its own remote head if it already exists (idempotent re-run),
|
|
27
|
-
# otherwise on the destination branch.
|
|
28
|
-
- name: "[{{ dest_branch }}] Check out the working branch"
|
|
29
|
-
ansible.builtin.command:
|
|
30
|
-
cmd: >-
|
|
31
|
-
git checkout -B {{ source_branch }}
|
|
32
|
-
{{ ('origin/' + source_branch) if remote_src.rc == 0 else ('origin/' + dest_branch) }}
|
|
33
|
-
chdir: "{{ work_dir }}"
|
|
34
|
-
|
|
35
|
-
- name: "[{{ dest_branch }}] Generate brand files via antelope-cli"
|
|
36
|
-
ansible.builtin.command:
|
|
37
|
-
argv:
|
|
38
|
-
- npx
|
|
39
|
-
- "antelope-cli@{{ antelope_cli_version }}"
|
|
40
|
-
- onboarding-ca
|
|
41
|
-
- --brand_assets_folder
|
|
42
|
-
- "{{ brand_assets_folder }}"
|
|
43
|
-
chdir: "{{ work_dir }}"
|
|
44
|
-
environment:
|
|
45
|
-
CI: "true"
|
|
46
|
-
changed_when: true
|
|
47
|
-
|
|
48
|
-
- name: "[{{ dest_branch }}] Stage changes"
|
|
49
|
-
ansible.builtin.command:
|
|
50
|
-
cmd: git add -A
|
|
51
|
-
chdir: "{{ work_dir }}"
|
|
52
|
-
changed_when: false
|
|
53
|
-
|
|
54
|
-
- name: "[{{ dest_branch }}] Detect staged changes"
|
|
55
|
-
ansible.builtin.command:
|
|
56
|
-
cmd: git diff --cached --quiet
|
|
57
|
-
chdir: "{{ work_dir }}"
|
|
58
|
-
register: staged
|
|
59
|
-
failed_when: false
|
|
60
|
-
changed_when: false
|
|
61
|
-
|
|
62
|
-
- name: "[{{ dest_branch }}] Commit"
|
|
63
|
-
ansible.builtin.command:
|
|
64
|
-
cmd: >-
|
|
65
|
-
git -c user.name="{{ git_user_name }}" -c user.email="{{ git_user_email }}"
|
|
66
|
-
commit -m "{{ jira_key }}: On-Boarding {{ brand_name }} Client Branding"
|
|
67
|
-
chdir: "{{ work_dir }}"
|
|
68
|
-
when: staged.rc == 1
|
|
69
|
-
|
|
70
|
-
- name: "[{{ dest_branch }}] Push source branch"
|
|
71
|
-
ansible.builtin.command:
|
|
72
|
-
cmd: "git push -u origin {{ source_branch }}"
|
|
73
|
-
chdir: "{{ work_dir }}"
|
|
74
|
-
when: staged.rc == 1
|
|
75
|
-
|
|
76
|
-
- name: "[{{ dest_branch }}] Open pull request"
|
|
77
|
-
ansible.builtin.uri:
|
|
78
|
-
url: "{{ api_base }}/repositories/{{ workspace }}/{{ repo_slug }}/pullrequests"
|
|
79
|
-
method: POST
|
|
80
|
-
headers:
|
|
81
|
-
Authorization: "Bearer {{ bitbucket_token }}"
|
|
82
|
-
body_format: json
|
|
83
|
-
body:
|
|
84
|
-
title: "{{ jira_key }}: On-Boarding {{ brand_name }} Client Branding"
|
|
85
|
-
description: "{{ jira_key }}: On-Boarding {{ brand_name }} Client Branding"
|
|
86
|
-
source:
|
|
87
|
-
branch:
|
|
88
|
-
name: "{{ source_branch }}"
|
|
89
|
-
destination:
|
|
90
|
-
branch:
|
|
91
|
-
name: "{{ dest_branch }}"
|
|
92
|
-
reviewers: "{{ reviewers }}"
|
|
93
|
-
close_source_branch: true
|
|
94
|
-
return_content: true
|
|
95
|
-
status_code: [201, 400] # 400 tolerated: a PR for this source->dest already exists
|
|
96
|
-
register: pr_response
|
|
97
|
-
|
|
98
|
-
- name: "[{{ dest_branch }}] Record PR result"
|
|
99
|
-
ansible.builtin.set_fact:
|
|
100
|
-
pr_results: >-
|
|
101
|
-
{{ (pr_results | default([])) + [{
|
|
102
|
-
'destination': dest_branch,
|
|
103
|
-
'source': source_branch,
|
|
104
|
-
'status': pr_response.status,
|
|
105
|
-
'url': (pr_response.json.links.html.href | default('(already exists or not created)'))
|
|
106
|
-
}] }}
|
|
1
|
+
---
|
|
2
|
+
# Runs once per destination branch. `dest_branch` is the loop var.
|
|
3
|
+
|
|
4
|
+
- name: "[{{ dest_branch }}] Compose source branch name"
|
|
5
|
+
ansible.builtin.set_fact:
|
|
6
|
+
branch_prefix: "{{ 'hotfix' if dest_branch is match('(master|release)') else 'feature' }}"
|
|
7
|
+
|
|
8
|
+
- name: "[{{ dest_branch }}] Set source branch"
|
|
9
|
+
ansible.builtin.set_fact:
|
|
10
|
+
source_branch: "{{ branch_prefix }}/{{ jira_key }}-onboarding-{{ brand_assets_folder }}"
|
|
11
|
+
|
|
12
|
+
- name: "[{{ dest_branch }}] Fetch all remote branches"
|
|
13
|
+
ansible.builtin.command:
|
|
14
|
+
cmd: git fetch origin --prune
|
|
15
|
+
chdir: "{{ work_dir }}"
|
|
16
|
+
changed_when: false
|
|
17
|
+
|
|
18
|
+
- name: "[{{ dest_branch }}] Does the source branch already exist on origin?"
|
|
19
|
+
ansible.builtin.command:
|
|
20
|
+
cmd: "git ls-remote --exit-code --heads origin {{ source_branch }}"
|
|
21
|
+
chdir: "{{ work_dir }}"
|
|
22
|
+
register: remote_src
|
|
23
|
+
failed_when: false
|
|
24
|
+
changed_when: false
|
|
25
|
+
|
|
26
|
+
# Base the working branch on its own remote head if it already exists (idempotent re-run),
|
|
27
|
+
# otherwise on the destination branch.
|
|
28
|
+
- name: "[{{ dest_branch }}] Check out the working branch"
|
|
29
|
+
ansible.builtin.command:
|
|
30
|
+
cmd: >-
|
|
31
|
+
git checkout -B {{ source_branch }}
|
|
32
|
+
{{ ('origin/' + source_branch) if remote_src.rc == 0 else ('origin/' + dest_branch) }}
|
|
33
|
+
chdir: "{{ work_dir }}"
|
|
34
|
+
|
|
35
|
+
- name: "[{{ dest_branch }}] Generate brand files via antelope-cli"
|
|
36
|
+
ansible.builtin.command:
|
|
37
|
+
argv:
|
|
38
|
+
- npx
|
|
39
|
+
- "antelope-cli@{{ antelope_cli_version }}"
|
|
40
|
+
- onboarding-ca
|
|
41
|
+
- --brand_assets_folder
|
|
42
|
+
- "{{ brand_assets_folder }}"
|
|
43
|
+
chdir: "{{ work_dir }}"
|
|
44
|
+
environment:
|
|
45
|
+
CI: "true"
|
|
46
|
+
changed_when: true
|
|
47
|
+
|
|
48
|
+
- name: "[{{ dest_branch }}] Stage changes"
|
|
49
|
+
ansible.builtin.command:
|
|
50
|
+
cmd: git add -A
|
|
51
|
+
chdir: "{{ work_dir }}"
|
|
52
|
+
changed_when: false
|
|
53
|
+
|
|
54
|
+
- name: "[{{ dest_branch }}] Detect staged changes"
|
|
55
|
+
ansible.builtin.command:
|
|
56
|
+
cmd: git diff --cached --quiet
|
|
57
|
+
chdir: "{{ work_dir }}"
|
|
58
|
+
register: staged
|
|
59
|
+
failed_when: false
|
|
60
|
+
changed_when: false
|
|
61
|
+
|
|
62
|
+
- name: "[{{ dest_branch }}] Commit"
|
|
63
|
+
ansible.builtin.command:
|
|
64
|
+
cmd: >-
|
|
65
|
+
git -c user.name="{{ git_user_name }}" -c user.email="{{ git_user_email }}"
|
|
66
|
+
commit -m "{{ jira_key }}: On-Boarding {{ brand_name }} Client Branding"
|
|
67
|
+
chdir: "{{ work_dir }}"
|
|
68
|
+
when: staged.rc == 1
|
|
69
|
+
|
|
70
|
+
- name: "[{{ dest_branch }}] Push source branch"
|
|
71
|
+
ansible.builtin.command:
|
|
72
|
+
cmd: "git push -u origin {{ source_branch }}"
|
|
73
|
+
chdir: "{{ work_dir }}"
|
|
74
|
+
when: staged.rc == 1
|
|
75
|
+
|
|
76
|
+
- name: "[{{ dest_branch }}] Open pull request"
|
|
77
|
+
ansible.builtin.uri:
|
|
78
|
+
url: "{{ api_base }}/repositories/{{ workspace }}/{{ repo_slug }}/pullrequests"
|
|
79
|
+
method: POST
|
|
80
|
+
headers:
|
|
81
|
+
Authorization: "Bearer {{ bitbucket_token }}"
|
|
82
|
+
body_format: json
|
|
83
|
+
body:
|
|
84
|
+
title: "{{ jira_key }}: On-Boarding {{ brand_name }} Client Branding"
|
|
85
|
+
description: "{{ jira_key }}: On-Boarding {{ brand_name }} Client Branding"
|
|
86
|
+
source:
|
|
87
|
+
branch:
|
|
88
|
+
name: "{{ source_branch }}"
|
|
89
|
+
destination:
|
|
90
|
+
branch:
|
|
91
|
+
name: "{{ dest_branch }}"
|
|
92
|
+
reviewers: "{{ reviewers }}"
|
|
93
|
+
close_source_branch: true
|
|
94
|
+
return_content: true
|
|
95
|
+
status_code: [201, 400] # 400 tolerated: a PR for this source->dest already exists
|
|
96
|
+
register: pr_response
|
|
97
|
+
|
|
98
|
+
- name: "[{{ dest_branch }}] Record PR result"
|
|
99
|
+
ansible.builtin.set_fact:
|
|
100
|
+
pr_results: >-
|
|
101
|
+
{{ (pr_results | default([])) + [{
|
|
102
|
+
'destination': dest_branch,
|
|
103
|
+
'source': source_branch,
|
|
104
|
+
'status': pr_response.status,
|
|
105
|
+
'url': (pr_response.json.links.html.href | default('(already exists or not created)'))
|
|
106
|
+
}] }}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
---
|
|
2
|
-
# Constants — the target repository for Client Area onboarding.
|
|
3
|
-
api_base: "https://api.bitbucket.org/2.0"
|
|
4
|
-
workspace: "xsitesinc"
|
|
5
|
-
repo_slug: "web-client-area"
|
|
6
|
-
repo_ssh_url: "git@bitbucket.org:xsitesinc/web-client-area.git"
|
|
1
|
+
---
|
|
2
|
+
# Constants — the target repository for Client Area onboarding.
|
|
3
|
+
api_base: "https://api.bitbucket.org/2.0"
|
|
4
|
+
workspace: "xsitesinc"
|
|
5
|
+
repo_slug: "web-client-area"
|
|
6
|
+
repo_ssh_url: "git@bitbucket.org:xsitesinc/web-client-area.git"
|
package/index.js
CHANGED
package/onboarding-ca/brand.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
let brand = {
|
|
2
|
-
brandAssetsFolder: ''
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
function updateBrand(updatedBrand) {
|
|
6
|
-
brand = { ...brand, ...updatedBrand };
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function getBrand() {
|
|
10
|
-
return brand;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = { updateBrand, getBrand };
|
|
1
|
+
let brand = {
|
|
2
|
+
brandAssetsFolder: ''
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
function updateBrand(updatedBrand) {
|
|
6
|
+
brand = { ...brand, ...updatedBrand };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function getBrand() {
|
|
10
|
+
return brand;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = { updateBrand, getBrand };
|
package/onboarding-ca/index.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
const readline = require('readline');
|
|
2
|
-
const chalk = require('chalk');
|
|
3
|
-
const brandModule = require('./brand.js');
|
|
4
|
-
const scss = require('./scss.js');
|
|
5
|
-
const riskDisclaimer = require('./riskDisclaimer.js');
|
|
6
|
-
|
|
7
|
-
const HELP = `
|
|
8
|
-
Usage: ant-cli onboarding-ca --brand_assets_folder <folder>
|
|
9
|
-
|
|
10
|
-
Creates the Client Area brand assets in the current web-client-area checkout:
|
|
11
|
-
src/assets/other/<folder>/<folder>.scss (empty)
|
|
12
|
-
src/assets/other/<folder>/legal/risk-disclaimer.html
|
|
13
|
-
|
|
14
|
-
Options:
|
|
15
|
-
--brand_assets_folder Brand assets folder name, e.g. "zenithhorizongroup"
|
|
16
|
-
(required in non-interactive mode). This is the value used for
|
|
17
|
-
ENV_branding.brand_assets_folder. Normalized to lowercase, spaces removed.
|
|
18
|
-
-h, --help Show this help
|
|
19
|
-
|
|
20
|
-
Run from the root of a web-client-area checkout — files are written relative to the current directory.
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
// Normalize to the folder convention used across the brand repos (connectedBrandName):
|
|
24
|
-
// lowercase, no spaces. Harmless when a clean folder name is already supplied.
|
|
25
|
-
const normalizeFolder = (value) => value.trim().toLowerCase().replace(/ /g, '');
|
|
26
|
-
|
|
27
|
-
function parseArgs(argv) {
|
|
28
|
-
const opts = {};
|
|
29
|
-
for (let i = 0; i < argv.length; i++) {
|
|
30
|
-
const a = argv[i];
|
|
31
|
-
if (a === '--brand_assets_folder') opts.brandAssetsFolder = argv[++i];
|
|
32
|
-
else if (a === '--help' || a === '-h') opts.help = true;
|
|
33
|
-
}
|
|
34
|
-
return opts;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function promptFolder(rl) {
|
|
38
|
-
return new Promise((resolve) => {
|
|
39
|
-
rl.question('Enter the brand assets folder name (e.g. zenithhorizongroup):\n', (name) => resolve(name));
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async function run() {
|
|
44
|
-
// process.argv: [node, index.js, "onboarding-ca", ...flags]
|
|
45
|
-
const opts = parseArgs(process.argv.slice(3));
|
|
46
|
-
if (opts.help) {
|
|
47
|
-
console.log(HELP);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
console.log(chalk.underline(chalk.cyan('Antelope Client-Area on-boarding\n')));
|
|
52
|
-
|
|
53
|
-
// Interactive only in a real terminal and when not forced non-interactive (CI / Ansible).
|
|
54
|
-
const interactive = Boolean(process.stdin.isTTY) && !process.env.CI;
|
|
55
|
-
|
|
56
|
-
let rl;
|
|
57
|
-
let rawFolder = opts.brandAssetsFolder;
|
|
58
|
-
if (!rawFolder) {
|
|
59
|
-
if (!interactive) {
|
|
60
|
-
console.error(chalk.red('Error: --brand_assets_folder is required in non-interactive mode.'));
|
|
61
|
-
console.log(HELP);
|
|
62
|
-
process.exitCode = 1;
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
66
|
-
rawFolder = await promptFolder(rl);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const brandAssetsFolder = normalizeFolder(rawFolder || '');
|
|
70
|
-
if (!brandAssetsFolder) {
|
|
71
|
-
console.error(chalk.red('Error: brand assets folder must not be empty.'));
|
|
72
|
-
if (rl) rl.close();
|
|
73
|
-
process.exitCode = 1;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
brandModule.updateBrand({ brandAssetsFolder });
|
|
78
|
-
|
|
79
|
-
try {
|
|
80
|
-
console.log(chalk.bold(chalk.yellow(`\nOnboarding brand assets folder "${brandAssetsFolder}"`)));
|
|
81
|
-
console.log(chalk.bold(chalk.yellow('\nStep 1: Create brand stylesheet')));
|
|
82
|
-
await scss.start();
|
|
83
|
-
console.log(chalk.bold(chalk.yellow('\nStep 2: Create legal/risk-disclaimer.html')));
|
|
84
|
-
await riskDisclaimer.start();
|
|
85
|
-
console.log(chalk.green('\nClient-Area onboarding completed!'));
|
|
86
|
-
} catch (err) {
|
|
87
|
-
console.error(chalk.red(err) + '\n Please delete files added by this failed session.');
|
|
88
|
-
process.exitCode = 1;
|
|
89
|
-
} finally {
|
|
90
|
-
if (rl) rl.close();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
run();
|
|
1
|
+
const readline = require('readline');
|
|
2
|
+
const chalk = require('chalk');
|
|
3
|
+
const brandModule = require('./brand.js');
|
|
4
|
+
const scss = require('./scss.js');
|
|
5
|
+
const riskDisclaimer = require('./riskDisclaimer.js');
|
|
6
|
+
|
|
7
|
+
const HELP = `
|
|
8
|
+
Usage: ant-cli onboarding-ca --brand_assets_folder <folder>
|
|
9
|
+
|
|
10
|
+
Creates the Client Area brand assets in the current web-client-area checkout:
|
|
11
|
+
src/assets/other/<folder>/<folder>.scss (empty)
|
|
12
|
+
src/assets/other/<folder>/legal/risk-disclaimer.html
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
--brand_assets_folder Brand assets folder name, e.g. "zenithhorizongroup"
|
|
16
|
+
(required in non-interactive mode). This is the value used for
|
|
17
|
+
ENV_branding.brand_assets_folder. Normalized to lowercase, spaces removed.
|
|
18
|
+
-h, --help Show this help
|
|
19
|
+
|
|
20
|
+
Run from the root of a web-client-area checkout — files are written relative to the current directory.
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
// Normalize to the folder convention used across the brand repos (connectedBrandName):
|
|
24
|
+
// lowercase, no spaces. Harmless when a clean folder name is already supplied.
|
|
25
|
+
const normalizeFolder = (value) => value.trim().toLowerCase().replace(/ /g, '');
|
|
26
|
+
|
|
27
|
+
function parseArgs(argv) {
|
|
28
|
+
const opts = {};
|
|
29
|
+
for (let i = 0; i < argv.length; i++) {
|
|
30
|
+
const a = argv[i];
|
|
31
|
+
if (a === '--brand_assets_folder') opts.brandAssetsFolder = argv[++i];
|
|
32
|
+
else if (a === '--help' || a === '-h') opts.help = true;
|
|
33
|
+
}
|
|
34
|
+
return opts;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function promptFolder(rl) {
|
|
38
|
+
return new Promise((resolve) => {
|
|
39
|
+
rl.question('Enter the brand assets folder name (e.g. zenithhorizongroup):\n', (name) => resolve(name));
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function run() {
|
|
44
|
+
// process.argv: [node, index.js, "onboarding-ca", ...flags]
|
|
45
|
+
const opts = parseArgs(process.argv.slice(3));
|
|
46
|
+
if (opts.help) {
|
|
47
|
+
console.log(HELP);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
console.log(chalk.underline(chalk.cyan('Antelope Client-Area on-boarding\n')));
|
|
52
|
+
|
|
53
|
+
// Interactive only in a real terminal and when not forced non-interactive (CI / Ansible).
|
|
54
|
+
const interactive = Boolean(process.stdin.isTTY) && !process.env.CI;
|
|
55
|
+
|
|
56
|
+
let rl;
|
|
57
|
+
let rawFolder = opts.brandAssetsFolder;
|
|
58
|
+
if (!rawFolder) {
|
|
59
|
+
if (!interactive) {
|
|
60
|
+
console.error(chalk.red('Error: --brand_assets_folder is required in non-interactive mode.'));
|
|
61
|
+
console.log(HELP);
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
66
|
+
rawFolder = await promptFolder(rl);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const brandAssetsFolder = normalizeFolder(rawFolder || '');
|
|
70
|
+
if (!brandAssetsFolder) {
|
|
71
|
+
console.error(chalk.red('Error: brand assets folder must not be empty.'));
|
|
72
|
+
if (rl) rl.close();
|
|
73
|
+
process.exitCode = 1;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
brandModule.updateBrand({ brandAssetsFolder });
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
console.log(chalk.bold(chalk.yellow(`\nOnboarding brand assets folder "${brandAssetsFolder}"`)));
|
|
81
|
+
console.log(chalk.bold(chalk.yellow('\nStep 1: Create brand stylesheet')));
|
|
82
|
+
await scss.start();
|
|
83
|
+
console.log(chalk.bold(chalk.yellow('\nStep 2: Create legal/risk-disclaimer.html')));
|
|
84
|
+
await riskDisclaimer.start();
|
|
85
|
+
console.log(chalk.green('\nClient-Area onboarding completed!'));
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error(chalk.red(err) + '\n Please delete files added by this failed session.');
|
|
88
|
+
process.exitCode = 1;
|
|
89
|
+
} finally {
|
|
90
|
+
if (rl) rl.close();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
run();
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const brandModule = require('./brand.js');
|
|
5
|
-
|
|
6
|
-
// The disclaimer is the same fixed markup for every brand. Read the bundled template
|
|
7
|
-
// via __dirname (resolves inside the installed package, regardless of the cwd we write to).
|
|
8
|
-
const templatePath = path.join(__dirname, 'templates', 'risk-disclaimer.html');
|
|
9
|
-
|
|
10
|
-
function start() {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
try {
|
|
13
|
-
const { brandAssetsFolder } = brandModule.getBrand();
|
|
14
|
-
const dir = path.join('src', 'assets', 'other', brandAssetsFolder, 'legal');
|
|
15
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
16
|
-
const file = path.join(dir, 'risk-disclaimer.html');
|
|
17
|
-
const template = fs.readFileSync(templatePath, 'utf8');
|
|
18
|
-
fs.writeFileSync(file, template, 'utf8');
|
|
19
|
-
console.log(chalk.cyan(`Created ${file}`));
|
|
20
|
-
resolve(file);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
reject(error);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = { start };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const brandModule = require('./brand.js');
|
|
5
|
+
|
|
6
|
+
// The disclaimer is the same fixed markup for every brand. Read the bundled template
|
|
7
|
+
// via __dirname (resolves inside the installed package, regardless of the cwd we write to).
|
|
8
|
+
const templatePath = path.join(__dirname, 'templates', 'risk-disclaimer.html');
|
|
9
|
+
|
|
10
|
+
function start() {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
try {
|
|
13
|
+
const { brandAssetsFolder } = brandModule.getBrand();
|
|
14
|
+
const dir = path.join('src', 'assets', 'other', brandAssetsFolder, 'legal');
|
|
15
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
16
|
+
const file = path.join(dir, 'risk-disclaimer.html');
|
|
17
|
+
const template = fs.readFileSync(templatePath, 'utf8');
|
|
18
|
+
fs.writeFileSync(file, template, 'utf8');
|
|
19
|
+
console.log(chalk.cyan(`Created ${file}`));
|
|
20
|
+
resolve(file);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
reject(error);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = { start };
|
package/onboarding-ca/scss.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const brandModule = require('./brand.js');
|
|
5
|
-
|
|
6
|
-
// Creates the brand stylesheet. It is intentionally EMPTY — matches every existing
|
|
7
|
-
// brand in web-client-area (git blob e69de29b). brands.ts require()s it dynamically.
|
|
8
|
-
function start() {
|
|
9
|
-
return new Promise((resolve, reject) => {
|
|
10
|
-
try {
|
|
11
|
-
const { brandAssetsFolder } = brandModule.getBrand();
|
|
12
|
-
const dir = path.join('src', 'assets', 'other', brandAssetsFolder);
|
|
13
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
14
|
-
const file = path.join(dir, `${brandAssetsFolder}.scss`);
|
|
15
|
-
fs.writeFileSync(file, '', 'utf8');
|
|
16
|
-
console.log(chalk.cyan(`Created ${file}`));
|
|
17
|
-
resolve(file);
|
|
18
|
-
} catch (error) {
|
|
19
|
-
reject(error);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = { start };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const brandModule = require('./brand.js');
|
|
5
|
+
|
|
6
|
+
// Creates the brand stylesheet. It is intentionally EMPTY — matches every existing
|
|
7
|
+
// brand in web-client-area (git blob e69de29b). brands.ts require()s it dynamically.
|
|
8
|
+
function start() {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
try {
|
|
11
|
+
const { brandAssetsFolder } = brandModule.getBrand();
|
|
12
|
+
const dir = path.join('src', 'assets', 'other', brandAssetsFolder);
|
|
13
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
14
|
+
const file = path.join(dir, `${brandAssetsFolder}.scss`);
|
|
15
|
+
fs.writeFileSync(file, '', 'utf8');
|
|
16
|
+
console.log(chalk.cyan(`Created ${file}`));
|
|
17
|
+
resolve(file);
|
|
18
|
+
} catch (error) {
|
|
19
|
+
reject(error);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = { start };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
<div class="page-wrapper push-up">
|
|
2
|
-
<a
|
|
3
|
-
class="disclaimer__top-image push-down"
|
|
4
|
-
href="{{ 'RISK.DISCLAIMER.SPONSOR.URL' | translate }}"
|
|
5
|
-
target="_blank"
|
|
6
|
-
layout="row"
|
|
7
|
-
layout-align="center center"
|
|
8
|
-
><img alt=""
|
|
9
|
-
/></a>
|
|
10
|
-
<div class="disclaimer__title"><span translate="COMMON.RISK_DISCLAIMER"></span>:</div>
|
|
11
|
-
<p translate="DISCLAIMER" translate-value-risk="{{$ctrl.risk}}"></p>
|
|
12
|
-
</div>
|
|
1
|
+
<div class="page-wrapper push-up">
|
|
2
|
+
<a
|
|
3
|
+
class="disclaimer__top-image push-down"
|
|
4
|
+
href="{{ 'RISK.DISCLAIMER.SPONSOR.URL' | translate }}"
|
|
5
|
+
target="_blank"
|
|
6
|
+
layout="row"
|
|
7
|
+
layout-align="center center"
|
|
8
|
+
><img alt=""
|
|
9
|
+
/></a>
|
|
10
|
+
<div class="disclaimer__title"><span translate="COMMON.RISK_DISCLAIMER"></span>:</div>
|
|
11
|
+
<p translate="DISCLAIMER" translate-value-risk="{{$ctrl.risk}}"></p>
|
|
12
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
let brand = {
|
|
2
|
+
brandName: '',
|
|
3
|
+
kebabCaseName: '',
|
|
4
|
+
connectedBrandName: '',
|
|
5
|
+
color: '',
|
|
6
|
+
languages: null,
|
|
7
|
+
favicon: '',
|
|
8
|
+
type: '',
|
|
9
|
+
FCMSenderId: '',
|
|
10
|
+
logo: ''
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function updateBrand(updatedBrand) {
|
|
14
|
+
brand = { ...brand, ...updatedBrand };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getBrand() {
|
|
18
|
+
return brand;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = { updateBrand, getBrand };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const brandModule = require('./brand.js');
|
|
3
|
+
const chalk = require('chalk');
|
|
4
|
+
const configsFilePath = 'src/configs/configs.ts';
|
|
5
|
+
|
|
6
|
+
// Same output as onboarding/createConfig.js — FCMSenderId/type are resolved upfront (flags/prompt).
|
|
7
|
+
function start() {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
fs.writeFile(configsFilePath, updateConfigFile(), 'utf8', (error) => {
|
|
10
|
+
if (error) {
|
|
11
|
+
reject(error);
|
|
12
|
+
} else {
|
|
13
|
+
console.log(chalk.cyan('configs.ts file updated successfully!'));
|
|
14
|
+
resolve(null);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const updateConfigFile = () => {
|
|
21
|
+
const brand = brandModule.getBrand();
|
|
22
|
+
return `export const configs: WebCrmConfig = {
|
|
23
|
+
baseUrl: 'https://dev-apicrm.antelopesystem.com/SignalsCRM/',
|
|
24
|
+
appId: 0,
|
|
25
|
+
type: '${brand.type}',
|
|
26
|
+
defaultLanguage: 'en',
|
|
27
|
+
gaTrackingID: 'UA-70456753-2',
|
|
28
|
+
colorTheme: 'theme-${brand.connectedBrandName}',
|
|
29
|
+
templateTheme: 'theme-template-${brand.connectedBrandName}',
|
|
30
|
+
title: '${brand.brandName}',
|
|
31
|
+
favicon: '${brand.favicon}',
|
|
32
|
+
affiliatesApiUrl: '',
|
|
33
|
+
FCMSenderId: '${brand.FCMSenderId}',
|
|
34
|
+
brandAssetsFolder: '${brand.connectedBrandName}',
|
|
35
|
+
};`;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
module.exports = { start };
|