From 904c774d55e5cbf87f62f7e9596b29aa0c1ce858 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Thu, 26 May 2022 17:05:20 -0400 Subject: [PATCH 01/22] Adding badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 82f6321..61fbf9e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Emulsify Design System](https://user-images.githubusercontent.com/409903/170579210-327abcdd-2c98-4922-87bb-36446a4cc013.svg)](https://www.emulsify.info/) + # emulsify-cli Command line interface for Emulsify. From 891a76b0e4ddd1a7099a892f4a8e3abd053d2b47 Mon Sep 17 00:00:00 2001 From: Jim Vomero Date: Fri, 15 Jul 2022 15:35:23 -0400 Subject: [PATCH 02/22] feat: adds commit tag to name of cache bin --- src/handlers/componentInstall.ts | 1 + src/handlers/componentList.ts | 1 + src/handlers/systemInstall.ts | 1 + src/types/cache.d.ts | 1 + src/util/cache/cloneIntoCache.ts | 2 +- src/util/cache/getCachedItemPath.ts | 15 +++++++++++---- src/util/cache/getJsonFromCachedFile.ts | 9 +++++++-- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/handlers/componentInstall.ts b/src/handlers/componentInstall.ts index 83b8edd..2814bef 100644 --- a/src/handlers/componentInstall.ts +++ b/src/handlers/componentInstall.ts @@ -64,6 +64,7 @@ export default async function componentInstall( const systemConf: EmulsifySystem | void = await getJsonFromCachedFile( 'systems', [systemName], + emulsifyConfig.system.checkout, EMULSIFY_SYSTEM_CONFIG_FILE ); diff --git a/src/handlers/componentList.ts b/src/handlers/componentList.ts index 0ea8ea9..6755cda 100644 --- a/src/handlers/componentList.ts +++ b/src/handlers/componentList.ts @@ -58,6 +58,7 @@ export default async function componentList(): Promise { const systemConf: EmulsifySystem | void = await getJsonFromCachedFile( 'systems', [systemName], + emulsifyConfig.system.checkout, EMULSIFY_SYSTEM_CONFIG_FILE ); diff --git a/src/handlers/systemInstall.ts b/src/handlers/systemInstall.ts index d4fc799..4338689 100644 --- a/src/handlers/systemInstall.ts +++ b/src/handlers/systemInstall.ts @@ -119,6 +119,7 @@ export default async function systemInstall( const systemConf: EmulsifySystem | void = await getJsonFromCachedFile( 'systems', [repo.name], + repo.checkout, EMULSIFY_SYSTEM_CONFIG_FILE ); diff --git a/src/types/cache.d.ts b/src/types/cache.d.ts index 2ba6e27..0ae6b4b 100644 --- a/src/types/cache.d.ts +++ b/src/types/cache.d.ts @@ -4,4 +4,5 @@ declare module '@emulsify-cli/cache' { export type CacheBucket = 'systems' | 'variants'; export type CacheItemPath = string[]; + export type CacheCheckout = string | void; } diff --git a/src/util/cache/cloneIntoCache.ts b/src/util/cache/cloneIntoCache.ts index ccf2091..cc8e5c1 100644 --- a/src/util/cache/cloneIntoCache.ts +++ b/src/util/cache/cloneIntoCache.ts @@ -20,7 +20,7 @@ export default function cloneIntoCache( itemPath: CacheItemPath ) { return async ({ repository, checkout }: GitCloneOptions): Promise => { - const destination = getCachedItemPath(bucket, itemPath); + const destination = getCachedItemPath(bucket, itemPath, checkout); const parentDir = dirname(destination); // If the item is already in cache, simply return. diff --git a/src/util/cache/getCachedItemPath.ts b/src/util/cache/getCachedItemPath.ts index 10027d4..3713586 100644 --- a/src/util/cache/getCachedItemPath.ts +++ b/src/util/cache/getCachedItemPath.ts @@ -1,4 +1,8 @@ -import type { CacheBucket, CacheItemPath } from '@emulsify-cli/cache'; +import type { + CacheBucket, + CacheItemPath, + CacheCheckout, +} from '@emulsify-cli/cache'; import { join } from 'path'; import { createHash } from 'crypto'; @@ -11,12 +15,13 @@ import findFileInCurrentPath from '../fs/findFileInCurrentPath'; * * @param bucket name of the bucket containing the cached item. * @param itemPath array containing segments of the path to the cached item within the specified bucket. - * @param item name of the cached item. + * @param checkout commit, branch, or tag of the system this project is utilizing. * @returns string containing the full path to the specified cached item. */ export default function getCachedItemPath( bucket: CacheBucket, - itemPath: CacheItemPath + itemPath: CacheItemPath, + checkout: CacheCheckout ): string { const projectPath = findFileInCurrentPath(EMULSIFY_PROJECT_CONFIG_FILE); @@ -27,7 +32,9 @@ export default function getCachedItemPath( return join( CACHE_DIR, bucket, - createHash('md5').update(projectPath).digest('hex'), + createHash('md5') + .update(`MBR${String(projectPath)}${String(checkout)}`) + .digest('hex'), ...itemPath ); } diff --git a/src/util/cache/getJsonFromCachedFile.ts b/src/util/cache/getJsonFromCachedFile.ts index 406b474..bafd36d 100644 --- a/src/util/cache/getJsonFromCachedFile.ts +++ b/src/util/cache/getJsonFromCachedFile.ts @@ -1,4 +1,8 @@ -import type { CacheBucket, CacheItemPath } from '@emulsify-cli/cache'; +import type { + CacheBucket, + CacheItemPath, + CacheCheckout, +} from '@emulsify-cli/cache'; import getCachedItemPath from './getCachedItemPath'; import loadJsonFile from '../fs/loadJsonFile'; @@ -6,9 +10,10 @@ import loadJsonFile from '../fs/loadJsonFile'; export default async function getJsonFromCachedFile( bucket: CacheBucket, itemPath: CacheItemPath, + checkout: CacheCheckout, fileName: string ): Promise { return loadJsonFile( - getCachedItemPath(bucket, [...itemPath, fileName]) + getCachedItemPath(bucket, [...itemPath, fileName], checkout) ); } From 41d47720aec67e0761a99a749822e8df07fc8f8a Mon Sep 17 00:00:00 2001 From: Jim Vomero Date: Fri, 15 Jul 2022 16:16:38 -0400 Subject: [PATCH 03/22] feat: updates cache bin names in test to follow new hashing --- src/util/cache/cloneIntoCache.test.ts | 6 ++--- src/util/cache/getCachedItemPath.test.ts | 26 +++++++++++++------- src/util/cache/getJsonFromCachedFile.test.ts | 14 +++++++++-- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/util/cache/cloneIntoCache.test.ts b/src/util/cache/cloneIntoCache.test.ts index 88f4eed..5d72406 100644 --- a/src/util/cache/cloneIntoCache.test.ts +++ b/src/util/cache/cloneIntoCache.test.ts @@ -40,7 +40,7 @@ describe('cloneIntoCache', () => { existsSyncMock.mockReturnValueOnce(false).mockReturnValueOnce(false); await cloneIntoCache('systems', ['cornflake'])(cloneOptions); expect(mkdirMock).toHaveBeenCalledWith( - 'home/uname/.emulsify/cache/systems/f556ea98d7e82a3bb86892c77634c0b3', + 'home/uname/.emulsify/cache/systems/2a39785f5c873d7a694ac505a8123bb9', { recursive: true, } @@ -53,7 +53,7 @@ describe('cloneIntoCache', () => { await cloneIntoCache('systems', ['cornflake'])(cloneOptions); expect(gitCloneMock).toHaveBeenCalledWith( 'repo-path', - 'home/uname/.emulsify/cache/systems/f556ea98d7e82a3bb86892c77634c0b3/cornflake', + 'home/uname/.emulsify/cache/systems/2a39785f5c873d7a694ac505a8123bb9/cornflake', { '--branch': 'branch-name' } ); }); @@ -64,7 +64,7 @@ describe('cloneIntoCache', () => { await cloneIntoCache('systems', ['cornflake'])({ repository: 'repo-path' }); expect(gitCloneMock).toHaveBeenCalledWith( 'repo-path', - 'home/uname/.emulsify/cache/systems/f556ea98d7e82a3bb86892c77634c0b3/cornflake', + 'home/uname/.emulsify/cache/systems/6342daf21717ab9c095fcddf7943e4e1/cornflake', {} ); }); diff --git a/src/util/cache/getCachedItemPath.test.ts b/src/util/cache/getCachedItemPath.test.ts index d34838d..d52ced2 100644 --- a/src/util/cache/getCachedItemPath.test.ts +++ b/src/util/cache/getCachedItemPath.test.ts @@ -15,25 +15,33 @@ describe('getCachedItemPath', () => { it('can produce the path to a cached file if given a cache bucket, cache item name, and filename', () => { expect.assertions(2); expect( - getCachedItemPath('systems', ['compound', 'system.emulsify.json']) + getCachedItemPath( + 'systems', + ['compound', 'system.emulsify.json'], + 'branch-name' + ) ).toBe( - 'home/uname/.emulsify/cache/systems/f556ea98d7e82a3bb86892c77634c0b3/compound/system.emulsify.json' + 'home/uname/.emulsify/cache/systems/2a39785f5c873d7a694ac505a8123bb9/compound/system.emulsify.json' ); expect( - getCachedItemPath('variants', [ - 'compound', - 'drupal', - 'variant.emulsify.json', - ]) + getCachedItemPath( + 'variants', + ['compound', 'drupal', 'variant.emulsify.json'], + 'branch-name' + ) ).toBe( - 'home/uname/.emulsify/cache/variants/f556ea98d7e82a3bb86892c77634c0b3/compound/drupal/variant.emulsify.json' + 'home/uname/.emulsify/cache/variants/2a39785f5c873d7a694ac505a8123bb9/compound/drupal/variant.emulsify.json' ); }); it('throws an error if a project config file is not found', () => { findFileMock.mockReturnValueOnce(undefined); expect(() => - getCachedItemPath('systems', ['compound', 'system.emulsify.json']) + getCachedItemPath( + 'systems', + ['compound', 'system.emulsify.json'], + 'branch-name' + ) ).toThrow('Unable to find project.emulsify.json'); }); }); diff --git a/src/util/cache/getJsonFromCachedFile.test.ts b/src/util/cache/getJsonFromCachedFile.test.ts index 8755a0c..fb00f83 100644 --- a/src/util/cache/getJsonFromCachedFile.test.ts +++ b/src/util/cache/getJsonFromCachedFile.test.ts @@ -20,7 +20,12 @@ describe('getJsonFromCachedFile', () => { it('can load and parse the JSON from a file stored in cache', async () => { expect.assertions(2); await expect( - getJsonFromCachedFile('systems', ['compound'], 'system.emulsify.json') + getJsonFromCachedFile( + 'systems', + ['compound'], + 'branch-name', + 'system.emulsify.json' + ) ).resolves.toEqual({ the: 'json', }); @@ -33,7 +38,12 @@ describe('getJsonFromCachedFile', () => { expect.assertions(1); loadJsonMock.mockResolvedValueOnce(undefined); await expect( - getJsonFromCachedFile('systems', ['compound'], 'system.emulsify.json') + getJsonFromCachedFile( + 'systems', + ['compound'], + 'branch-name', + 'system.emulsify.json' + ) ).resolves.toBe(undefined); }); }); From 5f601a8d5aef806d182711e627e18f7117f2706d Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Fri, 5 Aug 2022 14:47:11 -0400 Subject: [PATCH 04/22] Create addtoprojects.yml --- .github/workflows/addtoprojects.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/addtoprojects.yml diff --git a/.github/workflows/addtoprojects.yml b/.github/workflows/addtoprojects.yml new file mode 100644 index 0000000..7bebb51 --- /dev/null +++ b/.github/workflows/addtoprojects.yml @@ -0,0 +1,21 @@ +name: Add to projects + +on: + issues: + types: + - opened + pull_request: + types: + - opened + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v0.3.0 + with: + # You can target a repository in a different organization + # to the issue + project-url: https://github.com/orgs/emulsify-ds/projects/6 + github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} From e6a6a336848c00413b195fe627409e02d20b7fb2 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Mon, 8 Aug 2022 10:19:43 -0400 Subject: [PATCH 05/22] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 61fbf9e..f494e52 100644 --- a/README.md +++ b/README.md @@ -50,3 +50,5 @@ Emulsify-cli is developed using TypeScript. You can find all of the source files ## Deployment This project is automatically built and deployed to NPM via a GitHub Actions workflow. In order to deploy changes merged into the `develop` branch, simply merge `develop` into `main`, and call it a day. + +### Contributors From 709e688f5e5b2a3f3e7b7bc688b985cc4de1a36c Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Mon, 8 Aug 2022 10:19:57 -0400 Subject: [PATCH 06/22] Create contributors.yml --- .github/workflows/contributors.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/contributors.yml diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml new file mode 100644 index 0000000..b683636 --- /dev/null +++ b/.github/workflows/contributors.yml @@ -0,0 +1,23 @@ +name: Add contributors +on: + schedule: + - cron: "20 20 * * *" + push: + branches: + - develop + +jobs: + add-contributors: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: BobAnkh/add-contributors@master + with: + CONTRIBUTOR: "### Contributors" + COLUMN_PER_ROW: "6" + ACCESS_TOKEN: ${{secrets.ADD_TO_PROJECT_PAT}} + IMG_WIDTH: "100" + FONT_SIZE: "14" + PATH: "/README.md" + COMMIT_MESSAGE: "docs(README): update contributors" + AVATAR_SHAPE: "round" From d49f14cad13182516aafb8827aebb2aca49fb96d Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Mon, 8 Aug 2022 10:20:31 -0400 Subject: [PATCH 07/22] docs(README): update contributors --- README.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/README.md b/README.md index f494e52..cc71073 100644 --- a/README.md +++ b/README.md @@ -52,3 +52,73 @@ Emulsify-cli is developed using TypeScript. You can find all of the source files This project is automatically built and deployed to NPM via a GitHub Actions workflow. In order to deploy changes merged into the `develop` branch, simply merge `develop` into `main`, and call it a day. ### Contributors + + + + + + + + + + + + + + + +
+ + Patrick +
+ Patrick Coffey +
+
+ + Brian +
+ Brian Lewis +
+
+ + Jeff +
+ Jeff Tomlinson +
+
+ + Callin +
+ Callin Mullaney +
+
+ + Andrii +
+ Andrii Shutov +
+
+ + Randy +
+ Randy Oest +
+
+ + Ryan +
+ Ryan Hagerty +
+
+ + mikeethedude/ +
+ mikeethedude +
+
+ + Igor +
+ Igor R. Plity +
+
From 402d6026222efcb88feefa019fcb6501b5cf3399 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Mon, 8 Aug 2022 10:21:04 -0400 Subject: [PATCH 08/22] docs(README): update contributors --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc71073..8c90cd8 100644 --- a/README.md +++ b/README.md @@ -84,17 +84,17 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor - - Andrii + + Randy
- Andrii Shutov + Randy Oest
- - Randy + + Andrii
- Randy Oest + Andrii Shutov
From f17ed61e3b0121ef8f2437340909df3998ad47cc Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Mon, 8 Aug 2022 10:21:38 -0400 Subject: [PATCH 09/22] docs(README): update contributors --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8c90cd8..cc71073 100644 --- a/README.md +++ b/README.md @@ -84,17 +84,17 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor - - Randy + + Andrii
- Randy Oest + Andrii Shutov
- - Andrii + + Randy
- Andrii Shutov + Randy Oest
From a1511ae5bba6c36ec8f8516aeef7e517551261fa Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Mon, 8 Aug 2022 16:34:54 -0400 Subject: [PATCH 10/22] docs(README): update contributors --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc71073..8c90cd8 100644 --- a/README.md +++ b/README.md @@ -84,17 +84,17 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor - - Andrii + + Randy
- Andrii Shutov + Randy Oest
- - Randy + + Andrii
- Randy Oest + Andrii Shutov
From 88c4b7486758f85f33b3e5fcc620d2feee480218 Mon Sep 17 00:00:00 2001 From: Mike Goulding Date: Tue, 6 Sep 2022 09:20:15 -0500 Subject: [PATCH 11/22] feat(36): adding latest tag when available --- jest.setup.js | 7 ++++++- src/handlers/systemInstall.ts | 9 ++++++++- src/util/getRepositoryLatestTag.test.ts | 26 +++++++++++++++++++++++++ src/util/getRepositoryLatestTag.ts | 20 +++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/util/getRepositoryLatestTag.test.ts create mode 100644 src/util/getRepositoryLatestTag.ts diff --git a/jest.setup.js b/jest.setup.js index 65bb8ae..c41feb5 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -3,8 +3,13 @@ jest.mock('simple-git', () => { clone: jest.fn(), branch: jest.fn(), checkout: jest.fn(), - fetch: jest.fn(), + fetch: jest.fn().mockReturnThis(), pull: jest.fn(), + init: jest.fn().mockReturnThis(), + addRemote: jest.fn().mockReturnThis(), + tags: jest.fn(() => { + return { latest: '' }; + }), }; return jest.fn(() => mockGit); diff --git a/src/handlers/systemInstall.ts b/src/handlers/systemInstall.ts index d4fc799..7cff079 100644 --- a/src/handlers/systemInstall.ts +++ b/src/handlers/systemInstall.ts @@ -19,6 +19,7 @@ import getAvailableSystems from '../util/system/getAvailableSystems'; import getGitRepoNameFromUrl from '../util/getGitRepoNameFromUrl'; import cloneIntoCache from '../util/cache/cloneIntoCache'; import getCachedItemCheckout from '../util/cache/getCachedItemCheckout'; +import getRepositoryLatestTag from '../util/getRepositoryLatestTag'; import installComponentFromCache from '../util/project/installComponentFromCache'; import installGeneralAssetsFromCache from '../util/project/installGeneralAssetsFromCache'; import getJsonFromCachedFile from '../util/cache/getJsonFromCachedFile'; @@ -109,10 +110,16 @@ export default async function systemInstall( ); } + let checkout = repo.checkout; + // Attempt to get latest tag if no branch was supplied. + if (!checkout) { + checkout = await getRepositoryLatestTag(repo.repository); + } + // Clone the system into the cache. await cloneIntoCache('systems', [repo.name])({ repository: repo.repository, - checkout: repo.checkout, + checkout: checkout, }); // Load the system configuration file. diff --git a/src/util/getRepositoryLatestTag.test.ts b/src/util/getRepositoryLatestTag.test.ts new file mode 100644 index 0000000..ee7c923 --- /dev/null +++ b/src/util/getRepositoryLatestTag.test.ts @@ -0,0 +1,26 @@ +import getRepositoryLatestTag from './getRepositoryLatestTag'; +import git from 'simple-git'; + +const gitTagsMock = git().tags as jest.Mock; + +describe('getLatestRepositoryTag', () => { + beforeEach(() => { + gitTagsMock.mockClear(); + }); + it('Can get latest tag from repository url', async () => { + expect.assertions(1); + gitTagsMock.mockReturnValueOnce({ latest: '1.5.0' }); + const latest = await getRepositoryLatestTag( + 'git@github.com:emulsify-ds/compound.git' + ); + expect(latest).toBe('1.5.0'); + }); + + it('Can return empty if no latest tag is found', async () => { + expect.assertions(1); + const latest = await getRepositoryLatestTag( + 'git@github.com:emulsify-ds/compoun.git' + ); + expect(latest).toBe(''); + }); +}); diff --git a/src/util/getRepositoryLatestTag.ts b/src/util/getRepositoryLatestTag.ts new file mode 100644 index 0000000..b8542d2 --- /dev/null +++ b/src/util/getRepositoryLatestTag.ts @@ -0,0 +1,20 @@ +import simpleGit from 'simple-git'; + +const git = simpleGit(); + +/** + * Helper function to get the latest tag for a given repository url. + * + * @param url git url to use + * @returns string of the latest tag or undefined. + */ +export default async function getRepositoryLatestTag( + url: string +): Promise { + const repositoryTags = await git + .init() + .addRemote('origin', url) + .fetch() + .tags(); + return repositoryTags.latest; +} From 6f5514bafcb13b346a5a00646e4446f4ed3c0342 Mon Sep 17 00:00:00 2001 From: Caleb Tucker-Raymond Date: Fri, 7 Oct 2022 09:52:55 -0700 Subject: [PATCH 12/22] fix: gives user a specific error message when the repository URL does not end in .git --- src/handlers/systemInstall.ts | 22 +++++++++++++++------- src/util/getGitRepoNameFromUrl.test.ts | 12 +++++++----- src/util/getGitRepoNameFromUrl.ts | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/handlers/systemInstall.ts b/src/handlers/systemInstall.ts index d4fc799..08a9891 100644 --- a/src/handlers/systemInstall.ts +++ b/src/handlers/systemInstall.ts @@ -43,13 +43,21 @@ export async function getSystemRepoInfo( ): Promise<(GitCloneOptions & { name: string }) | void> { // If a repository and checkout were specified, use that to return system information. if (repository && checkout) { - const repoName = getGitRepoNameFromUrl(repository); - if (repoName) { - return { - name: repoName, - repository, - checkout, - }; + try { + const repoName = getGitRepoNameFromUrl(repository); + if (repoName) { + return { + name: repoName, + repository, + checkout, + }; + } + } catch (error: unknown) { + if (error instanceof Error) { + return log('error', error.message, EXIT_ERROR); + } else { + throw error; + } } } diff --git a/src/util/getGitRepoNameFromUrl.test.ts b/src/util/getGitRepoNameFromUrl.test.ts index c33bc7c..82d3581 100644 --- a/src/util/getGitRepoNameFromUrl.test.ts +++ b/src/util/getGitRepoNameFromUrl.test.ts @@ -17,11 +17,13 @@ describe('getGitRepoNameFromUrl', () => { ).toBe('emulsify-drupal'); }); - it('can return void if given an invalid git url', () => { + it('can throw an Error if given an invalid git url', () => { expect.assertions(2); - expect(getGitRepoNameFromUrl('')).toBe(undefined); - expect( - getGitRepoNameFromUrl('https://github.com/emulsify-ds/emulsify-drupal') - ).toBe(undefined); + expect(() => { + getGitRepoNameFromUrl(''); + }).toThrow(Error); + expect(() => { + getGitRepoNameFromUrl('https://github.com/emulsify-ds/emulsify-drupal'); + }).toThrow(Error); }); }); diff --git a/src/util/getGitRepoNameFromUrl.ts b/src/util/getGitRepoNameFromUrl.ts index ff3dc06..222723c 100644 --- a/src/util/getGitRepoNameFromUrl.ts +++ b/src/util/getGitRepoNameFromUrl.ts @@ -14,7 +14,7 @@ export default function getGitRepoNameFromUrl(url: string): string | void { // If no .git extension is provided, then this is an invalid git url. if (!gitName.includes('.git')) { - return undefined; + throw new Error('The repository URL must end in .git.'); } return R.head(gitName.split('.')); } From 179e045213bc55cdd0a3f0043b864882e7964f76 Mon Sep 17 00:00:00 2001 From: Mike Goulding Date: Fri, 2 Dec 2022 11:21:04 -0600 Subject: [PATCH 13/22] feat(176): update node version --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 7da30cb..29ef05d 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.13 +18.12 From 64968e7826fa3a81e61a7e53ec092e41b0af3e17 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Fri, 16 Dec 2022 10:41:25 -0500 Subject: [PATCH 14/22] docs(README): update contributors --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8c90cd8..be61970 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,15 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor Randy Oest + + + mikeethedude/ +
+ mikeethedude +
+ + + Andrii @@ -97,8 +106,6 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor Andrii Shutov - - Ryan @@ -107,10 +114,10 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor - - mikeethedude/ + + Jim
- mikeethedude + Jim Vomero
From 8e9ae07100c5d7135e5ad381005df5e08024cfb8 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Fri, 16 Dec 2022 15:27:43 -0500 Subject: [PATCH 15/22] docs(README): update contributors --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index be61970..8863dd9 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,13 @@ This project is automatically built and deployed to NPM via a GitHub Actions wor Jim Vomero + + + Caleb +
+ Caleb Tucker-Raymond +
+ Igor From 4f9a2df3e424e1b0fba0a133ce92d2090acce704 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Fri, 9 Jun 2023 15:58:45 -0400 Subject: [PATCH 16/22] Adding download counter --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8863dd9..207dbc0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![Emulsify Design System](https://user-images.githubusercontent.com/409903/170579210-327abcdd-2c98-4922-87bb-36446a4cc013.svg)](https://www.emulsify.info/) - +![npm](https://img.shields.io/npm/dm/@emulsify/cli?style=flat-square) # emulsify-cli Command line interface for Emulsify. From 7505e86d5205ec7eb9c4b40cd7f342fb9df5b755 Mon Sep 17 00:00:00 2001 From: Randy Oest Date: Tue, 20 Jun 2023 17:57:48 -0700 Subject: [PATCH 17/22] Update documentation link Update the documentation link with the new URL. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 207dbc0..6c6d910 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ npm install -g @emulsify/cli ## Usage -For more information on how to use emulsify-cli, please see the [usage documentation](https://docs.emulsify.info/supporting-projects/emulsify-cli/emulsify-cli-usage). +For more information on how to use emulsify-cli, please see the [usage documentation](https://www.emulsify.info/docs/supporting-projects/emulsify-cli/emulsify-cli-usage). ## Development From 8b59e6dc031e0037350dc902db2ded09ad64a0a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 03:05:29 +0000 Subject: [PATCH 18/22] build(deps): bump commander from 7.2.0 to 12.0.0 Bumps [commander](https://github.com/tj/commander.js) from 7.2.0 to 12.0.0. - [Release notes](https://github.com/tj/commander.js/releases) - [Changelog](https://github.com/tj/commander.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/tj/commander.js/compare/v7.2.0...v12.0.0) --- updated-dependencies: - dependency-name: commander dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 16 ++++++++-------- package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 57aad56..49adaac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "ajv": "^7.2.4", "ajv-formats": "^2.1.1", "chalk": "^4.1.0", - "commander": "^7.0.0", + "commander": "^12.0.0", "consola": "^2.15.3", "fs-extra": "^10.0.0", "progress": "^2.0.3", @@ -3413,11 +3413,11 @@ } }, "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", + "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", "engines": { - "node": ">= 10" + "node": ">=18" } }, "node_modules/compare-func": { @@ -17532,9 +17532,9 @@ } }, "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", + "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==" }, "compare-func": { "version": "2.0.0", diff --git a/package.json b/package.json index a0ebf77..8f59a22 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "ajv": "^7.2.4", "ajv-formats": "^2.1.1", "chalk": "^4.1.0", - "commander": "^7.0.0", + "commander": "^12.0.0", "consola": "^2.15.3", "fs-extra": "^10.0.0", "progress": "^2.0.3", From f7d9b1f737326089aaeb5623a711d23f92aea66a Mon Sep 17 00:00:00 2001 From: amazingrando Date: Fri, 1 Mar 2024 13:01:49 -0500 Subject: [PATCH 19/22] chore: replace test string --- src/util/project/installComponentFromCache.test.ts | 4 ++-- src/util/project/installGeneralAssetsFromCache.test.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/project/installComponentFromCache.test.ts b/src/util/project/installComponentFromCache.test.ts index cbfffeb..676ed07 100644 --- a/src/util/project/installComponentFromCache.test.ts +++ b/src/util/project/installComponentFromCache.test.ts @@ -8,7 +8,7 @@ import findFileInCurrentPath from '../fs/findFileInCurrentPath'; import installComponentFromCache from './installComponentFromCache'; const findFileMock = (findFileInCurrentPath as jest.Mock).mockReturnValue( - '/home/uname/Projects/cornflake/web/themes/custom/cornflake/project.emulsify.json' + '/home/username/Projects/drupal-project/web/themes/custom/themename/project.emulsify.json' ); const pathExistsMock = (pathExists as jest.Mock).mockResolvedValue(false); @@ -87,7 +87,7 @@ describe('installComponentFromCache', () => { expect(copyItemFromCache as jest.Mock).toHaveBeenCalledWith( 'systems', ['compound', './components/00-base', 'link'], - '/home/uname/Projects/cornflake/web/themes/custom/cornflake/components/00-base/link', + '/home/username/Projects/drupal-project/web/themes/custom/themename/components/00-base/link', false ); }); diff --git a/src/util/project/installGeneralAssetsFromCache.test.ts b/src/util/project/installGeneralAssetsFromCache.test.ts index 10eb4a6..6853f6f 100644 --- a/src/util/project/installGeneralAssetsFromCache.test.ts +++ b/src/util/project/installGeneralAssetsFromCache.test.ts @@ -7,7 +7,7 @@ import findFileInCurrentPath from '../fs/findFileInCurrentPath'; import installGeneralAssetsFromCache from './installGeneralAssetsFromCache'; const findFileMock = (findFileInCurrentPath as jest.Mock).mockReturnValue( - '/home/uname/Projects/cornflake/web/themes/custom/cornflake/project.emulsify.json' + '/home/username/Projects/drupal-project/web/themes/custom/themename/project.emulsify.json' ); const copyItemMock = (copyItemFromCache as jest.Mock).mockResolvedValue(true); @@ -52,14 +52,14 @@ describe('installGeneralAssetsFromCache', () => { 1, 'systems', ['compound', './components/00-base/00-defaults'], - '/home/uname/Projects/cornflake/web/themes/custom/cornflake/components/00-base/00-defaults', + '/home/username/Projects/drupal-project/web/themes/custom/themename/components/00-base/00-defaults', true ); expect(copyItemMock).toHaveBeenNthCalledWith( 2, 'systems', ['compound', './components/style.scss'], - '/home/uname/Projects/cornflake/web/themes/custom/cornflake/components/style.scss', + '/home/username/Projects/drupal-project/web/themes/custom/themename/components/style.scss', true ); }); From 40553cca02d92586b48ad6823a9fd335b006ad4f Mon Sep 17 00:00:00 2001 From: Mike Goulding Date: Fri, 1 Mar 2024 13:19:15 -0600 Subject: [PATCH 20/22] build(deps): addressing deprecations in commander --- src/index.ts | 64 ++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/index.ts b/src/index.ts index 89a3c21..aa3a750 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,16 @@ import componentInstall from './handlers/componentInstall'; // Main program commands. program - .command('init [path]') + .enablePositionalOptions() + .option( + '-c --checkout ', + 'Commit, branch or tag of the base repository that should be checked out' + ); + +program + .command('init [path]', 'Initialize an Emulsify project', { + isDefault: true, + }) .option( '-m --machineName ', 'Machine-friendly name of the project you are initializing. If not provided, this will be automatically generated.' @@ -26,27 +35,25 @@ program '-p --platform ', 'Name of the platform Emulsify is being within. In some cases, Emulsify is able to automatically detect this. If it is not, Emulsify will prompt you to specify.' ) - .description('Initialize an Emulsify project', { - name: 'Name of the Emulsify project you are initializing. This should be a proper name, such as "Carmen Sandiego".', - path: 'Path to the folder in which you would like to to create your Emulsify project. For example, "./themes" will result in the Emulsify project being placed in ./themes/{name}', - }) .action(withProgressBar(init)); // System sub-commands. -const system = program - .command('system') - .description( - 'Parent command that contains sub-commands pertaining to systems' - ); +const system = program.command( + 'system', + 'Parent command that contains sub-commands pertaining to systems' +); system - .command('list') - .alias('ls') - .description( + .command( + 'list', 'Lists all of the available systems that Emulsify supports out-of-the-box' ) + .alias('ls') .action(systemList); system - .command('install [name]') + .command( + 'install [name]', + 'Install a system within an Emulsify project. You must specify either the name of an out-of-the-box system (such as compound), or a link to a git repository containing the system you want to install' + ) .option( '-r --repository ', 'Git repository containing the system you would like to install' @@ -59,29 +66,25 @@ system '-a --all', 'Use this to install all available components within the specified system. Without this flag, only the required system components will be installed.' ) - .description( - 'Install a system within an Emulsify project. You must specify either the name of an out-of-the-box system (such as compound), or a link to a git repository containing the system you want to install', - { - name: 'Name of the out-of-the-box system you would like to install', - } - ) .action(systemInstall); // Component sub-commands. -const component = program - .command('component') - .description( - 'Parent command that contains sub-commands pertaining to components' - ); +const component = program.command( + 'component', + 'Parent command that contains sub-commands pertaining to components' +); component - .command('list') - .alias('ls') - .description( + .command( + 'list', 'Lists all of the components that are available for installation within your project based on the system and variant you selected' ) + .alias('ls') .action(componentList); component - .command('install [name]') + .command( + 'install [name]', + "Install a component from within the current project's system and variant" + ) .option( '-f --force', 'Use this to overwrite a component that is already installed' @@ -91,9 +94,6 @@ component 'Use this to install all available components, rather than specifying a single component to install' ) .alias('i') - .description( - "Install a component from within the current project's system and variant" - ) .action(componentInstall); void program.parseAsync(process.argv); From afcfa963cddf1309692533ec17b009e7dafe6110 Mon Sep 17 00:00:00 2001 From: Mike Goulding Date: Fri, 1 Mar 2024 13:58:49 -0600 Subject: [PATCH 21/22] build(deps): updating nvm and removing dependency --- .nvmrc | 2 +- package-lock.json | 20 -------------------- package.json | 1 - 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/.nvmrc b/.nvmrc index 29ef05d..209e3ef 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.12 +20 diff --git a/package-lock.json b/package-lock.json index 49adaac..df4e837 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,6 @@ "@semantic-release/github": "^8.0.2", "@semantic-release/npm": "^8.0.3", "@types/chalk": "^2.2.0", - "@types/commander": "^2.12.2", "@types/fs-extra": "^9.0.8", "@types/jest": "^26.0.20", "@types/node": "^14.14.25", @@ -1838,16 +1837,6 @@ "chalk": "*" } }, - "node_modules/@types/commander": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", - "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", - "deprecated": "This is a stub types definition for commander (https://github.com/tj/commander.js). commander provides its own type definitions, so you don't need @types/commander installed!", - "dev": true, - "dependencies": { - "commander": "*" - } - }, "node_modules/@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -16328,15 +16317,6 @@ "chalk": "*" } }, - "@types/commander": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", - "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", - "dev": true, - "requires": { - "commander": "*" - } - }, "@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", diff --git a/package.json b/package.json index 8f59a22..47425f4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "@semantic-release/github": "^8.0.2", "@semantic-release/npm": "^8.0.3", "@types/chalk": "^2.2.0", - "@types/commander": "^2.12.2", "@types/fs-extra": "^9.0.8", "@types/jest": "^26.0.20", "@types/node": "^14.14.25", From 0ad4d17bdd9b761b3ae582ac2cf5a1c31f2f0ca6 Mon Sep 17 00:00:00 2001 From: Callin Mullaney <57088-callinmullaney@users.noreply.drupalcode.org> Date: Wed, 1 May 2024 10:23:37 -0500 Subject: [PATCH 22/22] fix: update release tagging config --- .github/workflows/release.yml | 4 ++-- release.config.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0070a3a..a9a3b12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,13 +13,13 @@ jobs: - name: Install Node.js uses: actions/setup-node@v2 with: - node-version: 16.13 + node-version: 20 - name: Install run: npm install - name: Build run: npm run build - name: Release env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm run semantic-release diff --git a/release.config.js b/release.config.js index 165c9fa..db00f09 100644 --- a/release.config.js +++ b/release.config.js @@ -1,4 +1,5 @@ module.exports = { + tagFormat: '${version}', branches: ['main'], repositoryUrl: 'git@github.com:emulsify-ds/emulsify-cli.git', plugins: [