Skip to content

Commit

Permalink
feat(workspace-tools): Added custom npm-publish executor
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Jan 26, 2024
1 parent ce0a42e commit 3e6292d
Show file tree
Hide file tree
Showing 13 changed files with 370 additions and 20 deletions.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"dependsOn": [
"^build"
],
"executor": "@nx/js:release-publish",
"executor": "@storm-software/workspace-tools:npm-publish",
"options": {
"packageRoot": "dist/{projectRoot}",
"registry": "https://registry.npmjs.org/"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@
},
"triggerEmptyDevReleaseByIncrementingThisNumber": 0
}

4 changes: 4 additions & 0 deletions packages/config-tools/src/utilities/process-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ export const handleProcess = (config: StormConfig) => {
writeError(config, `The program terminated with signal code: ${signal}`);
exitWithError(config);
});
process.on("SIGHUP", (signal: NodeJS.Signals) => {
writeError(config, `The program terminated with signal code: ${signal}`);
exitWithError(config);
});
};
18 changes: 13 additions & 5 deletions packages/linting-tools/src/tsconfig/tsconfig.root.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"incremental": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noUncheckedIndexedAccess": true,
"strictNullChecks": true,
"strict": true,
Expand All @@ -28,11 +27,20 @@
"emitDecoratorMetadata": true,
"target": "esnext",
"module": "esnext",
"lib": ["esnext", "dom", "dom.iterable"],
"lib": [
"esnext",
"dom",
"dom.iterable"
],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"esModuleInterop": true
},
"include": ["./reset.d.ts"],
"exclude": ["**/node_modules", "**/tmp"]
}
"include": [
"./reset.d.ts"
],
"exclude": [
"**/node_modules",
"**/tmp"
]
}
57 changes: 44 additions & 13 deletions packages/workspace-tools/config/nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "lint", "format", "test", "e2e"],
"cacheableOperations": [
"build",
"lint",
"format",
"test",
"e2e"
],
"parallel": 4,
"cacheDirectory": ".nx/cache"
}
Expand Down Expand Up @@ -49,14 +55,23 @@
"!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)",
"!{projectRoot}/tsconfig.storybook.json"
],
"sharedGlobals": ["{workspaceRoot}/babel.config.json"]
"sharedGlobals": [
"{workspaceRoot}/babel.config.json"
]
},
"targetDefaults": {
"build": {
"cache": true,
"inputs": ["default", "^production"],
"outputs": ["{options.outputPath}"],
"dependsOn": ["^build"],
"inputs": [
"default",
"^production"
],
"outputs": [
"{options.outputPath}"
],
"dependsOn": [
"^build"
],
"options": {
"main": "{projectRoot}/src/index.ts",
"outputPath": "dist/{projectRoot}",
Expand All @@ -78,18 +93,29 @@
"lint": {
"cache": true,
"executor": "nx:run-commands",
"outputs": ["{options.outputFile}"],
"outputs": [
"{options.outputFile}"
],
"options": {
"command": "npx biome lint --apply --no-errors-on-unmatched --files-ignore-unknown=true {projectRoot}",
"color": true
},
"inputs": ["default", "{workspaceRoot}/**/biome.json"]
"inputs": [
"default",
"{workspaceRoot}/**/biome.json"
]
},
"test": {
"cache": true,
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"],
"inputs": [
"default",
"^production",
"{workspaceRoot}/jest.preset.js"
],
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"options": {
"jestConfig": "{projectRoot}/jest.config.ts",
"passWithNoTests": true
Expand All @@ -106,9 +132,14 @@
},
"nx-release-publish": {
"cache": false,
"inputs": ["default", "^production"],
"dependsOn": ["^build"],
"executor": "@nx/js:release-publish",
"inputs": [
"default",
"^production"
],
"dependsOn": [
"^build"
],
"executor": "@storm-software/workspace-tools:npm-publish",
"options": {
"packageRoot": "dist/{projectRoot}",
"registry": "https://registry.npmjs.org/"
Expand Down Expand Up @@ -142,4 +173,4 @@
"analyzeSourceFiles": false
}
}
}
}
7 changes: 6 additions & 1 deletion packages/workspace-tools/executors.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"implementation": "./src/executors/typia/executor",
"schema": "./src/executors/typia/schema.json",
"description": "Run the Typia generator to create runtime type validators"
},
"npm-publish": {
"implementation": "./src/executors/npm-publish/executor",
"schema": "./src/executors/npm-publish/schema.json",
"description": "Publish a package to the NPM registry"
}
}
}
}
1 change: 1 addition & 0 deletions packages/workspace-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"esbuild-plugin-pino": "^2.1.0",
"fs-extra": "^11.1.1",
"glob": "^10.3.10",
"npm-run-path": "^5.2.0",
"prettier": "3.0.3",
"prettier-plugin-packagejson": "^2.4.9",
"resolve": "^1.22.8",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { NpmPublishExecutorSchema } from "./schema";
import executor from "./executor";

const options: NpmPublishExecutorSchema = {};

describe("NpmPublish Executor", () => {
it("can run", async () => {
const output = await executor(options);
expect(output.success).toBe(true);
});
});
Loading

0 comments on commit 3e6292d

Please sign in to comment.