Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to vue 3 #91

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
root: true,
env: {
node: true
node: true,
es2022: true,
},
'extends': [
'plugin:vue/essential',
Expand All @@ -11,7 +12,4 @@ module.exports = {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
5 changes: 0 additions & 5 deletions babel.config.js

This file was deleted.

31 changes: 0 additions & 31 deletions cli/export.js

This file was deleted.

40 changes: 28 additions & 12 deletions cli/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env node
const { resolveConfigPath } = require('../lib/tailwindConfigUtils')
const program = require('commander')
const { createServer, build } = require('vite')
const { resolve } = require('path')

program
.option('-c, --config <path>', 'Path to your Tailwind config file', './tailwind.config.js')

Expand All @@ -9,23 +12,36 @@ program
.description('Serve the viewer')
.option('-p, --port <port>', 'Port to run the viewer on', 3000)
.option('-o, --open', 'Open the viewer in default browser')
.action(args => {
require('../server')({
port: args.port,
tailwindConfigProvider: () => {
const configPath = resolveConfigPath(program.config)
delete require.cache[configPath]
return require(configPath)
},
shouldOpen: args.open
}).start()
.action(async args => {
process.env = { ...process.env, VITE_TCV_CONFIG: program.config };

const server = await createServer({
root: resolve(__dirname, '../'),
configFile: resolve(__dirname, '../vite.config.js'),
server: {
publicDir: resolve(__dirname, '../'),
port: args.port,
open: args.open
}
})

await server.listen()
server.printUrls()
})

program
.command('export [outputDir]')
.description('Create a static export of the viewer')
.action((outputDir = './tcv-build') => {
require('./export')(outputDir, resolveConfigPath(program.config))
.action(async (outputDir = './tcv-build') => {
process.env = { ...process.env, VITE_TCV_CONFIG: program.config };

await build({
root: resolve(__dirname, '../'),
configFile: resolve(__dirname, '../vite.config.js'),
build: {
outDir: resolve(outputDir)
}
})
})

program.parse(process.argv)
1 change: 1 addition & 0 deletions docs/assets/index-TREAqDGA.css

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions docs/assets/index-equpejj-.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/config.6ce3d239.json

This file was deleted.

3 changes: 0 additions & 3 deletions docs/css/app.a4ea028b.css

This file was deleted.

30 changes: 27 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon.ico><title>tailwind-config-viewer</title><script>window.__TCV_CONFIG = {
configPath: './config.6ce3d239.json'
}</script><link href=css/app.a4ea028b.css rel=preload as=style><link href=js/app.dc5ecb43.js rel=preload as=script><link href=js/chunk-vendors.6cab5322.js rel=preload as=script><link href=css/app.a4ea028b.css rel=stylesheet></head><body><noscript><strong>We're sorry but tailwind-config-viewer doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.6cab5322.js></script><script src=js/app.dc5ecb43.js></script></body></html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="/favicon.ico">
<title>tailwind-config-viewer</title>
<script>
window.__TCV_CONFIG = {
configPath: './config.json'
}
</script>
<script type="module" crossorigin src="/assets/index-equpejj-.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-TREAqDGA.css">
</head>

<body>
<noscript>
<strong>We're sorry but tailwind-config-viewer doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong>
</noscript>
<div id="app"></div>
</body>

</html>
2 changes: 0 additions & 2 deletions docs/js/app.dc5ecb43.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/app.dc5ecb43.js.map

This file was deleted.

8 changes: 0 additions & 8 deletions docs/js/chunk-vendors.6cab5322.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/chunk-vendors.6cab5322.js.map

This file was deleted.

9 changes: 2 additions & 7 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,8 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="icon" href="/favicon.ico">
<title>tailwind-config-viewer</title>
<script>
window.__TCV_CONFIG = {
configPath: './config.json'
}
</script>
</head>

<body>
Expand All @@ -20,7 +15,7 @@
continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.js"></script>
</body>

</html>
7 changes: 0 additions & 7 deletions lib/tailwindConfigUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ const resolveConfig = config => {
return transformConfig(resolveTailwindConfig(config))
}

const resolveConfigToJson = configPath => {
const tailwindConfig = require(configPath)
return JSON.stringify(resolveConfig(tailwindConfig))
}

const transformConfig = config => {
config.tailwindVersion = tailwindVersion
config.theme = replaceWithOverrides(config.theme)
Expand Down Expand Up @@ -82,6 +77,4 @@ const removeDisabledCorePlugins = (config) => {
module.exports = {
resolveConfig,
resolveConfigPath,
resolveConfigToJson,
transformConfig
}
Loading