Skip to content

Commit

Permalink
chore: move monorepo jest helper to the workspace package
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu-crouzet committed Nov 2, 2023
1 parent f2ce454 commit ec3be40
Show file tree
Hide file tree
Showing 64 changed files with 76 additions and 160 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ jobs:
${{ runner.os }}-jest-${{ env.hash }}
${{ runner.os }}-jest
${{ runner.os }}
- name: Build swagger generator
run: yarn nx run ama-sdk-schematics:build-swagger
- name: Test
env:
testCmd: ${{ inputs.affected && format('test:affected --base=remotes/origin/{0}', github.base_ref || github.ref_name) || 'test'}}
Expand Down
1 change: 0 additions & 1 deletion apps/chrome-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/localization": "workspace:^",
Expand Down
1 change: 0 additions & 1 deletion apps/github-cascading-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"@nx/jest": "~16.10.0",
"@nx/js": "~16.10.0",
"@nx/linter": "~16.10.0",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/ejs": "^3.1.2",
Expand Down
1 change: 0 additions & 1 deletion apps/showcase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"@angular/compiler-cli": "~16.2.0",
"@ng-bootstrap/ng-bootstrap": "^15.1.1",
"@nx/eslint-plugin": "~16.10.0",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/schematics": "workspace:^",
Expand Down
1 change: 0 additions & 1 deletion apps/vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/schematics": "workspace:^",
"@types/eslint": "^8.42.0",
Expand Down
10 changes: 5 additions & 5 deletions docs/dev-tools/DEV_TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ Options:
## Set Version
Replace the packages version in a monorepo
### Usage
```shell
Usage: set-version [options] <version>
Usage: o3r-set-version [options] <version>

Replace the packages version in a monorepos

Expand Down Expand Up @@ -163,7 +163,7 @@ Example : yarn o3r-pr-artifact-cleaner -b thisismybase64tokenwithuserandencrypte
## Peer dependencies updater
Update a package.json with the given dependencies versions and their respective peer dependencies.
Update a package.json with the given dependencies versions and their respective peer dependencies.
Relies on `npm info` to retrieve package information.
### Usage
Expand All @@ -179,7 +179,7 @@ Options:
--verbose Display debug log message
--silent Do not exit with error in case of metadata fetch error

Example : peer-dependencies-updater "@random/package@~2.21.0" "@o3r/core"
Example : peer-dependencies-updater "@random/package@~2.21.0" "@o3r/core"
```
## Scripts
Expand All @@ -199,7 +199,7 @@ This is used to edit the package.json version of a yarn workspaces packages.
### Usage
```bash
Usage: set-version [options] <version>
Usage: o3r-set-version [options] <version>
Replace the packages version in a monorepos
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { getJestProjects } = require('@o3r/dev-tools');
const { getJestProjects } = require('@o3r/workspace');

/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"get:current-dir": "node -e 'process.stdout.write(process.cwd());'",
"build": "yarn nx run-many --target=build --parallel $(yarn get:cpus-number)",
"build:affected": "yarn nx affected --target=build --parallel $(yarn get:cpus-number) --output-style stream",
"build:tools": "yarn nx run-many --target=build --projects=eslint-plugin,dev-tools --parallel $(yarn get:cpus-number)",
"build:tools": "yarn nx run-many --target=build --projects=eslint-plugin,dev-tools,workspace --parallel $(yarn get:cpus-number)",
"build:swagger-gen": "yarn nx run-many --target=build-swagger --parallel $(yarn get:cpus-number)",
"prepare:publish": "prepare-publish $(yarn workspaces:list | shx sed \"s/^(.+)\\$/\\$1\\/dist/\")",
"publish": "yarn run prepare:publish && yarn nx run-many --target=publish --parallel $(yarn get:cpus-number) --nx-bail --access=public",
Expand All @@ -25,7 +25,7 @@
"postinstall": "husky install && yarn build:tools && yarn harmonize:version",
"build:storybook": "yarn doc:generate:json && yarn ng run storybook:extract-style && build-storybook",
"clear": "rimraf -g './{packages,tools,apps}/{@*/,}{amaterasu/,}*/{dist,build,dist-*}/'",
"set:version": "yarn set-version --placeholder 0.0.0-placeholder --include '{apps,packages}/**/dist/package.json'",
"set:version": "yarn o3r-set-version --placeholder 0.0.0-placeholder --include '{apps,packages}/**/dist/package.json'",
"harmonize:version": "eslint '**/package.json*' --quiet --fix",
"doc:packages": "yarn nx run-many --target=documentation --parallel $(yarn get:cpus-number)",
"doc:root": "yarn prepare-doc-root-menu-template && yarn update-doc-summary ./docs && yarn compodoc",
Expand Down Expand Up @@ -165,9 +165,9 @@
"@nx/linter": "~16.10.0",
"@nx/workspace": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/workspace": "workspace:^",
"@schematics/angular": "~16.2.0",
"@swc-node/register": "^1.6.7",
"@swc/core": "^1.3.85",
Expand Down
5 changes: 2 additions & 3 deletions packages/@ama-sdk/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@schematics/angular": "~16.2.0",
"@swc/cli": "^0.1.57",
Expand Down Expand Up @@ -141,7 +140,7 @@
},
"schematics": "./collection.json",
"bin": {
"amasdk-clear-index": "./cli/clear-index.cjs",
"amasdk-files-pack": "./cli/files-pack.cjs"
"amasdk-clear-index": "./dist/cli/clear-index.cjs",
"amasdk-files-pack": "./dist/cli/files-pack.cjs"
}
}
1 change: 0 additions & 1 deletion packages/@ama-sdk/create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@nx/js": "~16.10.0",
"@nx/linter": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/test-helpers": "workspace:^",
Expand Down
3 changes: 2 additions & 1 deletion packages/@ama-sdk/create/testing/jest.config.it.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const { dirname } = require('node:path');
const getJestConfig = require('../../../../jest.config.it').getJestConfig;

/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
...getJestConfig(__dirname),
...getJestConfig(dirname(__dirname)),
displayName: require('../package.json').name
};
1 change: 0 additions & 1 deletion packages/@ama-sdk/schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"dependencies": {
"@angular-devkit/core": "~16.2.0",
"@angular-devkit/schematics": "~16.2.0",
"@o3r/dev-tools": "workspace:^",
"js-yaml": "^4.1.0",
"minimatch": "~9.0.3",
"rxjs": "^7.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/@ama-sdk/schematics/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const registerPackageSchematics = async (tree: Tree, context: SchematicContext)
}
const amaSdkSchematicsPackageJsonContent = JSON.parse(readFileSync(path.resolve(__dirname, '..', '..', 'package.json'), {encoding: 'utf-8'})) as PackageJson;
const amaSdkSchematicsVersion = amaSdkSchematicsPackageJsonContent.version?.replace(/^v/, '');
const schematicsDependencies = ['@o3r/dev-tools', '@o3r/schematics'];
const schematicsDependencies = ['@o3r/schematics'];
for (const dependency of schematicsDependencies) {
context.addTask(new DevInstall({
packageName: dependency + (amaSdkSchematicsVersion ? `@${amaSdkSchematicsVersion}` : ''),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q",
"build:esm2015": "swc src -d dist/esm2015 -C module.type=es6 -q",
"build:esm2020": "tsc -b tsconfigs/esm2020",
"set:version": "set-version --placeholder 0.0.0-placeholder",
"set:version": "o3r-set-version --placeholder 0.0.0-placeholder",
"resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
"generate": "schematics @ama-sdk/schematics:typescript-core --spec-path ./swagger-spec.yaml",
"spec:regen": "<%=packageManager%> run generate && amasdk-clear-index",
Expand All @@ -55,7 +55,6 @@
]
},
"dependencies": {
"@o3r/dev-tools": "~<%= sdkCoreVersion %>",
"@swc/helpers": "^0.5.0",
"tslib": "<%= versions['tslib'] %>"
},
Expand All @@ -80,6 +79,7 @@
"@o3r/schematics": "^<%= sdkCoreVersion %>",
"@o3r/eslint-config-otter": "^<%= sdkCoreVersion %>",
"@o3r/eslint-plugin": "^<%= sdkCoreVersion %>",
"@o3r/workspace": "^<%= sdkCoreVersion %>",
"@openapitools/openapi-generator-cli": "<%= versions['@openapitools/openapi-generator-cli'] %>",
"@swc/cli": "^0.1.57",
"@swc/core": "^1.3.85",
Expand Down
12 changes: 5 additions & 7 deletions packages/@ama-sdk/showcase-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,22 @@
"lint:ci": "eslint '**/*[jt]s' --quiet --format junit --output-file ./dist-lint/result.xml",
"lint": "eslint '**/*[jt]s' --cache",
"start": "tsc-watch -b tsconfigs/esm2020 --noClear --onFirstSuccess \"yarn run files:pack --watch\"",
"build": "yarn run build:cjs && yarn run build:esm2015 && yarn run build:esm2020 && yarn run build:entries",
"build": "yarn run build:cjs && yarn run build:esm2015 && yarn run build:esm2020 && yarn run files:pack",
"build:cjs": "swc src -d dist/cjs -C module.type=commonjs -q",
"build:esm2015": "swc src -d dist/esm2015 -C module.type=es6 -q",
"build:esm2020": "tsc -b tsconfigs/esm2020",
"build:entries": "yarn run files:pack && yarn exec generate-package-exports",
"set:version": "set-version --placeholder 0.0.0-placeholder",
"set:version": "o3r-set-version --placeholder 0.0.0-placeholder",
"resolve": "node -e 'process.stdout.write(require.resolve(process.argv[1]));'",
"generate": "schematics ../schematics/dist:typescript-core --spec-path ./swagger-spec.yaml",
"spec:regen": "yarn run generate --no-dry-run && yarn exec clear-index",
"clear-index": "node scripts/clear-index.js",
"files:pack": "node scripts/files-pack.js",
"spec:regen": "yarn run generate --no-dry-run && amasdk-clear-index",
"files:pack": "yarn amasdk-files-pack",
"test": "jest --passWithNoTests",
"publish:package": "npm publish ./dist",
"generate:mock": "schematics @ama-sdk/schematics:mock",
"doc:generate": "node scripts/override-readme.js && typedoc && node scripts/restore-readme.js",
"tools:changelog": "standard-version"
},
"dependencies": {
"@o3r/dev-tools": "workspace:^",
"@swc/helpers": "^0.5.0",
"tslib": "^2.5.3"
},
Expand All @@ -77,6 +74,7 @@
"@nx/jest": "~16.10.0",
"@o3r/eslint-config-otter": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/workspace": "workspace:^",
"@openapitools/openapi-generator-cli": "~2.7.0",
"@schematics/angular": "~16.2.0",
"@swc/cli": "^0.1.57",
Expand Down
1 change: 0 additions & 1 deletion packages/@ama-terasu/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@o3r/amaterasu-otter": "workspace:^",
"@o3r/amaterasu-sdk": "workspace:^",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/minimist": "^1.2.2",
Expand Down
1 change: 0 additions & 1 deletion packages/@ama-terasu/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/minimist": "^1.2.2",
Expand Down
1 change: 0 additions & 1 deletion packages/@ama-terasu/schematics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/node": "^18.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r/amaterasu/amaterasu-api-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/js-yaml": "^4.0.5",
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r/amaterasu/amaterasu-dodo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/node": "^18.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r/amaterasu/amaterasu-otter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/js-yaml": "^4.0.5",
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r/amaterasu/amaterasu-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@nx/eslint-plugin": "~16.10.0",
"@nx/jest": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@types/jest": "~29.5.2",
"@types/js-yaml": "^4.0.5",
Expand Down
2 changes: 0 additions & 2 deletions packages/@o3r/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@angular/router": "~16.2.0",
"@ngrx/store": "~16.3.0",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/schematics": "workspace:^",
"@schematics/angular": "~16.2.0",
"jasmine": "^5.0.0",
Expand Down Expand Up @@ -76,7 +75,6 @@
"@nx/linter": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/test-helpers": "workspace:^",
"@schematics/angular": "~16.2.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/@o3r/apis-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@angular-devkit/schematics": "~16.2.0",
"@angular/common": "~16.2.0",
"@angular/core": "~16.2.0",
"@o3r/dev-tools": "workspace:^",
"@o3r/schematics": "workspace:^",
"@schematics/angular": "~16.2.0",
"rxjs": "^7.8.1",
Expand Down Expand Up @@ -60,7 +59,6 @@
"@nx/js": "~16.10.0",
"@nx/linter": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/schematics": "workspace:^",
"@o3r/test-helpers": "workspace:^",
Expand Down
2 changes: 0 additions & 2 deletions packages/@o3r/application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"@angular/common": "~16.2.0",
"@angular/core": "~16.2.0",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/logger": "workspace:^",
"@o3r/routing": "workspace:^",
"@o3r/schematics": "workspace:^",
Expand Down Expand Up @@ -68,7 +67,6 @@
"@nx/linter": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/logger": "workspace:^",
"@o3r/routing": "workspace:^",
Expand Down
2 changes: 0 additions & 2 deletions packages/@o3r/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"@ngrx/store": "~16.3.0",
"@o3r/configuration": "workspace:^",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/extractors": "workspace:^",
"@o3r/logger": "workspace:^",
"@o3r/schematics": "workspace:^",
Expand Down Expand Up @@ -95,7 +94,6 @@
"@o3r/build-helpers": "workspace:^",
"@o3r/configuration": "workspace:^",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/extractors": "workspace:^",
"@o3r/localization": "workspace:^",
Expand Down
2 changes: 0 additions & 2 deletions packages/@o3r/configuration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"@ngrx/entity": "~16.3.0",
"@ngrx/store": "~16.3.0",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/logger": "workspace:^",
"@o3r/schematics": "workspace:^",
"@o3r/testing": "workspace:^",
Expand Down Expand Up @@ -90,7 +89,6 @@
"@nx/linter": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/core": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/logger": "workspace:^",
"@o3r/schematics": "workspace:^",
Expand Down
1 change: 0 additions & 1 deletion packages/@o3r/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"@nx/js": "~16.10.0",
"@nx/linter": "~16.10.0",
"@o3r/build-helpers": "workspace:^",
"@o3r/dev-tools": "workspace:^",
"@o3r/eslint-plugin": "workspace:^",
"@o3r/test-helpers": "workspace:^",
"@schematics/angular": "~16.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@o3r/core/schematics/ng-add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { prepareProject } from './project-setup/index';
export function ngAdd(options: NgAddSchematicsSchema): Rule {
const corePackageJsonContent = JSON.parse(fs.readFileSync(path.resolve(__dirname, '..', '..', 'package.json'), {encoding: 'utf-8'})) as PackageJson;
const o3rCoreVersion = corePackageJsonContent.version ? `@${corePackageJsonContent.version}` : '';
const schematicsDependencies = ['@o3r/dev-tools', '@o3r/schematics'];
const schematicsDependencies = ['@o3r/schematics'];

return async (tree: Tree, context: SchematicContext): Promise<Rule> => {
// check if the workspace package is installed, if not installed and we are in workspace context, we install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import type { PackageJson } from 'type-fest';

/**
* Package.json updates to include o3r ng update script
* Install of dev-tools and schematics packages
*
* @param pName project name
* @param o3rCoreVersion
* @param _o3rCoreVersion
Expand Down
Loading

0 comments on commit ec3be40

Please sign in to comment.