leanweb 1.3.2 → 1.3.5

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/dist.js CHANGED
@@ -17,8 +17,8 @@ if (args.length >= 3) {
17
17
  (async () => {
18
18
  const project = require(`${process.cwd()}/${utils.dirs.src}/leanweb.json`);
19
19
 
20
- await utils.exec(`npx lw clean`);
21
- await utils.exec(`npx lw build ${env}`);
20
+ await utils.exec(`npx leanweb clean`);
21
+ await utils.exec(`npx leanweb build ${env}`);
22
22
 
23
23
  const webpackConfig = utils.getWebPackConfig(utils.dirs.dist, project);
24
24
 
@@ -58,7 +58,10 @@ if (args.length >= 3) {
58
58
 
59
59
  fse.copySync(`./${utils.dirs.build}/favicon.svg`, `./${utils.dirs.dist}/favicon.svg`);
60
60
  project.resources?.forEach(resource => {
61
- fse.copySync(`./${utils.dirs.build}/${resource}`, `./${utils.dirs.dist}/${resource}`, { dereference: true });
61
+ const source = `./${utils.dirs.build}/${resource}`;
62
+ if (fs.existsSync(source)) {
63
+ fse.copySync(source, `./${utils.dirs.dist}/${resource}`, { dereference: true });
64
+ }
62
65
  });
63
66
 
64
67
  const postDistFile = './post-dist';
@@ -31,15 +31,18 @@ const require = createRequire(import.meta.url);
31
31
  fs.writeFileSync(leanwebJSONPath, JSON.stringify(project, null, 2));
32
32
  }
33
33
 
34
- await utils.exec(`npx lw clean`);
35
- await utils.exec(`npx lw build ${env}`);
34
+ await utils.exec(`npx leanweb clean`);
35
+ await utils.exec(`npx leanweb build ${env}`);
36
36
 
37
37
  fse.copySync(`./${utils.dirs.build}/electron.js`, `./${utils.dirs.electron}/electron.js`);
38
38
  fse.copySync(`./${utils.dirs.build}/index.html`, `./${utils.dirs.electron}/index.html`);
39
39
  fse.copySync(`./${utils.dirs.build}/${project.name}.css`, `./${utils.dirs.electron}/${project.name}.css`);
40
40
  fse.copySync(`./${utils.dirs.build}/favicon.svg`, `./${utils.dirs.electron}/favicon.svg`);
41
41
  project.resources?.forEach(resource => {
42
- fse.copySync(`./${utils.dirs.build}/${resource}`, `./${utils.dirs.electron}/${resource}`, { dereference: true });
42
+ const source = `./${utils.dirs.build}/${resource}`;
43
+ if (fs.existsSync(source)) {
44
+ fse.copySync(source, `./${utils.dirs.electron}/${resource}`, { dereference: true });
45
+ }
43
46
  });
44
47
 
45
48
  const webpackConfig = utils.getWebPackConfig(utils.dirs.electron, project);
package/commands/help.js CHANGED
@@ -2,7 +2,7 @@ import * as utils from './utils.js';
2
2
 
3
3
  (async () => {
4
4
  if (process.argv.length < 3) {
5
- utils.exec('npx lw version');
5
+ utils.exec('npx leanweb version');
6
6
  console.log('Usage: lw target parameters');
7
7
  console.log('Targets:\n');
8
8
  Object.keys(utils.targets).forEach(t => {
package/commands/init.js CHANGED
@@ -66,7 +66,7 @@ const require = createRequire(import.meta.url);
66
66
 
67
67
  utils.exec(`npm i -D @babel/runtime --loglevel=error`);
68
68
 
69
- utils.exec(`npx lw generate root`);
69
+ utils.exec(`npx leanweb generate root`);
70
70
 
71
71
  fse.copySync(`${__dirname}/../templates/lib`, `./${utils.dirs.src}/lib/`);
72
72
 
package/commands/serve.js CHANGED
@@ -24,12 +24,15 @@ const noopen = process.env.noopen || false;
24
24
  const build = async (eventType, filename) => {
25
25
  // console.log(eventType + ': ', filename);
26
26
  try {
27
- await utils.exec(`npx lw build ${env}`);
27
+ await utils.exec(`npx leanweb build ${env}`);
28
28
  fse.copySync(`./${utils.dirs.build}/index.html`, `./${utils.dirs.serve}/index.html`);
29
29
  fse.copySync(`./${utils.dirs.build}/${project.name}.css`, `./${utils.dirs.serve}/${project.name}.css`);
30
30
  fse.copySync(`./${utils.dirs.build}/favicon.svg`, `./${utils.dirs.serve}/favicon.svg`);
31
31
  project.resources?.forEach(resource => {
32
- fse.copySync(`./${utils.dirs.build}/${resource}`, `./${utils.dirs.serve}/${resource}`, { filter: utils.copySymbolLinkFilter });
32
+ const source = `./${utils.dirs.build}/${resource}`;
33
+ if (fs.existsSync(source)) {
34
+ fse.copySync(source, `./${utils.dirs.serve}/${resource}`, { filter: utils.copySymbolLinkFilter });
35
+ }
33
36
  });
34
37
  } catch (e) {
35
38
  console.error(e);
package/leanweb.js CHANGED
@@ -17,7 +17,7 @@ const __dirname = path.dirname(__filename);
17
17
  const args = process.argv;
18
18
 
19
19
  if (args.length < 3) {
20
- utils.exec('npx lw help');
20
+ utils.exec('npx leanweb help');
21
21
  return;
22
22
  }
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leanweb",
3
- "version": "1.3.2",
3
+ "version": "1.3.5",
4
4
  "description": "Builds framework agnostic web components.",
5
5
  "bin": {
6
6
  "leanweb": "leanweb.js",
@@ -30,12 +30,12 @@
30
30
  "fs-extra": "^10.1.0",
31
31
  "globby": "^13.1.2",
32
32
  "html-minifier": "^4.0.0",
33
- "isomorphic-git": "^1.19.1",
33
+ "isomorphic-git": "^1.19.2",
34
34
  "json5-loader": "^4.0.1",
35
35
  "node-watch": "^0.7.3",
36
36
  "parse5": "^7.0.0",
37
37
  "raw-loader": "^4.0.2",
38
- "sass": "^1.54.4",
38
+ "sass": "^1.54.5",
39
39
  "sass-loader": "^13.0.2",
40
40
  "semver": "^7.3.7",
41
41
  "webpack": "^5.74.0",
@@ -172,7 +172,10 @@ const nodeHandlers = {
172
172
 
173
173
  const immediateContext = (node, context) => {
174
174
  if (Array.isArray(context)) {
175
- return context.find(contextObj => node.name in contextObj);
175
+ if (context.length === 0) {
176
+ return null;
177
+ }
178
+ return context.find(contextObj => node.name in contextObj) ?? context[0];
176
179
  } else if (typeof context === 'object') {
177
180
  return context;
178
181
  }