@seeka-labs/cli-apps 2.0.16-alpha.0 → 2.0.20-alpha.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/LICENSE +19 -19
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/dist/init-template/.gitlab-ci.yml +46 -46
- package/dist/init-template/.yarnrc.yml +8 -0
- package/dist/init-template/README.md +6 -6
- package/dist/init-template/app/browser/jest.config.js +11 -11
- package/dist/init-template/app/browser/package.json +40 -40
- package/dist/init-template/app/browser/scripts/esbuild/build-browser-plugin.mjs +110 -110
- package/dist/init-template/app/browser/scripts/esbuild/plugins/importAsGlobals.mjs +38 -38
- package/dist/init-template/app/browser/src/browser.ts +12 -12
- package/dist/init-template/app/browser/src/plugin/index.test.ts +6 -6
- package/dist/init-template/app/browser/src/plugin/index.ts +47 -47
- package/dist/init-template/app/browser/tsconfig.json +34 -34
- package/dist/init-template/app/server-azure-function/.eslintrc.cjs +10 -10
- package/dist/init-template/app/server-azure-function/.funcignore +21 -21
- package/dist/init-template/app/server-azure-function/README.md +104 -104
- package/dist/init-template/app/server-azure-function/host.json +19 -19
- package/dist/init-template/app/server-azure-function/local.settings.example.json +25 -25
- package/dist/init-template/app/server-azure-function/package.json +52 -52
- package/dist/init-template/app/server-azure-function/scripts/ngrok.js +27 -27
- package/dist/init-template/app/server-azure-function/src/functions/healthCheck.ts +13 -13
- package/dist/init-template/app/server-azure-function/src/functions/pollingExample.ts +39 -39
- package/dist/init-template/app/server-azure-function/src/functions/queueExample.ts +66 -66
- package/dist/init-template/app/server-azure-function/src/functions/seekaAppWebhook.ts +235 -235
- package/dist/init-template/app/server-azure-function/src/lib/browser/index.ts +54 -54
- package/dist/init-template/app/server-azure-function/src/lib/jobs/index.ts +95 -95
- package/dist/init-template/app/server-azure-function/src/lib/logging/index.ts +92 -92
- package/dist/init-template/app/server-azure-function/src/lib/models/index.ts +6 -6
- package/dist/init-template/app/server-azure-function/src/lib/services/index.ts +40 -40
- package/dist/init-template/app/server-azure-function/src/lib/state/redis/index.ts +96 -96
- package/dist/init-template/app/server-azure-function/src/lib/state/seeka/installations.ts +64 -64
- package/dist/init-template/app/server-azure-function/tsconfig.json +17 -17
- package/dist/init-template/tsconfig.json +25 -25
- package/package.json +2 -2
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
stages:
|
|
2
|
-
- deploy
|
|
3
|
-
|
|
4
|
-
variables:
|
|
5
|
-
AZURE_FUNC_RESOURCE_NAME: seeka-app-example-name
|
|
6
|
-
CI_DEBUG_TRACE: "true"
|
|
7
|
-
|
|
8
|
-
workflow:
|
|
9
|
-
rules:
|
|
10
|
-
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
11
|
-
when: never
|
|
12
|
-
- if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
13
|
-
variables:
|
|
14
|
-
# AZURE_FUNC_SLOT: ""
|
|
15
|
-
# AZURE_FUNC_SLOT: "production"?????
|
|
16
|
-
HOSTING_REGION_NAME: auea
|
|
17
|
-
HOSTING_ENV_NAME: prod
|
|
18
|
-
when: always
|
|
19
|
-
- if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
20
|
-
variables:
|
|
21
|
-
# AZURE_FUNC_SLOT: staging
|
|
22
|
-
HOSTING_REGION_NAME: auea
|
|
23
|
-
HOSTING_ENV_NAME: stag
|
|
24
|
-
when: always
|
|
25
|
-
|
|
26
|
-
deploy:
|
|
27
|
-
stage: deploy
|
|
28
|
-
image: node:20
|
|
29
|
-
environment:
|
|
30
|
-
name: $HOSTING_REGION_NAME/$HOSTING_ENV_NAME/apps
|
|
31
|
-
before_script:
|
|
32
|
-
- echo "installing azure cli"
|
|
33
|
-
- curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
|
34
|
-
- az --version
|
|
35
|
-
- echo "logging in to azure"
|
|
36
|
-
- az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
|
|
37
|
-
- az account set --subscription "$AZURE_SUBSCRIPTION_ID"
|
|
38
|
-
- corepack enable
|
|
39
|
-
script:
|
|
40
|
-
- echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
|
|
41
|
-
- yarn install --immutable
|
|
42
|
-
- yarn clean && yarn build
|
|
43
|
-
- cd app/server-azure-function
|
|
44
|
-
- yarn func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
|
|
45
|
-
only:
|
|
46
|
-
- main
|
|
1
|
+
stages:
|
|
2
|
+
- deploy
|
|
3
|
+
|
|
4
|
+
variables:
|
|
5
|
+
AZURE_FUNC_RESOURCE_NAME: seeka-app-example-name
|
|
6
|
+
CI_DEBUG_TRACE: "true"
|
|
7
|
+
|
|
8
|
+
workflow:
|
|
9
|
+
rules:
|
|
10
|
+
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
|
|
11
|
+
when: never
|
|
12
|
+
- if: '$CI_COMMIT_BRANCH == "main" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
13
|
+
variables:
|
|
14
|
+
# AZURE_FUNC_SLOT: ""
|
|
15
|
+
# AZURE_FUNC_SLOT: "production"?????
|
|
16
|
+
HOSTING_REGION_NAME: auea
|
|
17
|
+
HOSTING_ENV_NAME: prod
|
|
18
|
+
when: always
|
|
19
|
+
- if: '$CI_COMMIT_BRANCH == "staging" && ($CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "web")'
|
|
20
|
+
variables:
|
|
21
|
+
# AZURE_FUNC_SLOT: staging
|
|
22
|
+
HOSTING_REGION_NAME: auea
|
|
23
|
+
HOSTING_ENV_NAME: stag
|
|
24
|
+
when: always
|
|
25
|
+
|
|
26
|
+
deploy:
|
|
27
|
+
stage: deploy
|
|
28
|
+
image: node:20
|
|
29
|
+
environment:
|
|
30
|
+
name: $HOSTING_REGION_NAME/$HOSTING_ENV_NAME/apps
|
|
31
|
+
before_script:
|
|
32
|
+
- echo "installing azure cli"
|
|
33
|
+
- curl -sL https://aka.ms/InstallAzureCLIDeb | bash
|
|
34
|
+
- az --version
|
|
35
|
+
- echo "logging in to azure"
|
|
36
|
+
- az login --service-principal --username "$AZURE_SERVICEPRINCIPAL_CLIENTID" --password "$AZURE_SERVICEPRINCIPAL_SECRET" --tenant "$AZURE_TENANT_ID"
|
|
37
|
+
- az account set --subscription "$AZURE_SUBSCRIPTION_ID"
|
|
38
|
+
- corepack enable
|
|
39
|
+
script:
|
|
40
|
+
- echo "deploying azure func $AZURE_FUNC_RESOURCE_NAME to slot $AZURE_FUNC_SLOT from branch $CI_COMMIT_BRANCH"
|
|
41
|
+
- yarn install --immutable
|
|
42
|
+
- yarn clean && yarn build
|
|
43
|
+
- cd app/server-azure-function
|
|
44
|
+
- yarn func azure functionapp publish $AZURE_FUNC_RESOURCE_NAME --no-build --javascript
|
|
45
|
+
only:
|
|
46
|
+
- main
|
|
47
47
|
- staging
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Seeka app
|
|
2
|
-
|
|
3
|
-
# updating all deps
|
|
4
|
-
```
|
|
5
|
-
cd repo root
|
|
6
|
-
npx npm-check-updates@latest -i --target minor --workspaces && npx npm-check-updates@latest -i --target latest --workspaces
|
|
1
|
+
# Seeka app
|
|
2
|
+
|
|
3
|
+
# updating all deps
|
|
4
|
+
```
|
|
5
|
+
cd repo root
|
|
6
|
+
npx npm-check-updates@latest -i --target minor --workspaces && npx npm-check-updates@latest -i --target latest --workspaces
|
|
7
7
|
```
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
roots: ['<rootDir>/src'],
|
|
3
|
-
testMatch: [
|
|
4
|
-
"**/*.test.ts"
|
|
5
|
-
],
|
|
6
|
-
transform: {
|
|
7
|
-
"^.+\\.(ts|tsx)$": "ts-jest"
|
|
8
|
-
},
|
|
9
|
-
collectCoverageFrom: ["src/**/*.ts", "!**/node_modules/**"],
|
|
10
|
-
coverageReporters: ["html", "text", "text-summary", "cobertura"],
|
|
11
|
-
}
|
|
1
|
+
export default {
|
|
2
|
+
roots: ['<rootDir>/src'],
|
|
3
|
+
testMatch: [
|
|
4
|
+
"**/*.test.ts"
|
|
5
|
+
],
|
|
6
|
+
transform: {
|
|
7
|
+
"^.+\\.(ts|tsx)$": "ts-jest"
|
|
8
|
+
},
|
|
9
|
+
collectCoverageFrom: ["src/**/*.ts", "!**/node_modules/**"],
|
|
10
|
+
coverageReporters: ["html", "text", "text-summary", "cobertura"],
|
|
11
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@seeka-app-example-name/browser",
|
|
3
|
-
"version": "2.0.9-alpha.0",
|
|
4
|
-
"description": "Seeka browser app seeka-app-example-name-browser",
|
|
5
|
-
"author": "Seeka company <support@seeka.co>",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist/"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"lint": "eslint --fix src/ --ext .ts",
|
|
12
|
-
"test:ci": "jest --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
|
|
13
|
-
"test": "jest --watch",
|
|
14
|
-
"clean": "rimraf dist build package",
|
|
15
|
-
"build": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin",
|
|
16
|
-
"build:dev": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev",
|
|
17
|
-
"watch": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev watch"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@seeka-labs/converge": "^1.8.64"
|
|
21
|
-
},
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@jest/globals": "^29.7.0",
|
|
24
|
-
"@jgoz/esbuild-plugin-typecheck": "^4.0.3",
|
|
25
|
-
"@types/jest": "^29.5.14",
|
|
26
|
-
"@types/lodash-es": "^4.17.12",
|
|
27
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
28
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
29
|
-
"esbuild": "^0.25.5",
|
|
30
|
-
"eslint": "^9",
|
|
31
|
-
"eslint-plugin-unused-imports": "^4.1.4",
|
|
32
|
-
"jest": "^29.7.0",
|
|
33
|
-
"jest-junit": "^16.0.0",
|
|
34
|
-
"rimraf": "^6.0.1",
|
|
35
|
-
"ts-jest": "^29.3.4",
|
|
36
|
-
"typescript": "^5.8.3",
|
|
37
|
-
"watch": "^1.0.2"
|
|
38
|
-
},
|
|
39
|
-
"stableVersion": "2.0.6"
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@seeka-app-example-name/browser",
|
|
3
|
+
"version": "2.0.9-alpha.0",
|
|
4
|
+
"description": "Seeka browser app seeka-app-example-name-browser",
|
|
5
|
+
"author": "Seeka company <support@seeka.co>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"lint": "eslint --fix src/ --ext .ts",
|
|
12
|
+
"test:ci": "jest --collectCoverage --coverageDirectory=\"./coverage\" --ci --reporters=default --reporters=jest-junit --watchAll=false",
|
|
13
|
+
"test": "jest --watch",
|
|
14
|
+
"clean": "rimraf dist build package",
|
|
15
|
+
"build": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin",
|
|
16
|
+
"build:dev": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev",
|
|
17
|
+
"watch": "yarn clean && node ./scripts/esbuild/build-browser-plugin.mjs seeka-app-example-name SampleAppConvergeSdkPlugin dev watch"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@seeka-labs/converge": "^1.8.64"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@jest/globals": "^29.7.0",
|
|
24
|
+
"@jgoz/esbuild-plugin-typecheck": "^4.0.3",
|
|
25
|
+
"@types/jest": "^29.5.14",
|
|
26
|
+
"@types/lodash-es": "^4.17.12",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
28
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
29
|
+
"esbuild": "^0.25.5",
|
|
30
|
+
"eslint": "^9",
|
|
31
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
32
|
+
"jest": "^29.7.0",
|
|
33
|
+
"jest-junit": "^16.0.0",
|
|
34
|
+
"rimraf": "^6.0.1",
|
|
35
|
+
"ts-jest": "^29.3.4",
|
|
36
|
+
"typescript": "^5.8.3",
|
|
37
|
+
"watch": "^1.0.2"
|
|
38
|
+
},
|
|
39
|
+
"stableVersion": "2.0.6"
|
|
40
|
+
}
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import { typecheckPlugin } from '@jgoz/esbuild-plugin-typecheck';
|
|
2
|
-
import { build, context, version } from 'esbuild';
|
|
3
|
-
import { copyFileSync, existsSync, mkdirSync } from 'fs';
|
|
4
|
-
import { resolve } from 'path';
|
|
5
|
-
import * as watch from 'watch';
|
|
6
|
-
import { importAsGlobals } from './plugins/importAsGlobals.mjs';
|
|
7
|
-
|
|
8
|
-
console.log('esbuild version:', version);
|
|
9
|
-
|
|
10
|
-
if (process.argv.length < 3) {
|
|
11
|
-
throw new Error('Missing arg');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const pluginName = process.argv[2];
|
|
15
|
-
|
|
16
|
-
const mode = process.argv.length > 4 ? process.argv[4] : 'prod';
|
|
17
|
-
const watchBuild = process.argv.length > 5 ? process.argv[5] == 'watch' : false;
|
|
18
|
-
|
|
19
|
-
console.log('mode:', mode);
|
|
20
|
-
console.log('watchBuild:', process.argv[4]);
|
|
21
|
-
|
|
22
|
-
const opts = {
|
|
23
|
-
entryPoints: ['src/browser.ts'],
|
|
24
|
-
bundle: true,
|
|
25
|
-
metafile: true,
|
|
26
|
-
minify: mode === 'dev' ? false : true,
|
|
27
|
-
format: 'iife',
|
|
28
|
-
platform: 'browser',
|
|
29
|
-
//sourcemap: 'external',
|
|
30
|
-
sourcemap: mode === 'dev' ? true : false,
|
|
31
|
-
external: ['@seeka-labs/converge'],
|
|
32
|
-
outfile: `dist/${pluginName}.min.js`,
|
|
33
|
-
plugins: [
|
|
34
|
-
importAsGlobals({
|
|
35
|
-
"@seeka-labs/converge": "SeekaConvergeCore"
|
|
36
|
-
}),
|
|
37
|
-
typecheckPlugin()
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const postBuild = () => {
|
|
42
|
-
// Copy outfile to ../dist/src/browser
|
|
43
|
-
if (!existsSync(resolve('../server-azure-function/dist/src/browser'))) {
|
|
44
|
-
mkdirSync(resolve('../server-azure-function/dist/src/browser'), {
|
|
45
|
-
recursive: true,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
copyFileSync(resolve(opts.outfile), resolve('../server-azure-function/dist/src/browser', `${pluginName}.min.js`))
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (watchBuild) {
|
|
52
|
-
const ctx = await context(opts);
|
|
53
|
-
|
|
54
|
-
async function buildWatch() {
|
|
55
|
-
await ctx.rebuild();
|
|
56
|
-
postBuild();
|
|
57
|
-
console.log('build succeeded');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
await buildWatch();
|
|
61
|
-
|
|
62
|
-
// Start watch
|
|
63
|
-
let monitorInstance;
|
|
64
|
-
watch.createMonitor(resolve('./src'), function (monitor) {
|
|
65
|
-
console.log('watching ./src, press any key to exit');
|
|
66
|
-
monitorInstance = monitor;
|
|
67
|
-
|
|
68
|
-
monitor.on("created", async function (f, stat) {
|
|
69
|
-
console.log('rebuilding due to file created', f)
|
|
70
|
-
try {
|
|
71
|
-
await buildWatch();
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
console.error(e);
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
monitor.on("changed", async function (f, curr, prev) {
|
|
78
|
-
console.log('rebuilding due to file changed', f)
|
|
79
|
-
try {
|
|
80
|
-
await buildWatch();
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
console.error(e);
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
monitor.on("removed", async function (f, stat) {
|
|
87
|
-
console.log('rebuilding due to file deleted', f)
|
|
88
|
-
try {
|
|
89
|
-
await buildWatch();
|
|
90
|
-
}
|
|
91
|
-
catch (e) {
|
|
92
|
-
console.error(e);
|
|
93
|
-
}
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
// Support stopping
|
|
98
|
-
var stdin = process.stdin;
|
|
99
|
-
stdin.setRawMode(true);
|
|
100
|
-
stdin.resume();
|
|
101
|
-
stdin.setEncoding('utf8');
|
|
102
|
-
stdin.on('data', function (key) {
|
|
103
|
-
console.log('Stopping watch...');
|
|
104
|
-
monitorInstance.stop();
|
|
105
|
-
process.exit();
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
await build(opts);
|
|
110
|
-
postBuild();
|
|
1
|
+
import { typecheckPlugin } from '@jgoz/esbuild-plugin-typecheck';
|
|
2
|
+
import { build, context, version } from 'esbuild';
|
|
3
|
+
import { copyFileSync, existsSync, mkdirSync } from 'fs';
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import * as watch from 'watch';
|
|
6
|
+
import { importAsGlobals } from './plugins/importAsGlobals.mjs';
|
|
7
|
+
|
|
8
|
+
console.log('esbuild version:', version);
|
|
9
|
+
|
|
10
|
+
if (process.argv.length < 3) {
|
|
11
|
+
throw new Error('Missing arg');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const pluginName = process.argv[2];
|
|
15
|
+
|
|
16
|
+
const mode = process.argv.length > 4 ? process.argv[4] : 'prod';
|
|
17
|
+
const watchBuild = process.argv.length > 5 ? process.argv[5] == 'watch' : false;
|
|
18
|
+
|
|
19
|
+
console.log('mode:', mode);
|
|
20
|
+
console.log('watchBuild:', process.argv[4]);
|
|
21
|
+
|
|
22
|
+
const opts = {
|
|
23
|
+
entryPoints: ['src/browser.ts'],
|
|
24
|
+
bundle: true,
|
|
25
|
+
metafile: true,
|
|
26
|
+
minify: mode === 'dev' ? false : true,
|
|
27
|
+
format: 'iife',
|
|
28
|
+
platform: 'browser',
|
|
29
|
+
//sourcemap: 'external',
|
|
30
|
+
sourcemap: mode === 'dev' ? true : false,
|
|
31
|
+
external: ['@seeka-labs/converge'],
|
|
32
|
+
outfile: `dist/${pluginName}.min.js`,
|
|
33
|
+
plugins: [
|
|
34
|
+
importAsGlobals({
|
|
35
|
+
"@seeka-labs/converge": "SeekaConvergeCore"
|
|
36
|
+
}),
|
|
37
|
+
typecheckPlugin()
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const postBuild = () => {
|
|
42
|
+
// Copy outfile to ../dist/src/browser
|
|
43
|
+
if (!existsSync(resolve('../server-azure-function/dist/src/browser'))) {
|
|
44
|
+
mkdirSync(resolve('../server-azure-function/dist/src/browser'), {
|
|
45
|
+
recursive: true,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
copyFileSync(resolve(opts.outfile), resolve('../server-azure-function/dist/src/browser', `${pluginName}.min.js`))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (watchBuild) {
|
|
52
|
+
const ctx = await context(opts);
|
|
53
|
+
|
|
54
|
+
async function buildWatch() {
|
|
55
|
+
await ctx.rebuild();
|
|
56
|
+
postBuild();
|
|
57
|
+
console.log('build succeeded');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
await buildWatch();
|
|
61
|
+
|
|
62
|
+
// Start watch
|
|
63
|
+
let monitorInstance;
|
|
64
|
+
watch.createMonitor(resolve('./src'), function (monitor) {
|
|
65
|
+
console.log('watching ./src, press any key to exit');
|
|
66
|
+
monitorInstance = monitor;
|
|
67
|
+
|
|
68
|
+
monitor.on("created", async function (f, stat) {
|
|
69
|
+
console.log('rebuilding due to file created', f)
|
|
70
|
+
try {
|
|
71
|
+
await buildWatch();
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
console.error(e);
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
monitor.on("changed", async function (f, curr, prev) {
|
|
78
|
+
console.log('rebuilding due to file changed', f)
|
|
79
|
+
try {
|
|
80
|
+
await buildWatch();
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
console.error(e);
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
monitor.on("removed", async function (f, stat) {
|
|
87
|
+
console.log('rebuilding due to file deleted', f)
|
|
88
|
+
try {
|
|
89
|
+
await buildWatch();
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
console.error(e);
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
// Support stopping
|
|
98
|
+
var stdin = process.stdin;
|
|
99
|
+
stdin.setRawMode(true);
|
|
100
|
+
stdin.resume();
|
|
101
|
+
stdin.setEncoding('utf8');
|
|
102
|
+
stdin.on('data', function (key) {
|
|
103
|
+
console.log('Stopping watch...');
|
|
104
|
+
monitorInstance.stop();
|
|
105
|
+
process.exit();
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
await build(opts);
|
|
110
|
+
postBuild();
|
|
111
111
|
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
export function importAsGlobals(mapping) {
|
|
2
|
-
// https://github.com/evanw/esbuild/issues/337
|
|
3
|
-
// https://stackoverflow.com/a/3561711/153718
|
|
4
|
-
const escRe = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
5
|
-
const filter = new RegExp(
|
|
6
|
-
Object.keys(mapping)
|
|
7
|
-
.map((mod) => `^${escRe(mod)}$`)
|
|
8
|
-
.join("|"),
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
name: "global-imports",
|
|
13
|
-
setup(build) {
|
|
14
|
-
build.onResolve({ filter }, (args) => {
|
|
15
|
-
if (!mapping[args.path]) {
|
|
16
|
-
throw new Error("Unknown global: " + args.path);
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
path: args.path,
|
|
20
|
-
namespace: "external-global",
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
build.onLoad(
|
|
25
|
-
{
|
|
26
|
-
filter,
|
|
27
|
-
namespace: "external-global",
|
|
28
|
-
},
|
|
29
|
-
async (args) => {
|
|
30
|
-
const global = mapping[args.path];
|
|
31
|
-
return {
|
|
32
|
-
contents: `module.exports = ${global};`,
|
|
33
|
-
loader: "js",
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
};
|
|
1
|
+
export function importAsGlobals(mapping) {
|
|
2
|
+
// https://github.com/evanw/esbuild/issues/337
|
|
3
|
+
// https://stackoverflow.com/a/3561711/153718
|
|
4
|
+
const escRe = (s) => s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
5
|
+
const filter = new RegExp(
|
|
6
|
+
Object.keys(mapping)
|
|
7
|
+
.map((mod) => `^${escRe(mod)}$`)
|
|
8
|
+
.join("|"),
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
name: "global-imports",
|
|
13
|
+
setup(build) {
|
|
14
|
+
build.onResolve({ filter }, (args) => {
|
|
15
|
+
if (!mapping[args.path]) {
|
|
16
|
+
throw new Error("Unknown global: " + args.path);
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
path: args.path,
|
|
20
|
+
namespace: "external-global",
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
build.onLoad(
|
|
25
|
+
{
|
|
26
|
+
filter,
|
|
27
|
+
namespace: "external-global",
|
|
28
|
+
},
|
|
29
|
+
async (args) => {
|
|
30
|
+
const global = mapping[args.path];
|
|
31
|
+
return {
|
|
32
|
+
contents: `module.exports = ${global};`,
|
|
33
|
+
loader: "js",
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
39
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { ISampleAppBrowserSdkPluginConfig } from '../../server-azure-function/src/lib/models';
|
|
2
|
-
import { SampleAppConvergeSdkPlugin } from "./plugin";
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
SampleAppConvergeSdkPlugin: (pluginConfig: ISampleAppBrowserSdkPluginConfig) => SampleAppConvergeSdkPlugin;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
(window as Window).SampleAppConvergeSdkPlugin = (pluginConfig: ISampleAppBrowserSdkPluginConfig) => {
|
|
11
|
-
return new SampleAppConvergeSdkPlugin(pluginConfig);
|
|
12
|
-
};
|
|
1
|
+
import type { ISampleAppBrowserSdkPluginConfig } from '../../server-azure-function/src/lib/models';
|
|
2
|
+
import { SampleAppConvergeSdkPlugin } from "./plugin";
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
SampleAppConvergeSdkPlugin: (pluginConfig: ISampleAppBrowserSdkPluginConfig) => SampleAppConvergeSdkPlugin;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
(window as Window).SampleAppConvergeSdkPlugin = (pluginConfig: ISampleAppBrowserSdkPluginConfig) => {
|
|
11
|
+
return new SampleAppConvergeSdkPlugin(pluginConfig);
|
|
12
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
describe("SampleTest", () => {
|
|
3
|
-
test("Sample", () => {
|
|
4
|
-
expect(1).toStrictEqual(1);
|
|
5
|
-
});
|
|
6
|
-
});
|
|
1
|
+
|
|
2
|
+
describe("SampleTest", () => {
|
|
3
|
+
test("Sample", () => {
|
|
4
|
+
expect(1).toStrictEqual(1);
|
|
5
|
+
});
|
|
6
|
+
});
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
ConvergeSdk,
|
|
4
|
-
IConvergePlugin
|
|
5
|
-
} from '@seeka-labs/converge';
|
|
6
|
-
|
|
7
|
-
import type { ISampleAppBrowserSdkPluginConfig } from '../../../server-azure-function/src/lib/models';
|
|
8
|
-
import { version } from '../../package.json';
|
|
9
|
-
|
|
10
|
-
// const checkSdkAndPluginVersion = (expectedVersion: string, sdk: ConvergeSdk, pluginName: string): void => {
|
|
11
|
-
// let runtimeVersion = sdk.config.runtime.ver as string;
|
|
12
|
-
// runtimeVersion = runtimeVersion.replace('^', '');
|
|
13
|
-
// expectedVersion = expectedVersion.replace('^', '');
|
|
14
|
-
|
|
15
|
-
// if (expectedVersion !== runtimeVersion) {
|
|
16
|
-
// sdk.debug.warn(`The expected SDK version of ${expectedVersion} for the ${pluginName} plugin does not match the current installlation runtime of ${runtimeVersion}`);
|
|
17
|
-
// }
|
|
18
|
-
// }
|
|
19
|
-
|
|
20
|
-
export class SampleAppConvergeSdkPlugin implements IConvergePlugin<ISampleAppBrowserSdkPluginConfig> {
|
|
21
|
-
constructor(pluginConfig: ISampleAppBrowserSdkPluginConfig) {
|
|
22
|
-
this.type = "seeka-app-example-name";
|
|
23
|
-
// this.name = this.type + "-" + pluginConfig.siteId;
|
|
24
|
-
this.name = this.type;
|
|
25
|
-
this.version = version;
|
|
26
|
-
this.sdk = {} as ConvergeSdk;
|
|
27
|
-
this.config = pluginConfig || {};
|
|
28
|
-
}
|
|
29
|
-
sdk: ConvergeSdk;
|
|
30
|
-
|
|
31
|
-
privacyConfig = {
|
|
32
|
-
// TODO
|
|
33
|
-
requiresIabPurposes: []
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
name: string;
|
|
37
|
-
type: string;
|
|
38
|
-
version: string;
|
|
39
|
-
config: ISampleAppBrowserSdkPluginConfig;
|
|
40
|
-
|
|
41
|
-
async init(_params: any): Promise<void> {
|
|
42
|
-
// checkSdkAndPluginVersion(dependencies['@seeka-labs/converge'], this.sdk, this.name)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
isLoaded(): boolean {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
ConvergeSdk,
|
|
4
|
+
IConvergePlugin
|
|
5
|
+
} from '@seeka-labs/converge';
|
|
6
|
+
|
|
7
|
+
import type { ISampleAppBrowserSdkPluginConfig } from '../../../server-azure-function/src/lib/models';
|
|
8
|
+
import { version } from '../../package.json';
|
|
9
|
+
|
|
10
|
+
// const checkSdkAndPluginVersion = (expectedVersion: string, sdk: ConvergeSdk, pluginName: string): void => {
|
|
11
|
+
// let runtimeVersion = sdk.config.runtime.ver as string;
|
|
12
|
+
// runtimeVersion = runtimeVersion.replace('^', '');
|
|
13
|
+
// expectedVersion = expectedVersion.replace('^', '');
|
|
14
|
+
|
|
15
|
+
// if (expectedVersion !== runtimeVersion) {
|
|
16
|
+
// sdk.debug.warn(`The expected SDK version of ${expectedVersion} for the ${pluginName} plugin does not match the current installlation runtime of ${runtimeVersion}`);
|
|
17
|
+
// }
|
|
18
|
+
// }
|
|
19
|
+
|
|
20
|
+
export class SampleAppConvergeSdkPlugin implements IConvergePlugin<ISampleAppBrowserSdkPluginConfig> {
|
|
21
|
+
constructor(pluginConfig: ISampleAppBrowserSdkPluginConfig) {
|
|
22
|
+
this.type = "seeka-app-example-name";
|
|
23
|
+
// this.name = this.type + "-" + pluginConfig.siteId;
|
|
24
|
+
this.name = this.type;
|
|
25
|
+
this.version = version;
|
|
26
|
+
this.sdk = {} as ConvergeSdk;
|
|
27
|
+
this.config = pluginConfig || {};
|
|
28
|
+
}
|
|
29
|
+
sdk: ConvergeSdk;
|
|
30
|
+
|
|
31
|
+
privacyConfig = {
|
|
32
|
+
// TODO
|
|
33
|
+
requiresIabPurposes: []
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
name: string;
|
|
37
|
+
type: string;
|
|
38
|
+
version: string;
|
|
39
|
+
config: ISampleAppBrowserSdkPluginConfig;
|
|
40
|
+
|
|
41
|
+
async init(_params: any): Promise<void> {
|
|
42
|
+
// checkSdkAndPluginVersion(dependencies['@seeka-labs/converge'], this.sdk, this.name)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
isLoaded(): boolean {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
48
|
}
|