@stacksjs/utils 0.75.86 → 0.75.88

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 CHANGED
@@ -71,7 +71,7 @@ install locally.
71
71
  The fastest path after Pantry is installed:
72
72
 
73
73
  ```bash
74
- panx @stacksjs/buddy new my-project
74
+ panx buddy new my-project
75
75
  ```
76
76
 
77
77
  Pantry executes Buddy in an isolated environment and provisions the generated project's declared toolchain during setup.
@@ -179,7 +179,7 @@ buddy make:migration create_cars_table # creates a cars migration file
179
179
  buddy make:factory cars # creates a Car factory file
180
180
  buddy make:notification welcome-email # bootstraps a welcome-email notification
181
181
  buddy make:lang de # bootstraps a lang/de.yml language file
182
- buddy make:stack my-plugin # scaffolds a project-shaped registry stack (new project? use `panx @stacksjs/buddy new`)
182
+ buddy make:stack my-plugin # scaffolds a project-shaped registry stack (new project? use `panx buddy new`)
183
183
 
184
184
  buddy migrate # runs database migrations
185
185
  buddy migrate:fresh # drops all tables & re-runs migrations (destroys all data; --seed reseeds)
package/dist/helpers.js CHANGED
@@ -1,4 +1,4 @@
1
- import process from"node:process";import{runCommand}from"@stacksjs/cli";import{app,ui}from"@stacksjs/config";import{err,handleError}from"@stacksjs/error-handling";import{frameworkPath,projectPath}from"@stacksjs/path";import{fs,readJsonFile,readPackageJson,readTextFile,writeTextFile}from"@stacksjs/storage";export async function packageManager(){const{packageManager}=await readPackageJson(frameworkPath("package.json"));return packageManager??""}export async function ensureProjectIsInitialized(){if(!isStacksProject()){console.error("This command must be run inside a Stacks project; create one with: panx @stacksjs/buddy new my-app");process.exit(1)}if(await isAppKeySet())return!0;if(fs.existsSync(projectPath(".env")))return!1;if(fs.existsSync(projectPath(".env.example")))fs.copyFileSync(projectPath(".env.example"),projectPath(".env"));else console.error("no .env.example file found");return await isAppKeySet()}export function isStacksProject(){if(!fs.existsSync(projectPath("package.json")))return!1;return fs.existsSync(projectPath("config"))||fs.existsSync(projectPath("storage/framework/core"))}export async function installIfVersionMismatch(){}export async function frameworkVersion(){return(await readPackageJson(frameworkPath("package.json"))).version??""}export async function isAppKeySet(){if(String(process.env.APP_KEY??"").trim().length>16)return!0;try{const appKey=(await readTextFile(".env",projectPath())).data.split(`
1
+ import process from"node:process";import{runCommand}from"@stacksjs/cli";import{app,ui}from"@stacksjs/config";import{err,handleError}from"@stacksjs/error-handling";import{frameworkPath,projectPath}from"@stacksjs/path";import{fs,readJsonFile,readPackageJson,readTextFile,writeTextFile}from"@stacksjs/storage";export async function packageManager(){const{packageManager}=await readPackageJson(frameworkPath("package.json"));return packageManager??""}export async function ensureProjectIsInitialized(){if(!isStacksProject()){console.error("This command must be run inside a Stacks project; create one with: panx buddy new my-app");process.exit(1)}if(await isAppKeySet())return!0;if(fs.existsSync(projectPath(".env")))return!1;if(fs.existsSync(projectPath(".env.example")))fs.copyFileSync(projectPath(".env.example"),projectPath(".env"));else console.error("no .env.example file found");return await isAppKeySet()}export function isStacksProject(){if(!fs.existsSync(projectPath("package.json")))return!1;return fs.existsSync(projectPath("config"))||fs.existsSync(projectPath("storage/framework/core"))}export async function installIfVersionMismatch(){}export async function frameworkVersion(){return(await readPackageJson(frameworkPath("package.json"))).version??""}export async function isAppKeySet(){if(String(process.env.APP_KEY??"").trim().length>16)return!0;try{const appKey=(await readTextFile(".env",projectPath())).data.split(`
2
2
  `).find((line)=>line.startsWith("APP_KEY="));return!!(appKey&&appKey.length>16)}catch{return!1}}export function determineResetPreset(preset){if(preset===void 0&&ui.reset)preset=ui.reset;if(preset===null)return[];const resetImport={tailwind:'import { tailwindPreflight as reset } from "@cwcss/crosswind"',preflight:'import { tailwindPreflight as reset } from "@cwcss/crosswind"',forms:'import { tailwindFormsPreflight as reset } from "@cwcss/crosswind"'}[preset??"tailwind"];return resetImport?[resetImport]:[]}export function isManifest(obj){if(!obj||typeof obj!=="object")return!1;const candidate=obj;return isOptionalString(candidate.name)&&isOptionalString(candidate.version)&&isOptionalString(candidate.description)}export function isOptionalString(value){const type=typeof value;return value===null||type==="undefined"||type==="string"}export async function setEnvValue(key,value){const file=await readTextFile(projectPath(".env")),escapedKey=key.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),keyPattern=new RegExp(`^${escapedKey}=.*$`,"m"),nextValue=`${key}=${value}`,data=keyPattern.test(file.data)?file.data.replace(keyPattern,nextValue):`${file.data}${file.data.endsWith(`
3
3
  `)?"":`
4
4
  `}${nextValue}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/utils",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.86",
5
+ "version": "0.75.88",
6
6
  "description": "The Stacks helper functions.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -62,20 +62,20 @@
62
62
  "size": "bun scripts/export-size.ts"
63
63
  },
64
64
  "dependencies": {
65
- "@stacksjs/browser": "0.75.86",
66
- "@stacksjs/cli": "0.75.86",
67
- "@stacksjs/config": "0.75.86",
68
- "@stacksjs/enums": "0.75.86",
69
- "@stacksjs/error-handling": "0.75.86",
70
- "@stacksjs/logging": "0.75.86",
71
- "@stacksjs/path": "0.75.86",
72
- "@stacksjs/storage": "0.75.86",
73
- "@stacksjs/strings": "0.75.86",
74
- "@stacksjs/types": "0.75.86"
65
+ "@stacksjs/browser": "0.75.88",
66
+ "@stacksjs/cli": "0.75.88",
67
+ "@stacksjs/config": "0.75.88",
68
+ "@stacksjs/enums": "0.75.88",
69
+ "@stacksjs/error-handling": "0.75.88",
70
+ "@stacksjs/logging": "0.75.88",
71
+ "@stacksjs/path": "0.75.88",
72
+ "@stacksjs/storage": "0.75.88",
73
+ "@stacksjs/strings": "0.75.88",
74
+ "@stacksjs/types": "0.75.88"
75
75
  },
76
76
  "devDependencies": {
77
- "@stacksjs/arrays": "0.75.86",
78
- "@stacksjs/lint": "0.75.86",
77
+ "@stacksjs/arrays": "0.75.88",
78
+ "@stacksjs/lint": "0.75.88",
79
79
  "better-dx": "^0.2.24",
80
80
  "filesize": "^11.0.25",
81
81
  "markdown-table": "^3.0.4"