Skip to content

Commit cd145fe

Browse files
committed
chore: bump deps, refactored configs
1 parent c0fe665 commit cd145fe

20 files changed

+101
-7610
lines changed

.commitlintrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional']
3+
};

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text=auto
1+
* text=auto eol=lf

.github/workflows/ci.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
on:
3+
- push
4+
- pull_request
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os:
11+
- ubuntu-latest
12+
node_version:
13+
- 14
14+
- 16
15+
- 18
16+
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Setup node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node_version }}
23+
- name: Install dependencies
24+
run: npm install
25+
- name: Run tests
26+
run: npm run test

.gitignore

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
*.log
33
.idea
44
node_modules
5-
lib
6-
5+
coverage
6+
.nyc_output
7+
locales/
8+
package-lock.json
9+
yarn.lock
710

811
Thumbs.db
912
tmp/
1013
temp/
11-
coverage
1214
*.lcov
13-
.nyc_output
15+
lib

.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn commitlint --edit $1
4+
npx --no-install commitlint --edit $1

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn lint-staged
4+
npx --no-install lint-staged && npm test

.lintstagedrc.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
module.exports = {
2-
"*.md": [
3-
filenames => filenames.map(filename => `remark ${filename} -qfo`)
4-
],
2+
"*.md": filenames => filenames.map(filename => `remark ${filename} -qfo`),
53
'package.json': 'fixpack',
64
'*.js': 'xo --fix'
75
};

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.prettierrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
singleQuote: true,
3+
bracketSpacing: true,
4+
trailingComma: 'none'
5+
};

.remarkrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['preset-github']
3+
};

.xo-config.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
prettier: true,
3+
space: true,
4+
extends: ['xo-lass'],
5+
envs: ['node', 'browser', 'jquery'],
6+
rules: {
7+
'import/extensions': 'warn'
8+
}
9+
};

README.md

-8
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
npm install @ladjs/assets
2525
```
2626

27-
[yarn][]:
28-
29-
```sh
30-
yarn add @ladjs/assets
31-
```
32-
3327

3428
## Usage
3529

@@ -52,6 +46,4 @@ See [Lad's usage][lad-usage] for more information.
5246

5347
[npm]: https://www.npmjs.com/
5448

55-
[yarn]: https://yarnpkg.com/
56-
5749
[lad-usage]: https://github.com/ladjs/lad/blob/master/template/assets/js/core.js

package.json

+23-59
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,43 @@
77
"url": "https://github.com/ladjs/assets/issues",
88
"email": "[email protected]"
99
},
10-
"commitlint": {
11-
"extends": [
12-
"@commitlint/config-conventional"
13-
]
14-
},
1510
"contributors": [
1611
"Nick Baugh <[email protected]> (http://niftylettuce.com/)"
1712
],
1813
"dependencies": {
19-
"clipboard": "^2.0.8",
14+
"clipboard": "^2.0.11",
2015
"is-string-and-not-blank": "^0.0.2",
21-
"qs": "^6.10.3",
22-
"spinkit": "1.x",
23-
"superagent": "^7.0.2",
24-
"sweetalert2": "8.x",
25-
"url-parse": "^1.5.4"
16+
"qs": "^6.10.4",
17+
"spinkit": "^1.2.5",
18+
"superagent": "^7.1.6",
19+
"sweetalert2": "^8.19.0",
20+
"url-parse": "^1.5.10"
2621
},
2722
"devDependencies": {
28-
"@babel/cli": "^7.16.8",
29-
"@babel/core": "^7.16.7",
30-
"@babel/preset-env": "^7.16.8",
31-
"@commitlint/cli": "^16.0.2",
32-
"@commitlint/config-conventional": "^16.0.0",
33-
"@ladjs/browserslist-config": "^0.0.1",
23+
"@babel/cli": "^7.17.10",
24+
"@babel/core": "^7.18.2",
25+
"@babel/preset-env": "^7.18.2",
26+
"@commitlint/cli": "^17.0.2",
27+
"@commitlint/config-conventional": "^17.0.2",
28+
"@ladjs/browserslist-config": "^1.0.0",
3429
"cross-env": "^7.0.3",
35-
"eslint": "^8.6.0",
36-
"eslint-config-xo-lass": "^1.0.6",
30+
"eslint": "^8.17.0",
31+
"eslint-config-xo-lass": "^2.0.1",
3732
"fixpack": "^4.0.0",
38-
"husky": "^7.0.4",
39-
"lint-staged": "^12.1.7",
33+
"husky": "^8.0.1",
34+
"lint-staged": "^13.0.0",
4035
"remark-cli": "^10.0.1",
41-
"remark-preset-github": "^4.0.1",
42-
"xo": "^0.47.0"
36+
"remark-preset-github": "^4.0.4",
37+
"xo": "^0.49.0"
4338
},
4439
"engines": {
45-
"node": ">=8.3"
40+
"node": ">=14"
4641
},
4742
"files": [
4843
"lib",
4944
"scss"
5045
],
5146
"homepage": "https://github.com/ladjs/assets",
52-
"husky": {
53-
"hooks": {
54-
"pre-commit": "npm test",
55-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
56-
}
57-
},
5847
"keywords": [
5948
"4",
6049
"ajax",
@@ -81,41 +70,16 @@
8170
],
8271
"license": "MIT",
8372
"main": "lib/index.js",
84-
"prettier": {
85-
"singleQuote": true,
86-
"bracketSpacing": true,
87-
"trailingComma": "none"
88-
},
89-
"remarkConfig": {
90-
"plugins": [
91-
"preset-github"
92-
]
93-
},
9473
"repository": {
9574
"type": "git",
9675
"url": "https://github.com/ladjs/assets"
9776
},
9877
"scripts": {
9978
"build": "babel src --out-dir lib --source-maps",
100-
"lint": "xo && remark . -qfo",
101-
"test": "npm run lint && npm run build",
79+
"lint": "xo --fix && remark . -qfo && fixpack",
80+
"prepare": "husky install",
81+
"pretest": "npm run lint",
82+
"test": "npm run build",
10283
"watch": "babel src --watch --out-dir lib --source-maps"
103-
},
104-
"xo": {
105-
"prettier": true,
106-
"space": true,
107-
"extends": [
108-
"xo-lass"
109-
],
110-
"envs": [
111-
"node",
112-
"browser",
113-
"jquery"
114-
],
115-
"rules": {
116-
"unicorn/catch-error-name": "off",
117-
"import/extensions": "warn",
118-
"unicorn/prefer-module": "off"
119-
}
12084
}
12185
}

src/ajax-form.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const isSANB = require('is-string-and-not-blank');
44
const qs = require('qs');
55
const superagent = require('superagent');
66

7-
const Spinner = require('./spinner');
7+
const Spinner = require('./spinner.js');
88

99
// Ajax form submission with frisbee
1010
// and sweetalert2 message response
@@ -379,12 +379,12 @@ const ajaxForm = async (ev) => {
379379
// Bootstrap 4
380380
$form.parents('.modal.show:first').modal('hide');
381381
}
382-
} catch (error) {
382+
} catch (err) {
383383
// Hide the spinner
384384
spinner.hide();
385385

386386
// Show error message
387-
Swal.fire(window._types.error, error.message, 'error');
387+
Swal.fire(window._types.error, err.message, 'error');
388388
} finally {
389389
// Re-enable form buttons
390390
$btns.prop('disabled', false).removeClass('disabled');

src/handle-hash-change.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const jumpTo = require('./jump-to');
1+
const jumpTo = require('./jump-to.js');
22

33
module.exports = (ev) => {
44
ev.preventDefault();

src/handle-hash-on-load.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const jumpTo = require('./jump-to');
1+
const jumpTo = require('./jump-to.js');
22

33
// if (window.location.hash !== '') jumpTo($, window.location.hash);
44
module.exports = () => {

src/index.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
const ajaxForm = require('./ajax-form');
2-
const changeHashOnScroll = require('./change-hash-on-scroll');
3-
const clipboard = require('./clipboard');
4-
const confirmPrompt = require('./confirm-prompt');
5-
const customFileInput = require('./custom-file-input');
6-
const flash = require('./flash');
7-
const handleFormOnPopstate = require('./handle-form-on-popstate');
8-
const handleHashChange = require('./handle-hash-change');
9-
const handleHashOnLoad = require('./handle-hash-on-load');
10-
const jumpTo = require('./jump-to');
11-
const modalAnchor = require('./modal-anchor');
12-
const resizeNavbarPadding = require('./resize-navbar-padding');
13-
const returnTo = require('./return-to');
14-
const spinner = require('./spinner');
1+
const ajaxForm = require('./ajax-form.js');
2+
const changeHashOnScroll = require('./change-hash-on-scroll.js');
3+
const clipboard = require('./clipboard.js');
4+
const confirmPrompt = require('./confirm-prompt.js');
5+
const customFileInput = require('./custom-file-input.js');
6+
const flash = require('./flash.js');
7+
const handleFormOnPopstate = require('./handle-form-on-popstate.js');
8+
const handleHashChange = require('./handle-hash-change.js');
9+
const handleHashOnLoad = require('./handle-hash-on-load.js');
10+
const jumpTo = require('./jump-to.js');
11+
const modalAnchor = require('./modal-anchor.js');
12+
const resizeNavbarPadding = require('./resize-navbar-padding.js');
13+
const returnTo = require('./return-to.js');
14+
const spinner = require('./spinner.js');
1515

1616
module.exports = {
1717
ajaxForm,

src/jump-to.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const jumpTo = (target, ev) => {
55
// if it does not have an data-target attribute then assume it's scroll top
66
if (ev && ev.currentTarget) {
77
const $currentTarget = $(ev.currentTarget);
8-
if (!$currentTarget.get(0).hasAttribute('data-target'))
8+
if (!Object.hasOwn($currentTarget.get(0).dataset, 'target'))
99
window.scrollTo(0, 0);
1010
}
1111

src/return-to.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const URLParse = require('url-parse');
22
const qs = require('qs');
33

4-
const jumpTo = require('./jump-to');
4+
const jumpTo = require('./jump-to.js');
55

66
//
77
// Since we support links containing `?return_to=/some/path`

0 commit comments

Comments
 (0)