-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
2,056 additions
and
655 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,12 +42,12 @@ | |
"rxjs-for-await": "^1.0.0", | ||
"shelljs": "^0.8.5", | ||
"tar": "^7.4.3", | ||
"tslib": "^2.8.0", | ||
"tslib": "^2.8.1", | ||
"yargs": "^17.7.2" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/storage": "^7.13.0", | ||
"@jamesives/github-pages-deploy-action": "^4.6.8", | ||
"@google-cloud/storage": "^7.14.0", | ||
"@jamesives/github-pages-deploy-action": "^4.6.9", | ||
"@jscutlery/semver": "^5.3.1", | ||
"@nx/eslint-plugin": "20.0.0", | ||
"@nx/jest": "20.0.0", | ||
|
@@ -56,29 +56,29 @@ | |
"@nx/plugin": "20.0.0", | ||
"@nx/react": "20.0.0", | ||
"@nx/webpack": "20.0.0", | ||
"@pulumi/gcp": "^8.6.0", | ||
"@pulumi/pulumi": "^3.137.0", | ||
"@pulumi/gcp": "^8.10.0", | ||
"@pulumi/pulumi": "^3.141.0", | ||
"@types/jest": "29.5.14", | ||
"@types/node": "22.7.9", | ||
"@types/node": "22.9.3", | ||
"@types/shelljs": "^0.8.15", | ||
"@types/yargs": "^17.0.33", | ||
"@typescript-eslint/eslint-plugin": "8.11.0", | ||
"@typescript-eslint/parser": "8.11.0", | ||
"@typescript-eslint/eslint-plugin": "8.15.0", | ||
"@typescript-eslint/parser": "8.15.0", | ||
"@vercel/ncc": "0.34.0", | ||
"dotenv": "16.4.5", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-simple-import-sort": "^12.1.1", | ||
"express": "^4.21.1", | ||
"husky": "^9.1.6", | ||
"husky": "^9.1.7", | ||
"jest": "29.7.0", | ||
"jest-environment-jsdom": "29.7.0", | ||
"nx": "20.0.0", | ||
"prettier": "3.3.3", | ||
"ts-jest": "29.2.5", | ||
"ts-node": "10.9.2", | ||
"tslint": "~6.1.3", | ||
"typescript": "5.6.3" | ||
"typescript": "5.7.2" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { detectPackageManager, getPackageManagerCommand } from 'nx/src/utils/package-manager' | ||
import { | ||
detectPackageManager, | ||
getPackageManagerCommand as nxGetPackageManagerCommand | ||
} from 'nx/src/utils/package-manager' | ||
|
||
import { buildCommand } from './build-command' | ||
import { execCommand, Options } from './exec' | ||
|
||
export function getPackageManagerDlxCommand() { | ||
return getPackageManagerCommand(detectPackageManager()).dlx | ||
return process.env.NX_EXTEND_COMMAND_USE_NPX ? 'npx' : nxGetPackageManagerCommand(detectPackageManager()).dlx | ||
} | ||
|
||
export function execPackageManagerCommand(command: string, options?: Options) { | ||
return execCommand(buildCommand([ | ||
process.env.NX_EXTEND_COMMAND_USE_NPX ? 'npx' : getPackageManagerDlxCommand(), | ||
getPackageManagerDlxCommand(), | ||
command | ||
]), options) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/gcp-storage/src/executors/upload/__tests__/upload.impl.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { uploadExecutor } from '../upload.impl' | ||
|
||
jest.mock('@nx-extend/core', () => { | ||
const originalModule = jest.requireActual('@nx-extend/core') | ||
|
||
//Mock the default export and named export 'foo' | ||
return { | ||
__esModule: true, | ||
...originalModule, | ||
execCommand: jest.fn(() => ({ success: true })) | ||
} | ||
}) | ||
|
||
import { execCommand as execCommandMock } from '@nx-extend/core' | ||
import { workspaceRoot } from 'nx/src/utils/workspace-root' | ||
|
||
describe('Upload', () => { | ||
it('should fail when directories is invalid', () => { | ||
uploadExecutor( | ||
{ bucket: 'test-bucket', directories: ['dist/apps/test-app'], gzip: false }, | ||
{ root: 'test-root' } as never | ||
) | ||
|
||
expect(execCommandMock).not.toHaveBeenCalled() | ||
}) | ||
|
||
it('should upload with directories', () => { | ||
uploadExecutor( | ||
{ bucket: 'test-bucket', directories: ['dist/apps/test-app:/test-app'], gzip: false }, | ||
{ root: 'test-root' } as never | ||
) | ||
|
||
expect(execCommandMock).toHaveBeenCalled() | ||
expect(execCommandMock).toHaveBeenCalledWith( | ||
`gsutil rsync -R ${workspaceRoot}/test-root/dist/apps/test-app gs://test-bucket/test-app`) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import { ExecutorContext } from '@nx/devkit' | ||
import { buildCommand, execPackageManagerCommand } from '@nx-extend/core' | ||
import { workspaceRoot } from '@nx/devkit' | ||
import { buildCommand, getPackageManagerDlxCommand } from '@nx-extend/core' | ||
import { execSync } from 'child_process' | ||
|
||
export interface ExecutorSchema { | ||
component?: string | ||
overwrite?: boolean | ||
} | ||
|
||
export async function addExecutor( | ||
options: ExecutorSchema, | ||
context: ExecutorContext | ||
): Promise<{ success: boolean }> { | ||
return execPackageManagerCommand( | ||
buildCommand([ | ||
'shadcn@latest add', | ||
(options.component ?? '').length === 0 ? '--all' : options.component, | ||
options.overwrite && '--overwrite' | ||
]), | ||
{ | ||
env: { | ||
...process.env, | ||
TS_NODE_PROJECT: 'tsconfig.base.json' | ||
} | ||
} | ||
) | ||
export async function addExecutor(options: ExecutorSchema): Promise<{ success: boolean }> { | ||
execSync(buildCommand([ | ||
getPackageManagerDlxCommand(), | ||
'shadcn@latest add', | ||
(options.component ?? '').length === 0 ? '--all' : options.component, | ||
options.overwrite && '--overwrite' | ||
]), { | ||
cwd: workspaceRoot, | ||
env: { | ||
...process.env, | ||
TS_NODE_PROJECT: 'tsconfig.base.json' | ||
}, | ||
stdio: 'inherit' | ||
}) | ||
|
||
return { success: true } | ||
} | ||
|
||
export default addExecutor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.