vaderjs-native 1.0.13 → 1.0.15
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 +122 -83
- package/cli.ts +586 -196
- package/index.ts +73 -1
- package/main.ts +321 -161
- package/package.json +3 -2
- package/templates/i.txt +1 -0
- package/plugins/tailwind.ts +0 -53
package/templates/i.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/plugins/tailwind.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//@ts-nocheck
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
|
|
5
|
-
import type { VaderPlugin, VaderAPI } from "vaderjs/plugins";
|
|
6
|
-
function checkIfTailwindInstalled() {
|
|
7
|
-
try {
|
|
8
|
-
//@ts-ignore
|
|
9
|
-
require.resolve('tailwindcss')
|
|
10
|
-
require.resolve('postcss')
|
|
11
|
-
return true
|
|
12
|
-
} catch (e) {
|
|
13
|
-
return false
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function initTailwind() {
|
|
18
|
-
const postcssConfig = path.resolve(process.cwd(), 'postcss.config.mjs')
|
|
19
|
-
const tailwindCssFile = path.join(process.cwd(), '/public/styles.css')
|
|
20
|
-
if(!fs.existsSync(tailwindCssFile)){
|
|
21
|
-
fs.writeFileSync(tailwindCssFile, `@import "tailwindcss"`)
|
|
22
|
-
}
|
|
23
|
-
if (!fs.existsSync(postcssConfig)) {
|
|
24
|
-
fs.writeFileSync(postcssConfig, `export default { plugins: { "@tailwindcss/postcss": {}, }}`)
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
name: 'tailwindcss',
|
|
33
|
-
description: 'TailwindCSS plugin for Vader.js',
|
|
34
|
-
version: '0.0.2',
|
|
35
|
-
onBuildStart: async (vader) => {
|
|
36
|
-
if (!checkIfTailwindInstalled()) {
|
|
37
|
-
console.error('TailwindCSS is not installed. Please install it using `bun install tailwindcss @tailwindcss/postcss postcss-cli`\n more info: https://tailwindcss.com/docs/installation/using-postcss`')
|
|
38
|
-
process.exit(1)
|
|
39
|
-
}else{
|
|
40
|
-
initTailwind()
|
|
41
|
-
console.log('Building TailwindCSS...')
|
|
42
|
-
await vader.runCommand(['bun', 'run', 'postcss', './public/styles.css', '-o', './public/tailwind_styles.css'])
|
|
43
|
-
vader.injectHTML(`<link rel="stylesheet" href="./tailwind_styles.css">`)
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return
|
|
48
|
-
},
|
|
49
|
-
onBuildFinish: async (vader) => {
|
|
50
|
-
console.log('TailwindCSS plugin finished building')
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
} as VaderPlugin;
|