* 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
100 lines
2.4 KiB
TypeScript
100 lines
2.4 KiB
TypeScript
import {
|
|
addProjectConfiguration,
|
|
ProjectConfiguration,
|
|
readWorkspaceConfiguration,
|
|
TargetConfiguration,
|
|
Tree,
|
|
updateWorkspaceConfiguration,
|
|
} from '@nrwl/devkit';
|
|
import { NormalizedSchema } from './normalize-options';
|
|
|
|
export function addProject(host: Tree, options: NormalizedSchema) {
|
|
const project: ProjectConfiguration = {
|
|
root: options.appProjectRoot,
|
|
sourceRoot: `${options.appProjectRoot}/src`,
|
|
projectType: 'application',
|
|
targets: { ...getTargets(options) },
|
|
tags: options.parsedTags,
|
|
};
|
|
|
|
addProjectConfiguration(host, options.projectName, {
|
|
...project,
|
|
});
|
|
|
|
const workspace = readWorkspaceConfiguration(host);
|
|
|
|
if (!workspace.defaultProject) {
|
|
workspace.defaultProject = options.projectName;
|
|
|
|
updateWorkspaceConfiguration(host, workspace);
|
|
}
|
|
}
|
|
|
|
function getTargets(options: NormalizedSchema) {
|
|
const architect: { [key: string]: TargetConfiguration } = {};
|
|
|
|
architect.start = {
|
|
executor: '@nrwl/react-native:start',
|
|
options: {
|
|
port: 8081,
|
|
},
|
|
};
|
|
|
|
architect.serve = {
|
|
executor: '@nrwl/workspace:run-commands',
|
|
options: {
|
|
command: `nx start ${options.name}`,
|
|
},
|
|
};
|
|
|
|
architect['run-ios'] = {
|
|
executor: '@nrwl/react-native:run-ios',
|
|
options: {},
|
|
};
|
|
|
|
architect['bundle-ios'] = {
|
|
executor: '@nrwl/react-native:bundle',
|
|
outputs: [`${options.appProjectRoot}/build`],
|
|
options: {
|
|
entryFile: `${options.appProjectRoot}/src/main.tsx`,
|
|
platform: 'ios',
|
|
bundleOutput: `dist/${options.appProjectRoot}/ios/main.jsbundle`,
|
|
},
|
|
};
|
|
|
|
architect['run-android'] = {
|
|
executor: '@nrwl/react-native:run-android',
|
|
options: {},
|
|
};
|
|
|
|
architect['build-android'] = {
|
|
executor: '@nrwl/react-native:build-android',
|
|
outputs: [
|
|
`${options.appProjectRoot}/android/app/build/outputs/bundle`,
|
|
`${options.appProjectRoot}/android/app/build/outputs/apk`,
|
|
],
|
|
options: {},
|
|
};
|
|
|
|
architect['bundle-android'] = {
|
|
executor: '@nrwl/react-native:bundle',
|
|
options: {
|
|
entryFile: `${options.appProjectRoot}/src/main.tsx`,
|
|
platform: 'android',
|
|
bundleOutput: `dist/${options.appProjectRoot}/android/main.jsbundle`,
|
|
},
|
|
};
|
|
|
|
architect['sync-deps'] = {
|
|
executor: '@nrwl/react-native:sync-deps',
|
|
options: {},
|
|
};
|
|
|
|
architect['ensure-symlink'] = {
|
|
executor: '@nrwl/react-native:ensure-symlink',
|
|
options: {},
|
|
};
|
|
|
|
return architect;
|
|
}
|