@newlogic-digital/core 4.0.1 → 4.1.0-next.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/index.js +13 -0
- package/package.json +9 -9
- package/src/linkAgentSkills.js +29 -16
- package/src/postcssCustomProperties.js +14 -0
package/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { Features as LightningCssFeatures, browserslistToTargets } from 'lightni
|
|
|
10
10
|
import process from 'node:process'
|
|
11
11
|
import heroicons from '@newlogic-digital/vite-plugin-heroicons'
|
|
12
12
|
import { fileURLToPath } from 'node:url'
|
|
13
|
+
import { processPostcssCustomProperties } from '@newlogic-digital/core/src/postcssCustomProperties.js'
|
|
13
14
|
|
|
14
15
|
const { name } = getPackageInfo(import.meta.url)
|
|
15
16
|
|
|
@@ -79,6 +80,9 @@ const defaultOptions = {
|
|
|
79
80
|
const plugin = async (options = {}) => {
|
|
80
81
|
options = deepMergeWith(defaultOptions, options)
|
|
81
82
|
|
|
83
|
+
/**
|
|
84
|
+
* @type import('vite').Plugin[]
|
|
85
|
+
*/
|
|
82
86
|
const optionalPlugins = []
|
|
83
87
|
|
|
84
88
|
if (options.format.includes('twig')) {
|
|
@@ -106,6 +110,15 @@ const plugin = async (options = {}) => {
|
|
|
106
110
|
if (options.cssInline.paths.length > 0) {
|
|
107
111
|
const cssInline = (await import('@vituum/vite-plugin-css-inline')).default
|
|
108
112
|
|
|
113
|
+
optionalPlugins.push({
|
|
114
|
+
name: '@newlogic-digital/core:postcss-custom-properties',
|
|
115
|
+
transform(code, id) {
|
|
116
|
+
if (id.endsWith('.css') && options.mode === 'emails') {
|
|
117
|
+
return processPostcssCustomProperties(code)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
})
|
|
121
|
+
|
|
109
122
|
optionalPlugins.push(cssInline(options.cssInline))
|
|
110
123
|
}
|
|
111
124
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newlogic-digital/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.1",
|
|
4
|
+
"version": "4.1.0-next.1",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"newlogic-core": "./bin/newlogic-core.js"
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@minify-html/node": "^0.18.1",
|
|
21
|
-
"@newlogic-digital/vite-plugin-heroicons": "^1.
|
|
21
|
+
"@newlogic-digital/vite-plugin-heroicons": "^1.2.1",
|
|
22
22
|
"@stylistic/eslint-plugin": "^5.10",
|
|
23
|
-
"@stylistic/stylelint-config": "^
|
|
24
|
-
"@vituum/vite-plugin-css-inline": "^2.0.
|
|
23
|
+
"@stylistic/stylelint-config": "^5.0.0",
|
|
24
|
+
"@vituum/vite-plugin-css-inline": "^2.1.0-next.1",
|
|
25
25
|
"@vituum/vite-plugin-latte": "^2.0.2",
|
|
26
26
|
"@vituum/vite-plugin-send": "^2.0.1",
|
|
27
|
-
"browserslist": "^4.28.
|
|
27
|
+
"browserslist": "^4.28.2",
|
|
28
28
|
"browserslist-to-esbuild": "^2.1.1",
|
|
29
29
|
"lightningcss": "^1.32.0",
|
|
30
|
-
"npm-check-updates": "^
|
|
31
|
-
"oxlint": "^1.
|
|
30
|
+
"npm-check-updates": "^20.0.0",
|
|
31
|
+
"oxlint": "^1.58.0",
|
|
32
32
|
"stylelint-config-standard": "^40.0.0",
|
|
33
33
|
"vituum": "^2.0.1"
|
|
34
34
|
},
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@tailwindcss/vite": "^4.2.2",
|
|
50
50
|
"@types/node": "^25.5",
|
|
51
51
|
"@vituum/vite-plugin-twig": "^2.0.1",
|
|
52
|
-
"rolldown": "^1.0.0-rc.
|
|
53
|
-
"typescript": "^
|
|
52
|
+
"rolldown": "^1.0.0-rc.12",
|
|
53
|
+
"typescript": "^6"
|
|
54
54
|
},
|
|
55
55
|
"files": [
|
|
56
56
|
"bin",
|
package/src/linkAgentSkills.js
CHANGED
|
@@ -46,7 +46,8 @@ if (!projectRoot || projectRoot === packageRoot || !fs.existsSync(sourceSkillsDi
|
|
|
46
46
|
|
|
47
47
|
const targetAgentsDir = path.join(projectRoot, '.agents')
|
|
48
48
|
const targetSkillsDir = path.join(targetAgentsDir, 'skills')
|
|
49
|
-
const
|
|
49
|
+
const targetClaudeDir = path.join(projectRoot, '.claude')
|
|
50
|
+
const targetClaudeSkillsDir = path.join(targetClaudeDir, 'skills')
|
|
50
51
|
const skillEntries = fs.readdirSync(sourceSkillsDir, { withFileTypes: true })
|
|
51
52
|
.filter(entry => entry.isDirectory())
|
|
52
53
|
|
|
@@ -57,7 +58,7 @@ if (skillEntries.length === 0) {
|
|
|
57
58
|
fs.mkdirSync(targetSkillsDir, { recursive: true })
|
|
58
59
|
|
|
59
60
|
let linkedCount = 0
|
|
60
|
-
let
|
|
61
|
+
let linkedClaudeSkillsDir = false
|
|
61
62
|
|
|
62
63
|
for (const entry of skillEntries) {
|
|
63
64
|
const sourcePath = path.join(sourceSkillsDir, entry.name)
|
|
@@ -81,27 +82,39 @@ for (const entry of skillEntries) {
|
|
|
81
82
|
linkedCount += 1
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
const claudeStat = getExistingTargetStat(
|
|
85
|
+
const claudeStat = getExistingTargetStat(targetClaudeDir)
|
|
86
|
+
let shouldLinkClaudeSkillsDir = true
|
|
85
87
|
|
|
86
|
-
if (claudeStat) {
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
if (claudeStat?.isSymbolicLink()) {
|
|
89
|
+
console.warn(`${styleText(['cyan', 'bold'], name)} ${styleText('yellow', `Skipping "${targetClaudeSkillsDir}" because "${targetClaudeDir}" already exists as a symlink. Remove "${targetClaudeDir}" and run the command again.`)}`)
|
|
90
|
+
shouldLinkClaudeSkillsDir = false
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (shouldLinkClaudeSkillsDir) {
|
|
94
|
+
fs.mkdirSync(targetClaudeDir, { recursive: true })
|
|
95
|
+
|
|
96
|
+
const claudeSkillsStat = getExistingTargetStat(targetClaudeSkillsDir)
|
|
97
|
+
|
|
98
|
+
if (claudeSkillsStat) {
|
|
99
|
+
if (!claudeSkillsStat.isSymbolicLink()) {
|
|
100
|
+
console.warn(`${styleText(['cyan', 'bold'], name)} ${styleText('yellow', `Skipping "${targetClaudeSkillsDir}" because it already exists and is not a symlink.`)}`)
|
|
101
|
+
}
|
|
102
|
+
else if (!isSameSymlinkTarget(targetClaudeSkillsDir, targetSkillsDir)) {
|
|
103
|
+
fs.unlinkSync(targetClaudeSkillsDir)
|
|
104
|
+
createDirectorySymlink(targetSkillsDir, targetClaudeSkillsDir)
|
|
105
|
+
linkedClaudeSkillsDir = true
|
|
106
|
+
}
|
|
89
107
|
}
|
|
90
|
-
else
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
linkedClaudeDir = true
|
|
108
|
+
else {
|
|
109
|
+
createDirectorySymlink(targetSkillsDir, targetClaudeSkillsDir)
|
|
110
|
+
linkedClaudeSkillsDir = true
|
|
94
111
|
}
|
|
95
112
|
}
|
|
96
|
-
else {
|
|
97
|
-
createDirectorySymlink(targetAgentsDir, targetClaudePath)
|
|
98
|
-
linkedClaudeDir = true
|
|
99
|
-
}
|
|
100
113
|
|
|
101
114
|
if (linkedCount > 0) {
|
|
102
115
|
console.info(`${styleText(['cyan', 'bold'], name)} ${styleText('green', `Linked ${linkedCount} skill${linkedCount === 1 ? '' : 's'} into "${targetSkillsDir}".`)}`)
|
|
103
116
|
}
|
|
104
117
|
|
|
105
|
-
if (
|
|
106
|
-
console.info(`${styleText(['cyan', 'bold'], name)} ${styleText('green', `Linked "${
|
|
118
|
+
if (linkedClaudeSkillsDir) {
|
|
119
|
+
console.info(`${styleText(['cyan', 'bold'], name)} ${styleText('green', `Linked "${targetClaudeSkillsDir}" to "${targetSkillsDir}".`)}`)
|
|
107
120
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import postcss from 'postcss'
|
|
2
|
+
import postcssCustomProperties from 'postcss-custom-properties'
|
|
3
|
+
|
|
4
|
+
export const processPostcssCustomProperties = (code, options = {
|
|
5
|
+
preserve: false,
|
|
6
|
+
}) => {
|
|
7
|
+
const processedCss = postcss(
|
|
8
|
+
[
|
|
9
|
+
postcssCustomProperties(options),
|
|
10
|
+
],
|
|
11
|
+
).process(code)
|
|
12
|
+
|
|
13
|
+
return processedCss.css.replace(/\s*--[\w-]+\s*:\s*[^;]*;/g, '')
|
|
14
|
+
}
|