Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: modularize the sdk #103

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .eslintrc.json

This file was deleted.

7 changes: 5 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module.exports = {
"^.+\\.(ts|tsx)$": "ts-jest",
},
coveragePathIgnorePatterns: ["__test__/"],
"collectCoverage": true,
"coverageReporters": ["html"],
collectCoverage: true,
coverageReporters: ["html"],
moduleNameMapper: {
"^lodash-es$": "lodash",
},
};
1,632 changes: 837 additions & 795 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dist"
],
"scripts": {
"build": "webpack --config webpack.prod.js",
"build": "rimraf dist/ && webpack --config webpack.prod.js",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest src --coverage --watchAll --coverageDirectory=\"coverage\"",
Expand All @@ -29,11 +29,11 @@
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"@contentstack/advanced-post-message": "github:contentstack/adv-post-message#EB-676-config-support",
"@contentstack/advanced-post-message": "github:contentstack/adv-post-message#main",
"@testing-library/jest-dom": "^5.14.1",
"@types/jest": "^27.0.1",
"@types/jsdom": "^21.1.6",
"@types/lodash": "^4.14.195",
"@types/lodash-es": "^4.17.12",
"@types/mustache": "^4.2.2",
"@types/uuid": "^8.3.1",
"@typescript-eslint/eslint-plugin": "^4.31.1",
Expand All @@ -49,6 +49,7 @@
"mini-css-extract-plugin": "^2.3.0",
"prettier": "^2.8.4",
"prettier-eslint": "^15.0.1",
"rimraf": "^5.0.5",
"style-loader": "^2.0.0",
"ts-jest": "^27.0.5",
"ts-loader": "^9.4.2",
Expand All @@ -64,9 +65,7 @@
"url": "https://github.com/contentstack/live-preview-sdk.git"
},
"dependencies": {
"just-camel-case": "^4.0.2",
"lodash": "^4.17.21",
"morphdom": "^2.6.1",
"lodash-es": "^4.17.21",
"mustache": "^4.2.0",
"uuid": "^8.3.2"
},
Expand Down
2 changes: 1 addition & 1 deletion src/__test__/data/contentType.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IPageSchema } from "../../types/contentTypeSchema.types";
import { IPageSchema } from "../../cms/types/contentTypeSchema.types";

export function getAllContentTypes(): {
all_fields: IPageSchema;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Config, { updateConfigFromUrl } from "../configHandler";
import { getDefaultConfig } from "../defaults";
import Config, { updateConfigFromUrl } from "../configManager";
import { getDefaultConfig } from "../config.default";

describe("Config", () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getDefaultConfig } from "../defaults";
import { getDefaultConfig } from "../config.default";
import { handleInitData, handleUserConfig } from "../handleUserConfig";
import { PublicLogger } from "../public-logger";
import { PublicLogger } from "../../logger/logger";
import {
IConfig,
IInitData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export function getUserInitData(): IInitData {
return {
ssr: true,
enable: true,
debug: false,
cleanCslpOnProduction: true,
editButton: {
enable: true,
Expand Down Expand Up @@ -40,6 +41,7 @@ export function getDefaultConfig(): IConfig {
return {
ssr: true,
enable: true,
debug: false,
cleanCslpOnProduction: true,
editButton: {
enable: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IConfig, IInitData } from "../types/types";
import { getDefaultConfig, getUserInitData } from "./defaults";
import { getDefaultConfig, getUserInitData } from "./config.default";
import { handleInitData } from "./handleUserConfig";
import { has as lodashHas, set as lodashSet } from "lodash";
import { has as lodashHas, set as lodashSet } from "lodash-es";

class Config {
static config: IConfig = getDefaultConfig();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { shouldRenderEditButton } from ".";
import { PublicLogger } from "./public-logger";
import { shouldRenderEditButton } from "../livePreview/editButton/editButton";
import { PublicLogger } from "../logger/logger";
import {
IClientUrlParams,
IConfig,
Expand Down
1 change: 1 addition & 0 deletions src/configManager/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./configManager";
218 changes: 0 additions & 218 deletions src/contentstack-live-preview-HOC.ts

This file was deleted.

Loading