Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style tweak #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env'],
}
22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,33 @@
"node": ">=8.16.0"
},
"scripts": {
"install-deps": "yarn && node \"./scripts/install-dependencies.js\"",
"lint": "run-p lint:*",
"lint:eslint": "eslint \"**/*.{js,mjs,vue}\"",
"lint:prettier": "prettier \"**/*.{css,html,js,json,less,md,scss,ts,vue,yaml,yml}\" --check",
"lint:stylelint": "stylelint \"**/*.{css,scss,less}\"",
"format": "run-p format:*",
"format:eslint": "yarn lint:eslint --fix",
"format:prettier": "prettier \"**/*.{css,html,js,json,less,md,scss,ts,vue,yaml,yml}\" --write",
"format:stylelint": "yarn lint:stylelint --fix"
"format:stylelint": "yarn lint:stylelint --fix",
"prepare": "node \"./scripts/install-dependencies.js\""
},
"dependencies": {
"dd_belatedpng": "1.0.3",
"html5shiv": "3.7.3",
"jquery": "3.5.0",
"jquery": "3.6.0",
"jquery-v1": "npm:[email protected]",
"jquery-v2": "npm:[email protected]",
"normalize.css": "8.0.1"
},
"devDependencies": {
"@fisker/eslint-config": "1.6.9",
"@fisker/eslint-config-legacy": "1.2.3",
"@fisker/prettier-config": "1.0.30",
"@fisker/stylelint-config": "1.2.4",
"eslint": "6.0.1",
"prettier": "1.19.1",
"stylelint": "13.0.0"
"@babel/preset-env": "7.14.4",
"@fisker/eslint-config": "6.0.1",
"@fisker/eslint-config-legacy": "5.0.8",
"@fisker/prettier-config": "4.0.4",
"@fisker/stylelint-config": "2.3.5",
"eslint": "7.27.0",
"npm-run-all": "4.1.5",
"prettier": "2.3.0",
"stylelint": "13.13.1"
}
}
2 changes: 1 addition & 1 deletion project.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const PROJECT_NAME = (() => {
try {
return require('./package.json').name
} catch {
return __dirname.split(/[\\/]/).pop()
return __dirname.split(/[/\\]/).pop()
}
})()

Expand Down
37 changes: 19 additions & 18 deletions scripts/check-fis3-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fis.log.throw = true

function getStdin() {
const {stdin} = process
return new Promise(resolve => {
return new Promise((resolve) => {
let result = ''
if (stdin.isTTY) {
resolve(result)
Expand All @@ -31,17 +31,17 @@ function getStdin() {
})
}

;(async function() {
;(async function () {
const input = await getStdin()
let plugins = input
.split('\n')
.map(text => {
.map((text) => {
const match = text.match(/--\s*(.*?)\s+/)
if (!match) {
return null
}
const type = match[1]
const re = /\[plugin `(.*?)`\]/g
const re = /\[plugin `(.*?)`]/g
const plugins = []
let result
while ((result = re.exec(text))) {
Expand All @@ -52,30 +52,31 @@ function getStdin() {
return null
}

return plugins.map(name => `${type}-${name}`)
return plugins.map((name) => `${type}-${name}`)
})
.filter(Boolean)

plugins = plugins.reduce((acc, current) =>
acc.concat(current.push ? current : [current])
)
plugins = plugins.reduce((accumulator, current) => [
...accumulator,
...(Array.isArray(current) ? current : [current]),
])

plugins = [...new Set(plugins)]

plugins = plugins.filter(name => {
plugins = plugins.filter((name) => {
try {
fis.require(name)
return false
} catch (error) {
} catch {
return true
}
})

if (plugins.length > 0) {
if (plugins.length !== 0) {
const configFile = path.join(__dirname, 'fis/index.js')
const source = fs.readFileSync(configFile, 'utf-8').replace('"', "'")

plugins = plugins.map(name => {
plugins = plugins.map((name) => {
if (source.includes(`'fis3-${name}'`)) {
return `fis3-${name}`
}
Expand All @@ -86,23 +87,23 @@ function getStdin() {
return name
})

const confirmedPlugins = plugins.filter(name => name.startsWith('fis'))
const unConfirmedPlugins = plugins.filter(name => !name.startsWith('fis'))
const confirmedPlugins = plugins.filter((name) => name.startsWith('fis'))
const unConfirmedPlugins = plugins.filter((name) => !name.startsWith('fis'))

if (confirmedPlugins.length > 0) {
if (confirmedPlugins.length !== 0) {
console.log(`缺少插件,安装脚本:

npm install -global ${confirmedPlugins.join(' ')}
`)
}

if (unConfirmedPlugins.length > 0) {
unConfirmedPlugins.forEach(name => {
if (unConfirmedPlugins.length !== 0) {
for (const name of unConfirmedPlugins) {
console.log(`缺少未知名称的插件 ${name} ,请确认插件名称后安装:
npm install -global fis3-${name}
或 npm install -global fis-${name}
`)
})
}
}

process.exit(1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/code-style/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function codeStyleGetter(lang) {
lang = lang || '_'
let codeStyle = cache[lang]
if (!codeStyle) {
codeStyle = Object.assign({}, codeStyleForLang[lang], editorConfig)
codeStyle = {...codeStyleForLang[lang], ...editorConfig}

cache[lang] = codeStyle
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = {
ARCHIVE_TYPE_GZ: 'tar.gz',
TIMESTAMP: new Date()
.toJSON()
.replace(/[-:]/g, '')
.replace(/[:-]/g, '')
.replace('T', '-')
.slice(2, 15),
DEVICE_MULTI: 'multi-device',
Expand Down
2 changes: 1 addition & 1 deletion scripts/dependencies/get-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function getDependencies(directory) {
const names = Object.keys(dependencies).sort()

return names
.map(name => ({name, version: dependencies[name]}))
.map((name) => ({name, version: dependencies[name]}))
.map(getDependencyInfo)
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/dependencies/get-package-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function getPackageFiles({pkg: package_, dir: directory}, relative = false) {
let files = getFiles(directory)

if (relative) {
files = files.map(file => path.relative(directory, file))
files = files.map((file) => path.relative(directory, file))
}

return files
Expand Down
4 changes: 2 additions & 2 deletions scripts/ejs-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function script(files) {
files = Array.isArray(files) ? files : [files]
return files
.map(function(file) {
.map(function (file) {
return `<script src="${file}"></script>`
})
.join('\n')
Expand All @@ -13,7 +13,7 @@ function script(files) {
function style(files) {
files = Array.isArray(files) ? files : [files]
return files
.map(function(file) {
.map(function (file) {
return `<link href="${file}" rel="stylesheet">`
})
.join('\n')
Expand Down
13 changes: 6 additions & 7 deletions scripts/fis/hack/fix-fis3-command-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function fixPackage(folder) {
let code = ''
try {
code = fs.readFileSync(file, 'utf-8')
} catch (error) {
} catch {
return
}

Expand All @@ -22,14 +22,11 @@ function fixPackage(folder) {

try {
fs.writeFileSync(
`${file}-${new Date()
.toISOString()
.replace(/\D/g, '')
.slice(0, 8)}.bak`,
`${file}-${new Date().toISOString().replace(/\D/g, '').slice(0, 8)}.bak`,
code
)
fs.writeFileSync(file, newCode)
} catch (error) {
} catch {
fis.log.warn(
'fis3可能无法监听到路径包含中文的文件的更新.\n你可以手动修改此文件[ %s ]',
file
Expand All @@ -38,7 +35,9 @@ function fixPackage(folder) {
}

function fix() {
fis.util.forEach(fis.require.paths, fixPackage)
for (const file of fis.require.paths) {
fixPackage(file)
}
}

fix()
Loading