-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit da1fb6d
Showing
18 changed files
with
4,535 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"image": "mcr.microsoft.com/vscode/devcontainers/typescript-node:18", | ||
"hostRequirements": { | ||
"cpus": 1 | ||
}, | ||
"containerEnv": { | ||
"NODE_AUTH_TOKEN": "" | ||
}, | ||
"waitFor": "onCreateCommand", | ||
"updateContentCommand": "yarn", | ||
"postCreateCommand": "", | ||
"postAttachCommand": "", | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": ["README.md"] | ||
} | ||
}, | ||
"portsAttributes": {}, | ||
"forwardPorts": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"root": true, | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"prettier", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/recommended-requiring-type-checking" | ||
], | ||
"plugins": ["import", "@typescript-eslint", "prettier", "jest"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": ["./tsconfig.json"], | ||
"ecmaVersion": "latest", | ||
"sourceType": "module", | ||
"warnOnUnsupportedTypeScriptVersion": true | ||
}, | ||
"ignorePatterns": ["/.cache", "/.git", "/.husky", "/.yarn", "/dist"], | ||
"settings": { | ||
"import/resolver": { | ||
"typescript": { | ||
"alwaysTryTypes": true, | ||
"project": "./tsconfig.json" | ||
} | ||
} | ||
}, | ||
"rules": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [hivivo] | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Main CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
|
||
- name: Install dependencies | ||
run: yarn | ||
|
||
- name: Lint the code | ||
run: yarn lint | ||
|
||
- name: Build release artifact | ||
run: yarn build | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-artifact | ||
path: | | ||
dist | ||
package.json | ||
release: | ||
needs: build | ||
# when merge to main and not a fork | ||
if: github.repository == 'hivivo/win-reg' && github.event_name == 'push' | ||
permissions: | ||
# for version bump | ||
contents: write | ||
# # for package release | ||
# packages: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js and Yarn | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: yarn | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release-artifact | ||
|
||
- name: Bump version | ||
uses: 'phips28/gh-action-bump-version@master' | ||
with: | ||
tag-prefix: 'v' | ||
|
||
# TODO: uncomment it when npm is wired | ||
# - name: Release | ||
# run: yarn publish | ||
# env: | ||
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# Cache | ||
/.cache | ||
.eslintcache | ||
|
||
# testing | ||
/coverage | ||
*.lcov | ||
|
||
# production | ||
/dist | ||
|
||
# Storybook | ||
/storybook-static | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
*-debug.log* | ||
|
||
# Visual Studio Code | ||
# https://github.com/github/gitignore/blob/master/Global/VisualStudioCode.gitignore | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
!.vscode/react.code-snippets | ||
|
||
# WebStorm | ||
.idea | ||
|
||
# macOS | ||
# https://github.com/github/gitignore/blob/master/Global/macOS.gitignore | ||
.DS_Store | ||
|
||
# misc | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true, | ||
"source.formatDocument": true, | ||
"source.fixAll.eslint": true | ||
}, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"files.exclude": { | ||
"**/.cache": true, | ||
"**/.DS_Store": true, | ||
"**/.editorconfig": true, | ||
"**/.eslintcache": true, | ||
"**/.git": true, | ||
"**/.gitattributes": true, | ||
"**/.husky": true, | ||
"**/.pnp.*": true, | ||
"**/.prettierignore": true, | ||
"**/node_modules": true, | ||
"**/yarn.lock": true, | ||
"**/*-debug.log*": true | ||
}, | ||
"search.exclude": { | ||
"**/dist/": true, | ||
"**/.pnp.*": true, | ||
"**/.yarn": true, | ||
"**/yarn-error.log": true, | ||
"**/yarn.lock": true, | ||
"**/*-debug.log*": true, | ||
"**/coverage": true, | ||
"**/storybook-static": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Vivo Xu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# win-reg | ||
|
||
Access Windows registry with REG commandline tool | ||
|
||
## Getting Started | ||
|
||
```sh | ||
yarn add win-reg | ||
``` | ||
|
||
## Developing | ||
|
||
### Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
#### `yarn lint` | ||
|
||
To lint the code and list the existing issues.\ | ||
Usually VSCode will format the code when saving. | ||
|
||
#### `yarn build` | ||
|
||
Builds the library for publishing to the `dist` folder. | ||
|
||
#### `yarn test` | ||
|
||
Run the tests. Attaching `--watch` to watch the file changes. | ||
|
||
### Developer Support | ||
|
||
ESlint, prettier and husky are hooked into the normal developing flows. | ||
|
||
## License | ||
|
||
Licensed under MIT. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"name": "win-reg", | ||
"version": "0.1.0", | ||
"description": "Access Windows registry with REG commandline tool", | ||
"type": "module", | ||
"repository": "https://github.com/hivivo/win-reg.git", | ||
"author": "Vivo Xu <git@vivoxu.com>", | ||
"main": "dist/index.js", | ||
"files": [ | ||
"/dist" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"postinstall": "husky install", | ||
"lint": "eslint --report-unused-disable-directives .", | ||
"build": "tsup src/index.ts --dts --format esm,cjs", | ||
"test": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^20.3.1", | ||
"@typescript-eslint/eslint-plugin": "^5.58.0", | ||
"@typescript-eslint/parser": "^5.58.0", | ||
"eslint": "^8.38.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-import-resolver-typescript": "^3.5.5", | ||
"eslint-plugin-import": "^2.27.5", | ||
"eslint-plugin-jest": "^27.2.2", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-promise": "^6.1.1", | ||
"husky": "^8.0.3", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.7", | ||
"ts-jest": "^29.1.0", | ||
"tsup": "^6.7.0", | ||
"typescript": "^5.0.4" | ||
}, | ||
"engines": { | ||
"node": ">= 18.12 <19" | ||
}, | ||
"prettier": { | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"quoteProps": "as-needed", | ||
"trailingComma": "all", | ||
"bracketSpacing": true, | ||
"bracketSameLine": false, | ||
"arrowParens": "always", | ||
"endOfLine": "lf" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"preset": "ts-jest/presets/default-esm", | ||
"transform": { | ||
"^.+\\.m?[tj]s?$": [ | ||
"ts-jest", | ||
{ | ||
"useESM": true | ||
} | ||
] | ||
}, | ||
"moduleNameMapper": { | ||
"^(\\.{1,2}/.*)\\.(m)?js$": "$1" | ||
}, | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(m)?ts$", | ||
"coverageDirectory": "coverage", | ||
"collectCoverageFrom": [ | ||
"src/**/*.ts", | ||
"src/**/*.mts", | ||
"!src/**/*.d.ts", | ||
"!src/**/*.d.mts" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { buildCommand } from './command.js'; | ||
|
||
describe('buildCommand', () => { | ||
it('allows to build command without any argument', () => { | ||
expect(buildCommand('dir')).toBe('dir'); | ||
}); | ||
|
||
it('adds quotes to all the arguments', () => { | ||
expect(buildCommand('dir', ['/a', '/b', '/c', '/d'])).toBe( | ||
'dir "/a" "/b" "/c" "/d"', | ||
); | ||
}); | ||
|
||
it('allows empty argument list', () => { | ||
expect(buildCommand('dir', [])).toBe('dir'); | ||
}); | ||
|
||
it('handles special characters in the argument list', () => { | ||
expect(buildCommand('dir', ['path with space', 'ar g"s"'])).toBe( | ||
'dir "path with space" "ar g""s"""', | ||
); | ||
}); | ||
}); |
Oops, something went wrong.