Skip to content

Commit

Permalink
feat: add yarn deploy (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
devdigital authored Jan 10, 2024
1 parent f7c5737 commit 4da839f
Show file tree
Hide file tree
Showing 37 changed files with 6,208 additions and 246 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
47 changes: 47 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nx"],
"overrides": [
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
},
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript"],
"rules": {}
},
{
"files": ["*.spec.ts", "*.spec.tsx", "*.spec.js", "*.spec.jsx"],
"env": {
"jest": true
},
"rules": {}
}
]
}
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
5 changes: 5 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
nodeLinker: node-modules

npmScopes:
utilz:
npmAlwaysAuth: true
npmAuthToken: '${NPM_TOKEN}'
5 changes: 5 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getJestProjects } from '@nx/jest';

export default {
projects: getJestProjects(),
};
3 changes: 3 additions & 0 deletions jest.preset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const nxPreset = require('@nx/jest/preset').default;

module.exports = { ...nxPreset };
27 changes: 27 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"pluginsConfig": {
"@nx/js": {
"analyzeSourceFiles": true
}
},
"extends": "nx/presets/npm.json",
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"tasksRunnerOptions": {
Expand All @@ -23,6 +28,28 @@
},
"test": {
"inputs": ["default", "^nonTest"]
},
"lint": {
"cache": true,
"inputs": [
"default",
"{workspaceRoot}/.eslintrc.json",
"{workspaceRoot}/.eslintignore",
"{workspaceRoot}/eslint.config.js"
]
},
"@nx/jest:jest": {
"cache": true,
"inputs": ["default", "^default", "{workspaceRoot}/jest.preset.js"],
"options": {
"passWithNoTests": true
},
"configurations": {
"ci": {
"ci": true,
"codeCoverage": true
}
}
}
},
"affected": {
Expand Down
27 changes: 25 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,31 @@
"devDependencies": {
"@jscutlery/semver": "^4.2.0",
"@nx/devkit": "^17.2.8",
"@nx/eslint": "17.2.8",
"@nx/eslint-plugin": "17.2.8",
"@nx/jest": "17.2.8",
"@nx/js": "17.2.8",
"@swc-node/register": "~1.6.7",
"@swc/cli": "~0.1.62",
"@swc/core": "~1.3.85",
"@tsconfig/node20": "^20.1.2",
"ngx-deploy-npm": "^7.1.0",
"nx": "17.1.2"
"@types/jest": "^29.4.0",
"@types/node": "18.16.9",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"eslint": "~8.48.0",
"eslint-config-prettier": "^9.0.0",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"nx": "17.1.2",
"prettier": "^2.6.2",
"ts-jest": "^29.1.0",
"ts-node": "10.9.1",
"typescript": "~5.2.2"
},
"dependencies": {
"@nx/plugin": "^17.2.8",
"@swc/helpers": "~0.5.2",
"tslib": "^2.3.0"
}
}
2 changes: 2 additions & 0 deletions packages/config-eslint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@utilz/config-eslint",
"main": "index.js",
"version": "0.1.0",
"license": "MIT",
"repository": {
"type": "git",
Expand All @@ -14,6 +15,7 @@
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.44.0",
"@utilz/nx-yarn-deploy": "workspace:^",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.0",
Expand Down
13 changes: 9 additions & 4 deletions packages/config-eslint/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/config-eslint",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand All @@ -25,6 +24,12 @@
"tag": "{tag}",
"notes": "{notes}"
}
},
"echo": {
"executor": "@utilz/nx-yarn-deploy:echo",
"options": {
"textToEcho": "Hello World!!!"
}
}
}
}
7 changes: 3 additions & 4 deletions packages/config-prettier/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/config-prettier",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/deepmerge/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/deepmerge",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/dummy/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/dummy",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/file/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/file",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/get/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/get",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/github/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/github",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/logger/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/logger",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
7 changes: 3 additions & 4 deletions packages/merge/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
}
},
"npm-publish": {
"executor": "ngx-deploy-npm:deploy",
"executor": "@utilz/nx-yarn-deploy:deploy",
"options": {
"access": "public",
"distFolderPath": "./packages/merge",
"noBuild": true
"projectFolderPath": "./packages/config-eslint",
"access": "public"
}
},
"git-push": {
Expand Down
32 changes: 32 additions & 0 deletions packages/nx-yarn-deploy/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
},
{
"files": ["./package.json", "./executors.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/nx-plugin-checks": "error"
}
}
]
}
11 changes: 11 additions & 0 deletions packages/nx-yarn-deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @utilz/nx-yarn-deploy

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build @utilz/nx-yarn-deploy` to build the library.

## Running unit tests

Run `nx test @utilz/nx-yarn-deploy` to execute the unit tests via [Jest](https://jestjs.io).
14 changes: 14 additions & 0 deletions packages/nx-yarn-deploy/executors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"executors": {
"echo": {
"implementation": "./src/executors/echo/executor",
"schema": "./src/executors/echo/schema.json",
"description": "echo executor"
},
"deploy": {
"implementation": "./src/executors/deploy/executor",
"schema": "./src/executors/deploy/schema.json",
"description": "deploy executor"
}
}
}
10 changes: 10 additions & 0 deletions packages/nx-yarn-deploy/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable */
export default {
displayName: '@utilz/nx-yarn-deploy',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/nx-yarn-deploy',
};
13 changes: 13 additions & 0 deletions packages/nx-yarn-deploy/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@utilz/nx-yarn-deploy",
"private": true,
"version": "0.0.1",
"dependencies": {
"@nx/devkit": "17.2.8",
"tslib": "^2.3.0"
},
"type": "commonjs",
"main": "./src/index.js",
"typings": "./src/index.d.ts",
"executors": "./executors.json"
}
Loading

0 comments on commit 4da839f

Please sign in to comment.