GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(material-parser): check module before install it; fix default va… · shenjo/lowcode-engine@fc452f7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • modules/material-parser
    • package.json
    • src
      • parse
        • transform.ts
      • utils.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎modules/material-parser/package.json‎

Copy file name to clipboardExpand all lines: modules/material-parser/package.json
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alilc/lowcode-material-parser",
3-
"version": "1.0.1",
3+
"version": "1.0.1-beta.3",
44
"description": "material parser for Ali lowCode engine",
55
"main": "lib/index.js",
66
"files": [
@@ -18,6 +18,8 @@
1818
"@types/prop-types": "^15.7.3",
1919
"copy-webpack-plugin": "^9.1.0",
2020
"copyfiles": "^2.4.1",
21+
"eslint": "^8.12.0",
22+
"eslint-config-ali": "^14.0.0",
2123
"jest": "^26.6.3",
2224
"js-yaml": "^3.13.1",
2325
"json-schema-to-typescript": "^8.2.0",
Collapse file

‎modules/material-parser/src/parse/transform.ts‎

Copy file name to clipboardExpand all lines: modules/material-parser/src/parse/transform.ts
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,11 @@ export function transformItem(name: string, item: any) {
286286
// if ('computed' in defaultValue) {
287287
// val = val.value;
288288
try {
289-
const value = safeEval(defaultValue.value);
290-
if (isEvaluable(value)) {
289+
if (isEvaluable(defaultValue.value)) {
290+
const value = safeEval(`'${defaultValue.value}'`);
291291
result.defaultValue = value;
292+
} else {
293+
result.defaultValue = defaultValue.value;
292294
}
293295
} catch (e) {
294296
log(e);
Collapse file

‎modules/material-parser/src/utils.ts‎

Copy file name to clipboardExpand all lines: modules/material-parser/src/utils.ts
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ export async function isNPMInstalled(args: {
1313
return pathExists(path.join(args.workDir, 'node_modules'));
1414
}
1515

16+
export async function isNPMModuleInstalled(
17+
args: { workDir: string; moduleDir: string; npmClient?: string },
18+
name: string,
19+
) {
20+
const modulePkgJsonPath = path.resolve(args.workDir, 'node_modules', name, 'package.json');
21+
return pathExists(modulePkgJsonPath);
22+
}
23+
1624
export async function install(args: { workDir: string; moduleDir: string; npmClient?: string }) {
1725
if (await isNPMInstalled(args)) return;
1826
const { workDir, npmClient = 'tnpm' } = args;
@@ -27,6 +35,7 @@ export async function installModule(
2735
args: { workDir: string; moduleDir: string; npmClient?: string },
2836
name: string,
2937
) {
38+
if (await isNPMModuleInstalled(args, name)) return;
3039
const { workDir, npmClient = 'tnpm' } = args;
3140
try {
3241
await spawn(npmClient, ['i', name], { stdio: 'inherit', cwd: workDir } as any);

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.