diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..336ebd9 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,35 @@ +name: Prettier code formatting +on: + push: + branches: [master, format, format-tests] + pull_request: + branches: [master, format] +jobs: + format: + runs-on: ubuntu-latest + steps: + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - name: Format + run: pretty-quick --staged + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v4.1.2 + with: + commit_message: Apply formatting changes + branch: ${{ github.head_ref }} diff --git a/lib/cli.js b/lib/cli.js index 17ecd83..5048df1 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -20,6 +20,7 @@ module.exports = async (argvs) => { const argv = yargs_parser(argvs, { alias: { release: ["r"], yes: ["y"] }, }); + let tests = { example: "vlad" }; const timer = elapsed.start(); const version = (argv["release"] || "latest").toString(); const targetDir = path.resolve(argv["_"][0] || "./"); diff --git a/package.json b/package.json index 02e36e6..9dde155 100644 --- a/package.json +++ b/package.json @@ -45,10 +45,5 @@ "jest": "^26.0.1", "prettier": "^2.0.5", "pretty-quick": "^3.0.0" - }, - "husky": { - "hooks": { - "pre-commit": "pretty-quick --staged" - } } } diff --git a/tests/test.js b/tests/test.js index 22ee447..7c06b2c 100644 --- a/tests/test.js +++ b/tests/test.js @@ -48,6 +48,7 @@ const runCli = async ({ await fs.ensureDir(defaultDir); prevCwd = process.cwd(); process.chdir(defaultDir); + let test={vlad:"test"}; } if (version) {