Skip to content

Commit

Permalink
feat(core): Add generator option for standalone projects (#71)
Browse files Browse the repository at this point in the history
Add a generator option for app, lib, and test to make standalone projects

Co-authored-by: Ben Callaghan <bcallaghan@selectbankcard.com>
  • Loading branch information
bcallaghan-et and Ben Callaghan authored Jul 12, 2021
1 parent 705777d commit 8db11d4
Show file tree
Hide file tree
Showing 52 changed files with 1,481 additions and 1,111 deletions.
31 changes: 31 additions & 0 deletions apps/docs-site/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"projectType": "application",
"root": "apps/docs-site",
"sourceRoot": "apps/docs-site/src",
"targets": {
"build": {
"executor": "@nx-plus/docusaurus:browser",
"options": {
"outputPath": "dist/apps/docs-site"
}
},
"serve": {
"executor": "@nx-plus/docusaurus:dev-server",
"options": {
"port": 3000
}
},
"deploy": {
"executor": "@nrwl/workspace:run-commands",
"options": {
"commands": [
"nx workspace-schematic generate-docs",
"nx build docs-site",
"npx ts-node tools/scripts/publish-docs-site"
],
"parallel": false
}
}
},
"tags": []
}
18 changes: 18 additions & 0 deletions apps/nx-ghpages-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"projectType": "application",
"root": "apps/nx-ghpages-e2e",
"sourceRoot": "apps/nx-ghpages-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"options": {
"target": "nx-ghpages:build",
"npmPackageName": "@nx-dotnet/nx-ghpages",
"pluginOutputPath": "dist/packages/nx-ghpages",
"jestConfig": "apps/nx-ghpages-e2e/jest.config.js"
}
}
},
"tags": [],
"implicitDependencies": ["nx-ghpages"]
}
2 changes: 1 addition & 1 deletion e2e/core-e2e/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ module.exports = {
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2ecore-e2e',
testTimeout: 60000,
testTimeout: 90000,
};
18 changes: 18 additions & 0 deletions e2e/core-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"projectType": "application",
"root": "e2e/core-e2e",
"sourceRoot": "e2e/core-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"options": {
"target": "core:build",
"npmPackageName": "@nx-dotnet/core",
"pluginOutputPath": "dist/packages/core",
"jestConfig": "e2e/core-e2e/jest.config.js"
}
}
},
"tags": [],
"implicitDependencies": ["core"]
}
4 changes: 1 addition & 3 deletions e2e/core-e2e/tests/nx-dotnet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@nrwl/nx-plugin/testing';

describe('nx-dotnet e2e', () => {
it('should create apps, libs, and project references', async (done) => {
it('should create apps, libs, and project references', async () => {
const testApp = uniq('app');
const testLib = uniq('lib');
ensureNxProject('@nx-dotnet/core', 'dist/packages/core');
Expand All @@ -24,8 +24,6 @@ describe('nx-dotnet e2e', () => {
);

expect(output.stdout).toMatch(/Reference .* added to the project/);

done();
});

describe('nx g app', () => {
Expand Down
18 changes: 18 additions & 0 deletions e2e/nxdoc-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"projectType": "application",
"root": "e2e/nxdoc-e2e",
"sourceRoot": "e2e/nxdoc-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"options": {
"target": "nxdoc:build",
"npmPackageName": "@nx-dotnet/nxdoc",
"pluginOutputPath": "dist/packages/nxdoc",
"jestConfig": "e2e/nxdoc-e2e/jest.config.js"
}
}
},
"tags": [],
"implicitDependencies": ["nxdoc"]
}
3 changes: 1 addition & 2 deletions e2e/nxdoc-e2e/tests/nxdoc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
describe('nxdoc e2e', () => {
it('should have a test', async (done) => {
it('should have a test', async () => {
expect(true).toBeTruthy();
done();
});
});
18 changes: 18 additions & 0 deletions e2e/typescript-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"projectType": "application",
"root": "e2e/typescript-e2e",
"sourceRoot": "e2e/typescript-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"options": {
"target": "typescript:build",
"npmPackageName": "@nx-dotnet/typescript",
"pluginOutputPath": "dist/packages/typescript",
"jestConfig": "e2e/typescript-e2e/jest.config.js"
}
}
},
"tags": [],
"implicitDependencies": ["typescript"]
}
8 changes: 4 additions & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module.exports = {
projects: [
'<rootDir>/packages/core',
'<rootDir>/e2e\\core-e2e',
'<rootDir>/e2e/core-e2e',
'<rootDir>/packages/typescript',
'<rootDir>/e2e\\typescript-e2e',
'<rootDir>/e2e/typescript-e2e',
'<rootDir>/packages/dotnet',
'<rootDir>/packages/utils',
'<rootDir>/packages/utils',
'<rootDir>/packages/dotnet',
'<rootDir>/packages/nxdoc',
'<rootDir>/e2e\\nxdoc-e2e',
'<rootDir>/e2e/nxdoc-e2e',
'<rootDir>/packages/nx-ghpages',
'<rootDir>/apps\\nx-ghpages-e2e',
'<rootDir>/apps/nx-ghpages-e2e',
],
};
32 changes: 24 additions & 8 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,36 @@
{
"migrations": [
{
"version": "12.1.0-beta.1",
"version": "12.5.0-beta.1",
"description": "Rename the workspace-schematic script into workspace-generator script",
"factory": "./src/migrations/update-12-5-0/add-target-dependencies",
"cli": "nx",
"description": "Update jest-preset-angular to version 8.4.0",
"factory": "./src/migrations/update-12-1-2/update-jest-preset-angular",
"package": "@nrwl/workspace",
"name": "add-target-dependencies"
},
{
"version": "12.4.0-beta.1",
"cli": "nx",
"description": "Add testEnvironment: 'jsdom' in web apps + libraries",
"factory": "./src/migrations/update-12-4-0/add-test-environment-for-node",
"package": "@nrwl/jest",
"name": "update-jest-preset-angular-8-4-0"
"name": "support-jest-27"
},
{
"version": "12.1.2-beta.1",
"version": "12.4.0-beta.1",
"cli": "nx",
"description": "Replace tsConfig with tsconfig for ts-jest in jest.config.js",
"factory": "./src/migrations/update-12-1-2/update-ts-jest",
"description": "Support for Jest 27 via updating ts-jest + jest-preset-angular",
"factory": "./src/migrations/update-12-4-0/update-jest-preset-angular",
"package": "@nrwl/jest",
"name": "update-ts-jest-6-5-5"
"name": "update-ts-jest-and-jest-preset-angular"
},
{
"cli": "nx",
"version": "12.4.0-beta.0",
"description": "Remove ESLint parserOptions.project config if no rules requiring type-checking are in use",
"factory": "./src/migrations/update-12-4-0/remove-eslint-project-config-if-no-type-checking-rules",
"package": "@nrwl/linter",
"name": "remove-eslint-project-config-if-no-type-checking-rules"
}
]
}
48 changes: 9 additions & 39 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,17 @@
}
}
},
"projects": {
"core": {
"tags": []
},
"core-e2e": {
"tags": [],
"implicitDependencies": ["core"]
},
"typescript": {
"tags": []
},
"typescript-e2e": {
"tags": [],
"implicitDependencies": ["typescript"]
},
"utils": {
"tags": []
},
"dotnet": {
"tags": []
},
"nxdoc": {
"tags": []
},
"nxdoc-e2e": {
"tags": [],
"implicitDependencies": ["nxdoc"]
},
"docs-site": {
"tags": []
},
"nx-ghpages": {
"tags": []
},
"nx-ghpages-e2e": {
"tags": [],
"implicitDependencies": ["nx-ghpages"]
}
},
"projects": {},
"workspaceLayout": {
"appsDir": "apps",
"libsDir": "packages"
},
"targetDependencies": {
"build": [
{
"target": "build",
"projects": "dependencies"
}
]
}
}
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@
"@commitlint/cli": "^12.1.1",
"@commitlint/config-conventional": "^12.1.1",
"@commitlint/types": "^12.1.1",
"@nrwl/cli": "12.3.4",
"@nrwl/devkit": "12.3.4",
"@nrwl/eslint-plugin-nx": "12.3.4",
"@nrwl/jest": "12.3.4",
"@nrwl/linter": "12.3.4",
"@nrwl/node": "12.3.4",
"@nrwl/nx-cloud": "12.1.1",
"@nrwl/nx-plugin": "12.3.4",
"@nrwl/tao": "12.3.4",
"@nrwl/workspace": "12.3.4",
"@nrwl/cli": "12.5.7",
"@nrwl/devkit": "12.5.7",
"@nrwl/eslint-plugin-nx": "12.5.7",
"@nrwl/jest": "12.5.7",
"@nrwl/linter": "12.5.7",
"@nrwl/node": "12.5.7",
"@nrwl/nx-cloud": "12.2.7",
"@nrwl/nx-plugin": "12.5.7",
"@nrwl/tao": "12.5.7",
"@nrwl/workspace": "12.5.7",
"@nx-dotnet/nxdoc": "latest",
"@nx-plus/docusaurus": "^12.0.0",
"@semantic-release/changelog": "^5.0.1",
Expand All @@ -88,12 +88,12 @@
"eslint-config-prettier": "8.1.0",
"fs-extra": "^10.0.0",
"husky": "^6.0.0",
"jest": "26.2.2",
"jest": "27.0.3",
"lint-staged": "^10.5.4",
"prettier": "2.2.1",
"prettier": "2.3.1",
"run-p": "*",
"semantic-release": "^17.4.2",
"ts-jest": "26.5.5",
"ts-jest": "27.0.3",
"ts-node": "~9.1.1",
"tslib": "^2.0.0",
"typescript": "4.1.4",
Expand Down
3 changes: 0 additions & 3 deletions packages/core/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": ["packages/nx-dotnet/tsconfig.*?.json"]
},
"rules": {}
},
{
Expand Down
1 change: 1 addition & 0 deletions packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/packages/core',
testTimeout: 40000,
testEnvironment: 'node',
};
64 changes: 64 additions & 0 deletions packages/core/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"root": "packages/core",
"sourceRoot": "packages/core/src",
"projectType": "library",
"targets": {
"lint": {
"executor": "@nrwl/linter:eslint",
"options": {
"lintFilePatterns": ["packages/core/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/core"],
"options": {
"jestConfig": "packages/core/jest.config.js",
"passWithNoTests": true
}
},
"build": {
"executor": "@nrwl/node:package",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/core",
"tsConfig": "packages/core/tsconfig.lib.json",
"packageJson": "packages/core/package.json",
"main": "packages/core/src/index.ts",
"updateBuildableProjectDepsInPackageJson": true,
"assets": [
"packages/core/*.md",
{
"input": "./packages/core/src",
"glob": "**/!(*.ts)",
"output": "./src"
},
{
"input": "./packages/core/src",
"glob": "**/*.d.ts",
"output": "./src"
},
{
"input": "./packages/core",
"glob": "generators.json",
"output": "."
},
{
"input": "./packages/core",
"glob": "executors.json",
"output": "."
},
"LICENSE",
"CHANGELOG.md",
"README.md",
{
"input": "./packages/core",
"glob": "migrations.json",
"output": "."
}
]
}
}
},
"tags": []
}
Loading

0 comments on commit 8db11d4

Please sign in to comment.