Commit 6231c232 authored by rockyl's avatar rockyl

init

parent 6eb7fbc0
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<module type="WEB_MODULE" version="4"> <module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$/../scilla-declare-generator" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
*/ */
const ts = require('typescript'); const ts = require('typescript');
const fs = require('fs-extra'); const path = require('path');
let declareMap; let declareMap;
let _componentsPath; let _componentsSrcPath;
let _projectPath; let _projectPath;
let _assetsPath; let _assetsPath;
let _filter; let _filter;
...@@ -18,7 +18,7 @@ const showLog = false; ...@@ -18,7 +18,7 @@ const showLog = false;
const showVerboseLog = false; const showVerboseLog = false;
exports.generateDeclareMap = function(tsconfig, dependencies, file, componentsPath, projectPath, assetsPath, filter) { exports.generateDeclareMap = function(tsconfig, dependencies, file, componentsPath, projectPath, assetsPath, filter) {
_componentsPath = componentsPath; _componentsSrcPath = path.join(componentsPath, 'src');
_projectPath = projectPath; _projectPath = projectPath;
_assetsPath = assetsPath; _assetsPath = assetsPath;
_filter = filter; _filter = filter;
...@@ -194,7 +194,7 @@ function addProp(dataContainer, name, valueDeclaration, checker) { ...@@ -194,7 +194,7 @@ function addProp(dataContainer, name, valueDeclaration, checker) {
defaultValue.push(value); defaultValue.push(value);
} }
} else if(typeName === 'number'){ } 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{ }else{
defaultValue = initializer && (initializer.text || (initializer.name && initializer.name.escapedText)); defaultValue = initializer && (initializer.text || (initializer.name && initializer.name.escapedText));
} }
...@@ -229,7 +229,7 @@ function getFullyQualifiedNameOfType(type, checker) { ...@@ -229,7 +229,7 @@ function getFullyQualifiedNameOfType(type, checker) {
} else if(path.indexOf('src') === 0){ } else if(path.indexOf('src') === 0){
path = path.replace('src', 'components') path = path.replace('src', 'components')
}else{ }else{
path = path.replace(_componentsPath, 'components') path = path.replace(_componentsSrcPath, 'components')
.replace(/\/\d+\.\d+\.\d+\/index/, '') .replace(/\/\d+\.\d+\.\d+\/index/, '')
} }
fullClassName = `"${path}".${className}`; 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