@rws-framework/client 2.19.0 → 2.19.1

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.
@@ -11,7 +11,8 @@ module.exports = async function(content) {
11
11
  const plugin = new RWSScssPlugin({
12
12
  appRootDir: this.query?.appRootDir,
13
13
  rwsWorkspaceDir: this.query?.rwsWorkspaceDir,
14
- publicDir: this.query?.publicDir
14
+ publicDir: this.query?.publicDir,
15
+ cssDir: this.query?.cssDir
15
16
  });
16
17
  let fromTs = false;
17
18
 
@@ -36,6 +36,7 @@ const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
36
36
  outputDir,
37
37
  outputFileName,
38
38
  publicDir,
39
+ cssDir,
39
40
  serviceWorkerPath,
40
41
  publicIndex,
41
42
  devTools,
@@ -137,6 +138,7 @@ const RWSWebpackWrapper = async (appRoot, rwsFrontendConfig, _packageDir) => {
137
138
  hotReload,
138
139
  hotReloadPort,
139
140
  publicDir,
141
+ cssDir,
140
142
  loaderIgnoreExceptions
141
143
  });
142
144
 
@@ -19,6 +19,7 @@ class RWSScssPlugin {
19
19
  appRootDir: null,
20
20
  rwsWorkspaceDir: null,
21
21
  publicDir: null,
22
+ cssDir: null,
22
23
  autoCompile: []
23
24
  }) {
24
25
  this.node_modules_dir = (fileDir) => path.relative(fileDir, path.join(this.getRWSRootDir(), '/node_modules'))
@@ -27,6 +28,7 @@ class RWSScssPlugin {
27
28
  _scss_compiler = _scss_compiler_builder(this);
28
29
 
29
30
  this.pubDir = params.publicDir;
31
+ this.cssDir = params.cssDir;
30
32
 
31
33
  if(!params.rwsWorkspaceDir){
32
34
  throw new Error('Pass "rwsWorkspaceDir" to the "@rws-framework/client/builder/webpack/loaders/rws_fast_ts_loader.js" loader.');
@@ -65,7 +67,7 @@ class RWSScssPlugin {
65
67
  }
66
68
 
67
69
  writeCssFile(scssFilePath, cssContent){
68
- return _scss_fs.writeCssFile(scssFilePath, cssContent);
70
+ return _scss_fs.writeCssFile(scssFilePath, cssContent, this.getRWSWorkspaceDir(), this.getCssDir());
69
71
  }
70
72
 
71
73
  getRWSWorkspaceDir() {
@@ -76,6 +78,10 @@ class RWSScssPlugin {
76
78
  return this.appRootDir;
77
79
  }
78
80
 
81
+ getCssDir() {
82
+ return this.cssDir;
83
+ }
84
+
79
85
  getPubDir() {
80
86
  return this.pubDir;
81
87
  }
@@ -5,19 +5,29 @@ let _scss_import = null;
5
5
  const _COMPILE_DIR_NAME = 'compiled';
6
6
 
7
7
 
8
- function writeCssFile(scssFilePath, cssContent) {
8
+ function writeCssFile(scssFilePath, cssContent, workspaceDir, finalCssDirOverride = null) {
9
9
  const cssFilePath = scssFilePath.replace('.scss', '.css');
10
- let endCssFilePath = cssFilePath.split('/');
10
+ let endCssFilePath = cssFilePath.split(path.sep);
11
11
  let endCssDir = [...endCssFilePath];
12
12
  endCssDir[endCssDir.length - 1] = `${_COMPILE_DIR_NAME}`;
13
- endCssDir = endCssDir.join('/');
13
+ endCssDir = endCssDir.join(path.sep);
14
+ const fileName = endCssFilePath[endCssFilePath.length - 1];
14
15
 
15
- if (!fs.existsSync(endCssDir)) {
16
- fs.mkdirSync(endCssDir);
17
- }
16
+ if(!finalCssDirOverride){
17
+ if (!fs.existsSync(endCssDir)) {
18
+ fs.mkdirSync(endCssDir);
19
+ }
18
20
 
19
- endCssFilePath[endCssFilePath.length - 1] = `${_COMPILE_DIR_NAME}/` + endCssFilePath[endCssFilePath.length - 1];
20
- endCssFilePath = endCssFilePath.join('/');
21
+ endCssFilePath[endCssFilePath.length - 1] = `${_COMPILE_DIR_NAME}${path.sep}` + fileName;
22
+ endCssFilePath = endCssFilePath.join(path.sep);
23
+ }else{
24
+ const cssDirPath = path.join(workspaceDir, finalCssDirOverride);
25
+ if(!fs.existsSync(cssDirPath)){
26
+ fs.mkdirSync(cssDirPath);
27
+ }
28
+
29
+ endCssFilePath = path.join(cssDirPath, fileName);
30
+ }
21
31
 
22
32
  fs.writeFile(endCssFilePath, cssContent, () => {});
23
33
  console.log('Saved external CSS file in: ' + endCssFilePath);
@@ -26,6 +26,8 @@ async function getBuildConfig(rwsFrontBuildConfig, _packageDir){
26
26
 
27
27
  const outputFileName = BuildConfigurator.get('outputFileName') || rwsFrontBuildConfig.outputFileName;
28
28
  const publicDir = BuildConfigurator.get('publicDir') || rwsFrontBuildConfig.publicDir;
29
+ const cssDir = BuildConfigurator.get('cssDir') || rwsFrontBuildConfig.cssDir;
30
+
29
31
  const serviceWorkerPath = BuildConfigurator.get('serviceWorker') || rwsFrontBuildConfig.serviceWorker;
30
32
 
31
33
  const publicIndex = BuildConfigurator.get('publicIndex') || rwsFrontBuildConfig.publicIndex;
@@ -65,6 +67,7 @@ async function getBuildConfig(rwsFrontBuildConfig, _packageDir){
65
67
  outputDir,
66
68
  outputFileName,
67
69
  publicDir,
70
+ cssDir,
68
71
  serviceWorkerPath,
69
72
  publicIndex,
70
73
  devTools,
@@ -10,7 +10,7 @@ const { timingCounterStart, timingCounterStop } = require('./_timing');
10
10
  const { rwsRuntimeHelper, rwsPath } = require('@rws-framework/console');
11
11
 
12
12
 
13
- function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entrypoint, loaderIgnoreExceptions, publicDir) {
13
+ function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entrypoint, loaderIgnoreExceptions, publicDir, cssDir) {
14
14
  const scssLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_scss_loader.js');
15
15
  const tsLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_ts_loader.js');
16
16
  const htmlLoader = path.join(packageDir, 'builder/webpack/loaders/rws_fast_html_loader.js');
@@ -100,7 +100,8 @@ function getRWSLoaders(packageDir, executionDir, tsConfigData, appRootDir, entry
100
100
  options: {
101
101
  rwsWorkspaceDir: executionDir,
102
102
  appRootDir,
103
- publicDir
103
+ publicDir,
104
+ cssDir
104
105
  }
105
106
  },
106
107
  ],
@@ -25,6 +25,7 @@ async function createWebpackConfig({
25
25
  hotReload,
26
26
  hotReloadPort,
27
27
  publicDir = null,
28
+ cssDir = null,
28
29
  loaderIgnoreExceptions
29
30
  }) {
30
31
 
@@ -59,7 +60,7 @@ async function createWebpackConfig({
59
60
  },
60
61
  devServer: hotReload ? getRWSHotReloadSetup(hotReloadPort, outputDir) : false,
61
62
  module: {
62
- rules: getRWSLoaders(_packageDir, executionDir, tsConfig, appRootDir, entrypoint, loaderIgnoreExceptions, publicDir),
63
+ rules: getRWSLoaders(_packageDir, executionDir, tsConfig, appRootDir, entrypoint, loaderIgnoreExceptions, publicDir, cssDir),
63
64
  },
64
65
  plugins: WEBPACK_PLUGINS,
65
66
  // externals: rwsExternals(_packageDir, executionDir, modules_setup, automatedChunks, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.19.0",
4
+ "version": "2.19.1",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"