diff --git a/.ddev/commands/web/phing b/.ddev/commands/web/phing new file mode 100755 index 0000000..02d5980 --- /dev/null +++ b/.ddev/commands/web/phing @@ -0,0 +1,5 @@ +#!/bin/bash + +## Description: Run phing inside the shell with `ddev phing` + +vendor/bin/phing "$@" diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..cede0f6 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +# Add directories and files to ignore: https://eslint.org/docs/latest/use/configure/ignore#the-eslintignore-file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..3eb7d12 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "drupal" + ] +} diff --git a/README.md b/README.md index 8b7af7a..13dbe24 100644 --- a/README.md +++ b/README.md @@ -33,36 +33,38 @@ Enter a short name for your project [example] : 1. Create a new project called "example" based on this template: - ``` - composer create-project palantirnet/drupal-skeleton example dev-develop --no-interaction - ``` - - This skeleton is based on Drupal 10. If you would like to install and use Drupal 9 instead, run: - ``` - composer create-project palantirnet/drupal-skeleton example dev-drupal9 --no-interaction - ``` - -2. Go into your new project directory and update the ddev configuration in `.ddev/config.yml`: + ``` + composer create-project palantirnet/drupal-skeleton example dev-develop --no-interaction + ``` + + This skeleton is based on Drupal 10. If you would like to install and use Drupal 9 instead, run: - ``` - # Update to match your project name. Using "drupal-skeleton" would make the site - # accessible at 'drupal-skeleton.ddev.site'. - name: drupal-skeleton + ``` + composer create-project palantirnet/drupal-skeleton example dev-drupal9 --no-interaction + ``` + +1. Go into your new project directory and update the ddev configuration in `.ddev/config.yml`: - # Use 'docroot' for Acquia, or 'web' for Pantheon or Platform.sh. - docroot: web - ``` + ``` + # Update to match your project name. Using "drupal-skeleton" would make the site + # accessible at 'drupal-skeleton.ddev.site'. + name: drupal-skeleton -3. From inside the ddev environment, run the script from `palantirnet/the-build` to set up the default Drupal variables and install Drupal: + # Use 'docroot' for Acquia, or 'web' for Pantheon or Platform.sh. + docroot: web + ``` + +1. From inside the ddev environment, run the script from `palantirnet/the-build` to set up the default Drupal variables and install Drupal: - ``` - ddev start - ddev ssh - vendor/bin/the-build-installer - ``` + ``` + ddev start + ddev ssh + vendor/bin/the-build-installer + ``` + +1. In your web browser, visit [http://example.ddev.site](http://example.ddev.site) -5. In your web browser, visit [http://example.ddev.site](http://example.ddev.site) -6. _Optional:_ While you are logged into the ddev environment, you can run Drush commands like `drush status`. +1. _Optional:_ While you are logged into the ddev environment, you can run Drush commands like `drush status`. ### Extra Credit @@ -122,6 +124,11 @@ Update the `composer.json`: composer update --lock ``` +Update the `package.json`: + +* Change the `name` from `palantirnet--drupal-skeleton` to `palantirnet--PROJECTNAME` (see [package.json name requirements](https://docs.npmjs.com/cli/v8/configuring-npm/package-json#name)) +* Update the `description` with a brief description of your project. + ### Configure your ddev development environment Go into your new project directory and update the ddev configuration in `.ddev/config.yml`. @@ -169,17 +176,17 @@ git push -u origin develop If you're allergic to phing and Benadryl isn't helping, you can also remove the-build: 1. `composer remove --dev palantirnet/the-build` -2. `rm -r .the-build` -3. `rm build.xml` -4. This will remove drush, coder, and phpmd -- if you want those dependencies, you'll need to add them back to your project: +1.`rm -r .the-build` +1. `rm build.xml` +1. This will remove drush, coder, and phpmd -- if you want those dependencies, you'll need to add them back to your project: ``` composer require --dev drush/drush drupal/coder phpmd/phpmd ``` -5. Review your `web/sites/default/settings.*.php` files (the-build managed these for you) -6. Install your build tooling of choice... or nothing at all... -7. _Update your project's README_ +1. Review your `web/sites/default/settings.*.php` files (the-build managed these for you) +1. Install your build tooling of choice... or nothing at all... +1. _Update your project's README_ See also: [Documentation on using the-build](https://github.com/palantirnet/the-build#using-the-build) @@ -214,24 +221,24 @@ In Drupal 8 development, all (or most) Drupal configuration should be exported a * Set the admin email address (your development environment will trap all emails) * Turn the Cron interval down to "never" * Uninstall unnecessary modules (e.g. Search, History, Comment) -2. Export your config: +1. Export your config: - ``` - drush cex -y - ``` + ``` + drush cex -y + ``` -3. You should have a ton of new `*.yml` files in `config/sites/default/`. Add them, and this config change, to git: +1. You should have a ton of new `*.yml` files in `config/sites/default/`. Add them, and this config change, to git: - ``` - git add config/ - git ci -m "Initial Drupal configuration." - git push - ``` -5. Reinstall your site and verify that your config is ready to go: + ``` + git add config/ + git ci -m "Initial Drupal configuration." + git push + ``` +1. Reinstall your site and verify that your config is ready to go: - ``` - vendor/bin/phing install - ``` + ``` + vendor/bin/phing install + ``` ## More information diff --git a/composer.json b/composer.json index c4f78dc..b294726 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,10 @@ { "type": "composer", "url": "https://packages.drupal.org/8" + }, + { + "type": "git", + "url": "https://github.com/palantirnet/the-build" } ], "require": { @@ -33,7 +37,7 @@ "dmore/behat-chrome-extension": "^1.4", "drupal/core-dev": "^10", "drupal/drupal-extension": "^5@alpha", - "palantirnet/the-build": "^4@beta" + "palantirnet/the-build": "dev-dev-37-eslint" }, "suggest": { "cweagans/composer-patches": "Try ^1.7. Apply patches to packages, especially Drupal.org contrib.", diff --git a/docs/general/drupal_development.md b/docs/general/drupal_development.md index b39179d..a02fb42 100644 --- a/docs/general/drupal_development.md +++ b/docs/general/drupal_development.md @@ -99,11 +99,19 @@ When you make changes to these files, you will generally need to run `phing buil ### Test Drupal -This project uses Behat to test Drupal; it also provides some PHP linting tools. You can run: +This project uses Behat to test Drupal; it also provides some PHP and Javascript linting tools. You can run: * All Behat tests: `behat` * One behat test: `behat features/installation.feature` -* The PHP code review: `phing code-review` +* The PHP + JS code review: `phing code-review` + +#### Javascript linting + +This project uses [eslint](https://eslint.org/docs/latest/use/) to check custom module js against Drupal js coding standards. + +If you'd like to handle your custom module's linting independently, add your module directory to the `/.eslintignore` file and add a command to additionally lint your js to the `code-review` phing target in `build.xml`. + +Note: There is [some default configuration for eslint](https://github.com/palantirnet/the-build/pull/223/files#diff-339072f52845d316656969cbac2815305c0ccea0ce9de789ba73d78849336067)) that you can override in your project configuration for `the-build` ---- -Copyright 2020 Palantir.net, Inc. +Copyright 2023 Palantir.net, Inc. diff --git a/package.json b/package.json new file mode 100644 index 0000000..c9359c3 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "palantirnet--drupal-skeleton", + "description": "A Drupal 8 project template.", + "version": "0.0.0", + "devDependencies": { + "eslint": "8.39.0", + "eslint-config-drupal": "5.0.2" + } +}