-
Notifications
You must be signed in to change notification settings - Fork 2
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
54 changed files
with
1,057 additions
and
6,983 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": ["**/*"], | ||
"plugins": ["@nx"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": { | ||
"@nx/enforce-module-boundaries": [ | ||
"error", | ||
{ | ||
"enforceBuildableLibDependency": true, | ||
"allow": [], | ||
"depConstraints": [ | ||
{ | ||
"sourceTag": "*", | ||
"onlyDependOnLibsWithTags": ["*"] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"extends": ["plugin:@nx/typescript"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"extends": ["plugin:@nx/javascript"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -19,7 +19,7 @@ packages: | |
proxy: npmjs | ||
|
||
# log settings | ||
logs: | ||
log: | ||
type: stdout | ||
format: pretty | ||
level: warn | ||
|
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,30 @@ | ||
{ | ||
"extends": ["../../.eslintrc.json", "../../.eslintrc.base.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.json"], | ||
"parser": "jsonc-eslint-parser", | ||
"rules": { | ||
"@nx/dependency-checks": [ | ||
"error", | ||
{ | ||
"ignoredFiles": ["{projectRoot}/vite.config.{js,ts,mjs,mts}"] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
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,3 @@ | ||
# cli-e2e-original | ||
|
||
End-to-end tests for the `cli` library. |
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,20 @@ | ||
{ | ||
"name": "cli-e2e-original", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "projects/cli-e2e-original/test", | ||
"projectType": "library", | ||
"tags": [], | ||
"targets": { | ||
"e2e": { | ||
"executor": "@nx/vite:test", | ||
"inputs": [ | ||
"default", | ||
"^production" | ||
], | ||
"outputs": ["{options.reportsDirectory}"], | ||
"options": { | ||
"reportsDirectory": "../../coverage/projects/cli-e2e-original" | ||
} | ||
} | ||
} | ||
} |
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,59 @@ | ||
|
||
import {join} from "node:path"; | ||
import {executeProcess} from "test-utils"; | ||
import {startVerdaccioServer} from "../../../tools/utils/registry"; | ||
|
||
const isVerbose: boolean = true;// process.env.NX_VERBOSE_LOGGING === 'true' ?? false; | ||
let stopRegistry; | ||
|
||
export async function setup() { | ||
|
||
// start registry | ||
stopRegistry = await startVerdaccioServer({ | ||
targetName: 'local-registry', | ||
storage: join('tmp', 'cli-source', 'local-registry', 'storage'), | ||
verbose: isVerbose, | ||
port: '4873' | ||
}); | ||
|
||
|
||
// package publish all projects | ||
await executeProcess({ | ||
command: 'nx', | ||
args: ['run-many', '-t=nx-release-publish', '--registry=http://localhost:4873'], | ||
observer: { | ||
onStdout: stdout => { | ||
if (isVerbose) { | ||
console.info(stdout) | ||
} | ||
}, | ||
onStderr: stdout => { | ||
if (isVerbose) { | ||
console.error(stdout) | ||
} | ||
} | ||
}, | ||
}); | ||
// package install all projects | ||
await executeProcess({ | ||
command: 'nx', | ||
args: ['run-many', '-t=npm-install', '--registry=http://localhost:4873'], | ||
observer: { | ||
onStdout: stdout => { | ||
if (isVerbose) { | ||
console.info(stdout) | ||
} | ||
}, | ||
onStderr: stdout => { | ||
if (isVerbose) { | ||
console.error(stdout) | ||
} | ||
} | ||
}, | ||
}); | ||
} | ||
|
||
export async function teardown() { | ||
// stop registry | ||
stopRegistry() | ||
} |
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,30 @@ | ||
import {dirname, join} from 'node:path'; | ||
import {afterEach, describe, expect, it} from "vitest"; | ||
import {mkdir, readFile, rm, writeFile} from "node:fs/promises"; | ||
import {execSync} from "node:child_process"; | ||
|
||
describe('CLI command - sort', () => { | ||
const baseDir = 'tmp/cli/sort'; | ||
|
||
afterEach(async () => { | ||
await rm(baseDir, {recursive: true, force: true}); | ||
}); | ||
|
||
it('should execute CLI command sort when param file is given', async () => { | ||
const testPath = join(baseDir, 'file-sort', 'users.json'); | ||
await mkdir(dirname(testPath), {recursive: true}); | ||
await writeFile(testPath, JSON.stringify([ | ||
{name: 'Michael'}, | ||
{name: 'Alice'}, | ||
])); | ||
|
||
expect(() => execSync(`npx @org/cli sort --file="${testPath}"`)).toThrow('Command failed: npx @org/cli sort --file="tmp/cli/sort/file-sort/users.json"'); | ||
/* | ||
const content = (await readFile(testPath)).toString(); | ||
expect(JSON.parse(content)).toEqual([ | ||
{name: 'Alice'}, | ||
{name: 'Michael'}, | ||
]); | ||
*/ | ||
}); | ||
}); |
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,19 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"module": "esnext", | ||
"forceConsistentCasingInFileNames": true, | ||
"strict": true, | ||
"noImplicitOverride": true, | ||
"noPropertyAccessFromIndexSignature": true, | ||
"noImplicitReturns": true, | ||
"noFallthroughCasesInSwitch": true | ||
}, | ||
"files": [], | ||
"include": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
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,26 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"types": [ | ||
"vitest/globals", | ||
"vitest/importMeta", | ||
"vite/client", | ||
"node", | ||
"vitest" | ||
] | ||
}, | ||
"include": [ | ||
"vite.config.ts", | ||
"vitest.config.ts", | ||
"test/**/*.test.ts", | ||
"test/**/*.spec.ts", | ||
"test/**/*.test.tsx", | ||
"test/**/*.spec.tsx", | ||
"test/**/*.test.js", | ||
"test/**/*.spec.js", | ||
"test/**/*.test.jsx", | ||
"test/**/*.spec.jsx", | ||
"test/**/*.d.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,28 @@ | ||
import { defineConfig } from 'vite'; | ||
|
||
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; | ||
|
||
export default defineConfig({ | ||
root: __dirname, | ||
cacheDir: '../../node_modules/.vite/projects/cli', | ||
|
||
plugins: [nxViteTsPaths()], | ||
|
||
// Uncomment this if you are using workers. | ||
// worker: { | ||
// plugins: [ nxViteTsPaths() ], | ||
// }, | ||
|
||
test: { | ||
globals: true, | ||
cache: { dir: '../../node_modules/.vitest' }, | ||
environment: 'node', | ||
include: ['test/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], | ||
reporters: ['default'], | ||
globalSetup: ['./setup/global-setup.ts'], | ||
coverage: { | ||
reportsDirectory: '../../coverage/projects/cli', | ||
provider: 'v8', | ||
}, | ||
}, | ||
}); |
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,59 @@ | ||
|
||
import {join} from "node:path"; | ||
import {executeProcess} from "test-utils"; | ||
import {startVerdaccioServer} from "../../../tools/utils/registry"; | ||
|
||
const isVerbose: boolean = true;// process.env.NX_VERBOSE_LOGGING === 'true' ?? false; | ||
let stopRegistry; | ||
|
||
export async function setup() { | ||
|
||
// start registry | ||
stopRegistry = await startVerdaccioServer({ | ||
targetName: 'local-registry', | ||
storage: join('tmp', 'cli-source', 'local-registry', 'storage'), | ||
verbose: isVerbose, | ||
port: '4873' | ||
}); | ||
|
||
|
||
// package publish all projects | ||
await executeProcess({ | ||
command: 'nx', | ||
args: ['run-many', '-t=nx-release-publish', '--registry=http://localhost:4873'], | ||
observer: { | ||
onStdout: stdout => { | ||
if (isVerbose) { | ||
console.info(stdout) | ||
} | ||
}, | ||
onStderr: stdout => { | ||
if (isVerbose) { | ||
console.error(stdout) | ||
} | ||
} | ||
}, | ||
}); | ||
// package install all projects | ||
await executeProcess({ | ||
command: 'nx', | ||
args: ['run-many', '-t=npm-install', '--registry=http://localhost:4873'], | ||
observer: { | ||
onStdout: stdout => { | ||
if (isVerbose) { | ||
console.info(stdout) | ||
} | ||
}, | ||
onStderr: stdout => { | ||
if (isVerbose) { | ||
console.error(stdout) | ||
} | ||
} | ||
}, | ||
}); | ||
} | ||
|
||
export async function teardown() { | ||
// stop registry | ||
stopRegistry() | ||
} |
Oops, something went wrong.