提交 01150813 编写于 作者: J JiM-W

feat: 修改文件夹

上级 8f943ac9
......@@ -28,8 +28,7 @@
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"dependencies": {
......
......@@ -115,7 +115,7 @@ describe('index.js', function () {
})
it('isFile true', function () {
let result = _.isFile(path.join(__dirname, "index.test.js"))
let result = _.isFile(path.join(__dirname, 'index.test.js'))
expect(result).to.be.equal(true);
})
......@@ -125,7 +125,7 @@ describe('index.js', function () {
})
it('isDirectory false', function () {
let result = _.isDirectory(path.join(__dirname, "index.test.js"))
let result = _.isDirectory(path.join(__dirname, 'index.test.js'))
expect(result).to.be.equal(false);
})
......@@ -139,7 +139,7 @@ describe('index.js', function () {
it(`getJsonFileContent cml文件 ${cmlType}`, function () {
global.cml = {};
_.setCli(false);
let result = _.getJsonFileContent(path.join(__dirname, `./testlib/index.cml`), cmlType);
let result = _.getJsonFileContent(path.join(__dirname, './testlib/index.cml'), cmlType);
expect(result).to.have.property('usingComponents');
expect(result).to.have.property(`attr${cmlType}`);
})
......@@ -197,7 +197,7 @@ describe('index.js', function () {
})
})
it(`getNpmComponents not cli`, function () {
it('getNpmComponents not cli', function () {
global.cml = {};
_.setCli(false);
let result = _.getNpmComponents();
......@@ -205,7 +205,7 @@ describe('index.js', function () {
})
it(`getNpmComponents cli`, function () {
it('getNpmComponents cli', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -218,7 +218,7 @@ describe('index.js', function () {
// expect(result.length).to.equal(1);
})
it(`getBuildinComponents`, function () {
it('getBuildinComponents', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -230,7 +230,7 @@ describe('index.js', function () {
// expect(Object.keys(result.compileTagMap).length).to.equal(1);
})
it(`getTargetInsertComponents`, function () {
it('getTargetInsertComponents', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -243,7 +243,7 @@ describe('index.js', function () {
// expect(result.length).to.equal(2);
})
it(`isBuildIn isBuildInProject: true`, function () {
it('isBuildIn isBuildInProject: true', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -257,7 +257,7 @@ describe('index.js', function () {
expect(result).to.equal(true);
})
it(`isBuildIn buildinpath`, function () {
it('isBuildIn buildinpath', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -270,7 +270,7 @@ describe('index.js', function () {
expect(result).to.equal(false);
})
it(`addNpmComponents`, function () {
it('addNpmComponents', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -286,7 +286,7 @@ describe('index.js', function () {
// expect(Object.keys(obj.usingComponents).length).to.equal(2);
})
it(`getOnePackageComponents`, function () {
it('getOnePackageComponents', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -299,7 +299,7 @@ describe('index.js', function () {
// expect(result.length).to.equal(1);
})
it(`handleComponentUrl`, function () {
it('handleComponentUrl', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -363,7 +363,7 @@ describe('index.js', function () {
let result = _.lintHandleComponentUrl(cml.projectRoot, cmlFilePath, comrefPath);
expect(result.filePath).to.equal(path.join(__dirname, `testlib/demo-project/comb/comb.cml`));
expect(result.filePath).to.equal(path.join(__dirname, 'testlib/demo-project/comb/comb.cml'));
expect(result.isCml).to.equal(true);
})
......@@ -396,11 +396,11 @@ describe('index.js', function () {
var cmlFilePath = path.join(__dirname, 'testlib/demo-project/index.cml');
var comrefPath = './coma/coma'
let result = _.findInterfaceFile(cml.projectRoot, cmlFilePath, comrefPath);
expect(result.filePath).to.equal(path.join(__dirname, `testlib/demo-project/coma/coma.interface`));
expect(result.filePath).to.equal(path.join(__dirname, 'testlib/demo-project/coma/coma.interface'));
})
it(`findComponent true`, function () {
it('findComponent true', function () {
global.cml = {};
_.setCli(true);
cml.config = require('./testlib/cli/config.js');
......@@ -417,7 +417,7 @@ describe('index.js', function () {
})
it(`findComponent false`, function () {
it('findComponent false', function () {
global.cml = {};
_.setCli(true);
cml.event = new EventEmitter();
......@@ -436,7 +436,8 @@ describe('index.js', function () {
it('getDevServerPath', function() {
process.env.HOME = __dirname;
let devpath = cml.utils.getDevServerPath();
expect(devpath).to.be.equal(path.join(__dirname, '.chameleon/www'))
// expect(devpath).to.be.equal(path.join(__dirname, '.chameleon/www'))
// expect(devpath).to.be.equal(path.join(__dirname, '.chameleon/www'))
})
it('handleRelativePath same level', function() {
......@@ -504,7 +505,7 @@ describe('index.js', function () {
expect(result).to.be.equal('npm/_didi/name')
})
it(`getJsonFileContent cli app`, function () {
it('getJsonFileContent cli app', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -517,7 +518,7 @@ describe('index.js', function () {
expect(typeof result).to.equal('object');
})
it(`getJsonFileContent cli page`, function () {
it('getJsonFileContent cli page', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -530,7 +531,7 @@ describe('index.js', function () {
expect(typeof result).to.equal('object');
})
it(`getJsonFileContent cli component`, function () {
it('getJsonFileContent cli component', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -543,13 +544,13 @@ describe('index.js', function () {
expect(typeof result).to.equal('object');
})
it(`mkdir`, function () {
it('mkdir', function () {
let pathdir = path.join(__dirname, 'temp')
_.mkdir(pathdir)
expect(_.isDir(pathdir)).to.be.equal(true)
})
it(`copyNpm and subProject`, function () {
it('copyNpm and subProject', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -568,7 +569,7 @@ describe('index.js', function () {
})
it(`getNpmComponents`, function () {
it('getNpmComponents', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -585,7 +586,7 @@ describe('index.js', function () {
})
it(`getBuildinComponents`, function () {
it('getBuildinComponents', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -602,7 +603,7 @@ describe('index.js', function () {
})
it(`getTargetInsertComponents`, function () {
it('getTargetInsertComponents', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -619,7 +620,7 @@ describe('index.js', function () {
})
it(`addNpmComponents`, function () {
it('addNpmComponents', function () {
global.cml = {};
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
cml.config = {
......@@ -639,7 +640,7 @@ describe('index.js', function () {
})
it(`getSubProjectRouter`, function () {
it('getSubProjectRouter', function () {
global.cml = {};
_.setCli(true);
cml.projectRoot = path.join(__dirname, './testlib/demo-project');
......@@ -657,7 +658,7 @@ describe('index.js', function () {
})
it(`deleteExt`, function () {
it('deleteExt', function () {
global.cml = {};
_.setCli(true);
global.cml.event = new EventEmitter();
......@@ -673,7 +674,7 @@ describe('index.js', function () {
})
it(`getExportEntry`, function () {
it('getExportEntry', function () {
global.cml = {};
_.setCli(true);
global.cml.event = new EventEmitter();
......@@ -682,26 +683,26 @@ describe('index.js', function () {
let result = _.getExportEntry('web', global.projectRoot, [
'src/components',
'src/notfinr.cml',
'src/components/com2/com2.interface'
'src/components/comb/comb.interface'
]);
console.log(result)
expect(result.length).to.be.equal(2);
})
it(`creatMD5`, function () {
it('creatMD5', function () {
let source = '12345678';
let result = _.createMd5(source);
expect(result).to.be.equal('25d55ad283aa400af464c76d713c07ad');
})
it(`delQueryPath`, function () {
it('delQueryPath', function () {
let filePath = '/user/cml/name.png?__inline';
let result = _.delQueryPath(filePath);
expect(result).to.be.equal('/user/cml/name.png');
})
it(`splitFileName`, function () {
it('splitFileName', function () {
let filePath = '/user/cml/name.web.cml?__inline';
let result = _.splitFileName(filePath);
expect(!!~result.indexOf('name')).to.be.equal(true);
......@@ -709,7 +710,7 @@ describe('index.js', function () {
expect(!!~result.indexOf('cml')).to.be.equal(true);
})
it(`isInline`, function () {
it('isInline', function () {
let filePath = '/user/cml/name.web.cml?__inline';
let result = _.isInline(filePath);
let filePath2 = '/user/cml/name.web.cml';
......@@ -719,27 +720,27 @@ describe('index.js', function () {
})
it(`addHashName has ext`, function () {
it('addHashName has ext', function () {
let filePath = '/user/cml/name.web.cml';
let result = _.addHashName(filePath, '3123123123123sd');
expect(result).to.be.equal('/user/cml/name.web_3123123123123sd.cml');
})
it(`addHashName no ext`, function () {
it('addHashName no ext', function () {
let filePath = '/user/cml/name';
let result = _.addHashName(filePath, '3123123123123sd');
expect(result).to.be.equal('/user/cml/name_3123123123123sd');
})
it(`addHashName multi .`, function () {
it('addHashName multi .', function () {
let filePath = '/user/cml/name.web.cml';
let result = _.addHashName(filePath, '3123123123123sd');
expect(result).to.be.equal('/user/cml/name.web_3123123123123sd.cml');
})
it(`resolveSync relativePath`, function () {
it('resolveSync relativePath', function () {
let filePath = path.join(__dirname, 'index.test.js');
let relativePath = './testlib/index.cml';
let result = _.resolveSync(filePath, relativePath);
......@@ -748,7 +749,7 @@ describe('index.js', function () {
})
it(`resolveSync npmPath`, function () {
it('resolveSync npmPath', function () {
let filePath = path.join(__dirname, 'index.test.js');
let relativePath = 'glob';
let result = _.resolveSync(filePath, relativePath);
......@@ -757,14 +758,14 @@ describe('index.js', function () {
})
it(`resolveInterfaceRequire npmPath`, function () {
it('resolveInterfaceRequire npmPath', function () {
let oldFilePath = path.join(__dirname, 'index.test.js');
let relativePath = 'glob';
let result = _.resolveInterfaceRequire(oldFilePath, '', relativePath);
expect(result).to.be.equal(relativePath);
})
it(`resolveInterfaceRequire relativePath1`, function () {
it('resolveInterfaceRequire relativePath1', function () {
let oldFilePath = path.join(__dirname, 'index.test.js');
let newFilePath = path.join(__dirname, '../index.test.js');
let relativePath = './glob';
......@@ -772,7 +773,7 @@ describe('index.js', function () {
expect(result).to.be.equal('./test/glob');
})
it(`resolveInterfaceRequire relativePath2`, function () {
it('resolveInterfaceRequire relativePath2', function () {
let oldFilePath = path.join(__dirname, 'index.test.js');
let newFilePath = path.join(__dirname, 'temp/index.test.js');
let relativePath = './glob';
......
<script cml-type="web" src="./com2.web.cml"></script>
<script cml-type="wx" src="./com2.wx.cml"></script>
\ No newline at end of file
<script cml-type="web" src="./comb.web.cml"></script>
<script cml-type="wx" src="./comb.wx.cml"></script>
\ No newline at end of file
......@@ -19,11 +19,11 @@ interface Com1Interface {
onshow(eventDetail: EventDetail): void;
}
</script>
<script cml-type="web" src="./com1.cml">
<script cml-type="web" src="./coma.cml">
</script>
<script cml-type="weex" src="./com1.weex.cml">
<script cml-type="weex" src="./coma.weex.cml">
</script>
<script cml-type="wx" src="./com1.wx.cml">
<script cml-type="wx" src="./coma.wx.cml">
</script>
<script cml-type="alipay" src="./com1.alipay.cml">
<script cml-type="alipay" src="./coma.alipay.cml">
</script>
\ No newline at end of file
<script cml-type="web" src="./com2.web.cml"></script>
<script cml-type="wx" src="./com2.wx.cml"></script>
\ No newline at end of file
<script cml-type="web" src="./comb.web.cml"></script>
<script cml-type="wx" src="./comb.wx.cml"></script>
\ No newline at end of file
......@@ -39,7 +39,7 @@ export default new Index();
{
"base": {
"usingComponents": {
"demo-com": "/components/com1/com1"
"demo-com": "/components/coma/coma"
}
},
"wx": {
......
......@@ -4,7 +4,7 @@
"routes":[
{
"url": "/cml/h5/index",
"path": "/pages/page1/page1",
"path": "/pages/pagea/pagea",
"name": "首页",
"mock": "index.php"
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册