Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change npm scope and import path #19

Merged
merged 3 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"groups": [
["^\\u0000"],
["^@?\\w"],
["^(@aloes)(/.*|$)"],
["^(@getlarge)(/.*|$)"],
["^"],
["^\\."]
]
Expand Down
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ To install the plugin, run the following command:

```bash
# with npm
npm install -D @aloes/nx-heroku
npm install -D @getlarge/nx-heroku

# or with yarn
yarn add -D @aloes/nx-heroku
yarn add -D @getlarge/nx-heroku
```

## Generate target
Expand All @@ -38,10 +38,10 @@ yarn add -D @aloes/nx-heroku
To generate a target for your application, run the following command:

```bash
npx nx generate @aloes/nx-heroku:deploy --projectName=my-app --org=your-heroku-team --appNamePrefix=your-app-prefix
npx nx generate @getlarge/nx-heroku:deploy --projectName=my-app --org=your-heroku-team --appNamePrefix=your-app-prefix

# or to be prompted for the project name, omit specifying it
npx nx g @aloes/nx-heroku:deploy
npx nx g @getlarge/nx-heroku:deploy

```

Expand All @@ -52,10 +52,10 @@ This will generate a `deploy` target in your `project.json` file.
To generate a target for your application, run the following command:

```bash
npx nx generate @aloes/nx-heroku:promote --projectName=my-app --org=your-heroku-team --appNamePrefix=your-app-prefix
npx nx generate @getlarge/nx-heroku:promote --projectName=my-app --org=your-heroku-team --appNamePrefix=your-app-prefix

# or to be prompted for the project name, omit specifying it
npx nx g @aloes/nx-heroku:promote
npx nx g @getlarge/nx-heroku:promote

```

Expand All @@ -65,36 +65,36 @@ This will generate a `promote` target in your `project.json` file.

### Deploy

The [`nx-heroku:deploy`](./packages/nx-heroku/src//executors/deploy/executor.ts) executor allows to deploy an Nx application to a targeted Heroku app. The deployment will be done for each pipeline stage declared via the option `config` (default: ['development'])
The [`nx-heroku:deploy`](./packages/nx-heroku/src//executors/deploy/executor.ts) executor allows the deployment of an Nx application to a targeted Heroku app. The deployment will be done for each pipeline stage declared via the option `config` (default: ['development'])

You can have a look at the [schema](./packages/nx-heroku/src/executors/deploy/schema.json) of the executor to see all the options available.
You can look at the executor [schema](./packages/nx-heroku/src/executors/deploy/schema.json) to see all the options available.

When deploying an application, the following steps are executed:

1. Set internal variables which are prefixed with HD to avoid conflicts with variables provided by the user (`variables` option)
1. Set internal variables that are prefixed with HD to avoid conflicts with variables provided by the user (`variables` option)
2. Authentification to Heroku via .netrc file
3. Set default options (branch to current branch, environment to development, watchDelay to 0)
4. Set the Heroku app name.
The Heroku app will be named after the pattern described in [Conventions](#naming-conventions).
5. Create project 'Procfile'
6. Create static buildpack config (optional)
7. Create 'Aptfile', to install extra Ubuntu dependencies before build (optional)
8. Ensure remote is added (and that application created).
6. Create static **buildpack** config (optional)
7. Create **Aptfile**, to install extra Ubuntu dependencies before build (optional)
8. Ensure the remote is added (and that the application is created).
9. Merge `HD_` prefixed variables with the one provided in the options and set Heroku app `config vars`.
You can provide your own variables prefixed by `HD_`, they will be added (without the prefix) to the Heroku app config automatically.
You can provide your variables that will be available at build time. They should be prefixed by `HD_`, they will be added (without the prefix) to the Heroku app config automatically.
The environment variables `HD_PROJECT_NAME`,`HD_PROJECT_ENV`, `HD_NODE_ENV` and `HD_PROCFILE` will automatically be defined based on the project name and environment being deployed.
`PROCFILE` is required when using [multi-procfile buildpack](https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-multi-procfile), it should be defined in each Heroku app to indicate the Procfile path for the given project.
10. Cleanup and register buildpacks.
Extra buildpacks can be provided by using `buildPacks` option, they will be installed in **the order they are provided in the array**.
11. Ensure app is attached to a pipeline with a stage matching the environment provided in options
11. Ensure the app is attached to a pipeline with a stage matching the environment provided in options
If the Heroku app doesn't exist, it will be created and attach to an existing or new pipeline.
12. Assign management member (optional)
13. Register addons (optional)
14. Register drain (optional)
15. Register webhook (optional)
16. Deploy (trigger build and release)
17. Run healthcheck (optional)
18. Rollback if healthcheck failed (optional)
17. Run health check (optional)
18. Rollback if health check failed (optional)

```mermaid
sequenceDiagram
Expand Down Expand Up @@ -172,7 +172,7 @@ For the given example project config:
"targets": {
...,
"deploy": {
"executor": "@aloes/nx-heroku:deploy",
"executor": "@getlarge/nx-heroku:deploy",
"options": {
"appNamePrefix": "aloes",
"procfile": "web: bin/start-nginx-solo",
Expand Down
10 changes: 5 additions & 5 deletions e2e/nx-heroku-e2e/tests/nx-heroku.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('nx-heroku e2e', () => {
const { projectName, getProjectConfig } = await createProject();
//
await expect(
runNxCommandAsync(`generate @aloes/nx-heroku:deploy ${projectName}`)
runNxCommandAsync(`generate @getlarge/nx-heroku:deploy ${projectName}`)
).rejects.toThrowError();
const project = getProjectConfig();
expect(project.targets?.deploy).toBeUndefined();
Expand All @@ -44,7 +44,7 @@ describe('nx-heroku e2e', () => {
const { projectName, getProjectConfig } = await createProject();
//
await runNxCommandAsync(
`generate @aloes/nx-heroku:deploy ${projectName} --org ${org}`
`generate @getlarge/nx-heroku:deploy ${projectName} --org ${org}`
);
const project = getProjectConfig();
expect(project.targets?.deploy?.options?.org).toEqual(org);
Expand All @@ -55,7 +55,7 @@ describe('nx-heroku e2e', () => {
//
//? the single quotes does not prevent parameter expansion
await runNxCommandAsync(
`generate @aloes/nx-heroku:deploy ${projectName} --org ${org} --apiKey '${HEROKU_API_KEY}' --email '${HEROKU_EMAIL}'`
`generate @getlarge/nx-heroku:deploy ${projectName} --org ${org} --apiKey '${HEROKU_API_KEY}' --email '${HEROKU_EMAIL}'`
);
const project = getProjectConfig();
expect(project.targets?.deploy?.options?.apiKey).toEqual(HEROKU_API_KEY);
Expand All @@ -72,7 +72,7 @@ describe('nx-heroku e2e', () => {
process.env.HEROKU_EMAIL = process.env.HEROKU_EMAIL_PREV;
// configure the target
await runNxCommandAsync(
`generate @aloes/nx-heroku:deploy ${projectName} --appNamePrefix=aloes`
`generate @getlarge/nx-heroku:deploy ${projectName} --appNamePrefix=aloes`
);
const project = getProjectConfig();
project.targets!.deploy.options = {
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('nx-heroku e2e', () => {
// TODO: first deploy then promote, or use existing app ? would be faster but goes against the principle of one project per test

await runNxCommandAsync(
`generate @aloes/nx-heroku:promote ${projectName} --apiKey='${HEROKU_API_KEY}' --email='${HEROKU_EMAIL}' --appNamePrefix=aloes`
`generate @getlarge/nx-heroku:promote ${projectName} --apiKey='${HEROKU_API_KEY}' --email='${HEROKU_EMAIL}' --appNamePrefix=aloes`
);
const project = getProjectConfig();
project.targets!.deploy.options = {
Expand Down
2 changes: 1 addition & 1 deletion e2e/nx-heroku-e2e/tests/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
removeNetRcFile,
} from '../../../packages/nx-heroku/src/executors/common/heroku';

const PLUGIN_NAME = '@aloes/nx-heroku';
const PLUGIN_NAME = '@getlarge/nx-heroku';
const PLUGIN_PATH = 'dist/packages/nx-heroku';
const E2E_PATH = 'e2e/nx-heroku-e2e';

Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"name": "nx-heroku",
"version": "0.0.0",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/getlarge/nx-heroku.git",
"directory": "packages/nx-heroku"
},
"scripts": {
"prepare": "husky install"
},
"private": true,
"devDependencies": {
"@commitlint/cli": "^17.0.3",
"@commitlint/config-conventional": "^17.0.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-heroku/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@aloes/nx-heroku",
"name": "@getlarge/nx-heroku",
"version": "0.4.1",
"main": "src/index.js",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/generators/common/schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "NxHeroku-deploy",
"title": "@aloes/nx-heroku:deploy target generator",
"title": "@getlarge/nx-heroku:deploy target generator",
"type": "object",
"properties": {
"projectName": {
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/generators/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function createTarget(
): TargetConfiguration {
const targetOptions = createTargetOptions(options);
return {
executor: `@aloes/nx-heroku:${targetName}`,
executor: `@getlarge/nx-heroku:${targetName}`,
...(Object.keys(targetOptions).length > 0
? { options: targetOptions }
: {}),
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-heroku/src/generators/deploy/generator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('nx-heroku deploy generator', () => {
expect(config).toBeDefined();
expect(config.targets).toHaveProperty('deploy');
expect(config.targets.deploy).toEqual({
executor: '@aloes/nx-heroku:deploy',
executor: '@getlarge/nx-heroku:deploy',
options: {
org: 'test-org',
apiKey: '${HEROKU_API_KEY}',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('nx-heroku promote generator', () => {
expect(config).toBeDefined();
expect(config.targets).toHaveProperty('promote');
expect(config.targets.promote).toEqual({
executor: '@aloes/nx-heroku:promote',
executor: '@getlarge/nx-heroku:promote',
options: {
org: 'test-org',
},
Expand Down
4 changes: 2 additions & 2 deletions packages/nx-heroku/src/plugins/plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('@nx/jest/plugin', () => {
"targets": {
"deploy-me": {
"cache": false,
"executor": "@aloes/nx-heroku:deploy",
"executor": "@getlarge/nx-heroku:deploy",
"inputs": [
"default",
"^production",
Expand All @@ -58,7 +58,7 @@ describe('@nx/jest/plugin', () => {
},
"promote-me": {
"cache": false,
"executor": "@aloes/nx-heroku:promote",
"executor": "@getlarge/nx-heroku:promote",
"inputs": [
"default",
"^production",
Expand Down
4 changes: 2 additions & 2 deletions packages/nx-heroku/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ function buildHerokuTargets(

const deployConfig: TargetConfiguration = {
...baseConfig,
executor: '@aloes/nx-heroku:deploy',
executor: '@getlarge/nx-heroku:deploy',
options: {
procfile,
},
};
const promoteConfig: TargetConfiguration = {
...baseConfig,
executor: '@aloes/nx-heroku:promote',
executor: '@getlarge/nx-heroku:promote',
options: {},
};

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"skipDefaultLibCheck": true,
"baseUrl": ".",
"paths": {
"@aloes/nx-heroku": ["packages/nx-heroku/src/index.ts"]
"@getlarge/nx-heroku": ["packages/nx-heroku/src/index.ts"]
}
},
"exclude": ["node_modules", "tmp"]
Expand Down