Skip to content

Upgrade to Yarn v3, Nx 13.1.4, and move to @nrwl/nx-plugin proper structure #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"parserOptions": {
"project": "./tsconfig.*?.json"
},
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
Expand All @@ -26,9 +24,6 @@
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"parserOptions": {
"project": "./tsconfig.*?.json"
},
"rules": {}
},
{
Expand Down
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ testem.log
.DS_Store
Thumbs.db

/*.tgz
/*.tgz

.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/packages/ddd/src/generators/feature/files/
4 changes: 3 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"recommendations": [
"ms-vscode.vscode-typescript-tslint-plugin",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
"firsttris.vscode-jest-runner",
"nrwl.angular-console",
"dbaeumer.vscode-eslint"
]
}
13 changes: 13 additions & 0 deletions .yarn/patches/@nrwl-nx-plugin-npm-13.1.4-c7e0db7239
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/utils/testing-utils/nx-project.js b/src/utils/testing-utils/nx-project.js
index 2eeabe33defda0bae009e8b09b7865a4e165c2af..d9c55a01f70b84e15e224274cdd3de8703787002 100644
--- a/src/utils/testing-utils/nx-project.js
+++ b/src/utils/testing-utils/nx-project.js
@@ -10,7 +10,7 @@ const paths_1 = require("./paths");
const utils_1 = require("./utils");
function runNxNewCommand(args, silent) {
const localTmpDir = path_1.dirname(paths_1.tmpProjPath());
- return child_process_1.execSync(`node ${require.resolve('@nrwl/tao')} new proj --nx-workspace-root=${localTmpDir} --no-interactive --skip-install --collection=@nrwl/workspace --npmScope=proj --preset=empty ${args || ''}`, Object.assign({ cwd: localTmpDir }, (silent && false ? { stdio: ['ignore', 'ignore', 'ignore'] } : {})));
+ return child_process_1.execSync(`node ${require.resolve('@nrwl/tao')} new proj --nx-workspace-root=${localTmpDir} --packageManager=yarn --no-interactive --skip-install --collection=@nrwl/workspace --npmScope=proj --preset=empty ${args || ''}`, Object.assign({ cwd: localTmpDir }, (silent && false ? { stdio: ['ignore', 'ignore', 'ignore'] } : {})));
}
function patchPackageJsonForPlugin(npmPackageName, distPath) {
const path = paths_1.tmpProjPath('package.json');
13 changes: 13 additions & 0 deletions .yarn/patches/@nrwl-tao-npm-13.1.4-4a2d4662fa
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/shared/package-manager.js b/src/shared/package-manager.js
index a7bc1f6b8797dbb3643775cda9afd2bc8ded0ef9..66cdcba5735af661eb651960277d05eff5cf3bef 100644
--- a/src/shared/package-manager.js
+++ b/src/shared/package-manager.js
@@ -29,7 +29,7 @@ exports.detectPackageManager = detectPackageManager;
function getPackageManagerCommand(packageManager = detectPackageManager()) {
const commands = {
yarn: () => ({
- install: 'yarn',
+ install: 'yarn dlx touch yarn.lock && yarn',
add: 'yarn add',
addDev: 'yarn add -D',
rm: 'yarn remove',
546 changes: 546 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

766 changes: 766 additions & 0 deletions .yarn/releases/yarn-3.2.0-rc.6.cjs

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'

yarnPath: .yarn/releases/yarn-3.2.0-rc.6.cjs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# @angular-architects/ddd -- DDD Plugin for Nx

see [libs/ddd/readme.md](libs/ddd/README.md)
see [packages/ddd/readme.md](packages/ddd/README.md)
5 changes: 0 additions & 5 deletions apps/ddd-e2e/jest.config.js

This file was deleted.

14 changes: 14 additions & 0 deletions e2e/ddd-e2e/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: 'ddd-e2e',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2e/ddd-e2e',
};
16 changes: 16 additions & 0 deletions e2e/ddd-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"root": "e2e/ddd-e2e",
"projectType": "application",
"sourceRoot": "e2e/ddd-e2e/src",
"targets": {
"e2e": {
"executor": "@nrwl/nx-plugin:e2e",
"options": {
"target": "ddd:build",
"jestConfig": "e2e/ddd-e2e/jest.config.js"
}
}
},
"tags": [],
"implicitDependencies": ["ddd"]
}
28 changes: 16 additions & 12 deletions apps/ddd-e2e/tests/ddd.test.ts → e2e/ddd-e2e/tests/ddd.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,45 @@ import {
uniq,
} from '@nrwl/nx-plugin/testing';
describe('ddd e2e', () => {
it('should create ddd', async (done) => {
it('should create ddd', async () => {
const plugin = uniq('ddd');
ensureNxProject('@angular-architects/ddd', 'dist/libs/ddd');
ensureNxProject('@angular-architects/ddd', 'dist/packages/ddd');
await runNxCommandAsync(`generate @angular-architects/ddd:ddd ${plugin}`);

const result = await runNxCommandAsync(`build ${plugin}`);
expect(result.stdout).toContain('Builder ran');

done();
});
expect(result.stdout).toContain('Executor ran');
}, 120000);

describe('--directory', () => {
it('should create src in the specified directory', async (done) => {
it('should create src in the specified directory', async () => {
const plugin = uniq('ddd');
ensureNxProject('@angular-architects/ddd', 'dist/libs/ddd');
ensureNxProject('@angular-architects/ddd', 'dist/packages/ddd');
await runNxCommandAsync(
`generate @angular-architects/ddd:ddd ${plugin} --directory subdir`
);
expect(() =>
checkFilesExist(`libs/subdir/${plugin}/src/index.ts`)
).not.toThrow();
done();
});
}, 120000);
});

describe('--tags', () => {
it('should add tags to nx.json', async (done) => {
it('should add tags to the project', async () => {
const plugin = uniq('ddd');
ensureNxProject('@angular-architects/ddd', 'dist/libs/ddd');
ensureNxProject('@angular-architects/ddd', 'dist/packages/ddd');
await runNxCommandAsync(
`generate @angular-architects/ddd:ddd ${plugin} --tags e2etag,e2ePackage`
);
const project = readJson(`libs/${plugin}/project.json`);
expect(project.tags).toEqual(['e2etag', 'e2ePackage']);
}, 120000);
});
});
/*
const nxJson = readJson('nx.json');
expect(nxJson.projects[plugin].tags).toEqual(['e2etag', 'e2ePackage']);
done();
});
});
});
*/
8 changes: 4 additions & 4 deletions apps/ddd-e2e/tsconfig.json → e2e/ddd-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["node", "jest"]
},
"include": [],
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.e2e.json"
},
{
"path": "./tsconfig.spec.json"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.spec.ts", "**/*.d.ts"]
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
}
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const { getJestProjects } = require('@nrwl/jest');

module.exports = {
projects: ['<rootDir>/libs/ddd'],
projects: getJestProjects(),
};
12 changes: 2 additions & 10 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
const nxPreset = require('@nrwl/jest/preset');
module.exports = {
...nxPreset,
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
};

module.exports = { ...nxPreset };
5 changes: 0 additions & 5 deletions libs/ddd/.eslintrc.json

This file was deleted.

10 changes: 0 additions & 10 deletions libs/ddd/jest.config.js

This file was deleted.

10 changes: 0 additions & 10 deletions libs/ddd/node_modules/.yarn-integrity

This file was deleted.

Empty file.
22 changes: 0 additions & 22 deletions libs/ddd/src/schematics/json-schema-to-ts.js

This file was deleted.

4 changes: 0 additions & 4 deletions libs/ddd/yarn.lock

This file was deleted.

11 changes: 0 additions & 11 deletions migrations.json

This file was deleted.

Loading