Type something to search...

Making Changes

Common workflows for modifying Astrolock

Making Changes

Common modification workflows for Astrolock development.

Warning

Always test changes with make test before committing. See Testing.


Changing Styles

Files: src/styles/global.css, src/styles/variables.css, tailwind.config.cjs

# Edit styles
vim src/styles/global.css

# Test with dev server
yarn dev
# Visit http://localhost:4321

Files: src/layouts/partials/*.astro, src/components/*.astro

Find the component, edit inline styles or Tailwind classes, test with yarn dev.


Adding Components

Create reusable components for MDX content.

# Create component
cat > src/layouts/shortcodes/MyComponent.tsx << 'EOF'
interface Props {
  title: string;
  type?: 'info' | 'warning';
}

export default function MyComponent({ title, type = 'info' }: Props) {
  return (
    <div className={`my-component--${type}`}>
      <h3>{title}</h3>
    </div>
  );
}
EOF

# Use in MDX
# <MyComponent title="Hello" type="warning" />

# Test
yarn dev

Modifying the CLI

  1. Edit cli/bashly.yml
commands:
  - name: mycommand
    help: Description
    args:
      - name: input
        required: true
    flags:
      - long: --verbose
        short: -v
  1. Create cli/commands/mycommand.sh
input="${args[input]}"
verbose="${args[--verbose]}"

echo "Processing: $input"
  1. Regenerate and test
bashly generate
./bin/astrolock mycommand "test" --verbose

Adding Features to Content Collections

  1. Update schema: src/content.config.ts
const audioSchema = z.object({
  // existing fields...
  myNewField: z.string().optional(),
});
  1. Use in templates
---
const { myNewField } = Astro.props.entry.data;
---
{myNewField && <p>{myNewField}</p>}
  1. Document: Update src/content/user-guide/reference/frontmatter/*.mdx
  1. Add to config schema: src/lib/config/unified-config-schema.ts
features: {
  myFeature: z.boolean().optional(),
}
  1. Use in templates
---
const config = await loadUnifiedConfig();
const hasFeature = config.collections?.[collection]?.features?.myFeature;
---
{hasFeature && <MyFeatureComponent />}
  1. Document: Update src/content/user-guide/reference/*.mdx

Adding Import Plugins

  1. Create plugin folder: mkdir -p plugins/my-plugin

  2. Add plugin code: plugins/my-plugin/myPlugin.ts

  3. Add CLI command in cli/bashly.yml:

- name: my-plugin
  help: Import from my-plugin
  args:
    - name: input
      required: true
  1. Create command: cli/commands/import/my-plugin.sh
input="${args[input]}"
node plugins/my-plugin/myPlugin.js "$input"
  1. Test:
bashly generate
./bin/astrolock import my-plugin /path/to/input

Contributing Guidelines

When contributing to Astrolock:

  1. Fork and clone the repository
  2. Create feature branch from main
  3. Make changes following existing patterns
  4. Run tests with make test
  5. Submit pull request with clear description

Code Style

  • Use yarn not npm
  • Use make targets for builds
  • Follow existing file organization
  • Add tests for new features
  • Update documentation

Testing Requirements

# All tests must pass
make test

# Test in a user site
cd ~/test-site
/path/to/astrolock-template/bin/astrolock build

Reporting Issues

Open issues at github.com/eyelock/astrolock-template/issues with:

  • OS and versions (Node.js, Yarn, OS)
  • Steps to reproduce
  • Error messages
  • Expected vs actual behavior

Tip

Need detailed reference? See Architecture and Directory Structure.