From 931327abdb40a9744d26b49add70a9c69d41f105 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 14:30:04 -0700 Subject: [PATCH 01/17] refactor: move workflows to standalone workspace --- packages/workflows/package.json | 16 ++++++++++++++++ .../src}/android.workflows.ts | 0 .../src}/deployment.workflows.ts | 0 .../workflows => workflows/src}/index.ts | 0 .../src}/misc.workflows.ts | 0 .../src}/repo.workflows.ts | 0 .../src}/sync.workflows.ts | 0 .../src}/workflow.model.ts | 0 yarn.lock | 13 +++++++++++++ 9 files changed, 29 insertions(+) create mode 100644 packages/workflows/package.json rename packages/{data-models/workflows => workflows/src}/android.workflows.ts (100%) rename packages/{data-models/workflows => workflows/src}/deployment.workflows.ts (100%) rename packages/{data-models/workflows => workflows/src}/index.ts (100%) rename packages/{data-models/workflows => workflows/src}/misc.workflows.ts (100%) rename packages/{data-models/workflows => workflows/src}/repo.workflows.ts (100%) rename packages/{data-models/workflows => workflows/src}/sync.workflows.ts (100%) rename packages/{data-models/workflows => workflows/src}/workflow.model.ts (100%) diff --git a/packages/workflows/package.json b/packages/workflows/package.json new file mode 100644 index 0000000000..81ac86fc18 --- /dev/null +++ b/packages/workflows/package.json @@ -0,0 +1,16 @@ +{ + "name": "workflows", + "version": "1.0.0", + "description": "", + "main": "src/index.ts", + "scripts": { + "build": "tsc -b", + "serve": "tsc -w" + }, + "dependencies": {}, + "devDependencies": { + "@types/node": "^16.18.9", + "shared": "workspace:*", + "typescript": "~4.2.4" + } +} diff --git a/packages/data-models/workflows/android.workflows.ts b/packages/workflows/src/android.workflows.ts similarity index 100% rename from packages/data-models/workflows/android.workflows.ts rename to packages/workflows/src/android.workflows.ts diff --git a/packages/data-models/workflows/deployment.workflows.ts b/packages/workflows/src/deployment.workflows.ts similarity index 100% rename from packages/data-models/workflows/deployment.workflows.ts rename to packages/workflows/src/deployment.workflows.ts diff --git a/packages/data-models/workflows/index.ts b/packages/workflows/src/index.ts similarity index 100% rename from packages/data-models/workflows/index.ts rename to packages/workflows/src/index.ts diff --git a/packages/data-models/workflows/misc.workflows.ts b/packages/workflows/src/misc.workflows.ts similarity index 100% rename from packages/data-models/workflows/misc.workflows.ts rename to packages/workflows/src/misc.workflows.ts diff --git a/packages/data-models/workflows/repo.workflows.ts b/packages/workflows/src/repo.workflows.ts similarity index 100% rename from packages/data-models/workflows/repo.workflows.ts rename to packages/workflows/src/repo.workflows.ts diff --git a/packages/data-models/workflows/sync.workflows.ts b/packages/workflows/src/sync.workflows.ts similarity index 100% rename from packages/data-models/workflows/sync.workflows.ts rename to packages/workflows/src/sync.workflows.ts diff --git a/packages/data-models/workflows/workflow.model.ts b/packages/workflows/src/workflow.model.ts similarity index 100% rename from packages/data-models/workflows/workflow.model.ts rename to packages/workflows/src/workflow.model.ts diff --git a/yarn.lock b/yarn.lock index 21aa080a66..12ed115dec 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24460,6 +24460,7 @@ __metadata: tsimportlib: ^0.0.5 typescript: ^4.1.2 winston: ^3.8.1 + workflows: "workspace:*" xlsx: ^0.18.5 bin: idapp: ./build/commands.js @@ -28470,6 +28471,18 @@ __metadata: languageName: node linkType: hard +"workflows@workspace:*, workflows@workspace:packages/workflows": + version: 0.0.0-use.local + resolution: "workflows@workspace:packages/workflows" + dependencies: + "@types/node": ^16.18.9 + clone: ^2.1.2 + scripts: "workspace:*" + shared: "workspace:*" + typescript: ~4.2.4 + languageName: unknown + linkType: soft + "wrap-ansi@npm:^6.2.0": version: 6.2.0 resolution: "wrap-ansi@npm:6.2.0" From a59e835f727273d56383a2d6b0b5a8a52361840f Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:02:41 -0700 Subject: [PATCH 02/17] refactor: shared utils --- package.json | 1 - .../gdrive-tools/src/commands/download.ts | 2 +- .../gdrive-tools/src/commands/watch.ts | 2 +- packages/data-models/index.ts | 3 +- packages/data-models/package.json | 1 - packages/scripts/package.json | 2 ++ .../convert/cacheStrategy/jsonFile.spec.ts | 2 +- .../commands/app-data/convert/convert.spec.ts | 12 +++---- .../app-data/convert/processors/base.spec.ts | 2 +- .../processors/flowParser/flowParser.spec.ts | 2 +- .../convert/processors/xlsxWorkbook.spec.ts | 2 +- .../commands/app-data/convert/utils/index.ts | 2 +- .../scripts/src/commands/app-data/download.ts | 4 +-- .../app-data/postProcess/assets.spec.ts | 2 +- .../commands/app-data/postProcess/assets.ts | 2 +- .../app-data/postProcess/sheets.spec.ts | 2 +- .../commands/app-data/postProcess/sheets.ts | 2 +- .../scripts/src/commands/app-data/watch.ts | 2 +- .../scripts/src/commands/compile/types.ts | 2 +- .../scripts/src/commands/config/decrypt.ts | 4 +-- .../scripts/src/commands/config/encrypt.ts | 4 +-- .../scripts/src/commands/deployment/common.ts | 2 +- .../src/commands/deployment/compile.ts | 4 +-- .../scripts/src/commands/deployment/create.ts | 4 +-- .../scripts/src/commands/deployment/get.ts | 4 +-- .../scripts/src/commands/deployment/import.ts | 4 +-- .../scripts/src/commands/deployment/set.ts | 4 +-- .../scripts/src/commands/e2e-data/parse.ts | 2 +- packages/scripts/src/commands/version.ts | 2 +- packages/scripts/src/commands/workflow/run.ts | 2 +- .../scripts/src/tasks/providers/android.ts | 3 +- .../scripts/src/tasks/providers/appData.ts | 4 +-- .../scripts/src/tasks/providers/encryption.ts | 4 +-- .../scripts/src/tasks/providers/gdrive.ts | 2 +- packages/scripts/src/tasks/providers/repo.ts | 2 +- .../scripts/src/tasks/providers/subtitles.ts | 4 +-- packages/scripts/src/utils/index.ts | 5 --- packages/scripts/tsconfig.json | 2 +- packages/shared/README.md | 6 ++++ packages/shared/src/index.ts | 8 ++++- packages/{scripts => shared}/src/paths.ts | 0 .../src/utils/cli-utils.ts | 0 .../src/utils/file-utils.spec.ts | 0 .../src/utils/file-utils.ts | 11 ------- packages/shared/src/utils/index.ts | 5 +++ .../src/utils/logging.utils.ts | 0 packages/shared/src/utils/misc-utils.ts | 11 +++++++ .../src/utils/string-utils.ts | 0 .../src/utils/typescript-utils.ts | 0 packages/workflows/README.md | 7 ++++ packages/workflows/package.json | 1 - packages/workflows/tsconfig.json | 14 ++++++++ yarn.lock | 32 +++++++++++++++++-- 53 files changed, 131 insertions(+), 75 deletions(-) delete mode 100644 packages/scripts/src/utils/index.ts create mode 100644 packages/shared/README.md rename packages/{scripts => shared}/src/paths.ts (100%) rename packages/{scripts => shared}/src/utils/cli-utils.ts (100%) rename packages/{scripts => shared}/src/utils/file-utils.spec.ts (100%) rename packages/{scripts => shared}/src/utils/file-utils.ts (97%) rename packages/{scripts => shared}/src/utils/logging.utils.ts (100%) create mode 100644 packages/shared/src/utils/misc-utils.ts rename packages/{scripts => shared}/src/utils/string-utils.ts (100%) rename packages/{scripts => shared}/src/utils/typescript-utils.ts (100%) create mode 100644 packages/workflows/README.md create mode 100644 packages/workflows/tsconfig.json diff --git a/package.json b/package.json index 60faf45799..2d3a2138c3 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,6 @@ "qrcode": "^1.5.1", "rxdb": "^13.15.3", "rxjs": "^7.8.0", - "scripts": "workspace:*", "shared": "workspace:*", "signature_pad": "^4.1.5", "stacktrace-js": "^2.0.2", diff --git a/packages/@idemsInternational/gdrive-tools/src/commands/download.ts b/packages/@idemsInternational/gdrive-tools/src/commands/download.ts index 5ff97c36cc..23cce9c184 100644 --- a/packages/@idemsInternational/gdrive-tools/src/commands/download.ts +++ b/packages/@idemsInternational/gdrive-tools/src/commands/download.ts @@ -7,7 +7,6 @@ import PQueue from "p-queue"; import { drive_v3 } from "googleapis"; import { GaxiosResponse, GaxiosOptions } from "gaxios"; import { Command } from "commander"; -import { PATHS } from "../paths"; import { GDRIVE_OFFICE_MAPPING, MIMETYPE_EXTENSIONS, @@ -19,6 +18,7 @@ import { cleanupEmptyFolders, } from "../utils"; import { authorizeGDrive } from "./authorize"; +import { PATHS } from "../paths"; const GOOGLE_FOLDER_MIMETYPE = "application/vnd.google-apps.folder"; diff --git a/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts b/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts index 0c8aac8ed9..cd05694dbb 100644 --- a/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts +++ b/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts @@ -3,10 +3,10 @@ import { Command } from "commander"; import type { drive_v3 } from "googleapis"; import { logProgramHelp } from "../utils"; import { authorizeGDrive, authorizeGDriveActivity } from "./authorize"; -import { PATHS } from "../paths"; import { randomUUID } from "crypto"; import { GDriveDownloader } from "./download"; import chalk from "chalk"; +import { PATHS } from "../paths"; /*************************************************************************************** * WiP Methods to enable streaming of live changes from google drive diff --git a/packages/data-models/index.ts b/packages/data-models/index.ts index 09769c9c38..e26fb3ddc7 100644 --- a/packages/data-models/index.ts +++ b/packages/data-models/index.ts @@ -1,7 +1,6 @@ export * from "./flowTypes"; export * from "./functions"; -// NOTE - avoid exporting workflows as node-based can't be consumed by frontend src -// export { IDeploymentWorkflows, IWorkflow, IWorkflowContext, WORKFLOW_DEFAULTS } from "./workflows"; + export { IDeploymentConfig, IDeploymentConfigJson, diff --git a/packages/data-models/package.json b/packages/data-models/package.json index 348fdcbe51..0c94a27d6a 100644 --- a/packages/data-models/package.json +++ b/packages/data-models/package.json @@ -10,7 +10,6 @@ "devDependencies": { "@types/clone": "^2.1.1", "@types/node": "^16.18.9", - "scripts": "workspace:*", "shared": "workspace:*", "typescript": "~4.2.4" }, diff --git a/packages/scripts/package.json b/packages/scripts/package.json index cbac212436..c21421e90f 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -42,6 +42,7 @@ "ts-morph": "^15.0.0", "typescript": "^4.1.2", "winston": "^3.8.1", + "workflows": "workspace:*", "xlsx": "^0.18.5" }, "devDependencies": { @@ -51,6 +52,7 @@ "@types/jasmine": "^3.10.6", "@types/node-rsa": "^1.1.1", "@types/semver": "^7.3.9", + "@types/winston": "^2.4.4", "esbuild": "^0.14.2", "jasmine": "^3.99.0", "jasmine-spec-reporter": "^7.0.0", diff --git a/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts b/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts index c45bb69888..4a877b08d7 100644 --- a/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts @@ -2,7 +2,7 @@ import { emptyDirSync, existsSync, readdirSync, readJsonSync, rmdirSync, statSyn import path from "path"; import { JsonFileCache } from "./jsonFile"; -import { SCRIPTS_WORKSPACE_PATH } from "../../../../paths"; +import { SCRIPTS_WORKSPACE_PATH } from "shared"; const testCacheDir = path.resolve(SCRIPTS_WORKSPACE_PATH, "test", "data", "cache", "spec"); const testData = { diff --git a/packages/scripts/src/commands/app-data/convert/convert.spec.ts b/packages/scripts/src/commands/app-data/convert/convert.spec.ts index 2cf1a47285..8bd67fb373 100644 --- a/packages/scripts/src/commands/app-data/convert/convert.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/convert.spec.ts @@ -2,7 +2,7 @@ import { AppDataConverter } from "./index"; import path from "path"; -import { SCRIPTS_TEST_DATA_DIR } from "../../../paths"; +import { SCRIPTS_TEST_DATA_DIR } from "shared"; import { emptyDirSync, existsSync, readdirSync } from "fs-extra"; import { clearLogs, getLogs } from "./utils"; @@ -59,7 +59,7 @@ describe("App Data Converter", () => { }); it("Throws on duplicate flows", async () => { await converter.run().catch((err) => { - expect(err.message.includes("Duplicate flows found")); + expect(err.message.includes("Duplicate flows found")).toEqual(true); }); }); }); @@ -70,20 +70,20 @@ describe("App Data Converter - Error Checking", () => { outputFolder: path.resolve(SCRIPTS_TEST_DATA_DIR, "output", "errorChecking"), cacheFolder: path.resolve(SCRIPTS_TEST_DATA_DIR, "cache"), }; - const errorConverter = new AppDataConverter(errorPaths); + let errorConverter = new AppDataConverter(errorPaths); beforeAll(() => { if (existsSync(paths.outputFolder)) { emptyDirSync(paths.outputFolder); } }); it("Tracks number of conversion errors", async () => { - const errorConverter = new AppDataConverter(errorPaths); + errorConverter = new AppDataConverter(errorPaths); const { errors } = await errorConverter.run(); expect(errors.length).toBeGreaterThan(0); }); - it("Throws on duplicate flows", async () => { + it("Throws on duplicate flows (2)", async () => { await errorConverter.run().catch((err) => { - expect(err.message.includes("Duplicate flows found")); + expect(err.message.includes("Duplicate flows found")).toBe(true); }); }); }); diff --git a/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts index 20485e66d9..9010af63dd 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts @@ -1,7 +1,7 @@ import path from "path"; import BaseProcessor from "./base"; -import { SCRIPTS_WORKSPACE_PATH } from "../../../../paths"; +import { SCRIPTS_WORKSPACE_PATH } from "shared"; import { clearLogs, getLogs } from "../utils"; const testDataDir = path.resolve(SCRIPTS_WORKSPACE_PATH, "test", "data"); const paths = { diff --git a/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts index 878cae5db3..c3917e4a7f 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts @@ -1,6 +1,6 @@ import path from "path"; import { FlowTypes } from "data-models"; -import { SCRIPTS_WORKSPACE_PATH } from "../../../../../paths"; +import { SCRIPTS_WORKSPACE_PATH } from "shared"; import { clearLogs, getLogs } from "../../utils"; import { FlowParserProcessor } from "./flowParser"; diff --git a/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts index 4d3d17a501..d9f1be2f3e 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts @@ -1,7 +1,7 @@ import path from "path"; import { XLSXWorkbookProcessor } from "./xlsxWorkbook"; -import { SCRIPTS_TEST_DATA_DIR } from "../../../../paths"; +import { SCRIPTS_TEST_DATA_DIR } from "shared"; import { clearLogs, getLogs, IContentsEntry } from "../utils"; const paths = { SHEETS_CACHE_FOLDER: path.resolve(SCRIPTS_TEST_DATA_DIR, "cache"), diff --git a/packages/scripts/src/commands/app-data/convert/utils/index.ts b/packages/scripts/src/commands/app-data/convert/utils/index.ts index ff7fd8a853..5793c7ed36 100644 --- a/packages/scripts/src/commands/app-data/convert/utils/index.ts +++ b/packages/scripts/src/commands/app-data/convert/utils/index.ts @@ -3,4 +3,4 @@ export * from "./app-data-condition.utils"; export * from "./app-data-action.utils"; export * from "./logging"; // Re-export common shared utils for easier import -export * from "../../../../utils"; +export * from "shared"; diff --git a/packages/scripts/src/commands/app-data/download.ts b/packages/scripts/src/commands/app-data/download.ts index db8945e43e..1288e519bb 100644 --- a/packages/scripts/src/commands/app-data/download.ts +++ b/packages/scripts/src/commands/app-data/download.ts @@ -4,8 +4,8 @@ import { spawnSync } from "child_process"; import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { CREDENTIALS_PATH, AUTH_TOKEN_PATH } from "../../paths"; -import { logWarning, promptOptions } from "../../utils"; +import { CREDENTIALS_PATH, AUTH_TOKEN_PATH } from "shared"; +import { logWarning, promptOptions } from "shared"; import { ActiveDeployment } from "../deployment/get"; /*************************************************************************************** diff --git a/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts b/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts index 874c30dc69..ea71e6c33f 100644 --- a/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts +++ b/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts @@ -9,7 +9,7 @@ import mockFs from "mock-fs"; // Use default imports to allow spying on functions and replacing with mock methods import { ActiveDeployment } from "../../deployment/get"; -import { Logger } from "../../../utils/logging.utils"; +import { Logger } from "shared"; import path from "path"; import { IAssetEntryHashmap } from "data-models/deployment.model"; diff --git a/packages/scripts/src/commands/app-data/postProcess/assets.ts b/packages/scripts/src/commands/app-data/postProcess/assets.ts index 26380b18df..dd03ed7c4f 100644 --- a/packages/scripts/src/commands/app-data/postProcess/assets.ts +++ b/packages/scripts/src/commands/app-data/postProcess/assets.ts @@ -15,7 +15,7 @@ import { replicateDir, sortJsonKeys, getNestedProperty, -} from "../../../utils"; +} from "shared"; import { ActiveDeployment } from "../../deployment/get"; import type { IAssetEntryHashmap, IContentsEntryMinimal } from "data-models/deployment.model"; diff --git a/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts b/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts index 62bf6a2def..30f2655ac9 100644 --- a/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts +++ b/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts @@ -6,7 +6,7 @@ import mockFs from "mock-fs"; // Use default imports to allow spying on functions and replacing with mock methods import { ActiveDeployment } from "../../deployment/get"; -import { Logger } from "../../../utils/logging.utils"; +import { Logger } from "shared"; import path from "path"; /** Mock file system folders for use in tests */ diff --git a/packages/scripts/src/commands/app-data/postProcess/sheets.ts b/packages/scripts/src/commands/app-data/postProcess/sheets.ts index 59c6f2bd43..f25b087e75 100644 --- a/packages/scripts/src/commands/app-data/postProcess/sheets.ts +++ b/packages/scripts/src/commands/app-data/postProcess/sheets.ts @@ -2,7 +2,7 @@ import * as path from "path"; import * as fs from "fs-extra"; import chalk from "chalk"; import { Command } from "commander"; -import { Logger, recursiveFindByExtension } from "../../../utils"; +import { Logger, recursiveFindByExtension } from "shared"; import { ActiveDeployment } from "../../deployment/get"; import { FlowTypes } from "data-models"; diff --git a/packages/scripts/src/commands/app-data/watch.ts b/packages/scripts/src/commands/app-data/watch.ts index b67c05b294..952bd66371 100644 --- a/packages/scripts/src/commands/app-data/watch.ts +++ b/packages/scripts/src/commands/app-data/watch.ts @@ -3,7 +3,7 @@ // import path from "path"; // import { watch } from "chokidar"; // import fs from "fs-extra"; -// import { ROOT_DIR } from "../../paths"; +// import { ROOT_DIR } from "shared"; // import chalk from "chalk"; // const program = new Command("watch"); diff --git a/packages/scripts/src/commands/compile/types.ts b/packages/scripts/src/commands/compile/types.ts index 028adce335..45d10e9d17 100644 --- a/packages/scripts/src/commands/compile/types.ts +++ b/packages/scripts/src/commands/compile/types.ts @@ -4,7 +4,7 @@ import { spawnSync } from "child_process"; import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { DATA_MODELS_WORKSPACE_PATH } from "../../paths"; +import { DATA_MODELS_WORKSPACE_PATH } from "shared"; /*************************************************************************************** * CLI diff --git a/packages/scripts/src/commands/config/decrypt.ts b/packages/scripts/src/commands/config/decrypt.ts index 606b6b01ec..6e00163c74 100644 --- a/packages/scripts/src/commands/config/decrypt.ts +++ b/packages/scripts/src/commands/config/decrypt.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import fs from "fs-extra"; -import { Logger, logOutput } from "../../utils"; -import { CONFIG_FOLDER_PATH, PRIVATE_KEY_PATH } from "../../paths"; +import { Logger, logOutput } from "shared"; +import { CONFIG_FOLDER_PATH, PRIVATE_KEY_PATH } from "shared"; import { Command } from "commander"; import NodeRSA from "node-rsa"; diff --git a/packages/scripts/src/commands/config/encrypt.ts b/packages/scripts/src/commands/config/encrypt.ts index 68bedb10d7..4bec40634f 100644 --- a/packages/scripts/src/commands/config/encrypt.ts +++ b/packages/scripts/src/commands/config/encrypt.ts @@ -3,8 +3,8 @@ import fs from "fs-extra"; import path from "path"; import chalk from "chalk"; import NodeRSA from "node-rsa"; -import { promptOptions } from "../../utils"; -import { PUBLIC_KEY_PATH } from "../../paths"; +import { promptOptions } from "shared"; +import { PUBLIC_KEY_PATH } from "shared"; import { Command } from "commander"; const program = new Command("download"); diff --git a/packages/scripts/src/commands/deployment/common.ts b/packages/scripts/src/commands/deployment/common.ts index d935e0160c..84e350cba8 100644 --- a/packages/scripts/src/commands/deployment/common.ts +++ b/packages/scripts/src/commands/deployment/common.ts @@ -2,7 +2,7 @@ import { DEPLOYMENT_CONFIG_EXAMPLE_DEFAULTS, getDefaultAppConfig } from "data-mo import type { IDeploymentConfig, IDeploymentConfigJson } from "data-models"; import path from "path"; -import { DEPLOYMENTS_PATH } from "../../paths"; +import { DEPLOYMENTS_PATH } from "shared"; import { loadDeploymentJson } from "./utils"; // re-export of type for convenience diff --git a/packages/scripts/src/commands/deployment/compile.ts b/packages/scripts/src/commands/deployment/compile.ts index 8605778e94..0621400375 100644 --- a/packages/scripts/src/commands/deployment/compile.ts +++ b/packages/scripts/src/commands/deployment/compile.ts @@ -4,8 +4,8 @@ import { Command } from "commander"; import { IDeploymentConfig, DEPLOYMENT_CONFIG_VERSION } from "data-models"; import fs from "fs-extra"; import path from "path"; -import { ROOT_DIR } from "../../paths"; -import { Logger } from "../../utils"; +import { ROOT_DIR } from "shared"; +import { Logger } from "shared"; import { IDeploymentConfigJson } from "./common"; import { convertFunctionsToStrings } from "./utils"; diff --git a/packages/scripts/src/commands/deployment/create.ts b/packages/scripts/src/commands/deployment/create.ts index 76ced15792..0c09db51f1 100644 --- a/packages/scripts/src/commands/deployment/create.ts +++ b/packages/scripts/src/commands/deployment/create.ts @@ -2,8 +2,8 @@ import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { DEPLOYMENTS_PATH } from "../../paths"; -import { Logger, logOutput, logWarning, promptInput, promptOptions } from "../../utils"; +import { DEPLOYMENTS_PATH } from "shared"; +import { Logger, logOutput, logWarning, promptInput, promptOptions } from "shared"; import type { IDeploymentConfigJson } from "./common"; import { DeploymentSet } from "./set"; import generateDefaultConfig from "./templates/config.default"; diff --git a/packages/scripts/src/commands/deployment/get.ts b/packages/scripts/src/commands/deployment/get.ts index e3665e46f9..98af0ce373 100644 --- a/packages/scripts/src/commands/deployment/get.ts +++ b/packages/scripts/src/commands/deployment/get.ts @@ -3,8 +3,8 @@ import { Command } from "commander"; import { IDeploymentConfig } from "data-models"; import fs from "fs-extra"; import path from "path"; -import { DEPLOYMENTS_PATH } from "../../paths"; -import { Logger } from "../../utils"; +import { DEPLOYMENTS_PATH } from "shared"; +import { Logger } from "shared"; import type { IDeploymentConfigJson } from "./common"; import { loadTSFileDefaultExport } from "./compile"; import { loadDeploymentJson } from "./utils"; diff --git a/packages/scripts/src/commands/deployment/import.ts b/packages/scripts/src/commands/deployment/import.ts index 5b8003a432..5bdc523bae 100644 --- a/packages/scripts/src/commands/deployment/import.ts +++ b/packages/scripts/src/commands/deployment/import.ts @@ -4,8 +4,8 @@ import { Command } from "commander"; import fs, { moveSync, rmSync } from "fs-extra"; import { resolve } from "path"; import GitProvider from "../../tasks/providers/git"; -import { DEPLOYMENTS_PATH } from "../../paths"; -import { Logger, logOutput, logWarning, promptConfirmation, promptInput } from "../../utils"; +import { DEPLOYMENTS_PATH } from "shared"; +import { Logger, logOutput, logWarning, promptConfirmation, promptInput } from "shared"; import { loadDeploymentJson } from "./utils"; import { existsSync } from "fs"; diff --git a/packages/scripts/src/commands/deployment/set.ts b/packages/scripts/src/commands/deployment/set.ts index cad54b9f5e..46fac797fc 100644 --- a/packages/scripts/src/commands/deployment/set.ts +++ b/packages/scripts/src/commands/deployment/set.ts @@ -2,8 +2,8 @@ import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { DEPLOYMENTS_PATH, ROOT_DIR } from "../../paths"; -import { promptOptions, logOutput, logWarning } from "../../utils"; +import { DEPLOYMENTS_PATH, ROOT_DIR } from "shared"; +import { promptOptions, logOutput, logWarning } from "shared"; import { ActiveDeployment } from "./get"; import { loadDeploymentJson } from "./utils"; diff --git a/packages/scripts/src/commands/e2e-data/parse.ts b/packages/scripts/src/commands/e2e-data/parse.ts index ed3f15d773..7f960cdf0b 100644 --- a/packages/scripts/src/commands/e2e-data/parse.ts +++ b/packages/scripts/src/commands/e2e-data/parse.ts @@ -5,7 +5,7 @@ import XLSX from "xlsx"; import prettier from "prettier"; import * as mappings from "./mappings"; import snippets from "./snippets"; -import { ROOT_DIR } from "../../paths"; +import { ROOT_DIR } from "shared"; interface IProgramOptions { input: string; diff --git a/packages/scripts/src/commands/version.ts b/packages/scripts/src/commands/version.ts index 9b374fc732..74953b0b89 100644 --- a/packages/scripts/src/commands/version.ts +++ b/packages/scripts/src/commands/version.ts @@ -1,7 +1,7 @@ import * as fs from "fs-extra"; import { Command } from "commander"; import inquirer from "inquirer"; -import { APP_BUILD_GRADLE_PATH, MAIN_PACKAGE_PATH } from "../paths"; +import { APP_BUILD_GRADLE_PATH, MAIN_PACKAGE_PATH } from "shared"; /*************************************************************************************** * CLI diff --git a/packages/scripts/src/commands/workflow/run.ts b/packages/scripts/src/commands/workflow/run.ts index b2d161e855..85233f480d 100644 --- a/packages/scripts/src/commands/workflow/run.ts +++ b/packages/scripts/src/commands/workflow/run.ts @@ -4,7 +4,7 @@ import boxen from "boxen"; import chalk from "chalk"; import path from "path"; import { Command } from "commander"; -import { IDeploymentWorkflows, IWorkflow, WORKFLOW_DEFAULTS } from "data-models/workflows"; +import { IDeploymentWorkflows, IWorkflow, WORKFLOW_DEFAULTS } from "workflows"; import ALL_TASKS from "../../tasks"; import { Logger, logProgramHelp, pad, promptOptions } from "../../utils"; import { ActiveDeployment } from "../deployment/get"; diff --git a/packages/scripts/src/tasks/providers/android.ts b/packages/scripts/src/tasks/providers/android.ts index 5224dd78b3..f8be32ff75 100644 --- a/packages/scripts/src/tasks/providers/android.ts +++ b/packages/scripts/src/tasks/providers/android.ts @@ -1,8 +1,7 @@ import * as path from "path"; import { Options, run } from "cordova-res"; import fs from "fs"; -import { ROOT_DIR } from "../../paths"; -import { Logger } from "../../utils"; +import { ROOT_DIR, Logger } from "shared"; const set_splash_image = async (splashAssetPath: string) => { if (!fs.existsSync(splashAssetPath)) { diff --git a/packages/scripts/src/tasks/providers/appData.ts b/packages/scripts/src/tasks/providers/appData.ts index 2bc17704b5..091ec2a47a 100644 --- a/packages/scripts/src/tasks/providers/appData.ts +++ b/packages/scripts/src/tasks/providers/appData.ts @@ -2,8 +2,8 @@ import { writeFileSync } from "fs-extra"; import path from "path"; import { parseCommand } from "../../commands"; import { WorkflowRunner } from "../../commands/workflow/run"; -import { SRC_ASSETS_PATH } from "../../paths"; -import { IContentsEntry, replicateDir } from "../../utils"; +import { SRC_ASSETS_PATH } from "shared"; +import { IContentsEntry, replicateDir } from "shared"; /** Prepare sourcely cached assets for population to app */ const postProcessAssets = (options: { sourceAssetsFolder: string }) => { diff --git a/packages/scripts/src/tasks/providers/encryption.ts b/packages/scripts/src/tasks/providers/encryption.ts index 1c6c3f8aaa..58563a1068 100644 --- a/packages/scripts/src/tasks/providers/encryption.ts +++ b/packages/scripts/src/tasks/providers/encryption.ts @@ -11,8 +11,8 @@ import { import NodeRSA from "node-rsa"; import { basename, resolve } from "path"; import { ActiveDeployment } from "../../commands/deployment/get"; -import { DEPLOYMENTS_PATH } from "../../paths"; -import { logOutput, promptConfirmation, promptEditorInput } from "../../utils"; +import { DEPLOYMENTS_PATH } from "shared"; +import { logOutput, promptConfirmation, promptEditorInput } from "shared"; /** Suffix added to all encrypted files to distinguish from originals */ const ENCRYPTED_SUFFIX = "crypt"; diff --git a/packages/scripts/src/tasks/providers/gdrive.ts b/packages/scripts/src/tasks/providers/gdrive.ts index 64a71697dd..c3cd068247 100644 --- a/packages/scripts/src/tasks/providers/gdrive.ts +++ b/packages/scripts/src/tasks/providers/gdrive.ts @@ -5,7 +5,7 @@ import { existsSync, removeSync } from "fs-extra"; import path from "path"; import { WorkflowRunner } from "../../commands/workflow/run"; -import { AUTH_TOKEN_PATH, CREDENTIALS_PATH } from "../../paths"; +import { AUTH_TOKEN_PATH, CREDENTIALS_PATH } from "shared"; const authorize = () => { // remove any pre-existing auth token diff --git a/packages/scripts/src/tasks/providers/repo.ts b/packages/scripts/src/tasks/providers/repo.ts index ea25e4a07b..ebfc4ef165 100644 --- a/packages/scripts/src/tasks/providers/repo.ts +++ b/packages/scripts/src/tasks/providers/repo.ts @@ -1,5 +1,5 @@ import { spawnSync } from "child_process"; -import { ROOT_DIR } from "../../paths"; +import { ROOT_DIR } from "shared"; const runTSCodeFormatter = (folderPath: string) => { const cmd = `npx prettier --config ${ROOT_DIR}/.prettierrc --write ${folderPath}/**/*.ts --loglevel error`; diff --git a/packages/scripts/src/tasks/providers/subtitles.ts b/packages/scripts/src/tasks/providers/subtitles.ts index 1c0aae9467..a8bfab1c5a 100644 --- a/packages/scripts/src/tasks/providers/subtitles.ts +++ b/packages/scripts/src/tasks/providers/subtitles.ts @@ -2,8 +2,8 @@ import chalk from "chalk"; import fs from "fs"; import * as path from "path"; import parser from "subtitles-parser-vtt"; -import { ROOT_DIR } from "../../paths"; -import { recursiveFindByExtension, Logger, logOutput, promptOptions } from "../../utils"; +import { ROOT_DIR } from "shared"; +import { recursiveFindByExtension, Logger, logOutput, promptOptions } from "shared"; // This is an interim solution for manually generating translated .vtt files, // to be used pending reworking the translations repo/pipeline to handle assets more generally diff --git a/packages/scripts/src/utils/index.ts b/packages/scripts/src/utils/index.ts deleted file mode 100644 index 1842e691d0..0000000000 --- a/packages/scripts/src/utils/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from "./cli-utils"; -export * from "./file-utils"; -export * from "./logging.utils"; -export * from "./string-utils"; -export * from "./typescript-utils"; diff --git a/packages/scripts/tsconfig.json b/packages/scripts/tsconfig.json index 3a15edbaf3..16dfe96f1a 100644 --- a/packages/scripts/tsconfig.json +++ b/packages/scripts/tsconfig.json @@ -8,7 +8,7 @@ // Global type definitions. "typeRoots": ["./node_modules/@types"] }, - "include": ["src/**/*.ts"], + "include": ["src/**/*.ts", "../shared/src/utils/file-utils.ts"], "ts-node": { "swc": true } diff --git a/packages/shared/README.md b/packages/shared/README.md new file mode 100644 index 0000000000..e59c9120fb --- /dev/null +++ b/packages/shared/README.md @@ -0,0 +1,6 @@ +## Shared + +Common platform data structures and manipulation methods. + +Note, some methods will only work in node-based environments (non-browser) + diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 0305fa80aa..710df44b60 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -1,2 +1,8 @@ -export * from "./utils"; export * from "./models"; +export * from "./types"; +export * from "./utils"; +export * from "./paths"; + +// Re-export all paths within a single namespace +import * as PATHS from "./paths"; +export { PATHS }; diff --git a/packages/scripts/src/paths.ts b/packages/shared/src/paths.ts similarity index 100% rename from packages/scripts/src/paths.ts rename to packages/shared/src/paths.ts diff --git a/packages/scripts/src/utils/cli-utils.ts b/packages/shared/src/utils/cli-utils.ts similarity index 100% rename from packages/scripts/src/utils/cli-utils.ts rename to packages/shared/src/utils/cli-utils.ts diff --git a/packages/scripts/src/utils/file-utils.spec.ts b/packages/shared/src/utils/file-utils.spec.ts similarity index 100% rename from packages/scripts/src/utils/file-utils.spec.ts rename to packages/shared/src/utils/file-utils.spec.ts diff --git a/packages/scripts/src/utils/file-utils.ts b/packages/shared/src/utils/file-utils.ts similarity index 97% rename from packages/scripts/src/utils/file-utils.ts rename to packages/shared/src/utils/file-utils.ts index 65dbb14647..c670026812 100644 --- a/packages/scripts/src/utils/file-utils.ts +++ b/packages/shared/src/utils/file-utils.ts @@ -3,8 +3,6 @@ import * as path from "path"; import * as os from "os"; import { createHash, randomUUID } from "crypto"; import { logWarning } from "./logging.utils"; -import { ROOT_DIR } from "../paths"; -import { spawnSync } from "child_process"; import { tmpdir } from "os"; /** @@ -524,15 +522,6 @@ export function createTempDir() { return dirPath; } -/** - * Run prettier to automatically format code in given folder path - * NOTE - by default will only format .ts files - */ -export function runPrettierCodeTidy(folderPath: string) { - const cmd = `npx prettier --config ${ROOT_DIR}/.prettierrc --write ${folderPath}/**/*.ts --loglevel error`; - return spawnSync(cmd, { stdio: ["inherit", "inherit", "inherit"], shell: true }); -} - /** Create a randomly-named temporary folder within the os temp directory */ export function createTemporaryFolder() { const folderName = randomUUID(); diff --git a/packages/shared/src/utils/index.ts b/packages/shared/src/utils/index.ts index c13064083d..93d76b4e00 100644 --- a/packages/shared/src/utils/index.ts +++ b/packages/shared/src/utils/index.ts @@ -1 +1,6 @@ +export * from "./cli-utils"; export * from "./delimiters"; +export * from "./file-utils"; +export * from "./logging.utils"; +export * from "./string-utils"; +export * from "./typescript-utils"; diff --git a/packages/scripts/src/utils/logging.utils.ts b/packages/shared/src/utils/logging.utils.ts similarity index 100% rename from packages/scripts/src/utils/logging.utils.ts rename to packages/shared/src/utils/logging.utils.ts diff --git a/packages/shared/src/utils/misc-utils.ts b/packages/shared/src/utils/misc-utils.ts new file mode 100644 index 0000000000..1158f832aa --- /dev/null +++ b/packages/shared/src/utils/misc-utils.ts @@ -0,0 +1,11 @@ +import { spawnSync } from "child_process"; +import { ROOT_DIR } from "../paths"; + +/** + * Run prettier to automatically format code in given folder path + * NOTE - by default will only format .ts files + */ +export function runPrettierCodeTidy(folderPath: string) { + const cmd = `npx prettier --config ${ROOT_DIR}/.prettierrc --write ${folderPath}/**/*.ts --loglevel error`; + return spawnSync(cmd, { stdio: ["inherit", "inherit", "inherit"], shell: true }); +} diff --git a/packages/scripts/src/utils/string-utils.ts b/packages/shared/src/utils/string-utils.ts similarity index 100% rename from packages/scripts/src/utils/string-utils.ts rename to packages/shared/src/utils/string-utils.ts diff --git a/packages/scripts/src/utils/typescript-utils.ts b/packages/shared/src/utils/typescript-utils.ts similarity index 100% rename from packages/scripts/src/utils/typescript-utils.ts rename to packages/shared/src/utils/typescript-utils.ts diff --git a/packages/workflows/README.md b/packages/workflows/README.md new file mode 100644 index 0000000000..22ce48ab8c --- /dev/null +++ b/packages/workflows/README.md @@ -0,0 +1,7 @@ +## Workflows + +Common workflows made available to scripts + +```sh +yarn workflow [name_of_workflow] +``` \ No newline at end of file diff --git a/packages/workflows/package.json b/packages/workflows/package.json index 81ac86fc18..625abb5978 100644 --- a/packages/workflows/package.json +++ b/packages/workflows/package.json @@ -7,7 +7,6 @@ "build": "tsc -b", "serve": "tsc -w" }, - "dependencies": {}, "devDependencies": { "@types/node": "^16.18.9", "shared": "workspace:*", diff --git a/packages/workflows/tsconfig.json b/packages/workflows/tsconfig.json new file mode 100644 index 0000000000..e9f6868de3 --- /dev/null +++ b/packages/workflows/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + /* Basic Options */ + "outDir": "dist", + "typeRoots": ["node_modules/@types"], + "declaration": true, + "skipLibCheck": true, + "lib": ["es2016", "dom"], + "target": "es5", + "esModuleInterop": true + }, + "include": ["src/index.ts"], + "exclude": ["**/*.d.ts", "dist", "**/node_modules"] +} diff --git a/yarn.lock b/yarn.lock index 12ed115dec..d403c541e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7056,6 +7056,15 @@ __metadata: languageName: node linkType: hard +"@types/winston@npm:^2.4.4": + version: 2.4.4 + resolution: "@types/winston@npm:2.4.4" + dependencies: + winston: "*" + checksum: 69b2be354ee8f2685cd1ce4f0c22e5a8edbd5f3fb6cf400bf0b07299daf5cdbdfb3e4f602aa318e6b21a108164aa921958cd09324088604a7affb92e99282087 + languageName: node + linkType: hard + "@types/ws@npm:8.5.3": version: 8.5.3 resolution: "@types/ws@npm:8.5.3" @@ -11344,7 +11353,6 @@ __metadata: "@types/clone": ^2.1.1 "@types/node": ^16.18.9 clone: ^2.1.2 - scripts: "workspace:*" shared: "workspace:*" typescript: ~4.2.4 languageName: unknown @@ -24431,6 +24439,7 @@ __metadata: "@types/jasmine": ^3.10.6 "@types/node-rsa": ^1.1.1 "@types/semver": ^7.3.9 + "@types/winston": ^2.4.4 actions: "workspace:*" boxen: ^5.0.1 chalk: ^4.1.0 @@ -28398,6 +28407,25 @@ __metadata: languageName: node linkType: hard +"winston@npm:*": + version: 3.10.0 + resolution: "winston@npm:3.10.0" + dependencies: + "@colors/colors": 1.5.0 + "@dabh/diagnostics": ^2.0.2 + async: ^3.2.3 + is-stream: ^2.0.0 + logform: ^2.4.0 + one-time: ^1.0.0 + readable-stream: ^3.4.0 + safe-stable-stringify: ^2.3.1 + stack-trace: 0.0.x + triple-beam: ^1.3.0 + winston-transport: ^4.5.0 + checksum: 47df0361220d12b46d1b3c98a1c380a3718321739d527a182ce7984fc20715e5b0b55db0bcd3fd076d1b1d3261903b890b053851cfd4bc028bda7951fa8ca2e0 + languageName: node + linkType: hard + "winston@npm:^3.0.0, winston@npm:^3.3.3, winston@npm:^3.8.1": version: 3.8.2 resolution: "winston@npm:3.8.2" @@ -28476,8 +28504,6 @@ __metadata: resolution: "workflows@workspace:packages/workflows" dependencies: "@types/node": ^16.18.9 - clone: ^2.1.2 - scripts: "workspace:*" shared: "workspace:*" typescript: ~4.2.4 languageName: unknown From b8d0c668001990c8af1fa1dd2e26f72a2df17dcd Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:17:06 -0700 Subject: [PATCH 03/17] refactor: package imports --- packages/scripts/package.json | 6 +-- .../scripts/src/commands/deployment/create.ts | 1 - .../scripts/src/commands/deployment/index.ts | 2 +- .../scripts/src/commands/deployment/utils.ts | 2 +- packages/scripts/tsconfig.json | 2 +- packages/shared/README.md | 4 +- packages/shared/package.json | 13 +++++- yarn.lock | 46 +++++-------------- 8 files changed, 31 insertions(+), 45 deletions(-) diff --git a/packages/scripts/package.json b/packages/scripts/package.json index c21421e90f..59fa41382d 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -30,10 +30,8 @@ "commander": "^8.3.0", "data-models": "workspace:*", "fs-extra": "^9.0.1", - "glob": "^7.2.0", "inquirer": "^7.3.3", "node-rsa": "^1.1.1", - "open": "^9.1.0", "p-queue": "^6.6.2", "semver": "^7.5.2", "shared": "workspace:*", @@ -52,7 +50,6 @@ "@types/jasmine": "^3.10.6", "@types/node-rsa": "^1.1.1", "@types/semver": "^7.3.9", - "@types/winston": "^2.4.4", "esbuild": "^0.14.2", "jasmine": "^3.99.0", "jasmine-spec-reporter": "^7.0.0", @@ -61,7 +58,6 @@ "nodemon": "^2.0.19", "pkg": "^5.5.1", "ts-node": "^10.8.0", - "ts-node-dev": "^1.0.0", - "tsimportlib": "^0.0.5" + "ts-node-dev": "^1.0.0" } } diff --git a/packages/scripts/src/commands/deployment/create.ts b/packages/scripts/src/commands/deployment/create.ts index 0c09db51f1..07563b5751 100644 --- a/packages/scripts/src/commands/deployment/create.ts +++ b/packages/scripts/src/commands/deployment/create.ts @@ -5,7 +5,6 @@ import path from "path"; import { DEPLOYMENTS_PATH } from "shared"; import { Logger, logOutput, logWarning, promptInput, promptOptions } from "shared"; import type { IDeploymentConfigJson } from "./common"; -import { DeploymentSet } from "./set"; import generateDefaultConfig from "./templates/config.default"; import generateExtendedConfig from "./templates/config.extended"; import { loadDeploymentJson } from "./utils"; diff --git a/packages/scripts/src/commands/deployment/index.ts b/packages/scripts/src/commands/deployment/index.ts index 165fa52a2f..3aa7be4af4 100644 --- a/packages/scripts/src/commands/deployment/index.ts +++ b/packages/scripts/src/commands/deployment/index.ts @@ -6,7 +6,7 @@ import createCmd from "./create"; import getCmd from "./get"; import importCmd from "./import"; import setCmd from "./set"; -import { logProgramHelp } from "../../utils"; +import { logProgramHelp } from "shared"; const program = new Command("deployment").description("Manage active deployment workspace"); diff --git a/packages/scripts/src/commands/deployment/utils.ts b/packages/scripts/src/commands/deployment/utils.ts index 51517dc8f7..a49a7f85c4 100644 --- a/packages/scripts/src/commands/deployment/utils.ts +++ b/packages/scripts/src/commands/deployment/utils.ts @@ -4,7 +4,7 @@ import path from "path"; import { DEPLOYMENT_CONFIG_VERSION } from "data-models"; -import { Logger } from "../../utils"; +import { Logger } from "shared"; import { compileDeploymentTSSync } from "./compile"; import { IDeploymentConfigJson } from "./common"; diff --git a/packages/scripts/tsconfig.json b/packages/scripts/tsconfig.json index 16dfe96f1a..3a15edbaf3 100644 --- a/packages/scripts/tsconfig.json +++ b/packages/scripts/tsconfig.json @@ -8,7 +8,7 @@ // Global type definitions. "typeRoots": ["./node_modules/@types"] }, - "include": ["src/**/*.ts", "../shared/src/utils/file-utils.ts"], + "include": ["src/**/*.ts"], "ts-node": { "swc": true } diff --git a/packages/shared/README.md b/packages/shared/README.md index e59c9120fb..a0b9eaf3ce 100644 --- a/packages/shared/README.md +++ b/packages/shared/README.md @@ -1,6 +1,8 @@ ## Shared -Common platform data structures and manipulation methods. +Common platform data structures and manipulation methods. + +There are particularly a number of utility methods used by both scripts and workflow packages Note, some methods will only work in node-based environments (non-browser) diff --git a/packages/shared/package.json b/packages/shared/package.json index 25e840f2c2..f8d8c2c557 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -9,10 +9,21 @@ }, "license": "ISC", "dependencies": { + "boxen": "^5.0.1", + "chalk": "^4.1.0", "character-parser": "^4.0.0", - "danfojs": "^1.1.1" + "commander": "^8.3.0", + "danfojs": "^1.1.1", + "fs-extra": "^9.0.1", + "glob": "^7.2.0", + "inquirer": "^7.3.3", + "open": "^9.1.0", + "tsimportlib": "^0.0.5", + "winston": "^3.8.1" }, "devDependencies": { + "@types/fs-extra": "^9.0.4", + "@types/inquirer": "^7.3.1", "@types/jasmine": "^3.10.6", "@types/node": "^16.11.47", "jasmine": "^3.99.0", diff --git a/yarn.lock b/yarn.lock index d403c541e9..e7661be139 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7056,15 +7056,6 @@ __metadata: languageName: node linkType: hard -"@types/winston@npm:^2.4.4": - version: 2.4.4 - resolution: "@types/winston@npm:2.4.4" - dependencies: - winston: "*" - checksum: 69b2be354ee8f2685cd1ce4f0c22e5a8edbd5f3fb6cf400bf0b07299daf5cdbdfb3e4f602aa318e6b21a108164aa921958cd09324088604a7affb92e99282087 - languageName: node - linkType: hard - "@types/ws@npm:8.5.3": version: 8.5.3 resolution: "@types/ws@npm:8.5.3" @@ -15046,7 +15037,6 @@ __metadata: qrcode: ^1.5.1 rxdb: ^13.15.3 rxjs: ^7.8.0 - scripts: "workspace:*" shared: "workspace:*" signature_pad: ^4.1.5 stacktrace-js: ^2.0.2 @@ -24427,7 +24417,7 @@ __metadata: languageName: node linkType: hard -"scripts@workspace:*, scripts@workspace:packages/scripts": +"scripts@workspace:packages/scripts": version: 0.0.0-use.local resolution: "scripts@workspace:packages/scripts" dependencies: @@ -24439,7 +24429,6 @@ __metadata: "@types/jasmine": ^3.10.6 "@types/node-rsa": ^1.1.1 "@types/semver": ^7.3.9 - "@types/winston": ^2.4.4 actions: "workspace:*" boxen: ^5.0.1 chalk: ^4.1.0 @@ -24448,7 +24437,6 @@ __metadata: data-models: "workspace:*" esbuild: ^0.14.2 fs-extra: ^9.0.1 - glob: ^7.2.0 inquirer: ^7.3.3 jasmine: ^3.99.0 jasmine-spec-reporter: ^7.0.0 @@ -24456,7 +24444,6 @@ __metadata: mock-fs: ^5.2.0 node-rsa: ^1.1.1 nodemon: ^2.0.19 - open: ^9.1.0 p-queue: ^6.6.2 pkg: ^5.5.1 semver: ^7.5.2 @@ -24466,7 +24453,6 @@ __metadata: ts-morph: ^15.0.0 ts-node: ^10.8.0 ts-node-dev: ^1.0.0 - tsimportlib: ^0.0.5 typescript: ^4.1.2 winston: ^3.8.1 workflows: "workspace:*" @@ -24894,16 +24880,27 @@ __metadata: version: 0.0.0-use.local resolution: "shared@workspace:packages/shared" dependencies: + "@types/fs-extra": ^9.0.4 + "@types/inquirer": ^7.3.1 "@types/jasmine": ^3.10.6 "@types/node": ^16.11.47 + boxen: ^5.0.1 + chalk: ^4.1.0 character-parser: ^4.0.0 + commander: ^8.3.0 danfojs: ^1.1.1 + fs-extra: ^9.0.1 + glob: ^7.2.0 + inquirer: ^7.3.3 jasmine: ^3.99.0 jasmine-spec-reporter: ^7.0.0 jasmine-ts: ^0.4.0 nodemon: ^2.0.19 + open: ^9.1.0 ts-node: ^10.8.0 + tsimportlib: ^0.0.5 typescript: ^4.1.2 + winston: ^3.8.1 languageName: unknown linkType: soft @@ -28407,25 +28404,6 @@ __metadata: languageName: node linkType: hard -"winston@npm:*": - version: 3.10.0 - resolution: "winston@npm:3.10.0" - dependencies: - "@colors/colors": 1.5.0 - "@dabh/diagnostics": ^2.0.2 - async: ^3.2.3 - is-stream: ^2.0.0 - logform: ^2.4.0 - one-time: ^1.0.0 - readable-stream: ^3.4.0 - safe-stable-stringify: ^2.3.1 - stack-trace: 0.0.x - triple-beam: ^1.3.0 - winston-transport: ^4.5.0 - checksum: 47df0361220d12b46d1b3c98a1c380a3718321739d527a182ce7984fc20715e5b0b55db0bcd3fd076d1b1d3261903b890b053851cfd4bc028bda7951fa8ca2e0 - languageName: node - linkType: hard - "winston@npm:^3.0.0, winston@npm:^3.3.3, winston@npm:^3.8.1": version: 3.8.2 resolution: "winston@npm:3.8.2" From 4bedc25c6cc0f483381f3374492abc82aeb6bc94 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:23:23 -0700 Subject: [PATCH 04/17] chore: revert import changes --- .../commands/app-data/convert/cacheStrategy/jsonFile.spec.ts | 2 +- .../scripts/src/commands/app-data/convert/convert.spec.ts | 2 +- .../src/commands/app-data/convert/processors/base.spec.ts | 2 +- .../app-data/convert/processors/flowParser/flowParser.spec.ts | 2 +- .../processors/flowParser/parsers/data_pipe.parser.spec.ts | 2 +- .../commands/app-data/convert/processors/xlsxWorkbook.spec.ts | 2 +- packages/scripts/src/commands/app-data/download.ts | 4 ++-- packages/scripts/src/commands/version.ts | 2 +- packages/scripts/src/paths.ts | 2 ++ packages/scripts/src/utils.ts | 2 ++ 10 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 packages/scripts/src/paths.ts create mode 100644 packages/scripts/src/utils.ts diff --git a/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts b/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts index 4a877b08d7..c45bb69888 100644 --- a/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/cacheStrategy/jsonFile.spec.ts @@ -2,7 +2,7 @@ import { emptyDirSync, existsSync, readdirSync, readJsonSync, rmdirSync, statSyn import path from "path"; import { JsonFileCache } from "./jsonFile"; -import { SCRIPTS_WORKSPACE_PATH } from "shared"; +import { SCRIPTS_WORKSPACE_PATH } from "../../../../paths"; const testCacheDir = path.resolve(SCRIPTS_WORKSPACE_PATH, "test", "data", "cache", "spec"); const testData = { diff --git a/packages/scripts/src/commands/app-data/convert/convert.spec.ts b/packages/scripts/src/commands/app-data/convert/convert.spec.ts index 8bd67fb373..a486ba4a6c 100644 --- a/packages/scripts/src/commands/app-data/convert/convert.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/convert.spec.ts @@ -2,7 +2,7 @@ import { AppDataConverter } from "./index"; import path from "path"; -import { SCRIPTS_TEST_DATA_DIR } from "shared"; +import { SCRIPTS_TEST_DATA_DIR } from "../../../paths"; import { emptyDirSync, existsSync, readdirSync } from "fs-extra"; import { clearLogs, getLogs } from "./utils"; diff --git a/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts index 9010af63dd..20485e66d9 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/base.spec.ts @@ -1,7 +1,7 @@ import path from "path"; import BaseProcessor from "./base"; -import { SCRIPTS_WORKSPACE_PATH } from "shared"; +import { SCRIPTS_WORKSPACE_PATH } from "../../../../paths"; import { clearLogs, getLogs } from "../utils"; const testDataDir = path.resolve(SCRIPTS_WORKSPACE_PATH, "test", "data"); const paths = { diff --git a/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts index c3917e4a7f..878cae5db3 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/flowParser/flowParser.spec.ts @@ -1,6 +1,6 @@ import path from "path"; import { FlowTypes } from "data-models"; -import { SCRIPTS_WORKSPACE_PATH } from "shared"; +import { SCRIPTS_WORKSPACE_PATH } from "../../../../../paths"; import { clearLogs, getLogs } from "../../utils"; import { FlowParserProcessor } from "./flowParser"; diff --git a/packages/scripts/src/commands/app-data/convert/processors/flowParser/parsers/data_pipe.parser.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/flowParser/parsers/data_pipe.parser.spec.ts index 57d8fed464..b6c6d5660a 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/flowParser/parsers/data_pipe.parser.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/flowParser/parsers/data_pipe.parser.spec.ts @@ -1,5 +1,5 @@ import { FlowTypes } from "data-models"; -import { IDataPipeOperation } from "shared/src/models/dataPipe/types"; +import type { IDataPipeOperation } from "shared/src/models/dataPipe/types"; import { DataPipeParser } from "./data_pipe.parser"; const testInputSources = { diff --git a/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts b/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts index d9f1be2f3e..4d3d17a501 100644 --- a/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts +++ b/packages/scripts/src/commands/app-data/convert/processors/xlsxWorkbook.spec.ts @@ -1,7 +1,7 @@ import path from "path"; import { XLSXWorkbookProcessor } from "./xlsxWorkbook"; -import { SCRIPTS_TEST_DATA_DIR } from "shared"; +import { SCRIPTS_TEST_DATA_DIR } from "../../../../paths"; import { clearLogs, getLogs, IContentsEntry } from "../utils"; const paths = { SHEETS_CACHE_FOLDER: path.resolve(SCRIPTS_TEST_DATA_DIR, "cache"), diff --git a/packages/scripts/src/commands/app-data/download.ts b/packages/scripts/src/commands/app-data/download.ts index 1288e519bb..db8945e43e 100644 --- a/packages/scripts/src/commands/app-data/download.ts +++ b/packages/scripts/src/commands/app-data/download.ts @@ -4,8 +4,8 @@ import { spawnSync } from "child_process"; import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { CREDENTIALS_PATH, AUTH_TOKEN_PATH } from "shared"; -import { logWarning, promptOptions } from "shared"; +import { CREDENTIALS_PATH, AUTH_TOKEN_PATH } from "../../paths"; +import { logWarning, promptOptions } from "../../utils"; import { ActiveDeployment } from "../deployment/get"; /*************************************************************************************** diff --git a/packages/scripts/src/commands/version.ts b/packages/scripts/src/commands/version.ts index 74953b0b89..9b374fc732 100644 --- a/packages/scripts/src/commands/version.ts +++ b/packages/scripts/src/commands/version.ts @@ -1,7 +1,7 @@ import * as fs from "fs-extra"; import { Command } from "commander"; import inquirer from "inquirer"; -import { APP_BUILD_GRADLE_PATH, MAIN_PACKAGE_PATH } from "shared"; +import { APP_BUILD_GRADLE_PATH, MAIN_PACKAGE_PATH } from "../paths"; /*************************************************************************************** * CLI diff --git a/packages/scripts/src/paths.ts b/packages/scripts/src/paths.ts new file mode 100644 index 0000000000..fd62713f87 --- /dev/null +++ b/packages/scripts/src/paths.ts @@ -0,0 +1,2 @@ +// re-export shared utils for ease of import +export * from "shared/src/paths"; diff --git a/packages/scripts/src/utils.ts b/packages/scripts/src/utils.ts new file mode 100644 index 0000000000..4646053846 --- /dev/null +++ b/packages/scripts/src/utils.ts @@ -0,0 +1,2 @@ +// re-export shared utils for ease of import +export * from "shared/src/utils"; From 579ffeba40cc385ba7034fdd3233c9987f5bd181 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:27:48 -0700 Subject: [PATCH 05/17] chore: restore import changes --- packages/scripts/src/commands/app-data/convert/utils/index.ts | 2 +- .../scripts/src/commands/app-data/postProcess/assets.spec.ts | 2 +- packages/scripts/src/commands/app-data/postProcess/assets.ts | 2 +- .../scripts/src/commands/app-data/postProcess/sheets.spec.ts | 1 - packages/scripts/src/commands/app-data/postProcess/sheets.ts | 2 +- packages/scripts/src/commands/app-data/watch.ts | 2 +- packages/scripts/src/commands/compile/types.ts | 2 +- packages/scripts/src/commands/config/decrypt.ts | 4 ++-- packages/scripts/src/commands/config/encrypt.ts | 4 ++-- packages/scripts/src/commands/deployment/common.ts | 2 +- packages/scripts/src/commands/deployment/compile.ts | 4 ++-- packages/scripts/src/commands/deployment/create.ts | 4 ++-- packages/scripts/src/commands/deployment/get.ts | 4 ++-- packages/scripts/src/commands/deployment/import.ts | 4 ++-- packages/scripts/src/commands/deployment/index.ts | 2 +- packages/scripts/src/commands/deployment/set.ts | 4 ++-- packages/scripts/src/commands/deployment/utils.ts | 2 +- packages/scripts/src/commands/e2e-data/parse.ts | 2 +- 18 files changed, 24 insertions(+), 25 deletions(-) diff --git a/packages/scripts/src/commands/app-data/convert/utils/index.ts b/packages/scripts/src/commands/app-data/convert/utils/index.ts index 5793c7ed36..ff7fd8a853 100644 --- a/packages/scripts/src/commands/app-data/convert/utils/index.ts +++ b/packages/scripts/src/commands/app-data/convert/utils/index.ts @@ -3,4 +3,4 @@ export * from "./app-data-condition.utils"; export * from "./app-data-action.utils"; export * from "./logging"; // Re-export common shared utils for easier import -export * from "shared"; +export * from "../../../../utils"; diff --git a/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts b/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts index ea71e6c33f..d5f341b167 100644 --- a/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts +++ b/packages/scripts/src/commands/app-data/postProcess/assets.spec.ts @@ -9,7 +9,7 @@ import mockFs from "mock-fs"; // Use default imports to allow spying on functions and replacing with mock methods import { ActiveDeployment } from "../../deployment/get"; -import { Logger } from "shared"; +import { Logger } from "../../../utils"; import path from "path"; import { IAssetEntryHashmap } from "data-models/deployment.model"; diff --git a/packages/scripts/src/commands/app-data/postProcess/assets.ts b/packages/scripts/src/commands/app-data/postProcess/assets.ts index dd03ed7c4f..26380b18df 100644 --- a/packages/scripts/src/commands/app-data/postProcess/assets.ts +++ b/packages/scripts/src/commands/app-data/postProcess/assets.ts @@ -15,7 +15,7 @@ import { replicateDir, sortJsonKeys, getNestedProperty, -} from "shared"; +} from "../../../utils"; import { ActiveDeployment } from "../../deployment/get"; import type { IAssetEntryHashmap, IContentsEntryMinimal } from "data-models/deployment.model"; diff --git a/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts b/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts index 30f2655ac9..b298841057 100644 --- a/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts +++ b/packages/scripts/src/commands/app-data/postProcess/sheets.spec.ts @@ -6,7 +6,6 @@ import mockFs from "mock-fs"; // Use default imports to allow spying on functions and replacing with mock methods import { ActiveDeployment } from "../../deployment/get"; -import { Logger } from "shared"; import path from "path"; /** Mock file system folders for use in tests */ diff --git a/packages/scripts/src/commands/app-data/postProcess/sheets.ts b/packages/scripts/src/commands/app-data/postProcess/sheets.ts index f25b087e75..59c6f2bd43 100644 --- a/packages/scripts/src/commands/app-data/postProcess/sheets.ts +++ b/packages/scripts/src/commands/app-data/postProcess/sheets.ts @@ -2,7 +2,7 @@ import * as path from "path"; import * as fs from "fs-extra"; import chalk from "chalk"; import { Command } from "commander"; -import { Logger, recursiveFindByExtension } from "shared"; +import { Logger, recursiveFindByExtension } from "../../../utils"; import { ActiveDeployment } from "../../deployment/get"; import { FlowTypes } from "data-models"; diff --git a/packages/scripts/src/commands/app-data/watch.ts b/packages/scripts/src/commands/app-data/watch.ts index 952bd66371..b67c05b294 100644 --- a/packages/scripts/src/commands/app-data/watch.ts +++ b/packages/scripts/src/commands/app-data/watch.ts @@ -3,7 +3,7 @@ // import path from "path"; // import { watch } from "chokidar"; // import fs from "fs-extra"; -// import { ROOT_DIR } from "shared"; +// import { ROOT_DIR } from "../../paths"; // import chalk from "chalk"; // const program = new Command("watch"); diff --git a/packages/scripts/src/commands/compile/types.ts b/packages/scripts/src/commands/compile/types.ts index 45d10e9d17..028adce335 100644 --- a/packages/scripts/src/commands/compile/types.ts +++ b/packages/scripts/src/commands/compile/types.ts @@ -4,7 +4,7 @@ import { spawnSync } from "child_process"; import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { DATA_MODELS_WORKSPACE_PATH } from "shared"; +import { DATA_MODELS_WORKSPACE_PATH } from "../../paths"; /*************************************************************************************** * CLI diff --git a/packages/scripts/src/commands/config/decrypt.ts b/packages/scripts/src/commands/config/decrypt.ts index 6e00163c74..606b6b01ec 100644 --- a/packages/scripts/src/commands/config/decrypt.ts +++ b/packages/scripts/src/commands/config/decrypt.ts @@ -1,7 +1,7 @@ #!/usr/bin/env node import fs from "fs-extra"; -import { Logger, logOutput } from "shared"; -import { CONFIG_FOLDER_PATH, PRIVATE_KEY_PATH } from "shared"; +import { Logger, logOutput } from "../../utils"; +import { CONFIG_FOLDER_PATH, PRIVATE_KEY_PATH } from "../../paths"; import { Command } from "commander"; import NodeRSA from "node-rsa"; diff --git a/packages/scripts/src/commands/config/encrypt.ts b/packages/scripts/src/commands/config/encrypt.ts index 4bec40634f..68bedb10d7 100644 --- a/packages/scripts/src/commands/config/encrypt.ts +++ b/packages/scripts/src/commands/config/encrypt.ts @@ -3,8 +3,8 @@ import fs from "fs-extra"; import path from "path"; import chalk from "chalk"; import NodeRSA from "node-rsa"; -import { promptOptions } from "shared"; -import { PUBLIC_KEY_PATH } from "shared"; +import { promptOptions } from "../../utils"; +import { PUBLIC_KEY_PATH } from "../../paths"; import { Command } from "commander"; const program = new Command("download"); diff --git a/packages/scripts/src/commands/deployment/common.ts b/packages/scripts/src/commands/deployment/common.ts index 84e350cba8..d935e0160c 100644 --- a/packages/scripts/src/commands/deployment/common.ts +++ b/packages/scripts/src/commands/deployment/common.ts @@ -2,7 +2,7 @@ import { DEPLOYMENT_CONFIG_EXAMPLE_DEFAULTS, getDefaultAppConfig } from "data-mo import type { IDeploymentConfig, IDeploymentConfigJson } from "data-models"; import path from "path"; -import { DEPLOYMENTS_PATH } from "shared"; +import { DEPLOYMENTS_PATH } from "../../paths"; import { loadDeploymentJson } from "./utils"; // re-export of type for convenience diff --git a/packages/scripts/src/commands/deployment/compile.ts b/packages/scripts/src/commands/deployment/compile.ts index 0621400375..8605778e94 100644 --- a/packages/scripts/src/commands/deployment/compile.ts +++ b/packages/scripts/src/commands/deployment/compile.ts @@ -4,8 +4,8 @@ import { Command } from "commander"; import { IDeploymentConfig, DEPLOYMENT_CONFIG_VERSION } from "data-models"; import fs from "fs-extra"; import path from "path"; -import { ROOT_DIR } from "shared"; -import { Logger } from "shared"; +import { ROOT_DIR } from "../../paths"; +import { Logger } from "../../utils"; import { IDeploymentConfigJson } from "./common"; import { convertFunctionsToStrings } from "./utils"; diff --git a/packages/scripts/src/commands/deployment/create.ts b/packages/scripts/src/commands/deployment/create.ts index 07563b5751..8081edf29b 100644 --- a/packages/scripts/src/commands/deployment/create.ts +++ b/packages/scripts/src/commands/deployment/create.ts @@ -2,8 +2,8 @@ import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { DEPLOYMENTS_PATH } from "shared"; -import { Logger, logOutput, logWarning, promptInput, promptOptions } from "shared"; +import { DEPLOYMENTS_PATH } from "../../paths"; +import { Logger, logOutput, logWarning, promptInput, promptOptions } from "../../utils"; import type { IDeploymentConfigJson } from "./common"; import generateDefaultConfig from "./templates/config.default"; import generateExtendedConfig from "./templates/config.extended"; diff --git a/packages/scripts/src/commands/deployment/get.ts b/packages/scripts/src/commands/deployment/get.ts index 98af0ce373..e3665e46f9 100644 --- a/packages/scripts/src/commands/deployment/get.ts +++ b/packages/scripts/src/commands/deployment/get.ts @@ -3,8 +3,8 @@ import { Command } from "commander"; import { IDeploymentConfig } from "data-models"; import fs from "fs-extra"; import path from "path"; -import { DEPLOYMENTS_PATH } from "shared"; -import { Logger } from "shared"; +import { DEPLOYMENTS_PATH } from "../../paths"; +import { Logger } from "../../utils"; import type { IDeploymentConfigJson } from "./common"; import { loadTSFileDefaultExport } from "./compile"; import { loadDeploymentJson } from "./utils"; diff --git a/packages/scripts/src/commands/deployment/import.ts b/packages/scripts/src/commands/deployment/import.ts index 5bdc523bae..5b8003a432 100644 --- a/packages/scripts/src/commands/deployment/import.ts +++ b/packages/scripts/src/commands/deployment/import.ts @@ -4,8 +4,8 @@ import { Command } from "commander"; import fs, { moveSync, rmSync } from "fs-extra"; import { resolve } from "path"; import GitProvider from "../../tasks/providers/git"; -import { DEPLOYMENTS_PATH } from "shared"; -import { Logger, logOutput, logWarning, promptConfirmation, promptInput } from "shared"; +import { DEPLOYMENTS_PATH } from "../../paths"; +import { Logger, logOutput, logWarning, promptConfirmation, promptInput } from "../../utils"; import { loadDeploymentJson } from "./utils"; import { existsSync } from "fs"; diff --git a/packages/scripts/src/commands/deployment/index.ts b/packages/scripts/src/commands/deployment/index.ts index 3aa7be4af4..165fa52a2f 100644 --- a/packages/scripts/src/commands/deployment/index.ts +++ b/packages/scripts/src/commands/deployment/index.ts @@ -6,7 +6,7 @@ import createCmd from "./create"; import getCmd from "./get"; import importCmd from "./import"; import setCmd from "./set"; -import { logProgramHelp } from "shared"; +import { logProgramHelp } from "../../utils"; const program = new Command("deployment").description("Manage active deployment workspace"); diff --git a/packages/scripts/src/commands/deployment/set.ts b/packages/scripts/src/commands/deployment/set.ts index 46fac797fc..cad54b9f5e 100644 --- a/packages/scripts/src/commands/deployment/set.ts +++ b/packages/scripts/src/commands/deployment/set.ts @@ -2,8 +2,8 @@ import { Command } from "commander"; import fs from "fs-extra"; import path from "path"; -import { DEPLOYMENTS_PATH, ROOT_DIR } from "shared"; -import { promptOptions, logOutput, logWarning } from "shared"; +import { DEPLOYMENTS_PATH, ROOT_DIR } from "../../paths"; +import { promptOptions, logOutput, logWarning } from "../../utils"; import { ActiveDeployment } from "./get"; import { loadDeploymentJson } from "./utils"; diff --git a/packages/scripts/src/commands/deployment/utils.ts b/packages/scripts/src/commands/deployment/utils.ts index a49a7f85c4..51517dc8f7 100644 --- a/packages/scripts/src/commands/deployment/utils.ts +++ b/packages/scripts/src/commands/deployment/utils.ts @@ -4,7 +4,7 @@ import path from "path"; import { DEPLOYMENT_CONFIG_VERSION } from "data-models"; -import { Logger } from "shared"; +import { Logger } from "../../utils"; import { compileDeploymentTSSync } from "./compile"; import { IDeploymentConfigJson } from "./common"; diff --git a/packages/scripts/src/commands/e2e-data/parse.ts b/packages/scripts/src/commands/e2e-data/parse.ts index 7f960cdf0b..ed3f15d773 100644 --- a/packages/scripts/src/commands/e2e-data/parse.ts +++ b/packages/scripts/src/commands/e2e-data/parse.ts @@ -5,7 +5,7 @@ import XLSX from "xlsx"; import prettier from "prettier"; import * as mappings from "./mappings"; import snippets from "./snippets"; -import { ROOT_DIR } from "shared"; +import { ROOT_DIR } from "../../paths"; interface IProgramOptions { input: string; From eee0339e7e79a988ae14b25077b9d8d73859e02e Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:29:13 -0700 Subject: [PATCH 06/17] chore: restore imports --- packages/scripts/src/tasks/providers/android.ts | 3 ++- packages/scripts/src/tasks/providers/appData.ts | 4 ++-- packages/scripts/src/tasks/providers/encryption.ts | 4 ++-- packages/scripts/src/tasks/providers/gdrive.ts | 2 +- packages/scripts/src/tasks/providers/repo.ts | 2 +- packages/scripts/src/tasks/providers/subtitles.ts | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/scripts/src/tasks/providers/android.ts b/packages/scripts/src/tasks/providers/android.ts index f8be32ff75..5224dd78b3 100644 --- a/packages/scripts/src/tasks/providers/android.ts +++ b/packages/scripts/src/tasks/providers/android.ts @@ -1,7 +1,8 @@ import * as path from "path"; import { Options, run } from "cordova-res"; import fs from "fs"; -import { ROOT_DIR, Logger } from "shared"; +import { ROOT_DIR } from "../../paths"; +import { Logger } from "../../utils"; const set_splash_image = async (splashAssetPath: string) => { if (!fs.existsSync(splashAssetPath)) { diff --git a/packages/scripts/src/tasks/providers/appData.ts b/packages/scripts/src/tasks/providers/appData.ts index 091ec2a47a..2bc17704b5 100644 --- a/packages/scripts/src/tasks/providers/appData.ts +++ b/packages/scripts/src/tasks/providers/appData.ts @@ -2,8 +2,8 @@ import { writeFileSync } from "fs-extra"; import path from "path"; import { parseCommand } from "../../commands"; import { WorkflowRunner } from "../../commands/workflow/run"; -import { SRC_ASSETS_PATH } from "shared"; -import { IContentsEntry, replicateDir } from "shared"; +import { SRC_ASSETS_PATH } from "../../paths"; +import { IContentsEntry, replicateDir } from "../../utils"; /** Prepare sourcely cached assets for population to app */ const postProcessAssets = (options: { sourceAssetsFolder: string }) => { diff --git a/packages/scripts/src/tasks/providers/encryption.ts b/packages/scripts/src/tasks/providers/encryption.ts index 58563a1068..1c6c3f8aaa 100644 --- a/packages/scripts/src/tasks/providers/encryption.ts +++ b/packages/scripts/src/tasks/providers/encryption.ts @@ -11,8 +11,8 @@ import { import NodeRSA from "node-rsa"; import { basename, resolve } from "path"; import { ActiveDeployment } from "../../commands/deployment/get"; -import { DEPLOYMENTS_PATH } from "shared"; -import { logOutput, promptConfirmation, promptEditorInput } from "shared"; +import { DEPLOYMENTS_PATH } from "../../paths"; +import { logOutput, promptConfirmation, promptEditorInput } from "../../utils"; /** Suffix added to all encrypted files to distinguish from originals */ const ENCRYPTED_SUFFIX = "crypt"; diff --git a/packages/scripts/src/tasks/providers/gdrive.ts b/packages/scripts/src/tasks/providers/gdrive.ts index c3cd068247..64a71697dd 100644 --- a/packages/scripts/src/tasks/providers/gdrive.ts +++ b/packages/scripts/src/tasks/providers/gdrive.ts @@ -5,7 +5,7 @@ import { existsSync, removeSync } from "fs-extra"; import path from "path"; import { WorkflowRunner } from "../../commands/workflow/run"; -import { AUTH_TOKEN_PATH, CREDENTIALS_PATH } from "shared"; +import { AUTH_TOKEN_PATH, CREDENTIALS_PATH } from "../../paths"; const authorize = () => { // remove any pre-existing auth token diff --git a/packages/scripts/src/tasks/providers/repo.ts b/packages/scripts/src/tasks/providers/repo.ts index ebfc4ef165..ea25e4a07b 100644 --- a/packages/scripts/src/tasks/providers/repo.ts +++ b/packages/scripts/src/tasks/providers/repo.ts @@ -1,5 +1,5 @@ import { spawnSync } from "child_process"; -import { ROOT_DIR } from "shared"; +import { ROOT_DIR } from "../../paths"; const runTSCodeFormatter = (folderPath: string) => { const cmd = `npx prettier --config ${ROOT_DIR}/.prettierrc --write ${folderPath}/**/*.ts --loglevel error`; diff --git a/packages/scripts/src/tasks/providers/subtitles.ts b/packages/scripts/src/tasks/providers/subtitles.ts index a8bfab1c5a..1c0aae9467 100644 --- a/packages/scripts/src/tasks/providers/subtitles.ts +++ b/packages/scripts/src/tasks/providers/subtitles.ts @@ -2,8 +2,8 @@ import chalk from "chalk"; import fs from "fs"; import * as path from "path"; import parser from "subtitles-parser-vtt"; -import { ROOT_DIR } from "shared"; -import { recursiveFindByExtension, Logger, logOutput, promptOptions } from "shared"; +import { ROOT_DIR } from "../../paths"; +import { recursiveFindByExtension, Logger, logOutput, promptOptions } from "../../utils"; // This is an interim solution for manually generating translated .vtt files, // to be used pending reworking the translations repo/pipeline to handle assets more generally From c0f269ad6910af698d8745d0a8db2461cc88ae08 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:33:56 -0700 Subject: [PATCH 07/17] chore: code tidying --- packages/scripts/src/commands/index.ts | 2 +- packages/workflows/src/sync.workflows.ts | 2 +- packages/workflows/src/workflow.model.ts | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/scripts/src/commands/index.ts b/packages/scripts/src/commands/index.ts index b43028330a..945b52b418 100644 --- a/packages/scripts/src/commands/index.ts +++ b/packages/scripts/src/commands/index.ts @@ -9,7 +9,7 @@ import configCmd from "./config"; import deploymentCmd from "./deployment"; import versionCmd from "./version"; import workflowCmd from "./workflow"; -import { logWarning, logProgramHelp } from "../utils/logging.utils"; +import { logWarning, logProgramHelp } from "../utils"; const program = new Command(); diff --git a/packages/workflows/src/sync.workflows.ts b/packages/workflows/src/sync.workflows.ts index 0569ee7863..58b3bb811d 100644 --- a/packages/workflows/src/sync.workflows.ts +++ b/packages/workflows/src/sync.workflows.ts @@ -1,5 +1,5 @@ import { normalize } from "path"; -import { replicateDir } from "scripts/src/utils"; +import { replicateDir } from "shared"; import type { IDeploymentWorkflows, IWorkflowStepContext } from "./workflow.model"; /** Default workflows made available to all deployments */ diff --git a/packages/workflows/src/workflow.model.ts b/packages/workflows/src/workflow.model.ts index f0f49ae10e..23ae0a45d3 100644 --- a/packages/workflows/src/workflow.model.ts +++ b/packages/workflows/src/workflow.model.ts @@ -1,7 +1,10 @@ // NOTE - this import can lead to build issues // https://www.codejam.info/2021/10/typescript-cannot-write-file-overwrite-input.html -import { IDeploymentConfigJson } from "scripts/src/commands/deployment/common"; -import type { ITasks } from "scripts/src/tasks"; +import type { IDeploymentConfigJson } from "data-models"; + +// HACK - we want type-safety for workflow tasks, however the tasks list is part of the +// scripts workspace. Avoid circular imports by direct import from relative path +import type { ITasks } from "../../scripts/src/tasks"; export interface IWorkflowContext { [step_name: string]: { output: any }; From bbc0ead676176ef2c34e95f88132e404a9ad87c6 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 15:57:44 -0700 Subject: [PATCH 08/17] chore: code tidying --- package.json | 1 - .../@idemsInternational/gdrive-tools/src/commands/download.ts | 2 +- packages/@idemsInternational/gdrive-tools/src/commands/watch.ts | 2 +- yarn.lock | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 2d3a2138c3..39bb299dd1 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,6 @@ "qrcode": "^1.5.1", "rxdb": "^13.15.3", "rxjs": "^7.8.0", - "shared": "workspace:*", "signature_pad": "^4.1.5", "stacktrace-js": "^2.0.2", "swiper": "^8.4.4", diff --git a/packages/@idemsInternational/gdrive-tools/src/commands/download.ts b/packages/@idemsInternational/gdrive-tools/src/commands/download.ts index 23cce9c184..5ff97c36cc 100644 --- a/packages/@idemsInternational/gdrive-tools/src/commands/download.ts +++ b/packages/@idemsInternational/gdrive-tools/src/commands/download.ts @@ -7,6 +7,7 @@ import PQueue from "p-queue"; import { drive_v3 } from "googleapis"; import { GaxiosResponse, GaxiosOptions } from "gaxios"; import { Command } from "commander"; +import { PATHS } from "../paths"; import { GDRIVE_OFFICE_MAPPING, MIMETYPE_EXTENSIONS, @@ -18,7 +19,6 @@ import { cleanupEmptyFolders, } from "../utils"; import { authorizeGDrive } from "./authorize"; -import { PATHS } from "../paths"; const GOOGLE_FOLDER_MIMETYPE = "application/vnd.google-apps.folder"; diff --git a/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts b/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts index cd05694dbb..0c8aac8ed9 100644 --- a/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts +++ b/packages/@idemsInternational/gdrive-tools/src/commands/watch.ts @@ -3,10 +3,10 @@ import { Command } from "commander"; import type { drive_v3 } from "googleapis"; import { logProgramHelp } from "../utils"; import { authorizeGDrive, authorizeGDriveActivity } from "./authorize"; +import { PATHS } from "../paths"; import { randomUUID } from "crypto"; import { GDriveDownloader } from "./download"; import chalk from "chalk"; -import { PATHS } from "../paths"; /*************************************************************************************** * WiP Methods to enable streaming of live changes from google drive diff --git a/yarn.lock b/yarn.lock index e7661be139..45a8e23f66 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15037,7 +15037,6 @@ __metadata: qrcode: ^1.5.1 rxdb: ^13.15.3 rxjs: ^7.8.0 - shared: "workspace:*" signature_pad: ^4.1.5 stacktrace-js: ^2.0.2 swiper: ^8.4.4 From 4017ce1e5de1d9a5a0d9c51efc576fdf4dba8c26 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 10 Aug 2023 16:24:19 -0700 Subject: [PATCH 09/17] chore: fix data-model imports --- package.json | 1 + packages/data-models/index.ts | 2 ++ packages/data-models/package.json | 12 ++++++++---- packages/data-models/tsconfig.json | 2 +- packages/shared/package.json | 2 +- .../shared/src/models/templatedData/templatedData.ts | 2 +- src/app/data/app-data.ts | 2 +- src/app/feature/campaign/campaign.service.ts | 2 +- src/app/feature/feedback/feedback.types.ts | 2 +- src/app/feature/template/template.page.ts | 2 +- .../theme/pages/theme-editor/theme-editor.page.ts | 2 +- src/app/feature/theme/services/theme.service.ts | 2 +- .../template/pipes/filter-display-component.pipe.ts | 2 +- .../shared/components/template/processors/item.ts | 7 +++++-- .../services/instance/template-action.registry.ts | 2 +- .../template/services/template-asset.service.ts | 3 +-- .../template/services/template-field.service.ts | 2 +- .../template/services/template-translate.service.ts | 2 +- .../components/template/services/template.service.ts | 2 +- .../shared/services/data/data-evaluation.service.ts | 2 +- src/app/shared/services/db/db-sync.service.ts | 5 ++--- src/app/shared/services/db/db.service.ts | 11 ++--------- .../dynamic-data/adapters/persistedMemory.ts | 2 +- .../services/dynamic-data/dynamic-data.service.ts | 2 +- .../local-notification-interaction.service.ts | 2 +- src/app/shared/services/server/server.service.ts | 2 +- src/environments/environment.prod.ts | 2 +- src/environments/environment.ts | 2 +- yarn.lock | 1 + 29 files changed, 43 insertions(+), 41 deletions(-) diff --git a/package.json b/package.json index 39bb299dd1..2d3a2138c3 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "qrcode": "^1.5.1", "rxdb": "^13.15.3", "rxjs": "^7.8.0", + "shared": "workspace:*", "signature_pad": "^4.1.5", "stacktrace-js": "^2.0.2", "swiper": "^8.4.4", diff --git a/packages/data-models/index.ts b/packages/data-models/index.ts index e26fb3ddc7..9e824ab4c2 100644 --- a/packages/data-models/index.ts +++ b/packages/data-models/index.ts @@ -9,3 +9,5 @@ export { } from "./deployment.model"; export { IAppSkin } from "./skin.model"; export { IAppConfig, IAppConfigOverride, getDefaultAppConfig } from "./appConfig"; +export * from "./db.model"; +export * from "./deployment.model"; diff --git a/packages/data-models/package.json b/packages/data-models/package.json index 0c94a27d6a..78b93fca0f 100644 --- a/packages/data-models/package.json +++ b/packages/data-models/package.json @@ -2,18 +2,22 @@ "name": "data-models", "version": "1.0.0", "description": "", - "types": "index.d.ts", + "files": [ + "dist" + ], + "main": "dist/index.js", + "types": "./dist/index.d.ts", "scripts": { "build": "tsc -b", "serve": "tsc -w" }, + "dependencies": { + "clone": "^2.1.2" + }, "devDependencies": { "@types/clone": "^2.1.1", "@types/node": "^16.18.9", "shared": "workspace:*", "typescript": "~4.2.4" - }, - "dependencies": { - "clone": "^2.1.2" } } diff --git a/packages/data-models/tsconfig.json b/packages/data-models/tsconfig.json index 2572ee9196..979d0e3ae0 100644 --- a/packages/data-models/tsconfig.json +++ b/packages/data-models/tsconfig.json @@ -9,6 +9,6 @@ "target": "es5", "esModuleInterop": true }, - "include": ["index.ts"], + "include": ["**/*.ts"], "exclude": ["**/*.d.ts", "dist", "node_modules"] } diff --git a/packages/shared/package.json b/packages/shared/package.json index f8d8c2c557..481231c809 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -2,7 +2,7 @@ "name": "shared", "version": "1.0.0", "description": "", - "main": "src/index.ts", + "main": "src", "scripts": { "test": "jasmine-ts --config=jasmine.json", "test:watch": "nodemon --ext ts --exec 'jasmine-ts --config=jasmine.json'" diff --git a/packages/shared/src/models/templatedData/templatedData.ts b/packages/shared/src/models/templatedData/templatedData.ts index 6f3a6edb84..1e2056d0cf 100644 --- a/packages/shared/src/models/templatedData/templatedData.ts +++ b/packages/shared/src/models/templatedData/templatedData.ts @@ -1,5 +1,5 @@ import { ITemplatedStringVariable } from "../../types"; -import { addStringDelimiters, extractDelimitedTemplateString } from "../../utils"; +import { addStringDelimiters, extractDelimitedTemplateString } from "../../utils/delimiters"; type ITemplatedDataContext = { [prefix: string]: any }; diff --git a/src/app/data/app-data.ts b/src/app/data/app-data.ts index bc9a461029..54bd944c26 100644 --- a/src/app/data/app-data.ts +++ b/src/app/data/app-data.ts @@ -1,5 +1,5 @@ import type { FlowTypes } from "data-models"; -import type { IAssetEntry } from "packages/data-models/deployment.model"; +import type { IAssetEntry } from "data-models"; import ASSETS_CONTENT_JSON from "src/assets/app_data/assets/contents.json"; import SHEETS_CONTENT_JSON from "src/assets/app_data/sheets/contents.json"; import TRANSLATIONS_CONTENT_JSON from "src/assets/app_data/translations/contents.json"; diff --git a/src/app/feature/campaign/campaign.service.ts b/src/app/feature/campaign/campaign.service.ts index 535cc36f01..41a8136cfe 100644 --- a/src/app/feature/campaign/campaign.service.ts +++ b/src/app/feature/campaign/campaign.service.ts @@ -1,7 +1,7 @@ import { Injectable, Injector } from "@angular/core"; import { addDays, addSeconds } from "date-fns"; import { addHours, addMinutes, addWeeks, endOfDay, isAfter, isBefore, setISODay } from "date-fns"; -import { extractDynamicFields, IAppConfig } from "packages/data-models"; +import { extractDynamicFields, IAppConfig } from "data-models"; import { Subscription } from "rxjs"; import { TemplateActionService } from "src/app/shared/components/template/services/instance/template-action.service"; import { TemplateTranslateService } from "src/app/shared/components/template/services/template-translate.service"; diff --git a/src/app/feature/feedback/feedback.types.ts b/src/app/feature/feedback/feedback.types.ts index a51af15473..8e0ba7a626 100644 --- a/src/app/feature/feedback/feedback.types.ts +++ b/src/app/feature/feedback/feedback.types.ts @@ -1,5 +1,5 @@ import { DeviceInfo } from "@capacitor/device"; -import { IDBMeta } from "packages/data-models/db.model"; +import { IDBMeta } from "data-models"; import { IContextMenuType } from "src/app/shared/modules/context-menu/context-menu.types"; /** Fields required to include a button in context menus */ diff --git a/src/app/feature/template/template.page.ts b/src/app/feature/template/template.page.ts index 4bdf70af19..37831a0bd8 100644 --- a/src/app/feature/template/template.page.ts +++ b/src/app/feature/template/template.page.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; -import { FlowTypes } from "packages/data-models"; +import { FlowTypes } from "data-models"; import { AppDataService } from "src/app/shared/services/data/app-data.service"; @Component({ diff --git a/src/app/feature/theme/pages/theme-editor/theme-editor.page.ts b/src/app/feature/theme/pages/theme-editor/theme-editor.page.ts index 95e7273254..2a3ee2e530 100644 --- a/src/app/feature/theme/pages/theme-editor/theme-editor.page.ts +++ b/src/app/feature/theme/pages/theme-editor/theme-editor.page.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from "@angular/core"; -import { IAppConfig } from "packages/data-models/appConfig"; +import { IAppConfig } from "data-models"; import { ThemeService } from "../../services/theme.service"; @Component({ diff --git a/src/app/feature/theme/services/theme.service.ts b/src/app/feature/theme/services/theme.service.ts index 104da20233..1d40d89907 100644 --- a/src/app/feature/theme/services/theme.service.ts +++ b/src/app/feature/theme/services/theme.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; import { BehaviorSubject } from "rxjs"; import { LocalStorageService } from "src/app/shared/services/local-storage/local-storage.service"; import { AppConfigService } from "src/app/shared/services/app-config/app-config.service"; -import { IAppConfig } from "packages/data-models"; +import { IAppConfig } from "data-models"; import { SyncServiceBase } from "src/app/shared/services/syncService.base"; @Injectable({ diff --git a/src/app/shared/components/template/pipes/filter-display-component.pipe.ts b/src/app/shared/components/template/pipes/filter-display-component.pipe.ts index c4e9ffe248..02e4960e2b 100644 --- a/src/app/shared/components/template/pipes/filter-display-component.pipe.ts +++ b/src/app/shared/components/template/pipes/filter-display-component.pipe.ts @@ -1,5 +1,5 @@ import { Pipe, PipeTransform } from "@angular/core"; -import { FlowTypes } from "packages/data-models"; +import { FlowTypes } from "data-models"; import { TEMPLATE_COMPONENT_MAPPING } from "../components"; /** diff --git a/src/app/shared/components/template/processors/item.ts b/src/app/shared/components/template/processors/item.ts index cb968ce858..61f8a31718 100644 --- a/src/app/shared/components/template/processors/item.ts +++ b/src/app/shared/components/template/processors/item.ts @@ -1,5 +1,8 @@ -// TODO - shared package name conflicts with local shared -import { AppStringEvaluator, TemplatedData } from "packages/shared"; +// NOTE - importing from 'shared' will fail as contains non-browser packages and +// name conflicts with local 'shared' folder. Import full path from packages instead +import { AppStringEvaluator } from "packages/shared/src/models/appStringEvaluator/appStringEvaluator"; +import { TemplatedData } from "packages/shared/src/models/templatedData/templatedData"; + import { shuffleArray } from "src/app/shared/utils"; import { FlowTypes } from "../models"; import { objectToArray } from "../utils"; diff --git a/src/app/shared/components/template/services/instance/template-action.registry.ts b/src/app/shared/components/template/services/instance/template-action.registry.ts index ad103c51a2..0369129867 100644 --- a/src/app/shared/components/template/services/instance/template-action.registry.ts +++ b/src/app/shared/components/template/services/instance/template-action.registry.ts @@ -1,6 +1,6 @@ import { Injectable } from "@angular/core"; import clone from "clone"; -import { FlowTypes } from "packages/data-models"; +import { FlowTypes } from "data-models"; export type IActionId = FlowTypes.TemplateRowAction["action_id"]; export type IActionHandlers = Record< diff --git a/src/app/shared/components/template/services/template-asset.service.ts b/src/app/shared/components/template/services/template-asset.service.ts index a62b804a5b..5d77b68fd8 100644 --- a/src/app/shared/components/template/services/template-asset.service.ts +++ b/src/app/shared/components/template/services/template-asset.service.ts @@ -1,10 +1,9 @@ import { Injectable } from "@angular/core"; -import { Capacitor } from "@capacitor/core"; import { ASSETS_CONTENTS_LIST, IAssetContents } from "src/app/data"; import { ThemeService } from "src/app/feature/theme/services/theme.service"; import { AsyncServiceBase } from "src/app/shared/services/asyncService.base"; import { TemplateTranslateService } from "./template-translate.service"; -import { IAssetEntry, IContentsEntryMinimal } from "packages/data-models/deployment.model"; +import { IAssetEntry, IContentsEntryMinimal } from "data-models"; import { HttpClient } from "@angular/common/http"; import { lastValueFrom } from "rxjs"; diff --git a/src/app/shared/components/template/services/template-field.service.ts b/src/app/shared/components/template/services/template-field.service.ts index cff0be3ac1..9750e2c76b 100644 --- a/src/app/shared/components/template/services/template-field.service.ts +++ b/src/app/shared/components/template/services/template-field.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import { IFlowEvent } from "data-models/db.model"; +import { IFlowEvent } from "data-models"; import { FlowTypes } from "data-models"; import { DbService } from "src/app/shared/services/db/db.service"; import { LocalStorageService } from "src/app/shared/services/local-storage/local-storage.service"; diff --git a/src/app/shared/components/template/services/template-translate.service.ts b/src/app/shared/components/template/services/template-translate.service.ts index 233f0927fb..8b9b605f0f 100644 --- a/src/app/shared/components/template/services/template-translate.service.ts +++ b/src/app/shared/components/template/services/template-translate.service.ts @@ -1,5 +1,5 @@ import { Injectable } from "@angular/core"; -import { IAppConfig } from "packages/data-models"; +import { IAppConfig } from "data-models"; import { BehaviorSubject } from "rxjs"; import { AppConfigService } from "src/app/shared/services/app-config/app-config.service"; import { AsyncServiceBase } from "src/app/shared/services/asyncService.base"; diff --git a/src/app/shared/components/template/services/template.service.ts b/src/app/shared/components/template/services/template.service.ts index 030a293b14..a45d24df3c 100644 --- a/src/app/shared/components/template/services/template.service.ts +++ b/src/app/shared/components/template/services/template.service.ts @@ -6,7 +6,7 @@ import { FlowTypes } from "src/app/shared/model"; import { ModalController } from "@ionic/angular"; import { ITemplatePopupComponentProps, TemplatePopupComponent } from "../components/layout/popup"; import { TemplateTranslateService } from "./template-translate.service"; -import { IFlowEvent } from "data-models/db.model"; +import { IFlowEvent } from "data-models"; import { TemplateVariablesService } from "./template-variables.service"; import { TemplateFieldService } from "./template-field.service"; import { arrayToHashmap } from "src/app/shared/utils"; diff --git a/src/app/shared/services/data/data-evaluation.service.ts b/src/app/shared/services/data/data-evaluation.service.ts index 63b8ed9b32..b4e8747a60 100644 --- a/src/app/shared/services/data/data-evaluation.service.ts +++ b/src/app/shared/services/data/data-evaluation.service.ts @@ -1,6 +1,6 @@ import { Injectable, Injector } from "@angular/core"; import { differenceInHours } from "date-fns"; -import { IDBTable } from "packages/data-models/db.model"; +import { IDBTable } from "data-models"; import { FlowTypes } from "src/app/shared/model"; import { TemplateFieldService } from "../../components/template/services/template-field.service"; import { TemplateVariablesService } from "../../components/template/services/template-variables.service"; diff --git a/src/app/shared/services/db/db-sync.service.ts b/src/app/shared/services/db/db-sync.service.ts index df2efc929b..dd6f3e8e25 100644 --- a/src/app/shared/services/db/db-sync.service.ts +++ b/src/app/shared/services/db/db-sync.service.ts @@ -1,14 +1,13 @@ import { HttpClient } from "@angular/common/http"; import { Injectable } from "@angular/core"; -import { interval } from "packages/api/node_modules/rxjs"; import { DB_SERVER_MAPPING, IDBMeta, IDBServerMapping, IDBServerUserRecord, IDBTable, -} from "packages/data-models/db.model"; -import { lastValueFrom } from "rxjs"; +} from "data-models"; +import { interval, lastValueFrom } from "rxjs"; import { environment } from "src/environments/environment"; import { IAppConfig } from "../../model"; import { AppConfigService } from "../app-config/app-config.service"; diff --git a/src/app/shared/services/db/db.service.ts b/src/app/shared/services/db/db.service.ts index 722e6ef738..ff81286b8d 100644 --- a/src/app/shared/services/db/db.service.ts +++ b/src/app/shared/services/db/db.service.ts @@ -5,14 +5,7 @@ import "dexie-syncable"; // import "./db-sync.service"; import { ICreateChange, IDatabaseChange, IDeleteChange, IUpdateChange } from "dexie-observable/api"; import { Subject } from "rxjs"; -import { - DB_TABLES, - DB_VERSION, - IDBMeta, - IDBEvent, - IDBTable, - IFlowEvent, -} from "data-models/db.model"; +import { DB_TABLES, DB_VERSION, IDBMeta, IDBEvent, IDBTable, IFlowEvent } from "data-models"; import { arrayToHashmapArray, generateTimestamp } from "../../utils"; import { EventService } from "../event/event.service"; import { AsyncServiceBase } from "../asyncService.base"; @@ -24,7 +17,7 @@ window.addEventListener("unhandledrejection", (event) => { let reason = event.reason; console.warn("Unhandled promise rejection:", reason && (reason.stack || reason)); }); - +console.log({ DB_VERSION, DB_TABLES }); db.version(DB_VERSION).stores(DB_TABLES); @Injectable({ diff --git a/src/app/shared/services/dynamic-data/adapters/persistedMemory.ts b/src/app/shared/services/dynamic-data/adapters/persistedMemory.ts index e067b2b54d..1360dca9df 100644 --- a/src/app/shared/services/dynamic-data/adapters/persistedMemory.ts +++ b/src/app/shared/services/dynamic-data/adapters/persistedMemory.ts @@ -14,7 +14,7 @@ addRxPlugin(RxDBMigrationPlugin); import { RxDBUpdatePlugin } from "rxdb/plugins/update"; addRxPlugin(RxDBUpdatePlugin); -import { FlowTypes } from "packages/data-models"; +import { FlowTypes } from "data-models"; import { environment } from "src/environments/environment"; import { deepMergeObjects, generateTimestamp } from "../../../utils"; diff --git a/src/app/shared/services/dynamic-data/dynamic-data.service.ts b/src/app/shared/services/dynamic-data/dynamic-data.service.ts index a0c6e16bb1..6e2379dd2a 100644 --- a/src/app/shared/services/dynamic-data/dynamic-data.service.ts +++ b/src/app/shared/services/dynamic-data/dynamic-data.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; import { addRxPlugin, MangoQuery, RxDocument } from "rxdb"; import { firstValueFrom, map } from "rxjs"; -import { FlowTypes } from "packages/data-models"; +import { FlowTypes } from "data-models"; import { environment } from "src/environments/environment"; import { AppDataService } from "../data/app-data.service"; import { AsyncServiceBase } from "../asyncService.base"; diff --git a/src/app/shared/services/notification/local-notification-interaction.service.ts b/src/app/shared/services/notification/local-notification-interaction.service.ts index 68d0e1a7c7..aa6c3831a1 100644 --- a/src/app/shared/services/notification/local-notification-interaction.service.ts +++ b/src/app/shared/services/notification/local-notification-interaction.service.ts @@ -1,6 +1,6 @@ import { Injectable } from "@angular/core"; import type { Table } from "dexie"; -import { IDBMeta } from "packages/data-models/db.model"; +import { IDBMeta } from "data-models"; import { BehaviorSubject } from "rxjs"; import { interval } from "rxjs"; import { debounce, filter } from "rxjs/operators"; diff --git a/src/app/shared/services/server/server.service.ts b/src/app/shared/services/server/server.service.ts index 24f850830b..c829a58953 100644 --- a/src/app/shared/services/server/server.service.ts +++ b/src/app/shared/services/server/server.service.ts @@ -1,7 +1,7 @@ import { HttpClient, HttpErrorResponse } from "@angular/common/http"; import { Injectable } from "@angular/core"; import { DeviceInfo, Device } from "@capacitor/device"; -import { IAppConfig } from "packages/data-models"; +import { IAppConfig } from "data-models"; import { interval } from "rxjs"; import { throwError } from "rxjs"; import { environment } from "src/environments/environment"; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 5c54890889..0d0b7d7fa7 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,7 +1,7 @@ import { firebaseConfig } from "./firebaseConfig"; import packageJson from "../../package.json"; import deploymentJson from "../../.idems_app/deployments/activeDeployment.json"; -import type { IDeploymentConfig } from "packages/data-models"; +import type { IDeploymentConfig } from "data-models"; export const environment = { version: packageJson.version, diff --git a/src/environments/environment.ts b/src/environments/environment.ts index caf9509183..d27f784c68 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,7 +1,7 @@ import { firebaseConfig } from "./firebaseConfig"; import packageJson from "../../package.json"; import deploymentJson from "../../.idems_app/deployments/activeDeployment.json"; -import type { IDeploymentConfig } from "packages/data-models"; +import type { IDeploymentConfig } from "data-models"; export const environment = { /** App version, as provided by package.json */ diff --git a/yarn.lock b/yarn.lock index 45a8e23f66..e7661be139 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15037,6 +15037,7 @@ __metadata: qrcode: ^1.5.1 rxdb: ^13.15.3 rxjs: ^7.8.0 + shared: "workspace:*" signature_pad: ^4.1.5 stacktrace-js: ^2.0.2 swiper: ^8.4.4 From 88e07c028e6267065cd2f637803d8f3076ae3f95 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Mon, 14 Aug 2023 13:54:47 -0700 Subject: [PATCH 10/17] chore: add postinstall --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 2d3a2138c3..fef2988213 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "start": "yarn prepare && concurrently --kill-others --raw \"yarn data-models:serve\" \"ng serve --open\"", "start:local": "yarn prepare && concurrently --kill-others --raw \"ng serve --open\" \"yarn workflow sync_local\"", "prepare": "node .husky/prepare.js && yarn scripts compile types && yarn workflow populate_src_assets", + "postinstall": "yarn prepare", "build": "yarn prepare && ng build --configuration=production", "data-models:serve": "yarn workspace data-models serve", "compodoc:generate": "compodoc --tsconfig tsconfig.docs.json --theme material --assetsFolder 'documentation/docs/assets' --output documentation/docs/generated --disablePrivate --disableLifeCycleHooks", From 06731c21ab16889164f0f205fb5c14b03c48201e Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Wed, 16 Aug 2023 09:31:37 -0700 Subject: [PATCH 11/17] chore: remove postinstall --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 9aab2e10fb..8fbe1f9877 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "start": "yarn prepare && concurrently --kill-others --raw \"yarn data-models:serve\" \"ng serve --open\"", "start:local": "yarn prepare && concurrently --kill-others --raw \"ng serve --open\" \"yarn workflow sync_local\"", "prepare": "node .husky/prepare.js && yarn scripts compile types && yarn workflow populate_src_assets", - "postinstall": "yarn prepare", "build": "yarn prepare && ng build --configuration=production", "data-models:serve": "yarn workspace data-models serve", "compodoc:generate": "compodoc --tsconfig tsconfig.docs.json --theme material --assetsFolder 'documentation/docs/assets' --output documentation/docs/generated --disablePrivate --disableLifeCycleHooks", From 06c5dd77c2c5dac4541e488f0bd84eed39d86ac7 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Wed, 16 Aug 2023 09:42:53 -0700 Subject: [PATCH 12/17] chore: revert scripts package remove --- package.json | 1 + yarn.lock | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8fbe1f9877..b6d20e33aa 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "qrcode": "^1.5.1", "rxdb": "^13.15.3", "rxjs": "^7.8.0", + "scripts": "workspace:*", "shared": "workspace:*", "signature_pad": "^4.1.5", "stacktrace-js": "^2.0.2", diff --git a/yarn.lock b/yarn.lock index e7661be139..073a3013c8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -15037,6 +15037,7 @@ __metadata: qrcode: ^1.5.1 rxdb: ^13.15.3 rxjs: ^7.8.0 + scripts: "workspace:*" shared: "workspace:*" signature_pad: ^4.1.5 stacktrace-js: ^2.0.2 @@ -24417,7 +24418,7 @@ __metadata: languageName: node linkType: hard -"scripts@workspace:packages/scripts": +"scripts@workspace:*, scripts@workspace:packages/scripts": version: 0.0.0-use.local resolution: "scripts@workspace:packages/scripts" dependencies: From f2ae43d03110210294d1cb2fad3a418ea86d2947 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 17 Aug 2023 15:55:23 -0700 Subject: [PATCH 13/17] fix: workflow import --- packages/scripts/src/tasks/providers/workflow.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scripts/src/tasks/providers/workflow.ts b/packages/scripts/src/tasks/providers/workflow.ts index 5c9a885298..b889ba2549 100644 --- a/packages/scripts/src/tasks/providers/workflow.ts +++ b/packages/scripts/src/tasks/providers/workflow.ts @@ -1,4 +1,4 @@ -import { IWorkflowContext } from "data-models/workflows"; +import { IWorkflowContext } from "workflows"; import { parseCommand } from "../../commands"; /** From 1ebb0dc754cf66b7a9fb91490e2c671861a384fc Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Fri, 18 Aug 2023 14:04:22 -0700 Subject: [PATCH 14/17] refactor: angular shared imports --- .github/workflows/web-build.yml | 5 --- package.json | 5 +-- packages/data-models/README.md | 40 +++++++++++++++++++ packages/data-models/index.ts | 15 ++----- packages/data-models/package.json | 8 +--- .../scripts/src/commands/compile/types.ts | 12 +++++- packages/shared/README.md | 38 +++++++++++++++++- packages/shared/package.json | 3 +- tsconfig.app.json | 6 ++- 9 files changed, 102 insertions(+), 30 deletions(-) create mode 100644 packages/data-models/README.md diff --git a/.github/workflows/web-build.yml b/.github/workflows/web-build.yml index 1404cc4239..f70bf42361 100644 --- a/.github/workflows/web-build.yml +++ b/.github/workflows/web-build.yml @@ -154,11 +154,6 @@ jobs: if: ${{env.GIT_SHA}} run: echo "export const GIT_SHA = \"$GIT_SHA\";" > src/environments/sha.ts - # Ensure required packages built to enable deployment set - # TODO - should add implicit dep to scripts when NX added - - name: Precompile - run: yarn scripts compile types - - name: Set deployment run: yarn workflow deployment set ${{env.DEPLOYMENT_NAME}} diff --git a/package.json b/package.json index b6d20e33aa..b56ef9e0cb 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,10 @@ ], "scripts": { "ng": "ng", - "start": "yarn prepare && concurrently --kill-others --raw \"yarn data-models:serve\" \"ng serve --open\"", + "start": "yarn prepare && ng serve --open", "start:local": "yarn prepare && concurrently --kill-others --raw \"ng serve --open\" \"yarn workflow sync_local\"", - "prepare": "node .husky/prepare.js && yarn scripts compile types && yarn workflow populate_src_assets", + "prepare": "node .husky/prepare.js && yarn workflow populate_src_assets", "build": "yarn prepare && ng build --configuration=production", - "data-models:serve": "yarn workspace data-models serve", "compodoc:generate": "compodoc --tsconfig tsconfig.docs.json --theme material --assetsFolder 'documentation/docs/assets' --output documentation/docs/generated --disablePrivate --disableLifeCycleHooks", "compodoc:serve": "yarn compodoc:generate --serve --watch --open", "scripts": "yarn workspace scripts start", diff --git a/packages/data-models/README.md b/packages/data-models/README.md new file mode 100644 index 0000000000..93271d6bb5 --- /dev/null +++ b/packages/data-models/README.md @@ -0,0 +1,40 @@ +## Data Models + +### How to import + +**Node** +The workspace is designed for direct import as `.ts` files, to be compiled within parent project. Most imports are made available from the top-level `index.ts` +```ts +import { getDefaultAppConfig } from "data-models" +``` +If any imports are not available simply update the workspace `index.ts` to include + +**Angular** +The angular compiler uses local `tsconfig.app.json` to include external dependencies, therefore if using an entry should be included +```json +{ + "extends": "./tsconfig.json", + "include": [ + "packages/data-models/**/*.ts", + ] +} + +``` +Once included, data-models can be imported in the same way +```ts +import { getDefaultAppConfig } from "data-models" +``` + +*Legacy Implementation* +If it is not possible to import via tsconfig, it is still possible to include as a workspace dependency (defined in package.json), however the data models package.json requires update to build and import from dist folder. Additionally any angular serve script should concurrently serve the data-models workspace to ensure changes are recompiled, e.g. + +```ts +"main": "dist/index.js", +"types": "dist/index.d.ts", +"scripts": { + "build": "tsc -b", + "serve": "tsc -w" +}, +``` + + diff --git a/packages/data-models/index.ts b/packages/data-models/index.ts index 9e824ab4c2..65b7b445d3 100644 --- a/packages/data-models/index.ts +++ b/packages/data-models/index.ts @@ -1,13 +1,6 @@ -export * from "./flowTypes"; -export * from "./functions"; - -export { - IDeploymentConfig, - IDeploymentConfigJson, - DEPLOYMENT_CONFIG_EXAMPLE_DEFAULTS, - DEPLOYMENT_CONFIG_VERSION, -} from "./deployment.model"; -export { IAppSkin } from "./skin.model"; -export { IAppConfig, IAppConfigOverride, getDefaultAppConfig } from "./appConfig"; +export * from "./appConfig"; export * from "./db.model"; export * from "./deployment.model"; +export * from "./flowTypes"; +export * from "./functions"; +export * from "./skin.model"; diff --git a/packages/data-models/package.json b/packages/data-models/package.json index 78b93fca0f..51b19f0edc 100644 --- a/packages/data-models/package.json +++ b/packages/data-models/package.json @@ -5,12 +5,8 @@ "files": [ "dist" ], - "main": "dist/index.js", - "types": "./dist/index.d.ts", - "scripts": { - "build": "tsc -b", - "serve": "tsc -w" - }, + "main": "./index.ts", + "types": "./index.ts", "dependencies": { "clone": "^2.1.2" }, diff --git a/packages/scripts/src/commands/compile/types.ts b/packages/scripts/src/commands/compile/types.ts index 028adce335..dc09865f13 100644 --- a/packages/scripts/src/commands/compile/types.ts +++ b/packages/scripts/src/commands/compile/types.ts @@ -13,19 +13,27 @@ import { DATA_MODELS_WORKSPACE_PATH } from "../../paths"; const program = new Command("types"); export default program.description("Compile types").action(() => { - compileTypes(); + _DEPRECATED_compileTypes(); }); /*************************************************************************************** * Main Methods *************************************************************************************/ /** + * DEPRECATED - CC 2023-08-18 + * Previously frontend app would import from data-models compiled dist, so extra step + * required to ensure this had been built before running + * However this has been updated to import .ts directly and compile with angular compiler + * so not required. + * Method should be retained for short term in case pattern required + * (recommend to remove post 2023-11-18) + * === * * Data models import types from scripts but scripts also import types from data models * Whilst the types are not in conflict themselves, they do lead to compilation issues * Remove any outstanding types before compiling noew */ -function compileTypes() { +function _DEPRECATED_compileTypes() { const dataModelsBuildPath = path.resolve(DATA_MODELS_WORKSPACE_PATH, "dist"); console.log(chalk.yellow("Compiling type definitions")); if (fs.existsSync(dataModelsBuildPath)) { diff --git a/packages/shared/README.md b/packages/shared/README.md index a0b9eaf3ce..a285f9bee3 100644 --- a/packages/shared/README.md +++ b/packages/shared/README.md @@ -1,8 +1,44 @@ ## Shared -Common platform data structures and manipulation methods. +Common platform methods and utility functions. There are particularly a number of utility methods used by both scripts and workflow packages Note, some methods will only work in node-based environments (non-browser) +### How to import + +**Node** +The workspace is designed for direct import as `.ts` files, to be compiled within parent project. Most imports are made available from the top-level `index.ts` +```ts +import { TemplatedData } from "shared" +``` +If any imports are not available simply update the workspace `index.ts` to include + +**Angular** +The angular compiler uses local `tsconfig.app.json` to include external dependencies, therefore if using an entry should be included + +```json +{ + "extends": "./tsconfig.json", + "include": [ + "packages/shared/**/*.ts", + ] +} +``` + +**NOTE** - the `shared` package workspace name conflicts with local `shared` folder +As such when importing methods a package-based path will be required, i.e + +```ts +import { TemplatedData } from "packages/shared" +``` + +In addition, to avoid compiler errors thrown by non-browser shared methods, explicit paths should be included to import only the supported files as required + +```ts +import { AppStringEvaluator } from "packages/shared/src/models/appStringEvaluator/appStringEvaluator"; +import { TemplatedData } from "packages/shared/src/models/templatedData/templatedData"; +``` + +In future it may be better to move any non-compatible shared methods to own package, or polyfill missing functions (e.g. `os`) \ No newline at end of file diff --git a/packages/shared/package.json b/packages/shared/package.json index 481231c809..b784ca972c 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -2,7 +2,8 @@ "name": "shared", "version": "1.0.0", "description": "", - "main": "src", + "main": "src/index.ts", + "types": "src/index.ts", "scripts": { "test": "jasmine-ts --config=jasmine.json", "test:watch": "nodemon --ext ts --exec 'jasmine-ts --config=jasmine.json'" diff --git a/tsconfig.app.json b/tsconfig.app.json index f45d7781bb..f2dda57b84 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -8,6 +8,10 @@ "include": [ "src/**/*.d.ts", "src/app/shared/components/template/components/odk-form/libs/**/*.js", - "src/app/shared/components/template/components/odk-form/libs/**/*.ts" + "src/app/shared/components/template/components/odk-form/libs/**/*.ts", + // Ensure any ts-based packages used by frontend app are listed here + // to allow import/live-reload within angular compiler + "packages/data-models/**/*.ts", + "packages/shared/**/*.ts" ] } From 64c2c053c514c22722c3414a04fb68827ada2238 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Fri, 18 Aug 2023 15:25:37 -0700 Subject: [PATCH 15/17] chore: code tidying --- src/app/shared/services/db/db.service.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/shared/services/db/db.service.ts b/src/app/shared/services/db/db.service.ts index ff81286b8d..3263c8b44d 100644 --- a/src/app/shared/services/db/db.service.ts +++ b/src/app/shared/services/db/db.service.ts @@ -17,7 +17,6 @@ window.addEventListener("unhandledrejection", (event) => { let reason = event.reason; console.warn("Unhandled promise rejection:", reason && (reason.stack || reason)); }); -console.log({ DB_VERSION, DB_TABLES }); db.version(DB_VERSION).stores(DB_TABLES); @Injectable({ From fade40c6b51820814e8ca211a98e710fc7d25f5d Mon Sep 17 00:00:00 2001 From: EsmeeIDEMS Date: Tue, 22 Aug 2023 13:28:02 +0100 Subject: [PATCH 16/17] Update app version to v0.16.20 --- android/app/build.gradle | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 52215b950a..aaeca8f7ce 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "international.idems.plh_teens" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 16019 - versionName "0.16.19" + versionCode 16020 + versionName "0.16.20" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { diff --git a/package.json b/package.json index cc3715bc72..ed05b1734c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "0.16.19", + "version": "0.16.20", "author": "IDEMS International", "license": "See LICENSE", "homepage": "https://idems.international/", From 3cf9a875535319f17b032879d7280076d82e36b5 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Tue, 22 Aug 2023 08:29:39 -0700 Subject: [PATCH 17/17] fix: master deployment hosting --- .github/workflows/web-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/web-build.yml b/.github/workflows/web-build.yml index 1404cc4239..29ae3fc5b2 100644 --- a/.github/workflows/web-build.yml +++ b/.github/workflows/web-build.yml @@ -75,7 +75,7 @@ jobs: # Set deployment from input, replacing branch slash name with suffix (`prod/my_deployment` -> `my_deployment`) # https://stackoverflow.com/a/40524879 - name: Set deployment - if: ${{inputs.deployment && inputs.deployment != 'master'}} + if: ${{inputs.deployment && inputs.deployment != 'master' && inputs.deployment!='refs/heads/master'}} run: | echo "DEPLOYMENT_NAME=$(echo ${{inputs.deployment}} | sed 's/.*\///')" >> $GITHUB_ENV; shell: bash