-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
1 parent
2111841
commit 6e5743d
Showing
10 changed files
with
815 additions
and
26 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,41 @@ | ||
import { | ||
checkFilesExist, | ||
cleanupProject, | ||
newProject, | ||
runCLI, | ||
} from '@nx/e2e/utils'; | ||
|
||
describe('Nx Import', () => { | ||
let proj: string; | ||
beforeAll( | ||
() => | ||
(proj = newProject({ | ||
packages: ['@nx/vue'], | ||
unsetProjectNameAndRootFormat: false, | ||
})) | ||
); | ||
afterAll(() => cleanupProject()); | ||
|
||
it('should be able to import a vite app', () => { | ||
const remote = 'https://github.com/FrozenPandaz/nx-examples.git'; | ||
const ref = 'vue'; | ||
const source = '.'; | ||
const directory = 'projects/vue-app'; | ||
runCLI( | ||
`import ${remote} ${directory} --ref ${ref} --source ${source} --no-interactive` | ||
); | ||
|
||
checkFilesExist( | ||
'projects/vue-app/.gitignore', | ||
'projects/vue-app/package.json', | ||
'projects/vue-app/index.html', | ||
'projects/vue-app/vite.config.ts', | ||
'projects/vue-app/e2e/tsconfig.json', | ||
'projects/vue-app/e2e/vue.spec.ts', | ||
'projects/vue-app/src/main.ts', | ||
'projects/vue-app/src/App.vue', | ||
'projects/vue-app/public/favicon.ico' | ||
); | ||
runCLI(`build created-vue-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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Arguments, CommandModule, MiddlewareFunction } from 'yargs'; | ||
import { linkToNxDevAndExamples } from '../yargs-utils/documentation'; | ||
import { withVerbose } from '../yargs-utils/shared-options'; | ||
import { handleErrors } from '../../utils/params'; | ||
import type { ImportOptions } from './import'; | ||
|
||
export const yargsImportCommand: CommandModule = { | ||
command: 'import [sourceRemoteUrl] [destination]', | ||
describe: false, | ||
builder: (yargs) => | ||
linkToNxDevAndExamples( | ||
withVerbose( | ||
yargs | ||
.positional('sourceRemoteUrl', { | ||
type: 'string', | ||
description: 'The remote URL of the source to import', | ||
}) | ||
.positional('destination', { | ||
type: 'string', | ||
description: | ||
'The directory in the current workspace to import into', | ||
}) | ||
.option('source', { | ||
type: 'string', | ||
description: | ||
'The directory in the source repository to import from', | ||
}) | ||
.option('ref', { | ||
type: 'string', | ||
description: 'The branch from the source repository to import', | ||
}) | ||
), | ||
'import' | ||
), | ||
handler: async (args) => { | ||
const exitCode = await handleErrors( | ||
(args.verbose as boolean) ?? process.env.NX_VERBOSE_LOGGING === 'true', | ||
async () => { | ||
return (await import('./import')).importHandler(args as any); | ||
} | ||
); | ||
process.exit(exitCode); | ||
}, | ||
}; |
Oops, something went wrong.