-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
458 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"eslint-config-custom": patch | ||
"@ensembleui/js-commons": patch | ||
--- | ||
|
||
Add js-commons package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
extends: ["custom/library"], | ||
ignorePatterns: ["tsup.config.ts"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# `js-commons` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-env node */ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "jsdom", | ||
moduleNameMapper: { | ||
"^lodash-es$": "lodash", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@ensembleui/js-commons", | ||
"version": "0.0.1", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"files": [ | ||
"./dist/**" | ||
], | ||
"repository": "https://github.com/EnsembleUI/ensemble-react", | ||
"scripts": { | ||
"dev": "tsup --watch", | ||
"build": "tsup", | ||
"test": "jest --passWithNoTests", | ||
"lint": "eslint ." | ||
}, | ||
"lint-staged": { | ||
"*.{ts,tsx}": "eslint --fix" | ||
}, | ||
"peerDependencies": { | ||
"firebase": "9.10.0" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash-es": "^4.17.8", | ||
"dayjs": "^1.11.10", | ||
"eslint-config-custom": "workspace:*", | ||
"firebase": "9.10.0", | ||
"lodash-es": "^4.17.21", | ||
"tsconfig": "workspace:*", | ||
"tsup": "^7.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
/** | ||
* DTOs = Data Transfer Objects | ||
* | ||
* Mostly equivalent to raw JSON definition over wire | ||
*/ | ||
export interface EnsembleDocument { | ||
readonly id: string; | ||
readonly name: string; | ||
readonly content: string; | ||
readonly type: EnsembleDocumentType; | ||
|
||
readonly description?: string; | ||
readonly isRoot?: boolean; | ||
readonly isDraft?: boolean; | ||
readonly isArchived?: boolean; | ||
readonly updatedAt?: Date; | ||
readonly updatedBy?: { | ||
name: string; | ||
}; | ||
} | ||
|
||
export enum EnsembleDocumentType { | ||
I18n = "i18n", | ||
Theme = "theme", | ||
Asset = "asset", | ||
Screen = "screen", | ||
Font = "font", | ||
Widget = "internal_widget", | ||
Script = "internal_script", | ||
Environment = "config", | ||
Secrets = "secrets", | ||
Label = "label", | ||
} | ||
|
||
export interface ApplicationDTO | ||
extends Omit<EnsembleDocument, "content" | "type"> { | ||
readonly description?: string; | ||
readonly isPublic?: boolean; | ||
readonly isAutoGenerated?: boolean; | ||
readonly isReact?: boolean; | ||
readonly status?: string; | ||
readonly category?: AppCategory; | ||
readonly collaborators?: Map<string, AccessType>; | ||
readonly demoOrder?: number; | ||
readonly publishingHistory?: PublishingHistory[]; | ||
readonly groupLabels?: Map<string, string>; | ||
|
||
readonly manifest?: Record< | ||
string, | ||
Partial<EnsembleDocument> & { | ||
filePath?: string; | ||
} | ||
>; | ||
|
||
readonly screens: ScreenDTO[]; | ||
readonly widgets: WidgetDTO[]; | ||
readonly scripts: ScriptDTO[]; | ||
readonly theme?: ThemeDTO; | ||
readonly themes?: ThemeDTO[]; | ||
readonly languages?: LanguageDTO[]; | ||
readonly assets?: AssetDTO[]; | ||
readonly env?: EnvironmentDTO; | ||
} | ||
|
||
export interface HasLabel { | ||
readonly labelGroup?: Label; | ||
} | ||
|
||
export interface Label { | ||
readonly id: string; | ||
readonly name: string; | ||
} | ||
|
||
export interface PublishingHistory { | ||
readonly publishedTo: string; | ||
readonly createdAt: Date; | ||
readonly publishedBy: string; | ||
readonly publishingLog: string; | ||
readonly role: string; | ||
} | ||
|
||
export type EnsembleLabeledDocument = EnsembleDocument & HasLabel; | ||
|
||
export type ScreenDTO = EnsembleLabeledDocument & { | ||
readonly type: EnsembleDocumentType.Screen; | ||
|
||
readonly path?: string; | ||
// deprecated? | ||
readonly category?: string; | ||
}; | ||
|
||
export type WidgetDTO = EnsembleLabeledDocument & { | ||
readonly type: EnsembleDocumentType.Widget; | ||
}; | ||
|
||
export type ScriptDTO = EnsembleLabeledDocument & { | ||
readonly type: EnsembleDocumentType.Script; | ||
}; | ||
export type ThemeDTO = EnsembleDocument & { | ||
readonly type: EnsembleDocumentType.Theme; | ||
}; | ||
|
||
export type LanguageDTO = EnsembleDocument & { | ||
readonly defaultLocale: boolean; | ||
}; | ||
|
||
export interface EnvironmentDTO { | ||
readonly envVariables?: Record<string, unknown>; | ||
readonly secretVariables?: Record<string, unknown>; | ||
} | ||
|
||
export type AssetDTO = EnsembleDocument & { | ||
readonly type: EnsembleDocumentType.Asset; | ||
readonly fileName: string; | ||
readonly publicUrl: string; | ||
readonly copyText: string; | ||
}; | ||
|
||
export type FontDTO = EnsembleDocument & { | ||
readonly name?: string; | ||
readonly fontFamily: string; | ||
readonly fontWeight: string; | ||
readonly fontStyle: string; | ||
readonly fontType: string; | ||
readonly publicUrl?: string; | ||
}; | ||
|
||
export enum AppCategory { | ||
Demo = "Demo", | ||
Template = "Template", | ||
} | ||
|
||
export enum AccessType { | ||
Read = "read", | ||
Write = "write", | ||
Owner = "owner", | ||
} | ||
|
||
export type EnsembleDocumentHistoryItem = EnsembleDocument & { | ||
readonly comment: string; | ||
readonly label: string; | ||
}; |
Oops, something went wrong.