leanweb 1.1.5 → 1.1.6
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/commands/build.js +1 -49
- package/package.json +1 -1
package/commands/build.js
CHANGED
|
@@ -18,52 +18,6 @@ const require = createRequire(import.meta.url);
|
|
|
18
18
|
env = args[2];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
// const replaceNodeModulesImport = (str, filePath) => {
|
|
22
|
-
// // match import not starting with dot or slash
|
|
23
|
-
// return str.replace(/^([^\S\r\n]*(?:importScripts|import).+?['"])((?!\.|\/|http\:|https\:).*?)(['"].*)$/gm, (m, a, b, c) => {
|
|
24
|
-
// if (b.startsWith(`~`)) {
|
|
25
|
-
// // ~/package.json
|
|
26
|
-
// return a + path.normalize(`${process.cwd()}/` + b.substring(1)) + c;
|
|
27
|
-
// } else if (b.indexOf('/') > -1) {
|
|
28
|
-
// // lodash-es/get.js
|
|
29
|
-
// return a + path.normalize(`${process.cwd()}/node_modules/` + b) + c;
|
|
30
|
-
// } else {
|
|
31
|
-
// const nodeModulePath = `${process.cwd()}/node_modules/` + b + '/package.json';
|
|
32
|
-
// const package = require(nodeModulePath);
|
|
33
|
-
// // lodash-es
|
|
34
|
-
// return a + path.normalize(`${process.cwd()}/node_modules/` + b + '/' + package.main) + c;
|
|
35
|
-
// }
|
|
36
|
-
// });
|
|
37
|
-
// };
|
|
38
|
-
|
|
39
|
-
// const walkDirSync = (dir, accept = null, callback) => {
|
|
40
|
-
// fs.readdirSync(dir).forEach(f => {
|
|
41
|
-
// let dirPath = path.join(dir, f);
|
|
42
|
-
// const isDirectory = fs.statSync(dirPath).isDirectory() && (!accept || (typeof accept === 'function' && accept(dirPath, f)));
|
|
43
|
-
// isDirectory ? walkDirSync(dirPath, accept, callback) : callback(path.join(dirPath));
|
|
44
|
-
// });
|
|
45
|
-
// };
|
|
46
|
-
|
|
47
|
-
// const preprocessJsImport = filePath => {
|
|
48
|
-
// if (
|
|
49
|
-
// filePath.toLowerCase().endsWith('.js') &&
|
|
50
|
-
// !filePath.toLowerCase().endsWith('/ast.js') &&
|
|
51
|
-
// !filePath.startsWith(`${utils.dirs.build}/lib/`) &&
|
|
52
|
-
// !filePath.startsWith(`${utils.dirs.build}/resources/`)
|
|
53
|
-
// ) {
|
|
54
|
-
// let jsFileString = fs.readFileSync(filePath, 'utf8');
|
|
55
|
-
// jsFileString = replaceNodeModulesImport(jsFileString, filePath);
|
|
56
|
-
// fs.writeFileSync(filePath, jsFileString);
|
|
57
|
-
// }
|
|
58
|
-
// };
|
|
59
|
-
|
|
60
|
-
// const buildDirFilter = dirPath => {
|
|
61
|
-
// if (dirPath.startsWith(`${utils.dirs.build}/lib/`)) {
|
|
62
|
-
// return false;
|
|
63
|
-
// }
|
|
64
|
-
// return true;
|
|
65
|
-
// };
|
|
66
|
-
|
|
67
21
|
const leanwebPackageJSON = require(`${__dirname}/../package.json`);
|
|
68
22
|
|
|
69
23
|
const buildModule = (projectPath) => {
|
|
@@ -108,8 +62,6 @@ const require = createRequire(import.meta.url);
|
|
|
108
62
|
};
|
|
109
63
|
|
|
110
64
|
const buildJS = () => {
|
|
111
|
-
// walkDirSync(buildDir, buildDirFilter, preprocessJsImport);
|
|
112
|
-
|
|
113
65
|
const jsString = project.components.reduce((acc, cur) => {
|
|
114
66
|
const cmpName = utils.getComponentName(cur);
|
|
115
67
|
let importString = `import './components/${cur}/${cmpName}.js';`;
|
|
@@ -129,7 +81,7 @@ const require = createRequire(import.meta.url);
|
|
|
129
81
|
const scssFileExists = fs.existsSync(scssFilename);
|
|
130
82
|
let cssString = '';
|
|
131
83
|
if (scssFileExists) {
|
|
132
|
-
let scssString = `@use "global-styles.scss";\n`;
|
|
84
|
+
let scssString = `@use "${buildDir}/global-styles.scss";\n`;
|
|
133
85
|
scssString += fs.readFileSync(scssFilename, 'utf8');
|
|
134
86
|
scssString += '\n[lw-false],[lw-for]{display:none !important;}\n';
|
|
135
87
|
cssString = utils.buildCSS(scssString, `${buildDir}/components/${cmp}`);
|