Skip to content

Commit

Permalink
v1.1.0 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
woong-jae authored Feb 18, 2024
1 parent ddfddd3 commit 46420cb
Show file tree
Hide file tree
Showing 15 changed files with 432 additions and 153 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Code-Vault에서 제공하는 크롬 확장도구입니다.

### 언어

c, cpp, java, javascript, typescript, python, kotlin
c, cpp, java, javascript, typescript, python, kotlin, go, rust

## 사용법

Expand Down
23 changes: 23 additions & 0 deletions bin/version/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { select } from '@inquirer/prompts';
import { updateManifestVersion } from './update.js';

const manifestPath = 'src/assets/manifest.json';
const target = await select({
message: 'Select a target',
choices: [
{
name: 'major',
value: 'major',
},
{
name: 'minor',
value: 'minor',
},
{
name: 'patch',
value: 'patch',
},
],
});

updateManifestVersion(manifestPath, target);
36 changes: 36 additions & 0 deletions bin/version/update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import fs from 'node:fs';

export async function updateManifestVersion(manifestPath, target) {
const { default: manifest } = await import(`../../${manifestPath}`, {
assert: {
type: 'json',
},
});

const updatedVersion = getUpdatedVersion(manifest.version, target);

manifest.version = updatedVersion;
manifest.version_name = updatedVersion;

fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
}

function getUpdatedVersion(version, target) {
const [major, minor, patch] = version
.split('.')
.map((version) => parseInt(version));

if (target === 'major') {
return [major + 1, 0, 0].join('.');
}

if (target === 'minor') {
return [major, minor + 1, 0].join('.');
}

if (target === 'patch') {
return [major, minor, patch + 1].join('.');
}

return [major, minor, patch].join('.');
}
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
"start": "webpack serve",
"build": "webpack",
"build:production": "NODE_ENV=production webpack && zip -r dist.zip dist",
"test": "pnpm jest --watch"
"test": "pnpm jest --watch",
"update:version": "node bin/version"
},
"devDependencies": {
"@inquirer/prompts": "^4.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@swc/cli": "^0.1.62",
"@swc/core": "^1.3.86",
Expand Down Expand Up @@ -75,6 +77,7 @@
"react-dom": "^18.2.0",
"tailwind-merge": "^1.14.0",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.22.4",
"zustand": "^4.4.1"
}
}
Loading

0 comments on commit 46420cb

Please sign in to comment.