Craigory Coppola 79cf69b4e4
feat(core): consolidate nx.json and workspace.json (#6642)
* feat(core): consolidate settings between workspace.json + nx.json

workspace.json (and linked project.json files) now contain all project specific settings.
nx.json now contains all settings that affect the whole workspace.

* chore(core): fix angular unit tests w/ new config

* chore(core): fix failing tests

* chore(core): fix formatting

* chore(core): fix more tests

* chore(core): normalize-nx-json feedback

* chore(core): Fix more unit tests

* chore(core): fix remaining tests in workspace

* chore(linter): fix remaining linter tests

* chore(core): fix remaining spec + build issues

* chore(core): formatting fixes

* feat(core): migration script to move config options to new locations

* chore(core): fix e2e tests

* chore(core): run format

* chore(react-native): fix failing tests

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* feat(core): move properties to new location during format step

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* feat(core): initial pass on ngcli-adapter for property consolidation

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* chore(misc): fix tests

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* docs(core): update docs with changes

* chore(misc): fix tests

* chore(core): code review changes

updateWorkspaceJson -> updateWorkspace, no longer uses updater function

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* chore(core): fix bug in ngcli impl

* fix(core): fix bug in ngcli-adapter

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* fix(core): fix ngcli-adapter

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* chore(core): fix workspace e2e

* chore(core): fix nx-plugin e2e

* fix(core): move defaultProject to nx.json

* chore(core): fix broken workspace test

* chore(core): formatting

* chore(core): fix workspace format

* chore(core): add nxJson to ExecutorContext

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>

* chore(core): remove all references ot `NxProjectConfiguration` from our code

* chore(core): Review Changes

* fix(core): update new config locations v13 migration
2021-10-14 10:42:47 -04:00

71 lines
1.5 KiB
TypeScript

import { NormalizedSchema } from './normalize-options';
import {
addProjectConfiguration,
joinPathFragments,
ProjectConfiguration,
Tree,
} from '@nrwl/devkit';
export function addProject(host: Tree, options: NormalizedSchema) {
const targets: Record<string, any> = {};
targets.build = {
builder: '@nrwl/next:build',
outputs: ['{options.outputPath}'],
options: {
root: options.appProjectRoot,
outputPath: joinPathFragments('dist', options.appProjectRoot),
},
// This has to be here so `nx serve [app] --prod` will work. Otherwise
// a missing configuration error will be thrown.
configurations: {
production: {},
},
};
targets.serve = {
builder: '@nrwl/next:server',
options: {
buildTarget: `${options.projectName}:build`,
dev: true,
},
configurations: {
production: {
buildTarget: `${options.projectName}:build:production`,
dev: false,
},
},
};
if (options.server) {
targets.serve.options = {
...targets.serve.options,
customServerPath: options.server,
};
}
targets.export = {
builder: '@nrwl/next:export',
options: {
buildTarget: `${options.projectName}:build:production`,
},
};
const project: ProjectConfiguration = {
root: options.appProjectRoot,
sourceRoot: options.appProjectRoot,
projectType: 'application',
targets,
tags: options.parsedTags,
};
addProjectConfiguration(
host,
options.projectName,
{
...project,
},
options.standaloneConfig
);
}