Skip to content

Commit

Permalink
reconfigured linter and prettier and updated code base
Browse files Browse the repository at this point in the history
  • Loading branch information
unicar9 committed Jan 24, 2021
1 parent 0b27abf commit 6022100
Show file tree
Hide file tree
Showing 42 changed files with 4,788 additions and 8,708 deletions.
16 changes: 0 additions & 16 deletions .circleci/config.yml

This file was deleted.

69 changes: 54 additions & 15 deletions .neutrinorc.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,75 @@
const copy = require('@neutrinojs/copy')
const standardjs = require('@neutrinojs/standardjs')
const react = require('@neutrinojs/react')
const copy = require('@neutrinojs/copy');
const react = require('@neutrinojs/react');
const jest = require('@neutrinojs/jest');
const eslint = require('@neutrinojs/eslint');

module.exports = {
options: {
root: __dirname,
tests: 'src'
tests: 'src',
},
use: [
eslint({
// Uses extensions from neutrino.options.extensions
// test: neutrino.regexFromExtensions(),
include: [],
exclude: [/node_modules/],
eslint: {
baseConfig: {
env: {
es6: true,
browser: true,
node: true,
jest: true,
},
extends: ['eslint:recommended', 'plugin:react/recommended', 'prettier', 'prettier/react'],
globals: {
process: true,
},
overrides: [],
parser: require.resolve('babel-eslint'),
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['prettier', 'import'],
root: true,
rules: {
'prettier/prettier': ['error'],
'no-unexpected-multiline': 0,
'no-duplicate-imports': ['error'],
'no-console': 0,
'jsx-a11y/anchor-is-valid': 0,
'jsx-a11y/anchor-has-content': 0,
'import/order': [
'error',
{
groups: ['builtin', 'external', 'parent', 'sibling', 'index'],
},
],
},
},
},
}),
copy({
patterns: [
{
from: 'src/static',
to: 'static'
}
]
to: 'static',
},
],
}),
standardjs(),
react({
html: {
title: 'New Tab',
},
style: {
test: /\.(css|sass|scss)$/,
loaders: [
{ loader: 'sass-loader', useId: 'sass' }
]
}
loaders: [{ loader: 'sass-loader', useId: 'sass' }],
},
}),
jest({
setupFilesAfterEnv: ['<rootDir>/src/setupTests.js']
})
]
setupFilesAfterEnv: ['<rootDir>/src/setupTests.js'],
}),
],
};
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.history
builds
coverage
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100
}
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,67 +5,81 @@
## [2.3.0]

### 新增

- 竖版诗词选项

### 修改

- 诗词显示样式

### 修复

- 背景图下载透明度问题

## [2.2.0]

### 新增

- 更多中国色
- 在 waves 背景下左右箭头可随机变换中国色

### 修改

- 搜索框默认隐藏

## [2.1.3]

### 新增

- 新增可隐藏搜索框
- 新增搜索引擎选项

### 修改

- 更新几枝 logo
- 调整页面布局

## [2.1.2]

### 新增

- 支持本地诗词并显示错误提示。

## [2.1.1]

### 新增

- 增加今日诗词 credit

### 修复

- 诗句分行排列问题

## [2.1.0]
## [2.1.0]

### 新增

- Blobs 背景附带鼠标交互效果
- 快捷键控制动画播放 (Space) 和背景保存 (S)

## [2.0.1]
## [2.0.1]

### 新增

- 右下角弹出菜单
- 可设置默认播放动画
- 可设置保留颜色名不淡出消失
- 可点击诗词名自动连接到 Google 搜索

### 修改

- 诗词显示方式,解决了文字显示不全的问题
- 字体大小响应屏幕宽度

## [2.0.0]

### 修改

- 新版本用 React 重写了几枝,使用了 [neutrino](https://neutrinojs.org/packages/react/) 的配置
- 使用了新版本 [今日诗词 API](https://www.jinrishici.com/)
- 使用了 [Evergreen React UI library](https://evergreen.segment.com/)
- 使用了 [Evergreen React UI library](https://evergreen.segment.com/)
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 几枝 | Jizhi

[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)

支持自定义新标签页的 Chrome/Firefox 扩展,几枝将在新标签页上展示中国传统色的层叠波浪动画效果搭配经典诗词。
Expand All @@ -11,11 +12,11 @@ A Chrome/Firefox extension with custom new tab page featuring Chinese poems and

## Chrome 本地装载

* 下载最新的 release 打包文件,首先运行 `yarn` 再运行 `yarn build` 生成 **builds 文件夹(包含 Chrome 和 Firefox 的 build 文件以及压缩包)**
* 在Chrome浏览器里输入 chrome://extensions/ 进入插件管理页面
* 打开右上角开发者模式(Developer mode)
* 点击左上角 **Load unpacked** 按钮并选取刚刚生成的 **build_chrome 文件夹**
* 「几枝」装载成功,打开新标签页试试吧
- 下载最新的 release 打包文件,首先运行 `yarn` 再运行 `yarn build` 生成 **builds 文件夹(包含 Chrome 和 Firefox 的 build 文件以及压缩包)**
- 在 Chrome 浏览器里输入 chrome://extensions/ 进入插件管理页面
- 打开右上角开发者模式(Developer mode)
- 点击左上角 **Load unpacked** 按钮并选取刚刚生成的 **build_chrome 文件夹**
- 「几枝」装载成功,打开新标签页试试吧

![jizhi-2.1.0 gif](https://github.com/unicar9/jizhi/blob/master/examples/jizhi-2.1.0.gif)
![jizhi gif](https://github.com/unicar9/jizhi/blob/master/examples/jizhi.gif)
Expand All @@ -28,18 +29,14 @@ A Chrome/Firefox extension with custom new tab page featuring Chinese poems and

## 鸣谢

* 使用的字体为[方正金陵系列](http://www.foundertype.com/index.php/FontInfo/index/id/202#)的金陵细简体。
* 层叠的波浪动画效果是利用[P5.js](http://p5js.org/)实现的。
* 诗词名句调用使用[古诗词·一言API](https://gushi.ci/)
* 中国传统色名称及色号参考了以下来源:
* [中国色-中国传统颜色](http://zhongguose.com/)
* [Traditional Chinese Colors | 中国传统颜色](http://boxingp.github.io/traditional-chinese-colors/)
* [中国传统色彩](https://color.uisdc.com/)
* [最全!超美中国传统色 含RGB、CMYK色值!值得收藏!](https://www.weibo.com/ttarticle/p/show?id=2309404248238352952773)




- 使用的字体为[方正金陵系列](http://www.foundertype.com/index.php/FontInfo/index/id/202#)的金陵细简体。
- 层叠的波浪动画效果是利用[P5.js](http://p5js.org/)实现的。
- 诗词名句调用使用[古诗词·一言 API](https://gushi.ci/)
- 中国传统色名称及色号参考了以下来源:
- [中国色-中国传统颜色](http://zhongguose.com/)
- [Traditional Chinese Colors | 中国传统颜色](http://boxingp.github.io/traditional-chinese-colors/)
- [中国传统色彩](https://color.uisdc.com/)
- [最全!超美中国传统色 含 RGB、CMYK 色值!值得收藏!](https://www.weibo.com/ttarticle/p/show?id=2309404248238352952773)

## Contributors ✨

Expand Down
76 changes: 38 additions & 38 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
const chalk = require('chalk')
const fs = require('fs')
const path = require('path')
const archiver = require('archiver')
const log = console.log
const chalk = require('chalk');
const fs = require('fs');
const path = require('path');
const archiver = require('archiver');
const log = console.log;

const browsers = {
chrome: {
name: 'chrome',
labelColor: 'magenta'
labelColor: 'magenta',
},
firefox: {
name: 'firefox',
labelColor: 'yellow'
}
}
labelColor: 'yellow',
},
};

const getArchive = browser => {
const buildFolderPath = path.resolve(__dirname, `./builds/build_${browser}`)
const getArchive = (browser) => {
const buildFolderPath = path.resolve(__dirname, `./builds/build_${browser}`);

if (!fs.existsSync(buildFolderPath)) {
log(chalk.yellow(`${browser} build folder NOT found...`))
return
log(chalk.yellow(`${browser} build folder NOT found...`));
return;
}

const chalkLabel = chalk.keyword(`${browsers[browser].labelColor}`)
const label = chalkLabel(browser)
const chalkLabel = chalk.keyword(`${browsers[browser].labelColor}`);
const label = chalkLabel(browser);

log(label, chalk.green(`${browser} build folder found...`))
log(label, chalk.green(`${browser} build folder found...`));

const zipPath = path.resolve(__dirname, `./builds/${browser}.zip`)
const output = fs.createWriteStream(zipPath)
const zipPath = path.resolve(__dirname, `./builds/${browser}.zip`);
const output = fs.createWriteStream(zipPath);

const archive = archiver('zip', {
zlib: { level: 9 }
})
zlib: { level: 9 },
});

output.on('close', () => {
const fileSizeMB = (archive.pointer() / 1048576).toFixed(2)
log(label, chalk.green(`Zip file size: ${fileSizeMB} MB`))
log(label, 'archiver has been finalized and the output file descriptor has closed.')
})
const fileSizeMB = (archive.pointer() / 1048576).toFixed(2);
log(label, chalk.green(`Zip file size: ${fileSizeMB} MB`));
log(label, 'archiver has been finalized and the output file descriptor has closed.');
});

output.on('end', () => log(label, 'Data has been drained'))
output.on('end', () => log(label, 'Data has been drained'));

archive.on('warning', err => {
archive.on('warning', (err) => {
if (err.code === 'ENOENT') {
log(label, 'EEEEEE')
log(label, 'EEEEEE');
} else {
throw err
throw err;
}
})
});

archive.on('error', err => {
throw err
})
archive.on('error', (err) => {
throw err;
});

archive.pipe(output)
archive.directory(buildFolderPath, false)
archive.finalize()
}
archive.pipe(output);
archive.directory(buildFolderPath, false);
archive.finalize();
};

getArchive('chrome')
getArchive('firefox')
getArchive('chrome');
getArchive('firefox');
4 changes: 2 additions & 2 deletions chrome.background.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-undef */
chrome.browserAction.onClicked.addListener(() => {
chrome.tabs.create({ url: 'chrome://newtab' })
})
chrome.tabs.create({ url: 'chrome://newtab' });
});
Loading

0 comments on commit 6022100

Please sign in to comment.