Commit 6231c232 authored by rockyl's avatar rockyl

init

parent 6eb7fbc0
......@@ -2,7 +2,7 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$/../scilla-declare-generator" />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
......
......@@ -3,10 +3,10 @@
*/
const ts = require('typescript');
const fs = require('fs-extra');
const path = require('path');
let declareMap;
let _componentsPath;
let _componentsSrcPath;
let _projectPath;
let _assetsPath;
let _filter;
......@@ -18,7 +18,7 @@ const showLog = false;
const showVerboseLog = false;
exports.generateDeclareMap = function(tsconfig, dependencies, file, componentsPath, projectPath, assetsPath, filter) {
_componentsPath = componentsPath;
_componentsSrcPath = path.join(componentsPath, 'src');
_projectPath = projectPath;
_assetsPath = assetsPath;
_filter = filter;
......@@ -194,7 +194,7 @@ function addProp(dataContainer, name, valueDeclaration, checker) {
defaultValue.push(value);
}
} else if(typeName === 'number'){
defaultValue = initializer && (initializer.text ? parseFloat(initializer.text) : (initializer.operand ? -parseFloat(initializer.operand.text) : undefined))
defaultValue = initializer && (initializer.text ? initializer.text : (initializer.operand ? '-' + initializer.operand.text : undefined))
}else{
defaultValue = initializer && (initializer.text || (initializer.name && initializer.name.escapedText));
}
......@@ -229,7 +229,7 @@ function getFullyQualifiedNameOfType(type, checker) {
} else if(path.indexOf('src') === 0){
path = path.replace('src', 'components')
}else{
path = path.replace(_componentsPath, 'components')
path = path.replace(_componentsSrcPath, 'components')
.replace(/\/\d+\.\d+\.\d+\/index/, '')
}
fullClassName = `"${path}".${className}`;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment