vaderjs 1.4.5 → 1.4.6

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.
Files changed (2) hide show
  1. package/main.js +8 -5
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -12,12 +12,12 @@ if (!fs.existsSync(process.cwd() + '/app')) {
12
12
  if (!fs.existsSync(process.cwd() + '/public')) {
13
13
  fs.mkdirSync(process.cwd() + '/public')
14
14
  }
15
- const mode = args.includes('dev') ? 'development' : args.includes('prod') ? 'production' : null
15
+ const mode = args.includes('dev') ? 'development' : args.includes('prod') || args.includes('build') ? 'production' : null
16
16
  if(!mode){
17
17
  console.log(`
18
18
  Usage:
19
19
  bun vaderjs dev - Start development server output in dist/
20
- bun vaderjs prod - Build for production output in dist/
20
+ bun vaderjs prod - Build for production output in dist/
21
21
  `)
22
22
  process.exit(1)
23
23
  }
@@ -98,7 +98,11 @@ const handleReplacements = (code, file) => {
98
98
 
99
99
  async function generateApp() {
100
100
  // remove files from dist
101
+ if(mode === 'development'){
101
102
  fs.rmdirSync(process.cwd() + '/dist', { recursive: true })
103
+ }else{
104
+ fs.mkdirSync(process.cwd() + '/dist', { recursive: true })
105
+ }
102
106
  return new Promise(async (resolve, reject) => {
103
107
  let routes = new Bun.FileSystemRouter({
104
108
  dir: process.cwd() + '/app',
@@ -196,7 +200,6 @@ async function generateApp() {
196
200
  fs.mkdirSync(process.cwd() + '/dist/src/vader', { recursive: true })
197
201
  fs.writeFileSync(process.cwd() + '/dist/src/vader/index.js', await new Bun.Transpiler({
198
202
  loader: 'ts',
199
- minify: true,
200
203
  }).transformSync(await Bun.file(require.resolve('vaderjs')).text()))
201
204
 
202
205
  const spawn = Bun.spawn({
@@ -266,7 +269,7 @@ async function generateApp() {
266
269
 
267
270
  }
268
271
 
269
- generateApp()
272
+ await generateApp()
270
273
  function handleFiles(){
271
274
  return new Promise(async (resolve, reject) => {
272
275
  try {
@@ -282,7 +285,7 @@ function handleFiles(){
282
285
  }
283
286
  })
284
287
  }
285
- handleFiles()
288
+ await handleFiles()
286
289
  let isBuilding = false;
287
290
  let timeout = null
288
291
  if(mode === 'development'){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vaderjs",
3
- "version": "1.4.5",
3
+ "version": "1.4.6",
4
4
  "description": "A simple and powerful JavaScript library for building modern web applications.",
5
5
  "main":"./index.js",
6
6
  "bin": {