Skip to content

Commit

Permalink
Fix theme of tree, and the scipt for building assets
Browse files Browse the repository at this point in the history
  • Loading branch information
cklei-carly committed Nov 6, 2023
1 parent 7460013 commit fee5cb7
Show file tree
Hide file tree
Showing 10 changed files with 2,162 additions and 4,715 deletions.
28 changes: 28 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.idea export-ignore
/.prettierrc export-ignore
/.package-lock.json export-ignore
/.editorconfig export-ignore
/.php_cs.dist.php export-ignore
/.vscode export-ignore
/art export-ignore
/docs export-ignore
/images export-ignore
/tests export-ignore
/package.json export-ignore
/phpstan-baseline.neon export-ignore
/phpstan.neon.dist export-ignore
/postcss.config.js export-ignore
/phpunit.xml.dist export-ignore
/pint.json export-ignore
/psalm.xml export-ignore
/psalm.xml.dist export-ignore
/tailwind.config.js export-ignore
/testbench.yaml export-ignore
/UPGRADING.md export-ignore
8 changes: 5 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
.DS_Store
.idea
.phpunit.result.cache
.vscode
build
composer.lock
coverage
docs
node_modules
phpunit.xml
phpstan.neon
testbench.yaml
vendor
node_modules
/build/
vendor
50 changes: 50 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import esbuild from 'esbuild'

const isDev = process.argv.includes('--dev')

async function compile(options) {
const context = await esbuild.context(options)

if (isDev) {
await context.watch()
} else {
await context.rebuild()
await context.dispose()
}
}

const defaultOptions = {
define: {
'process.env.NODE_ENV': isDev ? `'development'` : `'production'`,
},
bundle: true,
mainFields: ['module', 'main'],
platform: 'neutral',
sourcemap: isDev ? 'inline' : false,
sourcesContent: isDev,
treeShaking: true,
target: ['es2020'],
minify: !isDev,
plugins: [{
name: 'watchPlugin',
setup: function (build) {
build.onStart(() => {
console.log(`Build started at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)
})

build.onEnd((result) => {
if (result.errors.length > 0) {
console.log(`Build failed at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`, result.errors)
} else {
console.log(`Build finished at ${new Date(Date.now()).toLocaleTimeString()}: ${build.initialOptions.outfile}`)
}
})
}
}],
}

compile({
...defaultOptions,
entryPoints: ['./resources/js/plugin.js'],
outfile: './resources/dist/filament-tree.js',
})
Loading

0 comments on commit fee5cb7

Please sign in to comment.