Skip to content

Commit

Permalink
moved to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
maxprilutskiy committed Oct 7, 2024
1 parent 1576f24 commit 6ceaf98
Show file tree
Hide file tree
Showing 12 changed files with 198 additions and 83 deletions.
2 changes: 1 addition & 1 deletion action/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ COPY src /src
RUN npm install -g pnpm && pnpm install

# Run the Node.js application
ENTRYPOINT ["node", "/src/index.mjs"]
ENTRYPOINT ["ts-node", "/src/index.ts"]
2 changes: 1 addition & 1 deletion action/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"octokit": "^4.0.2",
"simple-git": "^3.26.0",
"ts-node": "^10.9.2",
"zod": "^3.23.8"
}
}
170 changes: 136 additions & 34 deletions action/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
26 changes: 0 additions & 26 deletions action/src/index.mjs

This file was deleted.

25 changes: 25 additions & 0 deletions action/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { execSync } from 'child_process';

import loadConfig from './instances/config';
// Uses GitHub's official Octokit
import loadOctokit from './instances/octokit';
import doStuff from './do-stuff';

// Run

(async function main() {
const config = await loadConfig();
const octokit = await loadOctokit();

// Do stuff
await doStuff();
// Commit changes
execSync('git config --global user.name "Replexica"');
execSync('git config --global user.email "support@replexica.com"');
execSync(`git config --global safe.directory ${process.cwd()}`);

execSync('git add .');
execSync(`git commit -m "${config.commitMessageText}"`);
execSync('git push');

})();
File renamed without changes.
7 changes: 0 additions & 7 deletions action/src/instances/config.mjs

This file was deleted.

10 changes: 10 additions & 0 deletions action/src/instances/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import loadEnv from './_env.js';

export default async function loadConfig() {
const env = await loadEnv();

return {
isPullRequestMode: env.REPLEXICA_PULL_REQUEST,
commitMessageText: env.REPLEXICA_COMMIT_MESSAGE,
};
}
13 changes: 0 additions & 13 deletions action/src/instances/git.mjs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import env from './_env.mjs';
import env from './_env.js';
import { Octokit } from 'octokit';

export default async function loadOctokit() {
Expand Down
24 changes: 24 additions & 0 deletions action/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"strict": true,
"pretty": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"moduleResolution": "NodeNext",
"module": "NodeNext",
"target": "ESNext",
"rootDir": "src",
"outDir": "build",
},
"include": [
"src/**/*.ts",
"src/**/*.tsx"
],
"exclude": [
"src/**/*.spec.ts",
"src/**/*.spec.tsx"
]
}

0 comments on commit 6ceaf98

Please sign in to comment.