xm / starter_craft_3
Starter for creating Craft 4 sites at XM Media
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 5
Language:Twig
Type:project
Requires
- php: 8.1.*
- clubstudioltd/craft-asset-rev: ^7.0
- craftcms/ckeditor: 3.9.0
- craftcms/cms: 4.11.3
- craftcms/contact-form: 3.1.0
- craftcms/contact-form-honeypot: 2.1.0
- ether/seo: 4.2.3
- hybridinteractive/craft-contact-form-extensions: 4.2.2
- mmikkel/cp-field-inspect: ^1.4
- roave/security-advisories: dev-master
- spicyweb/craft-neo: 4.2.10
- verbb/field-manager: 3.0.9
- vlucas/phpdotenv: ^5.4
- wrav/oembed: 3.0.9
Requires (Dev)
- yiisoft/yii2-shell: ^2.0.3
This package is auto-updated.
Last update: 2024-11-16 18:38:39 UTC
README
Used to create new projects using Craft CMS at XM Media.
Setting Up a New Site
- Create a new project:
composer create-project xm/starter_craft project-name --stability=dev --no-install --remove-vcs
- Update
composer.json
:name
,license
(likelyprivate
) anddescription
- Update
package.json
:name
,version
,git.url
,license
,private
,script.dev-server
- Setup dev server:
- If using InterWorx, upload
setup_dev.sh
and run:sh ./setup_dev.sh
- Upload the files (exclude files that are OS dependent like
node_modules
&.env
or that are only for editing like.idea
and.git
and a lot of what's in.gitignore
). - Install Composer (if not already installed)
- Install PHP packages/vendors:
php composer.phar install
- Add
.env
(copy.env.example
and update). - Run
. ./node_setup.sh
(this will setup node & install the JS packages – requires yarn to be installed). - Run
yarn dev
oryarn build
(for production) to compile JS & CSS files. - Give executable perms to bin dir:
chmod u+x craft
- Install craft:
./craft install/craft
- If using InterWorx, upload
- Remove or update the
LICENSE
file. - Install Composer locally (if not installed globally).
- Composer install & update (locally):
composer install && composer update
- Run
yarn && yarn upgrade
locally. - Upload
composer.lock
andyarn.lock
and on the server, runphp composer.phar install
and. ./node_setup.sh
again. - Find and make changes near
@todo-craft
comments throughout the site. All changed files will need to uploaded to the server. - Create new favicons: realfavicongenerator.net
- Add icon/logo as SVGs in
/storage/rebrand/icon/
and/storage/rebrand/logo/
aslogo.svg
. (SVGs are best.) Only works with paid version of Craft. - Delete starter files:
README.md
(or update) andTEMPLATES.md
. - Update site name:
- In Settings -> General
- In Settings -> Sites
- Globals -> Site Information
Dev site can be accessed at https://[domain]/
Craft admin is located at /admin
System Requirements
- PHP 8.1+
- MySQL 5.7+
- Node 14
- Yarn
Commands
- Production JS/CSS build:
yarn build
- Dev JS/CSS build:
yarn dev
- Dev JS/CSS watch:
yarn watch
(files will not be versioned) - Dev JS/CSS HMR server:
yarn dev-server
(see below) - JS Tests (Jest):
yarn test:unit
- E2E Tests (Cypress):
yarn test:e2e
- Linting:
- JS (ESLint):
yarn lint:js
oryarn lint:js:fix
- CSS:
yarn lint:css
oryarn lint:css:fix
- JS (ESLint):
- PHP Tests (PhpUnit):
composer test
- no memory limit
php -d memory_limit=-1 bin/simple-phpunit
- with coverage (HTML)
composer test:coverage
- PHP CS: (must be installed first)
- Dry run:
composer cs
- Fix:
composer cs:fix
- Dry run:
- PHP Static Analysis (PHPStan):
composer static
Incorporated Libraries & Tools
- Frontend – full list of dependencies can be found in package.json
- Vue – frontend framework
- Vue Router – routing package for frontend
- Vuex – helps to manage state
- Vue Devtools – makes debugging in the browser easier
- Vue Templates – the syntax for .vue files
- Vue Test Utils – to help testing Vue components
- Vue CLI – to manage & run the frontend compilation & testing
- SASS – CSS preprocessor (uses node-sass)
- Webpack – compiles JS & CSS
- Babel – transforms JS to work in all browsers
- Webpack Encore – connects the frontend and backend and makes Webpack configuration simpler
- PostCSS – transforms CSS
- Autoprefixer – for adding browser prefixes
- Purge CSS – removes unused CSS during the deployment process (not run in dev)
- SVGO – optimizes SVG files
- Bundle Analyzer – displays sizes/stats on the JS bundle size
- Tailwind – utility first styling framework
- Jest – JS unit testing
- Cypress – end-to-end (e2e) testing
- Lodash – helper functions for JS
- date-fns – helper functions for Dates in JS
- PortalVue – helps to manage things like modals
- Vue-JS-Modal – for modals
- Faker.js – for generating fake data in tests
- ESLint – checks JS for conventions & errors
- Stylelint – checks CSS for conventions & errors
- Vue – frontend framework
- Backend – full list of dependencies can be found in composer.json
- GitLab – deployment
- Dev Tools