Skip to content

Commit

Permalink
Merge pull request #9514 from elwayman02/addon-contributing
Browse files Browse the repository at this point in the history
[ENHANCEMENT] Use packager commands in `CONTRIBUTING.md` and `README.md` files in `app` and `addon` blueprints
  • Loading branch information
NullVoxPopuli committed Oct 24, 2023
2 parents db9e195 + a751a4e commit 7338655
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 64 deletions.
12 changes: 6 additions & 6 deletions blueprints/addon/files/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

## Linting

* `<% if (pnpm) { %>pnpm lint<% } else if (yarn) { %>yarn lint<% } else { %>npm run lint<% } %>`
* `<% if (pnpm) { %>pnpm lint:fix<% } else if (yarn) { %>yarn lint:fix<% } else { %>npm run lint:fix<% } %>`
* `<%= invokeScriptPrefix %> lint`
* `<%= invokeScriptPrefix %> lint:fix`

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
* `<%= invokeScriptPrefix %> test` – Runs the test suite on the current Ember version
* `<%= invokeScriptPrefix %> test:ember <% if (npm) { %>-- <% } %>--server` – Runs the test suite in "watch mode"
* `<%= invokeScriptPrefix %> test:ember-compatibility` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* `<%= invokeScriptPrefix %> start`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
12 changes: 12 additions & 0 deletions blueprints/addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ module.exports = {
outdent;
}

let invokeScriptPrefix = 'npm run';

if (options.packageManager === 'yarn') {
invokeScriptPrefix = 'yarn';
}

if (options.packageManager === 'pnpm') {
invokeScriptPrefix = 'pnpm';
}

return {
addonDirectory: directoryForPackageName(addonName),
name,
Expand All @@ -182,6 +192,8 @@ module.exports = {
year: date.getFullYear(),
yarn: options.packageManager === 'yarn',
pnpm: options.packageManager === 'pnpm',
npm: options.packageManager !== 'yarn' && options.packageManager !== 'pnpm',
invokeScriptPrefix,
welcome: options.welcome,
blueprint: 'addon',
blueprintOptions,
Expand Down
14 changes: 7 additions & 7 deletions blueprints/app/files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `<%= invokeScriptPrefix %> start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -32,18 +32,18 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `<%= invokeScriptPrefix %> test`
* `<%= invokeScriptPrefix %> test:ember <% if (npm) { %>-- <% } %>--server`

### Linting

* `<% if (pnpm) { %>pnpm lint<% } else if (yarn) { %>yarn lint<% } else { %>npm run lint<% } %>`
* `<% if (pnpm) { %>pnpm lint:fix<% } else if (yarn) { %>yarn lint:fix<% } else { %>npm run lint:fix<% } %>`
* `<%= invokeScriptPrefix %> lint`
* `<%= invokeScriptPrefix %> lint:fix`

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `<%= execBinPrefix %> ember build` (development)
* `<%= invokeScriptPrefix %> build` (production)

### Deploying

Expand Down
16 changes: 16 additions & 0 deletions blueprints/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ module.exports = {
outdent;
}

let invokeScriptPrefix = 'npm run';
let execBinPrefix = 'npm exec';

if (options.packageManager === 'yarn') {
invokeScriptPrefix = 'yarn';
execBinPrefix = 'yarn';
}

if (options.packageManager === 'pnpm') {
invokeScriptPrefix = 'pnpm';
execBinPrefix = 'pnpm';
}

return {
appDirectory: directoryForPackageName(name),
name,
Expand All @@ -55,6 +68,9 @@ module.exports = {
emberCLIVersion: require('../../package').version,
yarn: options.packageManager === 'yarn',
pnpm: options.packageManager === 'pnpm',
npm: options.packageManager !== 'yarn' && options.packageManager !== 'pnpm',
invokeScriptPrefix,
execBinPrefix,
welcome: options.welcome,
blueprint: 'app',
blueprintOptions,
Expand Down
8 changes: 4 additions & 4 deletions tests/fixtures/addon/defaults-travis/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
* `npm run test` – Runs the test suite on the current Ember version
* `npm run test:ember -- --server` – Runs the test suite in "watch mode"
* `npm run test:ember-compatibility` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* `npm start`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
8 changes: 4 additions & 4 deletions tests/fixtures/addon/defaults/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
* `npm run test` – Runs the test suite on the current Ember version
* `npm run test:ember -- --server` – Runs the test suite in "watch mode"
* `npm run test:ember-compatibility` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* `npm run start`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
8 changes: 4 additions & 4 deletions tests/fixtures/addon/pnpm/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
* `pnpm test` – Runs the test suite on the current Ember version
* `pnpm test:ember --server` – Runs the test suite in "watch mode"
* `pnpm test:ember-compatibility` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* `pnpm start`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
8 changes: 4 additions & 4 deletions tests/fixtures/addon/yarn/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

## Running tests

* `ember test` – Runs the test suite on the current Ember version
* `ember test --server` – Runs the test suite in "watch mode"
* `ember try:each` – Runs the test suite against multiple Ember versions
* `yarn test` – Runs the test suite on the current Ember version
* `yarn test:ember --server` – Runs the test suite in "watch mode"
* `yarn test:ember-compatibility` – Runs the test suite against multiple Ember versions

## Running the dummy application

* `ember serve`
* `yarn start`
* Visit the dummy application at [http://localhost:4200](http://localhost:4200).

For more information on using ember-cli, visit [https://cli.emberjs.com/release/](https://cli.emberjs.com/release/).
10 changes: 5 additions & 5 deletions tests/fixtures/app/defaults/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `npm run start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -30,8 +30,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `npm run test`
* `npm run test:ember -- --server`

### Linting

Expand All @@ -40,8 +40,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `npm exec ember build` (development)
* `npm run build` (production)

### Deploying

Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures/app/npm-travis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `npm run start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -30,8 +30,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `npm run test`
* `npm run test -- --server`

### Linting

Expand All @@ -40,8 +40,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `npm exec ember build` (development)
* `npm run build` (production)

### Deploying

Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures/app/npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `npm run start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -30,8 +30,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `npm run test`
* `npm run test:ember -- --server`

### Linting

Expand All @@ -40,8 +40,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `npm exec ember build` (development)
* `npm run build` (production)

### Deploying

Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures/app/pnpm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `pnpm start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -31,8 +31,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `pnpm test`
* `pnpm test:ember --server`

### Linting

Expand All @@ -41,8 +41,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `pnpm ember build` (development)
* `pnpm build` (production)

### Deploying

Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures/app/with-blueprint-override-lint-fail/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `npm start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -30,8 +30,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `npm run test:ember`
* `npm run test:ember --server`

### Linting

Expand All @@ -40,8 +40,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `npm exec ember build` (development)
* `npm run build` (production)

### Deploying

Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures/app/yarn-travis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You will need the following things properly installed on your computer.

## Running / Development

* `ember serve`
* `yarn start`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

Expand All @@ -31,8 +31,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Running Tests

* `ember test`
* `ember test --server`
* `yarn test`
* `yarn test --server`

### Linting

Expand All @@ -41,8 +41,8 @@ Make use of the many generators for code, try `ember help generate` for more det

### Building

* `ember build` (development)
* `ember build --environment production` (production)
* `yarn ember build` (development)
* `yarn build` (production)

### Deploying

Expand Down

0 comments on commit 7338655

Please sign in to comment.