Skip to content

Commit 5327a47

Browse files
committed
new init 20231112
1 parent b01ee5c commit 5327a47

37 files changed

+2396
-531
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.dockerignore
2+
Dockerfile
3+
4+
.git
5+
6+
node_modules

.eslintrc.cjs

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'next/core-web-vitals', 'plugin:@next/next/recommended'],
5+
ignorePatterns: ['dist', '.eslintrc.cjs', 'vite.config.ts', 'node_modules/**', 'next.config.js'],
6+
parser: '@typescript-eslint/parser',
7+
parserOptions: {
8+
project: ['./tsconfig.json'], // Specify it only for TypeScript files
9+
// ecmaFeatures: {
10+
// jsx: true,
11+
// },
12+
// ecmaVersion: 12,
13+
// sourceType: 'module',
14+
},
15+
plugins: [
16+
'@typescript-eslint', //
17+
// 'react-refresh',
18+
// 'react',
19+
],
20+
rules: {
21+
// 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
22+
// Note: you must disable the base rule as it can report incorrect errors
23+
'no-unused-vars': 'off',
24+
'@typescript-eslint/no-unused-vars': 'warn',
25+
'@typescript-eslint/no-explicit-any': 'warn',
26+
'@typescript-eslint/no-unsafe-assignment': 'error',
27+
'@typescript-eslint/no-unsafe-argument': 'error',
28+
'prefer-const': 'warn',
29+
'@typescript-eslint/no-var-requires': 'warn',
30+
'no-empty': 'warn', // dk ... so many , before didnt install ext / the npm .. dk
31+
'react-hooks/exhaustive-deps': 'warn',
32+
'@typescript-eslint/ban-ts-comment': 'warn',
33+
'@typescript-eslint/no-floating-promises': 'error',
34+
'@typescript-eslint/await-thenable': 'error',
35+
'no-inner-declarations': 'off',
36+
37+
// https://github.com/vercel/next.js/discussions/24254
38+
// https://nextjs.org/docs/pages/building-your-application/configuring/eslint#additional-configurations
39+
// ~~~// ;not_working; waste my time
40+
// doc specify multi things but unclear on what was there to take effect
41+
// default install of plugins are poor
42+
'@next/next/no-html-link-for-pages': 'error',
43+
},
44+
};
45+
46+
// // const config = {
47+
// // export default config;
48+
//
49+
// // Cannot read config file: H:\Using\code_comment_remover-ui-awstest\.eslintrc.js Error: Unexpected token 'export'
50+
// // dk . must cjs? ...
51+
//
52+
// // []
53+
// // I think we could update the `--init` command to read `package.json`, and if it has `"type": "module"` then create `.eslintrc.cjs` instead of `.eslintrc.js`.
54+
// // <>
55+
// // https://github.com/eslint/eslint/issues/14137

.eslintrc.json

-3
This file was deleted.

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ yarn-error.log*
3333
# typescript
3434
*.tsbuildinfo
3535
next-env.d.ts
36+
37+
#
38+
CommentNt.txt
39+
_saveUsing

.vscode/launch.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Run ts file one click with tsx (global)",
8+
"runtimeExecutable": "tsx",
9+
"runtimeArgs": [],
10+
"program": "${file}",
11+
"args": [],
12+
"skipFiles": [
13+
"<node_internals>/**",
14+
"node_modules/**"
15+
],
16+
},
17+
// {
18+
// "type": "chrome",
19+
// "request": "launch",
20+
// "name": "Open index.html",
21+
// "file": "h:\\Using\\tldraw-contribute\\tldraw\\apps\\examples\\src\\index.html"
22+
// },
23+
{
24+
"type": "chrome",
25+
"request": "launch",
26+
"name": "Debug Vite",
27+
"url": "http://localhost:5173",
28+
// https://stackoverflow.com/questions/66147328/is-there-a-way-to-debug-code-in-vscode-initiated-with-vite
29+
// must have the vite server already running, then attach
30+
// "webRoot": "H:/Using/tldraw-contribute/tldraw/apps/examples/src"
31+
// "webRoot": "H:/Using/TLightChat/tlightchat-main"
32+
"webRoot": "${workspaceFolder}",
33+
// https://stackoverflow.com/questions/47556495/how-do-i-skip-external-code-when-debugging-in-vs-code
34+
"skipFiles": [
35+
"<node_internals>/**",
36+
"${workspaceFolder}/node_modules/**/*.js",
37+
"**/proxy.js",
38+
"**/prepareinjection.js",
39+
"**/installhook.js",
40+
"main.jsx",
41+
"@react-refresh",
42+
],
43+
}
44+
]
45+
}

Dockerfile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM node:20.9.0-slim
2+
3+
WORKDIR /usr/local/diskUsing/wsp/currApp
4+
COPY . .
5+
6+
RUN npm install -g pnpm@8.10.2
7+
RUN pnpm install
8+
9+
EXPOSE 3000
10+
CMD ["pnpm", "start"]

Global.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
declare module '*.css';
2+
declare module '*.scss';
3+
// []
4+
// TypeScript does not know that there are files other than `.ts`or `.tsx` so it will throw an error if an import has an unknown file suffix.
5+
// <>
6+
// https://stackoverflow.com/questions/40382842/cant-import-css-scss-modules-typescript-says-cannot-find-module
7+
// ~~~// dk guess vite knew that

Jenkinsfile

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
pipeline {
2+
agent {
3+
4+
docker {
5+
label 'jenkinsAgent-jdk17-docker'
6+
// label 'felipecrs_jenkins_agent_dind_20231111'
7+
image 'node:20.9.0-slim'
8+
args '-v /var/run/docker.sock:/var/run/docker.sock'
9+
}
10+
11+
// ;; // Dind is just a huge problem -- Ec2 with Docker > Jenkins_Controller in Container (lv1) > Jenkins_Agent in Container (lv1, sibling) > Nodejs in Container (lv2) > git & build javascript inside the Container (lv2) & build Docker image inisde (lv2.5, triple nested Dind)
12+
// ;; // the concept (viusal graph) of where the Jenkins Agent & Docker container is not clear -- agent with docker installed ; or spawn a new agent inside the docker ; is this dind or dood
13+
// ;; // there is no_knowlres for using this Docker pipeline plugin -- dk the syntax & dk how separate Stage inside that
14+
// ;;
15+
// ;; // ... @messy[docker_plugin vs docker_pipeline & dind pb] @pb[npm install hang & permission prolem]
16+
// ;;
17+
// ;; // type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock
18+
// ;; // type=bind,source=/usr/bin/docker,destination=/usr/bin/docker
19+
// ;;
20+
// ;; // run as privileged process + root user in agent template
21+
// ;; // ;seems causing problem[cuz dk auto has -u 0:0]; args '-u root -v /var/run/docker.sock:/var/run/docker.sock'
22+
// ;; // use `/home/jenkins/agent` in agent template // @pb[docker hangs the whole pc]
23+
// ;;
24+
// ;; // dk miss more
25+
}
26+
27+
28+
stages {
29+
30+
stage('checkout') {
31+
steps {
32+
git branch: 'main', url: 'https://github.com/Norlandz/code_comment_remover-ui-awstest' // @config[project name]
33+
sh 'pwd'
34+
sh 'ls -la'
35+
}
36+
}
37+
stage('setup env') {
38+
steps {
39+
// sh '''
40+
// curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
41+
// . ~/.nvm/nvm.sh
42+
// nvm install 18.12.0
43+
// npm install
44+
// '''
45+
sh 'npm install -g pnpm@8.10.2'
46+
}
47+
}
48+
stage('build') {
49+
steps {
50+
// nodejs('nodejs-v20.9.0') {
51+
// sh 'npm install'
52+
// }
53+
sh 'pnpm install'
54+
}
55+
}
56+
stage('test') {
57+
steps {
58+
// nodejs('nodejs-v20.9.0') {
59+
sh 'echo "pseudo Testing"'
60+
}
61+
}
62+
stage('build docker image') {
63+
steps {
64+
sh 'docker build -t mindde/code_comment_remover-ui:v0.0.1 .' // @config[project name]
65+
}
66+
}
67+
stage('publish docker image') {
68+
environment {
69+
CredDockerhub = credentials('idVal_CredDockerhub')
70+
}
71+
steps {
72+
sh 'docker login -u $CredDockerhub_USR -p $CredDockerhub_PSW'
73+
sh 'docker push mindde/code_comment_remover-ui:v0.0.1' // @config[project name]
74+
sh 'docker logout'
75+
}
76+
}
77+
// @think: compnesation step if fail...
78+
stage('call (async) remote server to pull & run (deploy) docker image (using watchtower)') { // watchtower will do this, no need to _ special docker trigger / publish_over_ssh _
79+
steps {
80+
sh 'echo "this curl will fail -- if watchtower is not up yet. \nwhich can happen at the first time of the whole project setup -- \n1. this script need to build the image to dockerhub \n2. docker-compose.yml file pulls the image and start up all containers \n3. watchtower will be started in that docker-compose.yml together \n-- once watchtower is up, all later builds will be able to call to watchtower no problem."'
81+
sh 'curl -H "Authorization: Bearer tokenVal_WATCHTOWER_HTTP_API_TOKEN_toBeSentFromJenkins" 10.15.1.137:8080/v1/update' // FIXME @config the ip address need know ahead of time?...
82+
}
83+
}
84+
stage('done') {
85+
steps {
86+
sh 'echo done'
87+
sh 'ls -la'
88+
}
89+
}
90+
}
91+
}

README.md

-36
This file was deleted.

docker-compose.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: '3.9'
2+
services:
3+
codeCommentRemoverUi:
4+
image: 'mindde/code-comment-remover-ui:v0.0.1'
5+
ports:
6+
- '3000:3000' # main entry to the App
7+
# container_name: 'codeCommentRemoverUi'
8+
jsParserSub:
9+
image: 'mindde/jsparsersub:v0.0.1'
10+
ports:
11+
- '127.0.0.1:14080:14080'
12+
# container_name: 'jsParserSub'
13+
javaParserSub:
14+
image: 'mindde/javaparsersub:v0.0.1'
15+
ports:
16+
- '127.0.0.1:18082:18082'
17+
# container_name: 'javaParserSub'
18+
watchtower:
19+
image: 'containrrr/watchtower:arm64v8-1.7.1'
20+
command: '--schedule "0 0 4 * * *" --http-api-update --cleanup'
21+
environment:
22+
- WATCHTOWER_HTTP_API_TOKEN=tokenVal_WATCHTOWER_HTTP_API_TOKEN_toBeSentFromJenkins
23+
# DOCKER_HOST=unix:///var/run/docker.sock
24+
# WATCHTOWER_SCHEDULE=0 0 4 * * * # aga quote pb dk
25+
# WATCHTOWER_HTTP_API_UPDATE=true
26+
# WATCHTOWER_LABEL_ENABLE=true
27+
# WATCHTOWER_SCOPE=thisScope
28+
# WATCHTOWER_DISABLE_CONTAINERS= , , ,
29+
# WATCHTOWER_INCLUDE_STOPPED=false
30+
# WATCHTOWER_REVIVE_STOPPED=false
31+
# WATCHTOWER_REMOVE_VOLUMES=false?
32+
# --health-check
33+
# WATCHTOWER_DEBUG=true
34+
# WATCHTOWER_LOG_LEVEL=info
35+
# WATCHTOWER_HTTP_API_METRICS=true
36+
# https://containrrr.dev/watchtower/arguments/
37+
# labels:
38+
# - "com.centurylinklabs.watchtower.enable=false"
39+
volumes:
40+
- '/var/run/docker.sock:/var/run/docker.sock'
41+
# restart: 'unless-stopped' # aga need better policy -- dont bindly restart - but need start up at system boot
42+
ports:
43+
- '8686:8080' # call watchtower to pull new docker image
44+
container_name: 'watchtower'

next.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {}
2+
const nextConfig = {
3+
// productionBrowserSourceMaps: true, // ;not_working; https://stackoverflow.com/questions/77071236/webpack-internal-in-console-opens-in-new-browser-tab-with-empty-page-next-js
4+
};
35

4-
module.exports = nextConfig
6+
export default nextConfig;

package.json

+31-13
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,43 @@
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {
6+
"cser": "tsx ./src/initRun/InitRun.ts",
67
"dev": "next dev",
78
"build": "next build",
89
"start": "next start",
910
"lint": "next lint"
1011
},
1112
"dependencies": {
12-
"react": "^18",
13-
"react-dom": "^18",
14-
"next": "13.5.6"
13+
"axios": "^1.5.1",
14+
"cors": "^2.8.5",
15+
"dayjs": "^1.11.10",
16+
"express": "^4.18.2",
17+
"express-async-errors": "^3.1.1",
18+
"moment": "^2.29.4",
19+
"next": "13.5.6",
20+
"react": "^18.2.0",
21+
"react-dom": "^18.2.0",
22+
"react-select": "^5.7.7"
1523
},
1624
"devDependencies": {
17-
"typescript": "^5",
18-
"@types/node": "^20",
19-
"@types/react": "^18",
20-
"@types/react-dom": "^18",
21-
"autoprefixer": "^10",
22-
"postcss": "^8",
23-
"tailwindcss": "^3",
24-
"eslint": "^8",
25-
"eslint-config-next": "13.5.6"
26-
}
25+
"@next/eslint-plugin-next": "^13.5.6",
26+
"@types/express": "^4.17.20",
27+
"@types/node": "^20.8.7",
28+
"@types/react": "^18.2.31",
29+
"@types/react-dom": "^18.2.14",
30+
"@typescript-eslint/eslint-plugin": "^6.8.0",
31+
"@typescript-eslint/parser": "^6.8.0",
32+
"autoprefixer": "^10.4.16",
33+
"encoding": "^0.1.13",
34+
"eslint": "^8.52.0",
35+
"eslint-config-next": "^13.5.6",
36+
"eslint-plugin-react": "^7.33.2",
37+
"eslint-plugin-react-hooks": "^4.6.0",
38+
"eslint-plugin-react-refresh": "^0.4.3",
39+
"postcss": "^8.4.31",
40+
"tailwindcss": "^3.3.3",
41+
"typescript": "^5.2.2",
42+
"typescript-plugin-css-modules": "^5.0.2"
43+
},
44+
"type": "module"
2745
}

0 commit comments

Comments
 (0)