artharexian-ui 0.2.3 → 0.2.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/cli/index.mjs +17 -12
- package/package.json +1 -1
package/cli/index.mjs
CHANGED
|
@@ -44,29 +44,34 @@ function ensureCssImport() {
|
|
|
44
44
|
|
|
45
45
|
let code = fs.readFileSync(mainFile, 'utf8')
|
|
46
46
|
|
|
47
|
-
if
|
|
47
|
+
// Check if local styles import exists
|
|
48
|
+
if (code.includes('./styles/style.css') || code.includes('@/styles/style.css')) return
|
|
48
49
|
|
|
49
|
-
code = `import '
|
|
50
|
+
code = `import './styles/style.css'\n` + code
|
|
50
51
|
fs.writeFileSync(mainFile, code)
|
|
51
|
-
console.log('✔
|
|
52
|
+
console.log('✔ Style import added to src/main')
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
function copyStyles() {
|
|
55
|
-
const stylesSrc = path.
|
|
56
|
+
const stylesSrc = path.resolve(cwd, 'node_modules/artharexian-ui/src/styles')
|
|
56
57
|
const stylesDst = path.resolve(cwd, 'src/styles')
|
|
57
58
|
|
|
58
59
|
if (!fs.existsSync(stylesSrc)) {
|
|
59
|
-
|
|
60
|
-
const nmStyles = path.resolve(cwd, 'node_modules/artharexian-ui/src/styles')
|
|
61
|
-
if (fs.existsSync(nmStyles)) {
|
|
62
|
-
copyDir(nmStyles, stylesDst)
|
|
63
|
-
console.log('✔ Styles copied to src/styles')
|
|
64
|
-
}
|
|
60
|
+
console.log('⚠ Styles not found in package')
|
|
65
61
|
return
|
|
66
62
|
}
|
|
67
63
|
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
fs.mkdirSync(stylesDst, { recursive: true })
|
|
65
|
+
|
|
66
|
+
// Copy all CSS files from package to project
|
|
67
|
+
for (const file of fs.readdirSync(stylesSrc)) {
|
|
68
|
+
if (file.endsWith('.css')) {
|
|
69
|
+
const srcFile = path.join(stylesSrc, file)
|
|
70
|
+
const dstFile = path.join(stylesDst, file)
|
|
71
|
+
fs.copyFileSync(srcFile, dstFile)
|
|
72
|
+
console.log(`✔ ${file} installed to src/styles/${file}`)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
70
75
|
}
|
|
71
76
|
|
|
72
77
|
if (!command) {
|