Skip to content

Commit 1b02729

Browse files
committed
perbaikin docker lagi
1 parent d01a832 commit 1b02729

File tree

6 files changed

+48
-20
lines changed

6 files changed

+48
-20
lines changed

.dockerignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ tests
1818
__tests__
1919
*.test.js
2020
*.spec.js
21-
README.md
2221
CONTRIBUTING.md
23-
LICENSE
2422
.github
2523
.eslintrc.js
2624
.prettierrc

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Taufiqurrahman
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
EOF

dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ RUN npm ci --only=production
1212

1313
# Copy source code
1414
COPY src/ ./src/
15-
COPY README.md ./
16-
COPY LICENSE ./
15+
COPY README.md .
16+
COPY LICENSE .
1717

1818
# Create a minimal production image
1919
FROM node:18-alpine

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "id-auto-formalizer",
33
"version": "0.1.0",
44
"description": "Konversi teks Bahasa Indonesia dari kasual ke formal untuk surat, email, dan laporan resmi",
5+
"type": "module",
56
"main": "src/index.js",
67
"bin": {
78
"formalize": "src/cli.js"
@@ -21,7 +22,7 @@
2122
"formal-language",
2223
"cli"
2324
],
24-
"author": "Your Name",
25+
"author": "Taufiqurrahman",
2526
"license": "MIT",
2627
"dependencies": {
2728
"chalk": "^5.3.0",
@@ -42,4 +43,4 @@
4243
"url": "https://github.com/codenamekii/id-auto-formalizer/issues"
4344
},
4445
"homepage": "https://github.com/codenamekii/id-auto-formalizer#readme"
45-
}
46+
}

src/cli.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/usr/bin/env node
22

3-
const { Command } = require('commander');
4-
const chalk = require('chalk');
5-
const ora = require('ora');
6-
const fs = require('fs').promises;
7-
const path = require('path');
8-
const readline = require('readline');
9-
const IndonesianFormalizer = require('./formalizer');
3+
import chalk from 'chalk';
4+
import { Command } from 'commander';
5+
import fs from 'fs/promises';
6+
import ora from 'ora';
7+
import path from 'path';
8+
import readline from 'readline';
9+
import IndonesianFormalizer from './formalizer.js'; // tambahkan .js agar import ESM bisa resolve
1010

1111
const program = new Command();
1212
const formalizer = new IndonesianFormalizer();
@@ -56,6 +56,7 @@ program
5656
console.log('\n' + chalk.blue('📊 Analisis Formalitas:'));
5757
console.log(chalk.white(` Level: ${analysis.level}`));
5858
console.log(chalk.white(` Skor Formalitas: ${analysis.score}%`));
59+
// eslint-disable-next-line max-len
5960
console.log(chalk.white(` Kata Informal: ${analysis.informalWords}/${analysis.totalWords}`));
6061
}
6162

@@ -64,6 +65,7 @@ program
6465
if (suggestions.length > 0) {
6566
console.log('\n' + chalk.magenta('💡 Saran Perbaikan:'));
6667
suggestions.forEach((s, i) => {
68+
// eslint-disable-next-line max-len
6769
console.log(chalk.white(` ${i + 1}. ${s.reason}: "${s.original}" → "${s.suggestion}"`));
6870
});
6971
}
@@ -122,6 +124,7 @@ program
122124
.description('Mode interaktif untuk formalisasi real-time')
123125
.action(() => {
124126
console.log(chalk.cyan(banner));
127+
// eslint-disable-next-line max-len
125128
console.log(chalk.yellow('Mode Interaktif - Ketik teks informal, tekan Enter untuk formalisasi'));
126129
console.log(chalk.gray('Ketik "exit" untuk keluar, "help" untuk bantuan\n'));
127130

@@ -133,7 +136,7 @@ program
133136

134137
rl.prompt();
135138

136-
rl.on('line', (line) => {
139+
rl.on('line', line => {
137140
const input = line.trim();
138141

139142
if (input === 'exit' || input === 'quit') {
@@ -214,7 +217,7 @@ program
214217
.option('-d, --directory <dir>', 'Directory input')
215218
.option('-o, --output-dir <dir>', 'Directory output')
216219
.option('-e, --extension <ext>', 'File extension (default: .txt)', '.txt')
217-
.action(async (options) => {
220+
.action(async options => {
218221
console.log(chalk.cyan(banner));
219222

220223
const dir = options.directory || '.';

src/formalizer.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,20 @@ class IndonesianFormalizer {
136136
'yg': 'yang',
137137
'dgn': 'dengan',
138138
'dg': 'dengan',
139+
// eslint-disable-next-line no-dupe-keys
139140
'utk': 'untuk',
141+
// eslint-disable-next-line no-dupe-keys
140142
'u/': 'untuk',
141143
'dr': 'dari',
142144
'ke': 'ke',
143145
'pd': 'pada',
144146
'kpd': 'kepada',
145147
'bg': 'bagi',
148+
// eslint-disable-next-line no-dupe-keys
146149
'bg': 'bagi',
147150
'dlm': 'dalam',
148151
'di': 'di',
152+
// eslint-disable-next-line no-dupe-keys
149153
'pd': 'pada',
150154
'ttg': 'tentang',
151155
'thd': 'terhadap',
@@ -232,13 +236,13 @@ class IndonesianFormalizer {
232236
{ pattern: /\s+/g, replacement: ' ' },
233237

234238
// Kapitalisasi awal kalimat
235-
{ pattern: /^.|\.\s+./g, replacement: (match) => match.toUpperCase() },
239+
{ pattern: /^.|\.\s+./g, replacement: match => match.toUpperCase() },
236240

237241
// Tanda baca berulang
238242
{ pattern: /\.{2,}/g, replacement: '.' },
239243
{ pattern: /\?{2,}/g, replacement: '?' },
240-
{ pattern: /\!{2,}/g, replacement: '!' },
241-
{ pattern: /\,{2,}/g, replacement: ',' },
244+
{ pattern: /!{2,}/g, replacement: '!' },
245+
{ pattern: /,{2,}/g, replacement: ',' },
242246

243247
// Spasi sebelum tanda baca
244248
{ pattern: /\s+([.,!?;:])/g, replacement: '$1' },
@@ -252,7 +256,7 @@ class IndonesianFormalizer {
252256
{ pattern: /(\d+)m/gi, replacement: '$1 miliar' },
253257

254258
// Tanggal informal
255-
{ pattern: /(\d{1,2})\/(\d{1,2})\/(\d{2,4})/g, replacement: '$1-$2-$3' },
259+
{ pattern: /(\d{1,2})\/(\d{1,2})\/(\d{2,4})/g, replacement: '$1-$2-$3' }
256260
];
257261

258262
// Kalimat pembuka formal
@@ -502,4 +506,4 @@ class IndonesianFormalizer {
502506
}
503507
}
504508

505-
module.exports = IndonesianFormalizer;
509+
export default IndonesianFormalizer;

0 commit comments

Comments
 (0)