init
This commit is contained in:
parent
ba73cc8752
commit
780e5d5002
@ -16,16 +16,15 @@
|
|||||||
"profile": {
|
"profile": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"cwd": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"target-dir": {
|
"target-dir": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"toolchain": {
|
"toolchain": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": [
|
"enum": ["stable", "beta", "nightly"],
|
||||||
"stable",
|
|
||||||
"beta",
|
|
||||||
"nightly"
|
|
||||||
],
|
|
||||||
"default": "stable"
|
"default": "stable"
|
||||||
},
|
},
|
||||||
"features": {
|
"features": {
|
||||||
|
@ -77,7 +77,7 @@ describe('add-napi generator', () => {
|
|||||||
"release": true,
|
"release": true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"executor": "@monodon/rust:napi",
|
"executor": "@unbox-x/nx-rust:napi",
|
||||||
"options": Object {
|
"options": Object {
|
||||||
"dist": "test",
|
"dist": "test",
|
||||||
"jsFile": "index.js",
|
"jsFile": "index.js",
|
||||||
|
@ -60,7 +60,7 @@ export default async function (tree: Tree, options: AddNapiGeneratorSchema) {
|
|||||||
build: {
|
build: {
|
||||||
cache: true,
|
cache: true,
|
||||||
outputs: [`{workspaceRoot}/${normalizedOptions.projectRoot}`],
|
outputs: [`{workspaceRoot}/${normalizedOptions.projectRoot}`],
|
||||||
executor: '@monodon/rust:napi',
|
executor: '@unbox-x/nx-rust:napi',
|
||||||
options: {
|
options: {
|
||||||
dist: normalizedOptions.projectRoot,
|
dist: normalizedOptions.projectRoot,
|
||||||
jsFile: 'index.js',
|
jsFile: 'index.js',
|
||||||
|
@ -66,7 +66,7 @@ export default async function (
|
|||||||
sourceRoot: `${normalizedOptions.projectRoot}/src`,
|
sourceRoot: `${normalizedOptions.projectRoot}/src`,
|
||||||
targets: {
|
targets: {
|
||||||
build: {
|
build: {
|
||||||
executor: '@monodon/rust:build',
|
executor: '@unbox-x/nx-rust:build',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
tags: normalizedOptions.parsedTags,
|
tags: normalizedOptions.parsedTags,
|
||||||
|
@ -40,7 +40,7 @@ describe('init generator', () => {
|
|||||||
const nxJson = readNxJson(appTree);
|
const nxJson = readNxJson(appTree);
|
||||||
expect(nxJson?.plugins).toMatchInlineSnapshot(`
|
expect(nxJson?.plugins).toMatchInlineSnapshot(`
|
||||||
Array [
|
Array [
|
||||||
"@monodon/rust",
|
"@unbox-x/nx-rust",
|
||||||
]
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
@ -55,7 +55,7 @@ describe('init generator', () => {
|
|||||||
expect(nxJson?.plugins).toMatchInlineSnapshot(`
|
expect(nxJson?.plugins).toMatchInlineSnapshot(`
|
||||||
Array [
|
Array [
|
||||||
"@nrwl/graph/plugin",
|
"@nrwl/graph/plugin",
|
||||||
"@monodon/rust",
|
"@unbox-x/nx-rust",
|
||||||
]
|
]
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
@ -45,7 +45,7 @@ function includeProjectGraphPlugin(tree: Tree) {
|
|||||||
if (!config) {
|
if (!config) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(config.plugins ??= []).push('@monodon/rust');
|
(config.plugins ??= []).push('@unbox-x/nx-rust');
|
||||||
updateNxJson(tree, config);
|
updateNxJson(tree, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ function processCargoMetadata(ctx: CreateNodesContext | CreateNodesContextV2): {
|
|||||||
if (!isPrivate) {
|
if (!isPrivate) {
|
||||||
targets['nx-release-publish'] = {
|
targets['nx-release-publish'] = {
|
||||||
dependsOn: ['^nx-release-publish'],
|
dependsOn: ['^nx-release-publish'],
|
||||||
executor: '@monodon/rust:release-publish',
|
executor: '@unbox-x/nx-rust:release-publish',
|
||||||
options: {},
|
options: {},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ function processCargoMetadata(ctx: CreateNodesContext | CreateNodesContextV2): {
|
|||||||
targets,
|
targets,
|
||||||
release: {
|
release: {
|
||||||
version: {
|
version: {
|
||||||
generator: '@monodon/rust:release-version',
|
generator: '@unbox-x/nx-rust:release-version',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ import { NxPlugin } from '@nx/devkit';
|
|||||||
import { createDependencies, createNodes, createNodesV2 } from './graph';
|
import { createDependencies, createNodes, createNodesV2 } from './graph';
|
||||||
|
|
||||||
const nxPlugin: NxPlugin = {
|
const nxPlugin: NxPlugin = {
|
||||||
name: '@monodon/rust',
|
name: '@unbox-x/nx-rust',
|
||||||
createDependencies,
|
createDependencies,
|
||||||
createNodes,
|
createNodes,
|
||||||
createNodesV2,
|
createNodesV2,
|
||||||
|
@ -7,6 +7,7 @@ export interface CargoMetadata {
|
|||||||
packages: Package[];
|
packages: Package[];
|
||||||
workspace_members: string[];
|
workspace_members: string[];
|
||||||
resolve: Resolve;
|
resolve: Resolve;
|
||||||
|
cwd: string;
|
||||||
target_directory: string;
|
target_directory: string;
|
||||||
version: number;
|
version: number;
|
||||||
workspace_root: string;
|
workspace_root: string;
|
||||||
|
@ -10,7 +10,7 @@ export function addBuildExecutor(
|
|||||||
): TargetConfiguration {
|
): TargetConfiguration {
|
||||||
return {
|
return {
|
||||||
cache: true,
|
cache: true,
|
||||||
executor: '@monodon/rust:build',
|
executor: '@unbox-x/nx-rust:build',
|
||||||
outputs: ['{options.target-dir}'],
|
outputs: ['{options.target-dir}'],
|
||||||
options: {
|
options: {
|
||||||
...additionalOptions,
|
...additionalOptions,
|
||||||
@ -27,7 +27,7 @@ export function addCheckExecutor(
|
|||||||
additionalOptions?: BuildExecutorSchema
|
additionalOptions?: BuildExecutorSchema
|
||||||
): TargetConfiguration {
|
): TargetConfiguration {
|
||||||
return {
|
return {
|
||||||
executor: '@monodon/rust:check',
|
executor: '@unbox-x/nx-rust:check',
|
||||||
outputs: ['{options.target-dir}'],
|
outputs: ['{options.target-dir}'],
|
||||||
options: {
|
options: {
|
||||||
...additionalOptions,
|
...additionalOptions,
|
||||||
@ -40,7 +40,7 @@ export function addTestExecutor(
|
|||||||
): TargetConfiguration {
|
): TargetConfiguration {
|
||||||
return {
|
return {
|
||||||
cache: true,
|
cache: true,
|
||||||
executor: '@monodon/rust:test',
|
executor: '@unbox-x/nx-rust:test',
|
||||||
outputs: ['{options.target-dir}'],
|
outputs: ['{options.target-dir}'],
|
||||||
options: {
|
options: {
|
||||||
...additionalOptions,
|
...additionalOptions,
|
||||||
@ -57,7 +57,7 @@ export function addRunExecutor(
|
|||||||
additionalOptions?: RunExecutorSchema
|
additionalOptions?: RunExecutorSchema
|
||||||
): TargetConfiguration {
|
): TargetConfiguration {
|
||||||
return {
|
return {
|
||||||
executor: '@monodon/rust:run',
|
executor: '@unbox-x/nx-rust:run',
|
||||||
outputs: ['{options.target-dir}'],
|
outputs: ['{options.target-dir}'],
|
||||||
options: {
|
options: {
|
||||||
...additionalOptions,
|
...additionalOptions,
|
||||||
@ -75,7 +75,7 @@ export function addLintExecutor(
|
|||||||
): TargetConfiguration {
|
): TargetConfiguration {
|
||||||
return {
|
return {
|
||||||
cache: true,
|
cache: true,
|
||||||
executor: '@monodon/rust:lint',
|
executor: '@unbox-x/nx-rust:lint',
|
||||||
outputs: ['{options.target-dir}'],
|
outputs: ['{options.target-dir}'],
|
||||||
options: {
|
options: {
|
||||||
...additionalOptions,
|
...additionalOptions,
|
||||||
@ -88,7 +88,7 @@ export function addWasmPackExecutor(
|
|||||||
): TargetConfiguration {
|
): TargetConfiguration {
|
||||||
return {
|
return {
|
||||||
cache: true,
|
cache: true,
|
||||||
executor: '@monodon/rust:wasm-pack',
|
executor: '@unbox-x/nx-rust:wasm-pack',
|
||||||
outputs: ['{options.target-dir}'],
|
outputs: ['{options.target-dir}'],
|
||||||
options: {
|
options: {
|
||||||
...additionalOptions,
|
...additionalOptions,
|
||||||
|
@ -7,6 +7,7 @@ export function runProcess(
|
|||||||
...args: string[]
|
...args: string[]
|
||||||
): { success: boolean } | PromiseLike<{ success: boolean }> {
|
): { success: boolean } | PromiseLike<{ success: boolean }> {
|
||||||
const metadata = cargoMetadata();
|
const metadata = cargoMetadata();
|
||||||
|
const cwd = metadata?.cwd ?? process.cwd();
|
||||||
const targetDir =
|
const targetDir =
|
||||||
metadata?.target_directory ??
|
metadata?.target_directory ??
|
||||||
joinPathFragments(workspaceRoot, 'dist', 'cargo');
|
joinPathFragments(workspaceRoot, 'dist', 'cargo');
|
||||||
@ -18,7 +19,7 @@ export function runProcess(
|
|||||||
}
|
}
|
||||||
|
|
||||||
execSync(processCmd + ' ' + args.join(' '), {
|
execSync(processCmd + ' ' + args.join(' '), {
|
||||||
cwd: process.cwd(),
|
cwd,
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
RUSTC_WRAPPER: '',
|
RUSTC_WRAPPER: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user