purgetss 7.1.3 → 7.1.4
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/dist/purgetss.ui.js +1 -1
- package/experimental/completions2.js +1 -0
- package/package.json +1 -1
- package/src/cli/commands/init.js +2 -6
- package/src/cli/commands/watch.js +2 -6
- package/src/core/builders/tailwind-helpers.js +4 -1
- package/src/index.js +15 -14
- package/src/shared/config-manager.js +23 -7
- package/src/index-legacy.js +0 -2973
package/dist/purgetss.ui.js
CHANGED
|
@@ -33,6 +33,7 @@ const srcConfigFile = path.resolve(__dirname, '../lib/templates/purgetss.config.
|
|
|
33
33
|
|
|
34
34
|
const configFile = (fs.existsSync(projectsConfigJS)) ? require(projectsConfigJS) : require(srcConfigFile)
|
|
35
35
|
configFile.purge = configFile.purge ?? { mode: 'all' }
|
|
36
|
+
configFile.theme = configFile.theme ?? {}
|
|
36
37
|
configFile.theme.extend = configFile.theme.extend ?? {}
|
|
37
38
|
|
|
38
39
|
const configOptions = (configFile.purge && configFile.purge.options) ? configFile.purge.options : {}
|
package/package.json
CHANGED
package/src/cli/commands/init.js
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
import fs from 'fs'
|
|
15
15
|
import _ from 'lodash'
|
|
16
16
|
import chalk from 'chalk'
|
|
17
|
-
import { createRequire } from 'module'
|
|
18
17
|
import { alloyProject, makeSureFolderExists } from '../../shared/utils.js'
|
|
19
18
|
import {
|
|
20
19
|
projectsConfigJS,
|
|
@@ -31,15 +30,13 @@ import {
|
|
|
31
30
|
PurgeTSSPackageJSON
|
|
32
31
|
} from '../../shared/constants.js'
|
|
33
32
|
import { logger } from '../../shared/logger.js'
|
|
34
|
-
import { getConfigOptions } from '../../shared/config-manager.js'
|
|
33
|
+
import { getConfigOptions, getConfigFile } from '../../shared/config-manager.js'
|
|
35
34
|
import { addHook, deleteHook, createJMKFile } from '../utils/hook-management.js'
|
|
36
35
|
import { getFiles } from '../utils/font-utilities.js'
|
|
37
36
|
import { buildTailwindBasedOnConfigOptions } from '../../core/builders/tailwind-builder.js'
|
|
38
37
|
|
|
39
38
|
const cwd = process.cwd()
|
|
40
39
|
|
|
41
|
-
// Create require for ESM compatibility
|
|
42
|
-
const require = createRequire(import.meta.url)
|
|
43
40
|
|
|
44
41
|
/**
|
|
45
42
|
* Get command configuration for hooks
|
|
@@ -48,8 +45,7 @@ const require = createRequire(import.meta.url)
|
|
|
48
45
|
* @returns {Object} Command configuration object
|
|
49
46
|
*/
|
|
50
47
|
function getCommands() {
|
|
51
|
-
//
|
|
52
|
-
const { getConfigFile } = require('../../shared/config-manager.js')
|
|
48
|
+
// Use the already imported getConfigFile function
|
|
53
49
|
const configFile = getConfigFile()
|
|
54
50
|
|
|
55
51
|
let methodCommand
|
|
@@ -12,15 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
import fs from 'fs'
|
|
14
14
|
import chalk from 'chalk'
|
|
15
|
-
import { createRequire } from 'module'
|
|
16
15
|
import { alloyProject } from '../../shared/utils.js'
|
|
17
16
|
import { projectsAlloyJMKFile } from '../../shared/constants.js'
|
|
18
17
|
import { logger } from '../../shared/logger.js'
|
|
18
|
+
import { getConfigFile } from '../../shared/config-manager.js'
|
|
19
19
|
import { disableHook, deleteHook, addHook, enableHook, createJMKFile } from '../utils/hook-management.js'
|
|
20
20
|
|
|
21
|
-
// Create require for ESM compatibility
|
|
22
|
-
const require = createRequire(import.meta.url)
|
|
23
|
-
|
|
24
21
|
/**
|
|
25
22
|
* Get command configuration for hooks
|
|
26
23
|
* Maintains exact same logic as original getCommands() function
|
|
@@ -29,8 +26,7 @@ const require = createRequire(import.meta.url)
|
|
|
29
26
|
* @returns {Object} Command configuration object
|
|
30
27
|
*/
|
|
31
28
|
function getCommands() {
|
|
32
|
-
//
|
|
33
|
-
const { getConfigFile } = require('../../shared/config-manager.js')
|
|
29
|
+
// Use the already imported getConfigFile function
|
|
34
30
|
const configFile = getConfigFile()
|
|
35
31
|
|
|
36
32
|
let methodCommand
|
|
@@ -12,9 +12,12 @@ import _ from 'lodash'
|
|
|
12
12
|
import defaultColors from 'tailwindcss/colors.js'
|
|
13
13
|
|
|
14
14
|
// Import functions from their new modular locations
|
|
15
|
-
import {
|
|
15
|
+
import { getConfigFile } from '../../shared/config-manager.js'
|
|
16
16
|
import { removeDeprecatedColors, fixPercentages } from '../../shared/helpers.js'
|
|
17
17
|
|
|
18
|
+
// Get config once for this module
|
|
19
|
+
const configFile = getConfigFile()
|
|
20
|
+
|
|
18
21
|
/**
|
|
19
22
|
* Remove fit, max, min values from width, height and spacing objects
|
|
20
23
|
* @param {Object} theObject - Object with width, height, spacing properties
|
package/src/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PurgeTSS v7.1.0 -
|
|
2
|
+
* PurgeTSS v7.1.0 - CLI Tool Entry Point
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* PurgeTSS is designed as a CLI-only tool for Titanium Alloy projects.
|
|
5
|
+
* All functionality is accessed through CLI commands:
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* - purgetss (initialize and purge)
|
|
8
|
+
* - purgetss build (build tailwind.tss)
|
|
9
|
+
* - purgetss build-fonts (build fonts)
|
|
10
|
+
* - purgetss module (install UI modules)
|
|
11
|
+
* - purgetss watch (setup auto-purging)
|
|
12
|
+
*
|
|
13
|
+
* For programmatic usage, PurgeTSS is not designed as a library.
|
|
14
|
+
* Use the CLI commands from your build scripts instead.
|
|
15
|
+
*
|
|
16
|
+
* @fileoverview CLI tool - not intended for programmatic usage
|
|
8
17
|
* @version 7.1.0
|
|
9
18
|
* @author César Estrada
|
|
10
19
|
* @since 2025-06-17
|
|
11
20
|
*/
|
|
12
21
|
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
export { purgeClasses } from './cli/commands/purge.js'
|
|
16
|
-
export { buildFonts } from './cli/commands/fonts.js'
|
|
17
|
-
export { shades } from './cli/commands/shades.js'
|
|
18
|
-
|
|
19
|
-
// Export utilities that might be useful for external tools
|
|
20
|
-
export { colores } from './shared/brand-colors.js'
|
|
21
|
-
export * as helpers from './shared/helpers.js'
|
|
22
|
-
export { configFile, configOptions } from './shared/config-manager.js'
|
|
22
|
+
// No exports - PurgeTSS is a CLI-only tool
|
|
23
|
+
// Use: purgetss <command> instead of importing functions
|
|
@@ -37,15 +37,27 @@ export function getConfigFile() {
|
|
|
37
37
|
makeSureFolderExists(projectsPurgeTSSFolder)
|
|
38
38
|
fs.renameSync(oldConfigPath, projectsConfigJS)
|
|
39
39
|
logger.info('Migrated config.js to config.cjs for ESM compatibility')
|
|
40
|
+
} else if (fs.existsSync(oldConfigPath) && fs.existsSync(projectsConfigJS)) {
|
|
41
|
+
// Remove old config.js if both exist
|
|
42
|
+
fs.unlinkSync(oldConfigPath)
|
|
43
|
+
logger.info('Removed duplicate config.js file')
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
const configFile = (fs.existsSync(projectsConfigJS))
|
|
43
47
|
? require(projectsConfigJS)
|
|
44
48
|
: require(srcConfigFile)
|
|
45
49
|
|
|
46
|
-
// Apply default values
|
|
47
|
-
configFile.purge = configFile.purge ?? {
|
|
50
|
+
// Apply default values following template structure
|
|
51
|
+
configFile.purge = configFile.purge ?? {}
|
|
52
|
+
configFile.purge.mode = configFile.purge.mode ?? 'all'
|
|
48
53
|
configFile.purge.method = configFile.purge.method ?? 'sync'
|
|
54
|
+
configFile.purge.options = configFile.purge.options ?? {}
|
|
55
|
+
configFile.purge.options.missing = configFile.purge.options.missing ?? true
|
|
56
|
+
configFile.purge.options.widgets = configFile.purge.options.widgets ?? false
|
|
57
|
+
configFile.purge.options.safelist = configFile.purge.options.safelist ?? []
|
|
58
|
+
configFile.purge.options.plugins = configFile.purge.options.plugins ?? []
|
|
59
|
+
|
|
60
|
+
configFile.theme = configFile.theme ?? {}
|
|
49
61
|
configFile.theme.extend = configFile.theme.extend ?? {}
|
|
50
62
|
|
|
51
63
|
return configFile
|
|
@@ -107,7 +119,9 @@ export function loadRawConfig() {
|
|
|
107
119
|
*
|
|
108
120
|
* @returns {Object} Configuration file with defaults applied
|
|
109
121
|
*/
|
|
110
|
-
export
|
|
122
|
+
export function getGlobalConfigFile() {
|
|
123
|
+
return getConfigFile()
|
|
124
|
+
}
|
|
111
125
|
|
|
112
126
|
/**
|
|
113
127
|
* Get the global config options instance (lazy-loaded)
|
|
@@ -115,7 +129,7 @@ export const configFile = getConfigFile()
|
|
|
115
129
|
*
|
|
116
130
|
* @returns {Object} Configuration options with defaults applied
|
|
117
131
|
*/
|
|
118
|
-
export
|
|
132
|
+
export function getGlobalConfigOptions() {
|
|
119
133
|
const file = getConfigFile()
|
|
120
134
|
const options = (file.purge && file.purge.options) ? file.purge.options : {}
|
|
121
135
|
|
|
@@ -126,7 +140,9 @@ export const configOptions = (() => {
|
|
|
126
140
|
}
|
|
127
141
|
|
|
128
142
|
return options
|
|
129
|
-
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Legacy exports removed - use getConfigFile() and getConfigOptions() functions instead
|
|
130
146
|
|
|
131
147
|
/**
|
|
132
148
|
* Export defaultTheme from tailwindcss for backward compatibility
|
|
@@ -142,7 +158,7 @@ export default {
|
|
|
142
158
|
hasProjectConfig,
|
|
143
159
|
getActiveConfigPath,
|
|
144
160
|
loadRawConfig,
|
|
145
|
-
|
|
146
|
-
|
|
161
|
+
getGlobalConfigFile,
|
|
162
|
+
getGlobalConfigOptions,
|
|
147
163
|
defaultTheme
|
|
148
164
|
}
|