Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
chore: wip

chore: wip

chore: wip
  • Loading branch information
chrisbbreuer committed Jan 21, 2025
1 parent 550ee94 commit 7fb8bba
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@
"@stacksjs/path": "workspace:*",
"@stacksjs/router": "workspace:*",
"@stacksjs/validation": "workspace:*",
"bun-plugin-auto-imports": "^0.1.5",
"bun-plugin-auto-imports": "^0.3.1",
"vite": "^6.0.9",
},
},
Expand Down Expand Up @@ -3114,7 +3114,7 @@

"bumpp": ["[email protected]", "", { "dependencies": { "c12": "^2.0.1", "cac": "^6.7.14", "escalade": "^3.2.0", "js-yaml": "^4.1.0", "jsonc-parser": "^3.3.1", "package-manager-detector": "^0.2.8", "prompts": "^2.4.2", "semver": "^7.6.3", "tinyexec": "^0.3.2", "tinyglobby": "^0.2.10" }, "bin": { "bumpp": "bin/bumpp.js" } }, "sha512-KG7oQmv6cz7QQwOvM3x/yPcF8+VBEtuLEEecmohNyb4+bLbtSVpJp8brjzcZYQN7UOyR4i0qIIYThnsBgP8uCA=="],

"bun-plugin-auto-imports": ["bun-plugin-auto-imports@0.1.5", "", { "dependencies": { "unimport": "^3.14.6" } }, "sha512-aUYPxelgHEqGQ3ZwiJd0yDW3WwqwjlFug8yZGGIKVKCJyhbZlY2XrpO2MSJBybW84UaeBkjB2zhMhwaMJl+WUA=="],
"bun-plugin-auto-imports": ["bun-plugin-auto-imports@0.3.1", "", { "dependencies": { "unimport": "^3.14.6" } }, "sha512-rWgCe/C4yQ31R1MIwhtVgKWwpGN2OFUIkAdvAgX0TxbS2X8kt5Tc5QN8d7NpaeNjbT/v/rEJ1NmqauQjIB9WLQ=="],

"bun-plugin-dtsx": ["[email protected]", "", { "dependencies": { "@stacksjs/dtsx": "^0.8.0" } }, "sha512-ZEGVuJllTxvTGGa+fcKst0/FvShPsdll209PVWgGalEeLxsp5NfGbmmPAHsHHLxNlffxizdY+cGwI7ZmmWUpRw=="],

Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions storage/framework/core/actions/src/dev/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { log, parseOptions, runCommand } from '@stacksjs/cli'
import { config } from '@stacksjs/config'
import { path as p } from '@stacksjs/path'
import { serve } from '@stacksjs/router'
import { initiateImports } from '@stacksjs/server'

const options = parseOptions()

Expand All @@ -11,6 +12,8 @@ serve({
port: config.ports?.api, // defaults to 3008
})

initiateImports()

// the reason we start a Vite dev server next is because we need the Bun server proxied by vite
await runCommand(`bunx --bun vite --config ${p.viteConfigPath('src/api.ts')}`, {
// ...options,
Expand Down
2 changes: 1 addition & 1 deletion storage/framework/core/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@stacksjs/path": "workspace:*",
"@stacksjs/router": "workspace:*",
"@stacksjs/validation": "workspace:*",
"bun-plugin-auto-imports": "^0.1.5",
"bun-plugin-auto-imports": "^0.3.1",
"vite": "^6.0.9"
}
}
20 changes: 12 additions & 8 deletions storage/framework/core/server/src/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { plugin } from 'bun'
import { path } from '@stacksjs/path'
import { autoImports } from 'bun-plugin-auto-imports'

const options: AutoImportsOptions = {
dts: path.storagePath('framework/types/server-auto-imports.d.ts'),
dirs: [
path.storagePath('framework/orm/src/models'),
path.storagePath('framework/requests'),
],
}

export function initiateImports(): void {
const options: AutoImportsOptions = {
dts: path.storagePath('framework/types/server-auto-imports.d.ts'),
dirs: [
path.storagePath('framework/orm/src/models'),
path.storagePath('framework/requests'),
],
eslint: {
enabled: true, // TODO: not needed in production envs
filepath: path.storagePath('framework/server-auto-imports.json'),
},
}

plugin(autoImports(options))
}
4 changes: 2 additions & 2 deletions storage/framework/core/vite-plugin/src/auto-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ export function autoImports(options?: AutoImportsOptions): Plugin {
},
],

dts: p.frameworkPath('types/auto-imports.d.ts'),
dts: p.frameworkPath('types/browser-auto-imports.d.ts'),
dirs: [p.userLibsPath('components'), p.userLibsPath('functions'), p.resourcesPath('stores'), p.browserPath('src')],
vueTemplate: true,

eslintrc: {
enabled: true,
filepath: p.frameworkPath('.eslintrc-auto-import.json'),
filepath: p.frameworkPath('browser-auto-imports.json'),
},

...options,
Expand Down
165 changes: 165 additions & 0 deletions storage/framework/server-auto-imports.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"globals": {
"AccessToken": true,
"AccessTokenColumn": true,
"AccessTokenColumns": true,
"AccessTokenModel": true,
"AccessTokenRequest": true,
"AccessTokenType": true,
"AccessTokenUpdate": true,
"Deployment": true,
"DeploymentColumn": true,
"DeploymentColumns": true,
"DeploymentModel": true,
"DeploymentRequest": true,
"DeploymentType": true,
"DeploymentUpdate": true,
"Deployments": true,
"DeploymentsTable": true,
"Error": true,
"ErrorColumn": true,
"ErrorColumns": true,
"ErrorModel": true,
"ErrorRequest": true,
"ErrorType": true,
"ErrorUpdate": true,
"Errors": true,
"ErrorsTable": true,
"FailedJob": true,
"FailedJobColumn": true,
"FailedJobColumns": true,
"FailedJobModel": true,
"FailedJobRequest": true,
"FailedJobType": true,
"FailedJobUpdate": true,
"FailedJobs": true,
"FailedJobsTable": true,
"Job": true,
"JobColumn": true,
"JobColumns": true,
"JobModel": true,
"JobRequest": true,
"JobType": true,
"JobUpdate": true,
"Jobs": true,
"JobsTable": true,
"NewAccessToken": true,
"NewDeployment": true,
"NewError": true,
"NewFailedJob": true,
"NewJob": true,
"NewPaymentMethod": true,
"NewPost": true,
"NewProduct": true,
"NewProject": true,
"NewRelease": true,
"NewSubscriber": true,
"NewSubscriberEmail": true,
"NewSubscription": true,
"NewTeam": true,
"NewTransaction": true,
"NewUser": true,
"PaymentMethod": true,
"PaymentMethodColumn": true,
"PaymentMethodColumns": true,
"PaymentMethodModel": true,
"PaymentMethodRequest": true,
"PaymentMethodType": true,
"PaymentMethodUpdate": true,
"PaymentMethods": true,
"PaymentMethodsTable": true,
"PersonalAccessTokens": true,
"PersonalAccessTokensTable": true,
"Post": true,
"PostColumn": true,
"PostColumns": true,
"PostModel": true,
"PostRequest": true,
"PostType": true,
"PostUpdate": true,
"Posts": true,
"PostsTable": true,
"Product": true,
"ProductColumn": true,
"ProductColumns": true,
"ProductModel": true,
"ProductRequest": true,
"ProductType": true,
"ProductUpdate": true,
"Products": true,
"ProductsTable": true,
"Project": true,
"ProjectColumn": true,
"ProjectColumns": true,
"ProjectModel": true,
"ProjectRequest": true,
"ProjectType": true,
"ProjectUpdate": true,
"Projects": true,
"ProjectsTable": true,
"Release": true,
"ReleaseColumn": true,
"ReleaseColumns": true,
"ReleaseModel": true,
"ReleaseRequest": true,
"ReleaseType": true,
"ReleaseUpdate": true,
"Releases": true,
"ReleasesTable": true,
"Subscriber": true,
"SubscriberColumn": true,
"SubscriberColumns": true,
"SubscriberEmail": true,
"SubscriberEmailColumn": true,
"SubscriberEmailColumns": true,
"SubscriberEmailModel": true,
"SubscriberEmailRequest": true,
"SubscriberEmailType": true,
"SubscriberEmailUpdate": true,
"SubscriberEmails": true,
"SubscriberEmailsTable": true,
"SubscriberModel": true,
"SubscriberRequest": true,
"SubscriberType": true,
"SubscriberUpdate": true,
"Subscribers": true,
"SubscribersTable": true,
"Subscription": true,
"SubscriptionColumn": true,
"SubscriptionColumns": true,
"SubscriptionModel": true,
"SubscriptionRequest": true,
"SubscriptionType": true,
"SubscriptionUpdate": true,
"Subscriptions": true,
"SubscriptionsTable": true,
"Team": true,
"TeamColumn": true,
"TeamColumns": true,
"TeamModel": true,
"TeamRequest": true,
"TeamType": true,
"TeamUpdate": true,
"Teams": true,
"TeamsTable": true,
"Transaction": true,
"TransactionColumn": true,
"TransactionColumns": true,
"TransactionModel": true,
"TransactionRequest": true,
"TransactionType": true,
"TransactionUpdate": true,
"Transactions": true,
"TransactionsTable": true,
"User": true,
"UserColumn": true,
"UserColumns": true,
"UserModel": true,
"UserRequest": true,
"UserType": true,
"UserUpdate": true,
"Users": true,
"UsersTable": true,
"request": true
}
}
3 changes: 2 additions & 1 deletion storage/framework/server/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export async function buildDockerImage() {
await Bun.$`rm -rf .DS_Store`.nothrow()
await Bun.$`rm -rf **/README.md`.nothrow()
await Bun.$`rm -rf **/.DS_Store`.nothrow()
await Bun.$`rm -rf **/.eslintrc-auto-import.json`.nothrow()
await Bun.$`rm -rf **/browser-auto-imports.json`.nothrow()
await Bun.$`rm -rf **/server-auto-imports.json`.nothrow()

log.success('Optimized Docker Image size')
log.success('Server ready to be built')
Expand Down
File renamed without changes.
Loading

0 comments on commit 7fb8bba

Please sign in to comment.