-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bearyan
committed
Mar 12, 2020
0 parents
commit f6520ea
Showing
169 changed files
with
404 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.DS_Store | ||
node_modules | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
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,23 @@ | ||
.DS_Store | ||
node_modules | ||
.cache | ||
|
||
# local env files | ||
.env.local | ||
.env.*.local | ||
|
||
build | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw* |
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,49 @@ | ||
const pkg = require('./package'); | ||
const origin = pkg.repository.url; | ||
const comparePath = `${origin}/compare/`; | ||
const commitPath = `${origin}/commit/`; | ||
|
||
module.exports = { | ||
filters: [ | ||
{ | ||
name: 'Features', | ||
regExp: /^(?:feat|add)/i, | ||
}, | ||
{ | ||
name: 'Bugfixes', | ||
regExp: /^fix/i, | ||
}, | ||
], | ||
parse(commits) { | ||
// RegExp.prototype.toJSON = RegExp.prototype.toString; // JSON.stringify会调用正则表达式的toJSON | ||
// return JSON.stringify(commits, null, 2); // output commits | ||
|
||
let output = ''; | ||
|
||
commits.forEach(log => { | ||
let date = new Date(); | ||
date = `${date.getFullYear()}-${('0' + (date.getMonth() + 1)).substr( | ||
-2, | ||
)}-${('0' + date.getDate()).substr(-2)}`; | ||
|
||
let currentTag = log.tag || log.commits[0].h; | ||
let prevTag = log.previousTag || log.commits[log.commits.length - 1].h; | ||
output += `### [${currentTag}](${comparePath}${prevTag || | ||
''}...${currentTag}) (${date})\n\n`; | ||
|
||
log.results.forEach(result => { | ||
output += `#### ${result.filter.name}\n`; | ||
|
||
result.commits.forEach(commit => { | ||
output += `* ${commit.s}([${commit.h}](${commitPath}${commit.h}))\n`; | ||
}); | ||
|
||
output += '\n'; | ||
}); | ||
|
||
output += '\n\n'; | ||
}); | ||
|
||
return output; | ||
}, | ||
}; |
Empty file.
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,72 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const pkg = require('../package'); | ||
const srcDir = path.resolve('./src/assets'); | ||
const distDir = path.resolve('./dist/'); | ||
const rimraf = require('rimraf'); | ||
const svg2css = require('../src/libs/svg2css'); | ||
const cssHeaderText = | ||
`/*! | ||
* ${pkg.name} v${pkg.version} (${pkg.repository.url}) | ||
* Copyright ${new Date().getFullYear()} Tencent, Inc. | ||
* Licensed under the ${pkg.license} license | ||
*/ | ||
`; | ||
const svgHeaderText = | ||
`<!-- | ||
* ${pkg.name} v${pkg.version} (${pkg.repository.url}) | ||
* Copyright ${new Date().getFullYear()} Tencent, Inc. | ||
* Licensed under the ${pkg.license} license | ||
--> | ||
`; | ||
|
||
rimraf.sync(distDir); | ||
fs.mkdirSync(distDir); | ||
|
||
const ALL_FILE_NAME = 'weui-icon'; | ||
|
||
function writeFile(fileDirPath, fileName, content) { | ||
const fileDir = path.resolve(distDir, fileDirPath); | ||
if (!fs.existsSync(fileDir)) { | ||
fs.mkdirSync(fileDir); | ||
} | ||
|
||
fs.appendFileSync(path.resolve(fileDir, fileName), ''); | ||
fs.writeFileSync(path.resolve(fileDir, fileName), content, 'utf-8'); | ||
} | ||
|
||
// 根据assets的svg文件,生成对应的less文件 | ||
const svgDirs = fs.readdirSync(srcDir); | ||
let convertMap = {}; | ||
let svgMap = {}; | ||
svgDirs.forEach(svgDir => { | ||
const dirPath = path.resolve(srcDir, svgDir); | ||
const svgFiles = fs.readdirSync(dirPath); | ||
svgMap[svgDir] = {}; | ||
|
||
svgFiles.forEach(filePath => { | ||
const fileName = path.basename(filePath, '.svg'); | ||
const svg = fs.readFileSync(path.resolve(dirPath, filePath), 'utf-8'); | ||
const singleContent = svg2css({ | ||
[`${svgDir}-${fileName}`]: svg, | ||
}); | ||
convertMap[`${svgDir}-${fileName}`] = svg; | ||
|
||
svgMap[svgDir][fileName] = svg; | ||
writeFile(svgDir, `${fileName}.css`, `${cssHeaderText}${singleContent}`); | ||
writeFile(svgDir, `${fileName}.svg`, `${svgHeaderText}${svg}`); | ||
}); | ||
}); | ||
|
||
// 生成一个总的less文件 | ||
const allStyle = svg2css(convertMap); | ||
writeFile('.', `${ALL_FILE_NAME}.css`, `${cssHeaderText}${allStyle}`); | ||
|
||
// 生成一个map | ||
writeFile( | ||
'.', | ||
`${ALL_FILE_NAME}.js`, | ||
`${cssHeaderText}/* eslint-disable */\nmodule.exports = ${JSON.stringify(svgMap, null, 2)}`, | ||
); |
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,24 @@ | ||
{ | ||
"name": "weui-icon", | ||
"version": "0.0.0", | ||
"main": "dist/weui-icon.css", | ||
"dependencies": { | ||
"rimraf": "^3.0.2", | ||
"svgo": "^1.3.2" | ||
}, | ||
"scripts": { | ||
"convert": "svgo src/assets/* && node build/convert.js", | ||
"build": "npm run convert", | ||
"changelog": "picklog -lw CHANGELOG.md && git add -A .", | ||
"version": "npm run build && npm run changelog", | ||
"postversion": "git push && git push --tags && npm publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/weui/weui-icon" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/weui/weui-icon/issues" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.