slim-select 2.12.1 ā 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/index.d.ts +5 -2
- package/jest.config.js +5 -5
- package/package.json +25 -23
- package/release.js +198 -0
- package/src/slim-select/index.ts +6 -2
- package/vite.config.mts +0 -7
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import CssClasses from './classes';
|
|
2
2
|
import Render from './render';
|
|
3
3
|
import Select from './select';
|
|
4
|
-
import Settings
|
|
5
|
-
import
|
|
4
|
+
import Settings from './settings';
|
|
5
|
+
import type { SettingsPartial } from './settings';
|
|
6
|
+
import Store from './store';
|
|
7
|
+
import type { DataArray, DataArrayPartial, Option, OptionOptional } from './store';
|
|
8
|
+
export { DataArray, DataArrayPartial, Option, OptionOptional, SettingsPartial };
|
|
6
9
|
export interface Config {
|
|
7
10
|
select: string | Element;
|
|
8
11
|
data?: DataArrayPartial;
|
package/jest.config.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
2
|
-
|
|
2
|
+
export default {
|
|
3
3
|
verbose: true,
|
|
4
4
|
preset: 'ts-jest',
|
|
5
5
|
testEnvironment: 'jsdom',
|
|
6
6
|
testMatch: ['**/*.test.ts'],
|
|
7
7
|
roots: ['./src/slim-select'],
|
|
8
|
-
reporters: process.env.CI ? [['github-actions', {silent: false}], 'summary'] : ['default'],
|
|
8
|
+
reporters: process.env.CI ? [['github-actions', { silent: false }], 'summary'] : ['default'],
|
|
9
9
|
coverageThreshold: {
|
|
10
10
|
global: {
|
|
11
|
-
lines: 75
|
|
12
|
-
}
|
|
13
|
-
}
|
|
11
|
+
lines: 75
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slim-select",
|
|
3
3
|
"description": "Slim advanced select dropdown",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.13.1",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
|
|
6
7
|
"homepage": "https://slimselectjs.com",
|
|
7
8
|
"license": "MIT",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"exports": {
|
|
30
31
|
".": {
|
|
31
32
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/slimselect.js",
|
|
33
|
+
"import": "./dist/slimselect.es.js",
|
|
33
34
|
"require": "./dist/slimselect.umd.js"
|
|
34
35
|
},
|
|
35
36
|
"./*": {
|
|
@@ -49,48 +50,49 @@
|
|
|
49
50
|
"build:library:css": "cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../",
|
|
50
51
|
"lint": "prettier --write ./src/**/*",
|
|
51
52
|
"test": "jest",
|
|
52
|
-
"test:coverage": "jest --coverage"
|
|
53
|
+
"test:coverage": "jest --coverage",
|
|
54
|
+
"release": "node release.js"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@jest/globals": "^30.
|
|
57
|
+
"@jest/globals": "^30.1.2",
|
|
56
58
|
"@rollup/plugin-babel": "^6.0.4",
|
|
57
59
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
58
60
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
59
61
|
"@rollup/plugin-replace": "^6.0.2",
|
|
60
62
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
62
|
-
"@testing-library/jest-dom": "^6.
|
|
63
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
64
|
+
"@testing-library/jest-dom": "^6.8.0",
|
|
63
65
|
"@testing-library/user-event": "^14.6.1",
|
|
64
66
|
"@types/downloadjs": "^1.4.6",
|
|
65
67
|
"@types/jest": "^30.0.0",
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
67
|
-
"@typescript-eslint/parser": "^8.
|
|
68
|
-
"@vitejs/plugin-vue": "^
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.44.1",
|
|
69
|
+
"@typescript-eslint/parser": "^8.44.1",
|
|
70
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
69
71
|
"clipboard": "^2.0.11",
|
|
70
72
|
"downloadjs": "^1.4.7",
|
|
71
|
-
"eslint": "^9.
|
|
72
|
-
"eslint-config-prettier": "^10.1.
|
|
73
|
-
"eslint-plugin-prettier": "^5.5.
|
|
73
|
+
"eslint": "^9.36.0",
|
|
74
|
+
"eslint-config-prettier": "^10.1.8",
|
|
75
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
74
76
|
"identity-obj-proxy": "^3.0.0",
|
|
75
|
-
"jest": "^30.
|
|
77
|
+
"jest": "^30.1.3",
|
|
76
78
|
"jest-canvas-mock": "^2.5.0",
|
|
77
|
-
"jest-environment-jsdom": "^30.
|
|
78
|
-
"prettier": "^3.
|
|
79
|
+
"jest-environment-jsdom": "^30.1.2",
|
|
80
|
+
"prettier": "^3.6.2",
|
|
79
81
|
"prismjs": "^1.30.0",
|
|
80
82
|
"rimraf": "^6.0.1",
|
|
81
|
-
"rollup": "^4.
|
|
83
|
+
"rollup": "^4.52.2",
|
|
82
84
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
83
85
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
84
86
|
"rollup-plugin-vue": "^6.0.0",
|
|
85
|
-
"sass": "^1.
|
|
86
|
-
"ts-jest": "^29.4.
|
|
87
|
+
"sass": "^1.93.2",
|
|
88
|
+
"ts-jest": "^29.4.4",
|
|
87
89
|
"tslib": "^2.8.1",
|
|
88
|
-
"typescript": "^5.
|
|
89
|
-
"vite": "^
|
|
90
|
+
"typescript": "^5.9.2",
|
|
91
|
+
"vite": "^7.1.7",
|
|
90
92
|
"vite-plugin-dts": "^4.5.4",
|
|
91
|
-
"vue": "^3.5.
|
|
93
|
+
"vue": "^3.5.22",
|
|
92
94
|
"vue-router": "^4.5.1",
|
|
93
|
-
"vue-tsc": "^
|
|
95
|
+
"vue-tsc": "^3.0.8",
|
|
94
96
|
"vuex": "^4.0.2"
|
|
95
97
|
}
|
|
96
|
-
}
|
|
98
|
+
}
|
package/release.js
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process'
|
|
4
|
+
import { readFileSync, writeFileSync } from 'fs'
|
|
5
|
+
import { fileURLToPath } from 'url'
|
|
6
|
+
import { dirname, join } from 'path'
|
|
7
|
+
import readline from 'readline'
|
|
8
|
+
import process from 'process'
|
|
9
|
+
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
11
|
+
const __dirname = dirname(__filename)
|
|
12
|
+
const rootDir = __dirname
|
|
13
|
+
|
|
14
|
+
// Colors for console output
|
|
15
|
+
const colors = {
|
|
16
|
+
reset: '\x1b[0m',
|
|
17
|
+
bright: '\x1b[1m',
|
|
18
|
+
red: '\x1b[31m',
|
|
19
|
+
green: '\x1b[32m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
blue: '\x1b[34m',
|
|
22
|
+
magenta: '\x1b[35m',
|
|
23
|
+
cyan: '\x1b[36m'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function log(message, color = 'reset') {
|
|
27
|
+
console.log(`${colors[color]}${message}${colors.reset}`)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function exec(command, options = {}) {
|
|
31
|
+
try {
|
|
32
|
+
log(`Running: ${command}`, 'cyan')
|
|
33
|
+
execSync(command, {
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
cwd: rootDir,
|
|
36
|
+
...options
|
|
37
|
+
})
|
|
38
|
+
return true
|
|
39
|
+
} catch (error) {
|
|
40
|
+
log(`Command failed: ${command}`, 'red')
|
|
41
|
+
log(`Exit code: ${error.status}`, 'red')
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readPackageJson() {
|
|
47
|
+
const packagePath = join(rootDir, 'package.json')
|
|
48
|
+
return JSON.parse(readFileSync(packagePath, 'utf8'))
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function writePackageJson(packageJson) {
|
|
52
|
+
const packagePath = join(rootDir, 'package.json')
|
|
53
|
+
writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n')
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function askQuestion(question) {
|
|
57
|
+
const rl = readline.createInterface({
|
|
58
|
+
input: process.stdin,
|
|
59
|
+
output: process.stdout
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
return new Promise((resolve) => {
|
|
63
|
+
rl.question(question, (answer) => {
|
|
64
|
+
rl.close()
|
|
65
|
+
resolve(answer)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function validateVersion(currentVersion, newVersion) {
|
|
71
|
+
// Check if version format is valid (x.y.z)
|
|
72
|
+
const versionRegex = /^\d+\.\d+\.\d+$/
|
|
73
|
+
if (!versionRegex.test(newVersion)) {
|
|
74
|
+
log('ā Invalid version format. Please use format: x.y.z (e.g., 1.0.1)', 'red')
|
|
75
|
+
return null
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const [major1, minor1, patch1] = currentVersion.split('.').map(Number)
|
|
79
|
+
const [major2, minor2, patch2] = newVersion.split('.').map(Number)
|
|
80
|
+
|
|
81
|
+
// Check if new version is greater than current
|
|
82
|
+
if (major2 > major1) return 'major'
|
|
83
|
+
if (major2 === major1 && minor2 > minor1) return 'minor'
|
|
84
|
+
if (major2 === major1 && minor2 === minor1 && patch2 > patch1) return 'patch'
|
|
85
|
+
|
|
86
|
+
log('ā New version must be greater than current version', 'red')
|
|
87
|
+
log(` Current: ${currentVersion}`, 'yellow')
|
|
88
|
+
log(` New: ${newVersion}`, 'yellow')
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function main() {
|
|
93
|
+
log('š Starting release process...', 'bright')
|
|
94
|
+
|
|
95
|
+
// Step 1: Run tests
|
|
96
|
+
log('\nš Step 1: Running tests...', 'yellow')
|
|
97
|
+
if (!exec('npm test')) {
|
|
98
|
+
log('ā Tests failed. Aborting release.', 'red')
|
|
99
|
+
process.exit(1)
|
|
100
|
+
}
|
|
101
|
+
log('ā
Tests passed!', 'green')
|
|
102
|
+
|
|
103
|
+
// Step 2: Build the project
|
|
104
|
+
log('\nšØ Step 2: Building project...', 'yellow')
|
|
105
|
+
|
|
106
|
+
// First run type check to catch TypeScript errors
|
|
107
|
+
log('Running type check...', 'cyan')
|
|
108
|
+
if (!exec('npx tsc --noEmit')) {
|
|
109
|
+
log('ā Type check failed. Aborting release.', 'red')
|
|
110
|
+
process.exit(1)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Then build
|
|
114
|
+
if (!exec('npm run build')) {
|
|
115
|
+
log('ā Build failed. Aborting release.', 'red')
|
|
116
|
+
process.exit(1)
|
|
117
|
+
}
|
|
118
|
+
log('ā
Build successful!', 'green')
|
|
119
|
+
|
|
120
|
+
// Step 3: Confirm documentation update
|
|
121
|
+
log('\nš Step 3: Documentation update confirmation...', 'yellow')
|
|
122
|
+
log(' Please ensure you have updated the documentation before proceeding.', 'cyan')
|
|
123
|
+
|
|
124
|
+
let docConfirmed = false
|
|
125
|
+
do {
|
|
126
|
+
const docAnswer = await askQuestion('Have you updated the documentation? (y/n): ')
|
|
127
|
+
docConfirmed = docAnswer.toLowerCase() === 'y' || docAnswer.toLowerCase() === 'yes'
|
|
128
|
+
|
|
129
|
+
if (!docConfirmed) {
|
|
130
|
+
log('ā Please update the documentation before continuing with the release.', 'red')
|
|
131
|
+
log(' You can run: npm run build:docs', 'cyan')
|
|
132
|
+
}
|
|
133
|
+
} while (!docConfirmed)
|
|
134
|
+
|
|
135
|
+
log('ā
Documentation update confirmed!', 'green')
|
|
136
|
+
|
|
137
|
+
// Step 4: Get current version and ask for new version
|
|
138
|
+
const packageJson = readPackageJson()
|
|
139
|
+
const currentVersion = packageJson.version
|
|
140
|
+
|
|
141
|
+
log(`\nš¦ Current version: ${currentVersion}`, 'blue')
|
|
142
|
+
log(' Format: x.y.z (e.g., 1.0.1, 1.1.0, 2.0.0)', 'cyan')
|
|
143
|
+
|
|
144
|
+
let newVersion
|
|
145
|
+
let versionType
|
|
146
|
+
|
|
147
|
+
do {
|
|
148
|
+
newVersion = await askQuestion(`Enter new version (current: ${currentVersion}): `)
|
|
149
|
+
versionType = validateVersion(currentVersion, newVersion)
|
|
150
|
+
} while (!versionType)
|
|
151
|
+
|
|
152
|
+
log(`\nš Step 4: Updating version from ${currentVersion} to ${newVersion} (${versionType} release)...`, 'yellow')
|
|
153
|
+
|
|
154
|
+
// Update package.json
|
|
155
|
+
packageJson.version = newVersion
|
|
156
|
+
writePackageJson(packageJson)
|
|
157
|
+
log('ā
Package.json updated!', 'green')
|
|
158
|
+
|
|
159
|
+
// Update package-lock.json to match the new version
|
|
160
|
+
log('Updating package-lock.json...', 'cyan')
|
|
161
|
+
if (!exec('npm install --package-lock-only')) {
|
|
162
|
+
log('ā Failed to update package-lock.json. Aborting release.', 'red')
|
|
163
|
+
process.exit(1)
|
|
164
|
+
}
|
|
165
|
+
log('ā
Package-lock.json updated!', 'green')
|
|
166
|
+
|
|
167
|
+
// Step 5: NPM login
|
|
168
|
+
log('\nš Step 5: NPM login...', 'yellow')
|
|
169
|
+
if (!exec('npm login')) {
|
|
170
|
+
log('ā NPM login failed. Aborting release.', 'red')
|
|
171
|
+
process.exit(1)
|
|
172
|
+
}
|
|
173
|
+
log('ā
NPM login successful!', 'green')
|
|
174
|
+
|
|
175
|
+
// Step 6: NPM publish
|
|
176
|
+
log('\nš¤ Step 6: Publishing to NPM...', 'yellow')
|
|
177
|
+
if (!exec('npm publish')) {
|
|
178
|
+
log('ā NPM publish failed. Aborting release.', 'red')
|
|
179
|
+
process.exit(1)
|
|
180
|
+
}
|
|
181
|
+
log('ā
Package published to NPM!', 'green')
|
|
182
|
+
|
|
183
|
+
log('\nš Release completed successfully!', 'bright')
|
|
184
|
+
log(`š¦ Version ${newVersion} is now published on NPM`, 'green')
|
|
185
|
+
log(`š Package: https://www.npmjs.com/package/${packageJson.name}`, 'blue')
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Handle errors
|
|
189
|
+
process.on('unhandledRejection', (error) => {
|
|
190
|
+
log(`ā Unhandled error: ${error}`, 'red')
|
|
191
|
+
process.exit(1)
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
// Run the release script
|
|
195
|
+
main().catch((error) => {
|
|
196
|
+
log(`ā Release failed: ${error}`, 'red')
|
|
197
|
+
process.exit(1)
|
|
198
|
+
})
|
package/src/slim-select/index.ts
CHANGED
|
@@ -2,8 +2,12 @@ import CssClasses from './classes'
|
|
|
2
2
|
import { debounce, hasClassInTree, isEqual } from './helpers'
|
|
3
3
|
import Render from './render'
|
|
4
4
|
import Select from './select'
|
|
5
|
-
import Settings
|
|
6
|
-
import
|
|
5
|
+
import Settings from './settings'
|
|
6
|
+
import type { SettingsPartial } from './settings'
|
|
7
|
+
import Store from './store'
|
|
8
|
+
import type { DataArray, DataArrayPartial, Option, OptionOptional } from './store'
|
|
9
|
+
|
|
10
|
+
export { DataArray, DataArrayPartial, Option, OptionOptional, SettingsPartial }
|
|
7
11
|
|
|
8
12
|
export interface Config {
|
|
9
13
|
select: string | Element
|
package/vite.config.mts
CHANGED