@degreesign/webapp 1.6.8 → 1.7.0
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/dist/src/main.js +4 -2
- package/dist/src/types.d.ts +2 -0
- package/dist/src/web.js +4 -6
- package/package.json +1 -1
package/dist/src/main.js
CHANGED
|
@@ -15,7 +15,7 @@ const web_1 = require("./web");
|
|
|
15
15
|
const obfuscate_1 = require("./obfuscate");
|
|
16
16
|
dotenv_1.default.config();
|
|
17
17
|
const build = (params) => {
|
|
18
|
-
const
|
|
18
|
+
const { mode = `production`, obfuscateON = false, minimiseON = true, srcDir = `src`, productionDir = `public_html`, port = 3210, maxFileSizeMB = 2, resolveOptions = {}, licenseText = ``, includeServerModules, type: setupType } = params, isWebApp = setupType != `server`, { filesList = [], } = isWebApp ? {} : params, { entryPoints = {}, customWebRules = [], configWebPlugins = [], cssMinimise = [] } = isWebApp ? (0, web_1.webConfig)(params) : {}, fileSize = maxFileSizeMB * 1024 ** 2, envKeys = {};
|
|
19
19
|
// Environment keys
|
|
20
20
|
for (const key in process.env)
|
|
21
21
|
envKeys[`process.env.${key}`] = JSON.stringify(process.env[key]);
|
|
@@ -50,7 +50,9 @@ const build = (params) => {
|
|
|
50
50
|
__dirname: false, // Prevent Webpack from mocking __dirname
|
|
51
51
|
__filename: false, // Prevent Webpack from mocking __filename
|
|
52
52
|
},
|
|
53
|
-
|
|
53
|
+
...includeServerModules ? {} : {
|
|
54
|
+
externals: [(0, webpack_node_externals_1.default)()], // Externalize all node_modules
|
|
55
|
+
},
|
|
54
56
|
},
|
|
55
57
|
resolve: {
|
|
56
58
|
extensions: [`.tsx`, `.ts`, `.js`, `.json`], // Resolve files
|
package/dist/src/types.d.ts
CHANGED
|
@@ -68,6 +68,8 @@ export interface ConfigBase {
|
|
|
68
68
|
licenseText?: string;
|
|
69
69
|
/** Show Packages Analyser Window */
|
|
70
70
|
openAnalyzer?: boolean;
|
|
71
|
+
/** Node module included for server */
|
|
72
|
+
includeServerModules?: boolean;
|
|
71
73
|
}
|
|
72
74
|
export interface ConfigWebApp extends ConfigBase {
|
|
73
75
|
/** Name of the website */
|
package/dist/src/web.js
CHANGED
|
@@ -143,20 +143,17 @@ Sitemap: https://${websiteDomain}/sitemap.xml`, getServiceWorkerContent = () =>
|
|
|
143
143
|
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
|
144
144
|
</IfModule>
|
|
145
145
|
|
|
146
|
-
#
|
|
146
|
+
# Disable Indexing
|
|
147
147
|
Options -Indexes
|
|
148
148
|
|
|
149
|
+
# Always use HTTPS
|
|
149
150
|
<IfModule mod_rewrite.c>
|
|
150
151
|
RewriteEngine On
|
|
151
152
|
RewriteCond %{HTTPS} off
|
|
152
153
|
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
153
154
|
</IfModule>
|
|
154
155
|
|
|
155
|
-
#
|
|
156
|
-
ErrorDocument 404 /404
|
|
157
|
-
ErrorDocument 403 /404
|
|
158
|
-
|
|
159
|
-
# Add content type
|
|
156
|
+
# Files and Directories
|
|
160
157
|
`;
|
|
161
158
|
for (let i = 0; i < pagesList.length; i++) {
|
|
162
159
|
const pageData = pagesList[i], pageURI = pageData.uri, isHome = pageHome == pageURI;
|
|
@@ -202,6 +199,7 @@ ErrorDocument 403 /404
|
|
|
202
199
|
}
|
|
203
200
|
;
|
|
204
201
|
htaccessFile += htaccessCustom;
|
|
202
|
+
htaccessFile += `\n\n# Errors\nErrorDocument 404 /404\nErrorDocument 403 /404`;
|
|
205
203
|
(0, utils_1.writeData)(`./${productionDir}/robots.txt`, robots);
|
|
206
204
|
(0, utils_1.writeData)(`./${productionDir}/.htaccess`, htaccessFile);
|
|
207
205
|
(0, utils_1.writeData)(`./${productionDir}/app.json`, JSON.stringify(appManifest));
|