@zohodesk/react-cli 0.0.1-beta.17 → 0.0.1-beta.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/.eslintrc.js +49 -10
- package/.prettierrc +6 -0
- package/CHANGELOG.md +5 -0
- package/README.md +859 -0
- package/bin/cli.js +215 -46
- package/cert/Tsicsezwild-22-23.crt +37 -0
- package/cert/Tsicsezwild-22-23.key +27 -0
- package/docs/CustomChunks.md +26 -0
- package/docs/DevStart.md +18 -0
- package/docs/HoverActive.md +12 -0
- package/docs/InstallNode.md +28 -0
- package/docs/TODOS.md +10 -0
- package/docs/ValueReplacer.md +60 -0
- package/docs/warnings_while_install.txt +35 -0
- package/files/eslintrc.js +62 -0
- package/files/prettierrc.js +3 -0
- package/lib/babel/cmjs-plugins-presets.js +24 -0
- package/lib/babel/es-plugins-presets.js +34 -0
- package/lib/common/getEntries.js +33 -46
- package/lib/common/getPublicPathConfig.js +40 -0
- package/lib/common/index.js +24 -19
- package/lib/common/splitChunks.js +110 -25
- package/lib/common/sslcertUpdater.js +59 -0
- package/lib/common/templateParameters.js +25 -0
- package/lib/common/testPattern.js +69 -0
- package/lib/common/valueReplacer.js +55 -0
- package/lib/configs/jest.config.js +31 -27
- package/lib/configs/libAlias.js +31 -0
- package/lib/configs/webpack.component.umd.config.js +46 -53
- package/lib/configs/webpack.css.umd.config.js +47 -46
- package/lib/configs/webpack.dev.config.js +99 -84
- package/lib/configs/webpack.docs.config.js +65 -57
- package/lib/configs/webpack.impact.config.js +109 -0
- package/lib/configs/webpack.prod.config.js +147 -104
- package/lib/hooks/docsProptypeHook.js +32 -38
- package/lib/jest/commitedFilesResult.js +144 -71
- package/lib/jest/coverageCollector.js +68 -35
- package/lib/jest/jsonMaker.js +54 -0
- package/lib/jest/preProcessors/cssPreprocessor.js +16 -18
- package/lib/jest/preProcessors/jsPreprocessor.js +5 -6
- package/lib/jest/preProcessors/otherFilesPreprocessor.js +5 -6
- package/lib/jest/result.js +92 -42
- package/lib/jest/run.js +75 -28
- package/lib/jest/setup.js +103 -102
- package/lib/loaderUtils/configsAssetsLoaders.js +117 -0
- package/lib/loaderUtils/getCSSLoaders.js +113 -0
- package/lib/loaderUtils/getDevJsLoaders.js +35 -23
- package/lib/loaderUtils/index.js +14 -7
- package/lib/loaders/docsLoader.js +15 -15
- package/lib/loaders/docsPropsLoader.js +14 -17
- package/lib/loaders/fileBountryLoader.js +17 -0
- package/lib/loaders/fileLoader.js +47 -38
- package/lib/loaders/scriptInstrumentLoader.js +23 -20
- package/lib/loaders/selectorMappingLoader.js +75 -0
- package/lib/loaders/workerLoader.js +136 -0
- package/lib/middlewares/HMRMiddleware.js +90 -72
- package/lib/middlewares/SSTMiddleware.js +21 -0
- package/lib/pluginUtils/getDevPlugins.js +177 -30
- package/lib/pluginUtils/getDocsPlugins.js +36 -15
- package/lib/pluginUtils/getLibraryImactPlugins.js +23 -0
- package/lib/pluginUtils/getLibraryPlugins.js +8 -10
- package/lib/pluginUtils/getProdPlugins.js +244 -37
- package/lib/pluginUtils/getServerPlugins.js +8 -11
- package/lib/pluginUtils/getUMDCSSPlugins.js +14 -18
- package/lib/pluginUtils/getUMDComponentPlugins.js +14 -9
- package/lib/pluginUtils/index.js +36 -43
- package/lib/plugins/CdnChangePlugin.js +77 -0
- package/lib/plugins/CleanupStatsPlugin.js +28 -0
- package/lib/plugins/EFCPlugin.js +241 -0
- package/lib/plugins/EFCPlugin.md +6 -0
- package/lib/plugins/EFCTemplatePlugin.js +151 -0
- package/lib/plugins/I18NInjectIntoIndexPlugin.js +141 -0
- package/lib/plugins/I18nSplitPlugin/I18nDebugPlugin.js +60 -0
- package/lib/plugins/I18nSplitPlugin/I18nDependency.js +44 -0
- package/lib/plugins/I18nSplitPlugin/I18nDownlodLogic.js +266 -0
- package/lib/plugins/I18nSplitPlugin/I18nFilesEmitter.js +183 -0
- package/lib/plugins/I18nSplitPlugin/I18nKeysIdentifer.js +100 -0
- package/lib/plugins/I18nSplitPlugin/I18nSplit.md +95 -0
- package/lib/plugins/I18nSplitPlugin/README.md +25 -0
- package/lib/plugins/I18nSplitPlugin/index.js +185 -0
- package/lib/plugins/I18nSplitPlugin/utils/collectI18nKeys.js +64 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nFileUrlPathTemplate.js +13 -0
- package/lib/plugins/I18nSplitPlugin/utils/getI18nKeysFormModules.js +26 -0
- package/lib/plugins/I18nSplitPlugin/utils/hashUtils.js +40 -0
- package/lib/plugins/I18nSplitPlugin/utils/index.js +31 -0
- package/lib/plugins/I18nSplitPlugin/utils/propertiesUtils.js +112 -0
- package/lib/plugins/ManifestPlugin.js +86 -0
- package/lib/plugins/ModuleStatsPlugin.js +98 -97
- package/lib/plugins/OptimizeJSPlugin.js +41 -0
- package/lib/plugins/PublicPathCallbackPlugin.js +63 -0
- package/lib/plugins/PublicPathChangePlugin.js +226 -0
- package/lib/plugins/ReportGeneratePlugin.js +181 -0
- package/lib/plugins/RequireVariablePublicPlugin.js +30 -0
- package/lib/plugins/ResourceHintsPlugin.js +67 -0
- package/lib/plugins/RtlSplitPlugin/OverwriteCssPathForRTL.js +80 -0
- package/lib/plugins/RtlSplitPlugin/RtlCssPlugin.js +82 -0
- package/lib/plugins/RtlSplitPlugin/RtrSplit.md +30 -0
- package/lib/plugins/RtlSplitPlugin/replaceCssDirTemplate.js +26 -0
- package/lib/plugins/ScriptInstrumentPlugin.js +22 -37
- package/lib/plugins/ServiceWorkerPlugin.js +107 -0
- package/lib/plugins/ShadowDOMSupportPlugin.js +270 -0
- package/lib/plugins/SourceMapHookPlugin.js +25 -59
- package/lib/plugins/TPHashMappingPlugin.js +67 -0
- package/lib/plugins/UglifyCSSPlugin.js +39 -0
- package/lib/plugins/UnusedFilesFindPlugin.js +150 -97
- package/lib/plugins/index.js +127 -37
- package/lib/plugins/libraryImpactPlugin.js +190 -0
- package/lib/plugins/webpackwatchrunplugin.js +26 -0
- package/lib/postcss-plugins/ExcludePlugin.js +23 -0
- package/lib/postcss-plugins/RTLSplitPlugin.js +138 -0
- package/lib/postcss-plugins/ValueReplacer.js +46 -0
- package/lib/postcss-plugins/__test__/hoverActivePlugin.spec.js +22 -0
- package/lib/postcss-plugins/__test__/test1Input.css +39 -0
- package/lib/postcss-plugins/__test__/test1Output.css +39 -0
- package/lib/postcss-plugins/hoverActivePlugin.js +368 -0
- package/lib/postcss-plugins/variableModifier.js +243 -0
- package/lib/schemas/index.js +541 -65
- package/lib/servers/clusterHubServer.js +22 -26
- package/lib/servers/devBuild.js +102 -0
- package/lib/servers/docsServer.js +3 -5
- package/lib/servers/docsServerCore.js +94 -79
- package/lib/servers/getCliPath.js +28 -0
- package/lib/servers/helpServer.js +19 -21
- package/lib/servers/httpsOptions.js +18 -0
- package/lib/servers/impactServer.js +123 -115
- package/lib/servers/mockserver.js +44 -0
- package/lib/servers/nowatchserver.js +200 -0
- package/lib/servers/scrServer.js +147 -0
- package/lib/servers/server.js +134 -132
- package/lib/servers/ssServer.js +106 -70
- package/lib/sh/reportPublish.sh +16 -10
- package/lib/templates/CoverageScriptTemplate.js +45 -18
- package/lib/templates/WMSTemplate.js +17 -18
- package/lib/templates/linterConstant.js +10 -0
- package/lib/utils/babelPresets.js +12 -4
- package/lib/utils/buildstats.html +148 -0
- package/lib/utils/clean.js +12 -11
- package/lib/utils/copy.js +16 -109
- package/lib/utils/copyTimezones.js +21 -0
- package/lib/utils/createEventStream.js +24 -19
- package/lib/utils/cssClassNameGenerate.js +77 -0
- package/lib/utils/cssURLReplacer.js +136 -0
- package/lib/utils/dependencyPostPublish.js +42 -0
- package/lib/utils/fileUtils.js +125 -0
- package/lib/utils/folderIterator.js +47 -0
- package/lib/utils/getComponents.js +126 -0
- package/lib/utils/getCurrentBranch.js +11 -17
- package/lib/utils/getDependenciesImpactList.js +151 -0
- package/lib/utils/getHash.js +26 -0
- package/lib/utils/getIp.js +20 -0
- package/lib/utils/getOptions.js +113 -28
- package/lib/utils/getServerURL.js +25 -8
- package/lib/utils/index.js +283 -68
- package/lib/utils/init.js +2 -2
- package/lib/utils/initPreCommitHook.js +47 -27
- package/lib/utils/jsonHelper.js +106 -0
- package/lib/utils/libraryImpactConfig.js +63 -0
- package/lib/utils/lint/addScripts.js +27 -0
- package/lib/utils/lint/checkExistingConfig.js +67 -0
- package/lib/utils/lint/copyConfigs.js +24 -0
- package/lib/utils/lint/index.js +54 -0
- package/lib/utils/lint/lintScripts.js +11 -0
- package/lib/utils/lint/lintSetup.js +31 -0
- package/lib/utils/lint/lintStagedPreCommitHook.js +7 -0
- package/lib/utils/lint/question.js +30 -0
- package/lib/utils/lintReporter.js +142 -0
- package/lib/utils/mailSender.js +16 -25
- package/lib/utils/pullOrigin.js +28 -0
- package/lib/utils/reinstallDependencies.js +133 -0
- package/lib/utils/removeAttributes.js +25 -23
- package/lib/utils/repoClone.js +59 -63
- package/lib/utils/request.js +64 -77
- package/lib/utils/resultSchema.json +73 -0
- package/lib/utils/rtl.js +59 -0
- package/lib/utils/setEnvVariables.js +13 -0
- package/lib/utils/ssTestHack.js +48 -0
- package/lib/utils/switchBranch.js +28 -0
- package/lib/utils/urlConcat.js +22 -0
- package/lib/utils/useExitCleanup.js +55 -0
- package/npm8.md +9 -0
- package/package.json +96 -64
- package/postpublish.js +6 -0
- package/templates/app/.eslintrc.js +140 -0
- package/templates/app/README.md +12 -12
- package/templates/app/app/index.html +24 -8
- package/templates/app/app/properties/ApplicationResources_en_US.properties +1 -1
- package/templates/app/app/properties/i18nkeys.json +3 -3
- package/templates/app/docs/all.html +69 -69
- package/templates/app/mockapi/index.js +18 -13
- package/templates/app/package.json +37 -17
- package/templates/app/src/actions/SampleActions/index.js +37 -0
- package/templates/app/src/actions/index.js +65 -0
- package/templates/app/src/appUrls.js +19 -0
- package/templates/app/src/components/Alert/Alert.js +134 -0
- package/templates/app/src/components/Alert/Alert.module.css +79 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.css +37 -0
- package/templates/app/src/components/FreezeLayer/FreezeLayer.js +84 -0
- package/templates/app/src/components/Sample/Sample.module.css +11 -0
- package/templates/app/src/components/Sample/SampleList.js +61 -0
- package/templates/app/src/components/Slider/Slider.css +41 -0
- package/templates/app/src/components/Slider/Slider.js +55 -0
- package/templates/app/src/containers/AlertContainer/index.js +15 -0
- package/templates/app/src/containers/AppContainer/index.js +96 -0
- package/templates/app/src/containers/AppContainer/index.module.css +27 -0
- package/templates/app/src/containers/CustomMatch/index.js +65 -0
- package/templates/app/src/containers/DevTools/index.js +10 -0
- package/templates/app/src/containers/Header/index.js +67 -0
- package/templates/app/src/containers/Header/index.module.css +43 -0
- package/templates/app/src/containers/Redirect/index.js +63 -0
- package/templates/app/src/containers/Redirector/index.js +47 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.js +42 -0
- package/templates/app/src/containers/SampleListContainer/ListContainer.module.css +3 -0
- package/templates/app/src/historyChange.js +5 -0
- package/templates/app/src/index.html +10 -0
- package/templates/app/src/index.js +24 -0
- package/templates/app/src/middleware/PromiseMiddleware.js +59 -0
- package/templates/app/src/reducers/alertData.js +11 -0
- package/templates/app/src/reducers/index.js +6 -0
- package/templates/app/src/reducers/samples.js +19 -0
- package/templates/app/src/store/configureStore.dev.js +51 -0
- package/templates/app/src/store/configureStore.js +5 -0
- package/templates/app/src/store/configureStore.prod.js +26 -0
- package/templates/app/src/util/Common.js +5 -0
- package/templates/app/src/util/RequestAPI.js +132 -0
- package/templates/appold/README.md +12 -0
- package/templates/appold/app/index.html +8 -0
- package/templates/appold/app/properties/ApplicationResources_en_US.properties +1 -0
- package/templates/appold/app/properties/i18nkeys.json +3 -0
- package/templates/appold/docs/all.html +69 -0
- package/templates/appold/mockapi/index.js +13 -0
- package/templates/{app → appold}/mockapi/tickets.json +0 -0
- package/templates/appold/package.json +17 -0
- package/templates/appold/src/components/Text/Text.css +0 -0
- package/templates/appold/src/components/Text/Text.js +23 -0
- package/templates/appold/src/components/Text/__tests__/Text.spec.js +30 -0
- package/templates/appold/src/components/Text/docs/Text__default.docs.js +16 -0
- package/templates/appold/src/components/docs.js +1 -0
- package/templates/appold/src/components/index.js +5 -0
- package/templates/appold/src/index.js +13 -0
- package/templates/docs/all.html +1 -1
- package/templates/docs/component.html +110 -69
- package/templates/docs/components.html +221 -0
- package/templates/docs/css/component.css +12 -14
- package/templates/docs/css/componentTest.css +7 -0
- package/templates/docs/css/style.css +150 -206
- package/templates/docs/impactReportTemplate.html +154 -0
- package/templates/docs/index.html +1482 -1336
- package/templates/library/src/index.js +0 -0
- package/.npmignore +0 -3
- package/cert/cert.pem +0 -129
- package/cert/key.pem +0 -27
- package/lib/common/getInsertAt.js +0 -36
- package/lib/common/getInsertIntoFunction.js +0 -13
- package/lib/configs/webpack.server.config.js +0 -93
- package/lib/plugins/ChunkManifestReplacePlugin.js +0 -94
- package/lib/plugins/RuntimePublicPathPlugin.js +0 -46
- package/lib/rmcntrlm.sh +0 -14
- package/lib/servers/nodeServer.js +0 -238
- package/lib/templates/HMRTemplate.js +0 -256
- package/lib/templates/publicPathTemplate.js +0 -16
- package/lib/utils/setConfig.js +0 -14
- package/node_modules/history/CHANGES.md +0 -395
- package/node_modules/history/DOMUtils.js +0 -3
- package/node_modules/history/ExecutionEnvironment.js +0 -3
- package/node_modules/history/LICENSE +0 -21
- package/node_modules/history/LocationUtils.js +0 -3
- package/node_modules/history/PathUtils.js +0 -3
- package/node_modules/history/README.md +0 -282
- package/node_modules/history/cjs/history.js +0 -933
- package/node_modules/history/cjs/history.min.js +0 -1
- package/node_modules/history/createBrowserHistory.js +0 -3
- package/node_modules/history/createHashHistory.js +0 -3
- package/node_modules/history/createMemoryHistory.js +0 -3
- package/node_modules/history/createTransitionManager.js +0 -3
- package/node_modules/history/es/DOMUtils.js +0 -7
- package/node_modules/history/es/ExecutionEnvironment.js +0 -7
- package/node_modules/history/es/LocationUtils.js +0 -7
- package/node_modules/history/es/PathUtils.js +0 -7
- package/node_modules/history/es/createBrowserHistory.js +0 -7
- package/node_modules/history/es/createHashHistory.js +0 -7
- package/node_modules/history/es/createMemoryHistory.js +0 -7
- package/node_modules/history/es/createTransitionManager.js +0 -7
- package/node_modules/history/es/warnAboutDeprecatedESMImport.js +0 -35
- package/node_modules/history/esm/history.js +0 -904
- package/node_modules/history/index.js +0 -7
- package/node_modules/history/package.json +0 -134
- package/node_modules/history/umd/history.js +0 -1059
- package/node_modules/history/umd/history.min.js +0 -1
- package/node_modules/history/warnAboutDeprecatedCJSRequire.js +0 -35
- package/templates/app/.npmignore +0 -9
- package/templates/library/.npmignore +0 -9
@@ -0,0 +1,26 @@
|
|
1
|
+
import { createBrowserHistory } from "history";
|
2
|
+
import { reduxRouter } from "@zohodesk/router-middleware";
|
3
|
+
import { createStore, applyMiddleware, compose, combineReducers } from "redux";
|
4
|
+
import { historyChange } from "../historyChange";
|
5
|
+
import thunk from "redux-thunk";
|
6
|
+
import rootReducer from "../reducers";
|
7
|
+
|
8
|
+
const configureStore = preloadedState => {
|
9
|
+
let history = createBrowserHistory();
|
10
|
+
|
11
|
+
let { historyMiddleware, routing } = reduxRouter(
|
12
|
+
history,
|
13
|
+
getUrls(),
|
14
|
+
historyChange
|
15
|
+
);
|
16
|
+
|
17
|
+
let middleWare = compose(applyMiddleware(thunk, historyMiddleware));
|
18
|
+
|
19
|
+
return createStore(
|
20
|
+
combineReducers(Object.assign(rootReducer, { routing })),
|
21
|
+
preloadedState,
|
22
|
+
middleWare
|
23
|
+
);
|
24
|
+
};
|
25
|
+
|
26
|
+
export default configureStore;
|
@@ -0,0 +1,132 @@
|
|
1
|
+
/*$Id$*/
|
2
|
+
export default function(url, header = null) {
|
3
|
+
let contentType = "json";
|
4
|
+
let core = {
|
5
|
+
ajax(method, url, args, payload, files, onProcess) {
|
6
|
+
let p = new Promise((resolve, reject) => {
|
7
|
+
let client = new XMLHttpRequest();
|
8
|
+
let uri = url;
|
9
|
+
var data = "";
|
10
|
+
if (args && (method === "POST" || method === "PUT")) {
|
11
|
+
let argcount = 0;
|
12
|
+
for (let key in args) {
|
13
|
+
if ({}.hasOwnProperty.call(args, key)) {
|
14
|
+
if (argcount++) {
|
15
|
+
data += "&";
|
16
|
+
}
|
17
|
+
data += `${encodeURIComponent(key)}=${encodeURIComponent(
|
18
|
+
args[key]
|
19
|
+
)}`;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
client.upload.addEventListener("progress", onProcess);
|
25
|
+
|
26
|
+
client.open(method, uri);
|
27
|
+
|
28
|
+
if (header) {
|
29
|
+
Object.keys(header).forEach(key => {
|
30
|
+
client.setRequestHeader(key, header[key]);
|
31
|
+
});
|
32
|
+
}
|
33
|
+
|
34
|
+
if (files && files.constructor === new FormData().constructor) {
|
35
|
+
client.send(files);
|
36
|
+
} else if (files) {
|
37
|
+
var data = new FormData();
|
38
|
+
data.append("file", files[0]);
|
39
|
+
client.send(data);
|
40
|
+
} else if (payload) {
|
41
|
+
if (payload instanceof FormData) {
|
42
|
+
client.send(payload);
|
43
|
+
} else {
|
44
|
+
if (contentType == "json") {
|
45
|
+
client.setRequestHeader(
|
46
|
+
"Content-Type",
|
47
|
+
"application/json;charset=UTF-8"
|
48
|
+
);
|
49
|
+
client.send(JSON.stringify(payload));
|
50
|
+
} else {
|
51
|
+
client.setRequestHeader(
|
52
|
+
"Content-Type",
|
53
|
+
"application/x-www-form-urlencoded;charset=UTF-8"
|
54
|
+
);
|
55
|
+
let data = "";
|
56
|
+
let argcount = 0;
|
57
|
+
for (let key in payload) {
|
58
|
+
if ({}.hasOwnProperty.call(payload, key)) {
|
59
|
+
if (argcount++) {
|
60
|
+
data += "&";
|
61
|
+
}
|
62
|
+
data += `${encodeURIComponent(key)}=${encodeURIComponent(
|
63
|
+
payload[key]
|
64
|
+
)}`;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
client.send(data);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
} else {
|
71
|
+
client.setRequestHeader(
|
72
|
+
"Content-Type",
|
73
|
+
"application/x-www-form-urlencoded"
|
74
|
+
);
|
75
|
+
client.send(data);
|
76
|
+
}
|
77
|
+
|
78
|
+
client.onload = function() {
|
79
|
+
if (
|
80
|
+
this.status === 200 ||
|
81
|
+
this.status === 201 ||
|
82
|
+
this.status === 204
|
83
|
+
) {
|
84
|
+
let response = this.response ? this.response : this.responseText;
|
85
|
+
if (response === "") {
|
86
|
+
resolve({ responseStatus: this.status }, () => percentComplete);
|
87
|
+
} else {
|
88
|
+
try {
|
89
|
+
resolve(JSON.parse(response));
|
90
|
+
} catch (e) {
|
91
|
+
resolve(response);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
} else {
|
95
|
+
reject(this);
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
client.onerror = function() {
|
100
|
+
reject(this);
|
101
|
+
};
|
102
|
+
});
|
103
|
+
p.getProgress = () => p.progress;
|
104
|
+
return p;
|
105
|
+
}
|
106
|
+
};
|
107
|
+
|
108
|
+
return {
|
109
|
+
get() {
|
110
|
+
return core.ajax("GET", url);
|
111
|
+
},
|
112
|
+
patch(args, payload) {
|
113
|
+
return core.ajax("PATCH", url, args, payload);
|
114
|
+
},
|
115
|
+
post(args, payload) {
|
116
|
+
return core.ajax("POST", url, args, payload);
|
117
|
+
},
|
118
|
+
put(args, payload, files) {
|
119
|
+
return core.ajax("PUT", url, args, payload, files);
|
120
|
+
},
|
121
|
+
del() {
|
122
|
+
return core.ajax("DELETE", url);
|
123
|
+
},
|
124
|
+
attach(files, onProcess) {
|
125
|
+
return core.ajax("POST", url, {}, undefined, files, onProcess);
|
126
|
+
},
|
127
|
+
setContentType(type) {
|
128
|
+
contentType = type;
|
129
|
+
return this;
|
130
|
+
}
|
131
|
+
};
|
132
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
app.key=key
|
@@ -0,0 +1,69 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
5
|
+
<style type="text/css">
|
6
|
+
.comps
|
7
|
+
{
|
8
|
+
padding: 10px;
|
9
|
+
max-width: 100%;
|
10
|
+
margin-bottom: 10px;
|
11
|
+
border-bottom: 1px solid #f5f5f5;
|
12
|
+
}
|
13
|
+
.componentNameRed
|
14
|
+
{
|
15
|
+
color: red;
|
16
|
+
}
|
17
|
+
.propertyName
|
18
|
+
{
|
19
|
+
color:green;
|
20
|
+
margin-left: 10px;
|
21
|
+
}
|
22
|
+
.valueName
|
23
|
+
{
|
24
|
+
color:orange;
|
25
|
+
margin-right: 10px;
|
26
|
+
}
|
27
|
+
.example
|
28
|
+
{
|
29
|
+
padding: 20px 20px 20px 0px;
|
30
|
+
width: 100%;
|
31
|
+
box-sizing: border-box;
|
32
|
+
margin: 15px 0px;
|
33
|
+
}
|
34
|
+
.htmlTag
|
35
|
+
{
|
36
|
+
color: #999;
|
37
|
+
color: #676565;
|
38
|
+
line-height: 25px;
|
39
|
+
margin-bottom: 10px;
|
40
|
+
font-size: 13px;
|
41
|
+
}
|
42
|
+
.textArea
|
43
|
+
{
|
44
|
+
min-width: 50%;
|
45
|
+
outline: none;
|
46
|
+
min-height: 100px;
|
47
|
+
margin: 15px 0px;
|
48
|
+
max-width: 90%;
|
49
|
+
}
|
50
|
+
|
51
|
+
</style>
|
52
|
+
</head>
|
53
|
+
<body>
|
54
|
+
<div id="react">
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<script src="/docs/js/vendor.js" ></script>
|
59
|
+
<script src="/docs/js/main.js" ></script>
|
60
|
+
<script>
|
61
|
+
var React = Component.React;
|
62
|
+
var ReactDOM = Component.ReactDOM;
|
63
|
+
var Text__default = Component.Text__default;
|
64
|
+
ReactDOM.render(React.createElement(Text__default), react);
|
65
|
+
</script>
|
66
|
+
|
67
|
+
|
68
|
+
</body>
|
69
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
var path = require('path');
|
2
|
+
var fs = require('fs');
|
3
|
+
|
4
|
+
function mockServer(app) {
|
5
|
+
var responseMapper = (url, file, type = 'application/json') => {
|
6
|
+
app.use(url, function(req, res) {
|
7
|
+
res.setHeader('Content-Type', type);
|
8
|
+
res.sendFile(path.join(__dirname, file));
|
9
|
+
});
|
10
|
+
};
|
11
|
+
responseMapper('/api/v1/tickets', 'tickets.json');
|
12
|
+
}
|
13
|
+
module.exports = mockServer;
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"name": "testapp",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "index.js",
|
6
|
+
"scripts": {
|
7
|
+
"clean": "react-cli clean build unittest coverage",
|
8
|
+
"docs":"react-cli docs",
|
9
|
+
"component":"react-cli build:component",
|
10
|
+
"component:umd":"react-cli build:component:umd",
|
11
|
+
"start": "react-cli start",
|
12
|
+
"build": "react-cli build",
|
13
|
+
"test": "npm run clean && react-cli test"
|
14
|
+
},
|
15
|
+
"author": "",
|
16
|
+
"license": "ISC"
|
17
|
+
}
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
export default class Text extends React.Component {
|
4
|
+
render() {
|
5
|
+
return (
|
6
|
+
<div
|
7
|
+
data-testid="data"
|
8
|
+
onClick={this.props.onClick.bind(this, this.props.content)}
|
9
|
+
>
|
10
|
+
{this.props.content}
|
11
|
+
</div>
|
12
|
+
);
|
13
|
+
}
|
14
|
+
}
|
15
|
+
Text.propTypes = {
|
16
|
+
content: PropTypes.string.isRequired,
|
17
|
+
onClick: PropTypes.func.isRequired
|
18
|
+
};
|
19
|
+
if (__DOCS__) {
|
20
|
+
Text.docs = {
|
21
|
+
componentGroup: 'Atom'
|
22
|
+
};
|
23
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import Text from '../Text';
|
3
|
+
|
4
|
+
describe('Text component specification', () => {
|
5
|
+
it('should display text content', () => {
|
6
|
+
var renderedDOM = TestUtils.renderIntoDocument(
|
7
|
+
<Text content="vimal" onClick={() => {}} />
|
8
|
+
);
|
9
|
+
expect(
|
10
|
+
TestUtils.findRenderedComponentsWithTestid(
|
11
|
+
renderedDOM,
|
12
|
+
'data'
|
13
|
+
).textContent.contains('vimal')
|
14
|
+
).toBe(true);
|
15
|
+
});
|
16
|
+
|
17
|
+
it('should call onClick ', () => {
|
18
|
+
var mockfn = jest.fn();
|
19
|
+
var renderedDOM = TestUtils.renderIntoDocument(
|
20
|
+
<Text content="vimal" onClick={mockfn} />
|
21
|
+
);
|
22
|
+
var textEle = TestUtils.findRenderedComponentsWithTestid(
|
23
|
+
renderedDOM,
|
24
|
+
'data'
|
25
|
+
);
|
26
|
+
TestUtils.Simulate.click(textEle);
|
27
|
+
expect(mockfn.mock.calls.length).toBe(1);
|
28
|
+
expect(mockfn.mock.calls[0][0]).toBe('vimal1');
|
29
|
+
});
|
30
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React, { Component } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import Text from '../Text';
|
4
|
+
export default class Text__default extends Component {
|
5
|
+
constructor(props) {
|
6
|
+
super(props);
|
7
|
+
}
|
8
|
+
render() {
|
9
|
+
return <Text content="vimal" onClick={val => {}} />;
|
10
|
+
}
|
11
|
+
}
|
12
|
+
if (__DOCS__) {
|
13
|
+
Text__default.docs = {
|
14
|
+
componentGroup: 'Atom'
|
15
|
+
};
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as Text__default } from './Text/docs/Text__default.docs';
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import ReactDOM from 'react-dom';
|
3
|
+
import Text from './components/Text/Text';
|
4
|
+
ReactDOM.render(
|
5
|
+
<Text content="vimalesan" onClick={v => {}} />,
|
6
|
+
document.getElementById('react')
|
7
|
+
);
|
8
|
+
if (!__DEVELOPMENT__) {
|
9
|
+
global.publicPath = function(chunkId) {
|
10
|
+
__webpack_public_path__ = `https://static${chunkId %
|
11
|
+
3}.tsi.zohocorpin.com:9090/app/`;
|
12
|
+
};
|
13
|
+
}
|
package/templates/docs/all.html
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
|
-
<html class="isRem">
|
2
|
+
<html class="isRem" dir="ltr">
|
3
3
|
<head>
|
4
4
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
@@ -17,20 +17,29 @@
|
|
17
17
|
var ReactDOM = Component.ReactDOM;
|
18
18
|
var React = Component.React;
|
19
19
|
var ReactDOMServer = Component.ReactDOMServer;
|
20
|
+
|
20
21
|
class RenderComponent extends React.Component {
|
21
22
|
constructor(props) {
|
22
23
|
super(props);
|
23
24
|
this.state = {
|
24
25
|
Components: Component,
|
25
|
-
|
26
|
-
|
26
|
+
isError:false,
|
27
|
+
selectedComponent:location.hash != '' ? location.hash.substring(1) : null,
|
28
|
+
componentList:window.componentList?window.componentList:Component
|
27
29
|
};
|
28
30
|
this.hashChange = this.hashChange.bind(this);
|
29
31
|
}
|
30
32
|
hashChange() {
|
33
|
+
let parentFrameNode = parent.document.getElementById('loadingText');
|
31
34
|
this.setState({
|
32
35
|
selectedComponent:
|
33
36
|
location.hash != '' ? location.hash.substring(1) : null
|
37
|
+
},()=>{
|
38
|
+
if(this.error) {
|
39
|
+
location.reload();
|
40
|
+
parentFrameNode? parentFrameNode.style.display = 'block':parentFrameNode.style.display='none';
|
41
|
+
this.error = false;
|
42
|
+
}
|
34
43
|
});
|
35
44
|
}
|
36
45
|
|
@@ -43,85 +52,117 @@
|
|
43
52
|
componentWillUnmount() {
|
44
53
|
window.removeEventListener('hashchange', this.hashChange);
|
45
54
|
}
|
55
|
+
|
56
|
+
componentDidCatch(){
|
57
|
+
this.error = true;
|
58
|
+
this.setState({isError:this.error})
|
59
|
+
}
|
46
60
|
render() {
|
47
|
-
const { Components, selectedComponent
|
61
|
+
const { Components, selectedComponent,componentList} = this.state;
|
62
|
+
// var CLG=[]
|
63
|
+
// var complistGroup=Object.keys(componentList).map((item,i)=>{
|
64
|
+
// if(Array.isArray(componentList[item].docs.testProps)){
|
65
|
+
// CLG.push(item)
|
66
|
+
// }
|
67
|
+
// })
|
48
68
|
|
69
|
+
let msg=componentList[selectedComponent]?'Sorry! for the inconvenience.':'Sorry! Request URL not found.'
|
49
70
|
var ComponentClass =
|
50
|
-
selectedComponent &&
|
71
|
+
selectedComponent && componentList[selectedComponent];
|
51
72
|
var keysSingleAr =
|
52
73
|
(ComponentClass &&
|
53
74
|
ComponentClass.docs &&
|
54
75
|
ComponentClass.docs.testProps &&
|
55
|
-
Object.keys(ComponentClass.docs.testProps)) ||
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
className={'smileIcon'}
|
80
|
-
>
|
81
|
-
<linearGradient
|
82
|
-
id="SVGID_1_"
|
83
|
-
gradientUnits="userSpaceOnUse"
|
84
|
-
x1="256"
|
85
|
-
y1="514"
|
86
|
-
x2="256"
|
87
|
-
y2="2"
|
88
|
-
gradientTransform="matrix(1 0 0 -1 0 514)"
|
89
|
-
>
|
90
|
-
<stop offset="0" style={{ stopColor: '#2AF598' }} />
|
91
|
-
<stop offset="1" style={{ stopColor: '#009EFD' }} />
|
92
|
-
</linearGradient>
|
93
|
-
<path
|
94
|
-
style={{ fill: 'url(#SVGID_1_)' }}
|
95
|
-
d="M344.354,381.58c-1.33-1.651-33.207-40.458-88.354-40.458
|
96
|
-
c-55.832,0-87.972,39.974-88.29,40.378l-31.42-24.756c1.79-2.271,44.687-55.622,119.71-55.622s117.92,53.352,119.71,55.622
|
97
|
-
L344.29,381.5L344.354,381.58z M437.02,437.02C485.371,388.668,512,324.38,512,256s-26.629-132.667-74.98-181.02
|
98
|
-
C388.667,26.629,324.38,0,256,0S123.333,26.629,74.98,74.98C26.629,123.333,0,187.62,0,256s26.629,132.668,74.98,181.02
|
99
|
-
C123.333,485.371,187.62,512,256,512S388.667,485.371,437.02,437.02z M472,256c0,119.103-96.897,216-216,216S40,375.103,40,256
|
100
|
-
S136.897,40,256,40S472,136.897,472,256z M168,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
|
101
|
-
S150.327,212.122,168,212.122z M344,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
|
102
|
-
S326.327,212.122,344,212.122z"
|
103
|
-
/>
|
104
|
-
</svg>
|
105
|
-
<div>Please click the components on left side menu bar</div>
|
106
|
-
</div>
|
107
|
-
)}
|
76
|
+
Object.keys(ComponentClass.docs.testProps)) || [];
|
77
|
+
var ErrorMessage=(
|
78
|
+
<div className={'emptyState'}>
|
79
|
+
<svg
|
80
|
+
x='0px'
|
81
|
+
y='0px'
|
82
|
+
viewBox='0 0 512 512'
|
83
|
+
style={{ enableBackground: 'new 0 0 512 512' }}
|
84
|
+
xmlSpace='preserve'
|
85
|
+
className={'smileIcon'}
|
86
|
+
>
|
87
|
+
<path
|
88
|
+
style={{ fill: '#f00' }}
|
89
|
+
d='M344.354,381.58c-1.33-1.651-33.207-40.458-88.354-40.458
|
90
|
+
c-55.832,0-87.972,39.974-88.29,40.378l-31.42-24.756c1.79-2.271,44.687-55.622,119.71-55.622s117.92,53.352,119.71,55.622
|
91
|
+
L344.29,381.5L344.354,381.58z M437.02,437.02C485.371,388.668,512,324.38,512,256s-26.629-132.667-74.98-181.02
|
92
|
+
C388.667,26.629,324.38,0,256,0S123.333,26.629,74.98,74.98C26.629,123.333,0,187.62,0,256s26.629,132.668,74.98,181.02
|
93
|
+
C123.333,485.371,187.62,512,256,512S388.667,485.371,437.02,437.02z M472,256c0,119.103-96.897,216-216,216S40,375.103,40,256
|
94
|
+
S136.897,40,256,40S472,136.897,472,256z M168,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
|
95
|
+
S150.327,212.122,168,212.122z M344,212.122c17.673,0,32-14.327,32-32s-14.327-32-32-32s-32,14.327-32,32
|
96
|
+
S326.327,212.122,344,212.122z'
|
97
|
+
/>
|
98
|
+
</svg>
|
99
|
+
<div>{msg}</div>
|
108
100
|
</div>
|
101
|
+
)
|
102
|
+
let renderElement = (
|
103
|
+
<React.Fragment>
|
104
|
+
{
|
105
|
+
this.state.isError || componentList[selectedComponent] ? (
|
106
|
+
<ComponentClass {...ComponentClass.docs.testProps} />
|
107
|
+
) : ( ErrorMessage )
|
108
|
+
}
|
109
|
+
</React.Fragment>
|
109
110
|
);
|
111
|
+
|
112
|
+
return <div className='root'>{componentList._provider ? (
|
113
|
+
<componentList._provider>
|
114
|
+
{this.state.isError?ErrorMessage:renderElement}
|
115
|
+
</componentList._provider>
|
116
|
+
) : (
|
117
|
+
this.state.isError?ErrorMessage:renderElement
|
118
|
+
)}</div>;
|
110
119
|
}
|
111
120
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
121
|
+
var compList;
|
122
|
+
var componentList= {};
|
123
|
+
var compGroupObj=function(comp,key,compGroup){
|
124
|
+
if (comp == 'React' || comp == 'ReactDOM' || comp =='renderToStaticMarkup') {
|
125
|
+
return;
|
126
|
+
}
|
127
|
+
if(comp=='default'){
|
128
|
+
componentList[key]=compGroup[comp]
|
129
|
+
return componentList
|
130
|
+
}
|
131
|
+
else{
|
132
|
+
componentList[comp]=compGroup[comp]
|
133
|
+
return componentList
|
134
|
+
}
|
122
135
|
}
|
123
|
-
|
136
|
+
Promise.all(Object.keys(Component).map((key) => {
|
124
137
|
|
138
|
+
let componentKey=Component[key];
|
139
|
+
if (key == 'React' || key == 'ReactDOM' || key=='renderToStaticMarkup') {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
if(key == '_provider'){
|
143
|
+
return compGroupObj(key,null,Component)
|
144
|
+
}
|
145
|
+
try{
|
146
|
+
return(
|
147
|
+
componentKey && componentKey.then((res)=>{
|
148
|
+
Object.keys(res).forEach((comp)=>{
|
149
|
+
let compGroup=res[comp];
|
150
|
+
Object.keys(compGroup).forEach((comps)=>{
|
151
|
+
compList=compGroupObj(comps,key,compGroup)
|
152
|
+
return compList
|
153
|
+
})
|
154
|
+
})
|
155
|
+
})
|
156
|
+
)
|
157
|
+
}
|
158
|
+
catch(error){
|
159
|
+
return Component
|
160
|
+
}
|
161
|
+
})).then(()=>{
|
162
|
+
Object.keys(componentList).length>1?window.componentList=componentList:window.componentList=Component
|
163
|
+
ReactDOM.render(<RenderComponent />, react);
|
164
|
+
})
|
165
|
+
</script>
|
125
166
|
<script type="text/javascript">
|
126
167
|
var err = null;
|
127
168
|
var comName = '';
|