diff --git a/libs/plugins-data-parser/.eslintrc.json b/libs/plugins-data-parser/.eslintrc.json new file mode 100644 index 0000000..adbe7ae --- /dev/null +++ b/libs/plugins-data-parser/.eslintrc.json @@ -0,0 +1,25 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": "error" + } + } + ] +} diff --git a/libs/plugins-data-parser/README.md b/libs/plugins-data-parser/README.md new file mode 100644 index 0000000..cedc3bd --- /dev/null +++ b/libs/plugins-data-parser/README.md @@ -0,0 +1,7 @@ +# plugins-data-parser + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build plugins-data-parser` to build the library. diff --git a/libs/plugins-data-parser/package.json b/libs/plugins-data-parser/package.json new file mode 100644 index 0000000..a59ea4c --- /dev/null +++ b/libs/plugins-data-parser/package.json @@ -0,0 +1,10 @@ +{ + "name": "plugins-data-parser", + "version": "0.0.1", + "dependencies": { + "tslib": "^2.3.0" + }, + "type": "commonjs", + "main": "./src/index.js", + "typings": "./src/index.d.ts" +} diff --git a/libs/plugins-data-parser/project.json b/libs/plugins-data-parser/project.json new file mode 100644 index 0000000..dfa4f3a --- /dev/null +++ b/libs/plugins-data-parser/project.json @@ -0,0 +1,19 @@ +{ + "name": "plugins-data-parser", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/plugins-data-parser/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/plugins-data-parser", + "main": "libs/plugins-data-parser/src/index.ts", + "tsConfig": "libs/plugins-data-parser/tsconfig.lib.json", + "assets": ["libs/plugins-data-parser/*.md"] + } + } + }, + "tags": [] +} diff --git a/libs/plugins-data-parser/src/index.ts b/libs/plugins-data-parser/src/index.ts new file mode 100644 index 0000000..2ed39dd --- /dev/null +++ b/libs/plugins-data-parser/src/index.ts @@ -0,0 +1 @@ +export * from './lib/plugins-data-parser'; diff --git a/libs/plugins-data-parser/src/lib/models/index.ts b/libs/plugins-data-parser/src/lib/models/index.ts new file mode 100644 index 0000000..cf28d34 --- /dev/null +++ b/libs/plugins-data-parser/src/lib/models/index.ts @@ -0,0 +1 @@ +export * from './parsed-file.model'; diff --git a/libs/plugins-data-parser/src/lib/models/parsed-file.model.ts b/libs/plugins-data-parser/src/lib/models/parsed-file.model.ts new file mode 100644 index 0000000..1ec71f1 --- /dev/null +++ b/libs/plugins-data-parser/src/lib/models/parsed-file.model.ts @@ -0,0 +1,127 @@ +export interface ParsedFile { + id: string; + name: string; + data: FileData; +} + +export interface FileData { + id: string; + version: number; + colors: IdData[]; + typographies: IdData[]; + pages: RootTail; // Tail is an array of uuid (string) + pagesIndex?: IdData[]; + components: IdData[]; + media?: IdData[]; +} + +export interface Color { + color: string; + opacity: number; + id: string; + name: string; + fileId: string; + path: string | null; +} + +export interface Typhography { + lineHeight: string; + path: string | null; + fontStyle: string; + textTransform: string; + fontId: string; + fontSize: string; + fontWeight: string; + name: string; + fontVariantId: string; + id: string; + letterSpacing: string; + fontFamily: string; + modifiedAt?: Date; +} + +export interface PageIndex { + options: IdData