-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from DFE-evernote/dev
Chore: update configurations
- Loading branch information
Showing
23 changed files
with
358 additions
and
17,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.DS_Store | ||
node_modules | ||
package-lock.json | ||
/dist | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.PHONY: dist test | ||
default: help | ||
|
||
install: | ||
npm install | ||
|
||
install-cn: | ||
npm install --registry=http://registry.npm.taobao.org | ||
|
||
new: | ||
node build/bin/new.js $(filter-out $@,$(MAKECMDGOALS)) | ||
node build/bin/build-entry.js | ||
|
||
dev: | ||
npm run dev | ||
|
||
dist: | ||
npm run dist | ||
|
||
pub: | ||
npm run pub | ||
|
||
# deploy: | ||
# # npm run deploy | ||
|
||
test: | ||
npm run test:ui | ||
|
||
help: | ||
@echo " \033[35m make\033[0m \033[1m命令使用说明:\033[0m" | ||
@echo " \033[35m make install\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 安装依赖" | ||
@echo " \033[35m make install-cn\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 安装依赖" | ||
@echo " \033[35m make new <component-name> [组件中文名]\033[0m\t--- 创建新组件(组件英文名用中横线)例如 'make new button-group 按钮'" | ||
@echo " \033[35m make dev\033[0m\t\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 启动开发" | ||
@echo " \033[35m make test\033[0m\t\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 运行测试" | ||
@echo " \033[35m make dist\033[0m\t\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 编译项目,构建目标文件" | ||
@echo " \033[35m make pub\033[0m\t\033[0m\t\033[0m\t\033[0m\t\033[0m\t--- 发布到 npm 上" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict' | ||
const fs = require('fs'), | ||
path = require('path'), | ||
jsonRender = require('json-templater/string'), | ||
uppercamelcase = require('uppercamelcase'), | ||
endOfLine = require('os').EOL, | ||
componentsList = require('../../components.json'), | ||
OUTPUT_PATH = path.join(__dirname, '../../packages/index.js') | ||
|
||
const MAIN_TEMPLATE = `/* Automatically generated by './build/bin/build-entry.js' */ | ||
{{include}} | ||
const components = [ | ||
{{install}}, | ||
] | ||
const install = (app, opts = {}) => { | ||
components.forEach(item => { | ||
app.component(item.name, item) | ||
}) | ||
app.$AXE = { | ||
size: opts.size || '', | ||
zIndex: opts.zIndex || 1000 | ||
} | ||
} | ||
export default { | ||
version: '{{version}}', | ||
install, | ||
{{export}}, | ||
} | ||
`, | ||
IMPORT_TEMPLATE = `import {{nameCameraCase}} from './{{name}}/'` | ||
|
||
const componentNames = Object.keys(componentsList), | ||
includeTempList = [], | ||
installTempList = [], | ||
exportTempList = [] | ||
componentNames.forEach(compItemName => { | ||
const AxeCompCameraName = 'Axe' + uppercamelcase(compItemName) | ||
includeTempList.push( | ||
jsonRender(IMPORT_TEMPLATE, { | ||
name: compItemName, | ||
nameCameraCase: AxeCompCameraName | ||
}) | ||
) | ||
installTempList.push(` ${AxeCompCameraName}`) | ||
exportTempList.push(` ${AxeCompCameraName}`) | ||
}) | ||
|
||
const template = jsonRender(MAIN_TEMPLATE, { | ||
include: includeTempList.join(endOfLine), | ||
install: installTempList.join(',' + endOfLine), | ||
export: exportTempList.join(',' + endOfLine), | ||
version: process.env.VERSION || require('../../package.json').version | ||
}) | ||
|
||
fs.writeFileSync(OUTPUT_PATH, template) | ||
// DONE | ||
console.log('🎉🎉🎉🎉🎉不骗你,这次是真的完了~🎉🎉🎉🎉🎉') | ||
console.log('[build entry] DONE:', OUTPUT_PATH) |
Oops, something went wrong.