mirror of
https://github.com/knex/knex.git
synced 2025-06-26 22:00:25 +00:00
Allow Knex 2.x with Typescript to be installed via git (#5187)
This commit is contained in:
parent
211c6a7765
commit
1baeefedf1
10
.github/workflows/integration-tests.yml
vendored
10
.github/workflows/integration-tests.yml
vendored
@ -110,6 +110,10 @@ jobs:
|
||||
always-auth: false
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- run: npm install
|
||||
- run: npm pack
|
||||
- run: npm install -g
|
||||
- name: Test npm git dependency
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir TMP/
|
||||
echo "{ \"dependencies\": { \"knex\": \"git+file://$(pwd)/\" } }" > TMP/package.json
|
||||
cd TMP/
|
||||
npm install --verbose
|
||||
|
0
.husky/pre-commit
Normal file → Executable file
0
.husky/pre-commit
Normal file → Executable file
@ -9,7 +9,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:gitignore && npm run build:ts",
|
||||
"clean": "git clean -f -X lib/",
|
||||
"clean": "node scripts/clean.js",
|
||||
"build:ts": "tsc",
|
||||
"build:gitignore": "node scripts/update_gitignore_for_tsc_output.js run",
|
||||
"format": "prettier --write \"{lib,bin,scripts,test}/**/*.js\"",
|
||||
@ -99,8 +99,7 @@
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,json}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
"prettier --write"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
|
29
scripts/clean.js
Executable file
29
scripts/clean.js
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const { execSync } = require("child_process");
|
||||
|
||||
function main() {
|
||||
const repoDir = path.dirname(__dirname)
|
||||
const gitDir = path.join(repoDir, '.git')
|
||||
const gitDirExists = doesDirectoryExist(gitDir)
|
||||
if (!gitDirExists) {
|
||||
console.log("No .git directory detected so can not clean 'lib/'. Exiting.")
|
||||
process.exit(0)
|
||||
}
|
||||
console.log("Cleaning 'lib/' of outputted files from Typescript compilation ...")
|
||||
const cmd = 'git clean -f -X lib/'
|
||||
const output = execSync(cmd, { cwd: repoDir })
|
||||
console.log(output.toString('utf8'))
|
||||
console.log('Done')
|
||||
}
|
||||
|
||||
function doesDirectoryExist(p) {
|
||||
if (fs.existsSync(p)) {
|
||||
return fs.lstatSync(p).isDirectory()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
main()
|
Loading…
x
Reference in New Issue
Block a user