Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
chore: npm publish routine
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonoh committed Nov 17, 2021
1 parent 8685338 commit 75796a2
Show file tree
Hide file tree
Showing 10 changed files with 187 additions and 36 deletions.
31 changes: 3 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"scripts": {
"build": "lerna run build",
"prepare": "husky install && lerna run prepare && lerna link --force-local",
"prepublish": "lerna run prepublish",
"postinstall": "lerna link --force-local",
"postinstall": "lerna run postinstall && lerna link --force-local",
"lint": "lerna run lint",
"test": "lerna run test",
"test:ci": "lerna run test:ci",
Expand All @@ -36,37 +35,12 @@
"path": "./node_modules/cz-conventional-changelog"
}
},
"release": {
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/changelog",
{
"changelogTitle": "# slonik-live-server changelog"
}
],
"@semantic-release/github",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
},
"devDependencies": {
"@semantic-release/changelog": "6.0.1",
"@semantic-release/commit-analyzer": "9.0.1",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "8.0.2",
"@semantic-release/npm": "8.0.3",
"@semantic-release/release-notes-generator": "10.0.2",
"@types/jest": "27.0.2",
"@types/node": "16.11.7",
Expand Down Expand Up @@ -97,6 +71,7 @@
"prettier": "2.4.1",
"rimraf": "3.0.2",
"semantic-release": "18.0.0",
"semantic-release-monorepo": "7.0.5",
"semantic-release-vsce": "3.5.0",
"slonik": "24.2.0",
"slonik-sql-tag-raw": "1.1.3",
Expand Down
13 changes: 13 additions & 0 deletions packages/ts-slonik-live-server-plugin/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.eslintignore
.eslintrc.yml
.git*
.husky/
node_modules/
.prettierrc.yml
src/
test-workspace/
tsconfig*.json
*.code-workspace
yarn-error.log
yarn.lock
package.json.backup
9 changes: 8 additions & 1 deletion packages/ts-slonik-live-server-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"description": "Typescript language service plugin for slonik.",
"keywords": [
"slonik",
"pg",
"postgres",
"postgresql",
"typescript language service plugin"
],
"bugs": {
Expand All @@ -23,8 +26,12 @@
],
"license": "MIT",
"scripts": {
"prepare": "yarn build",
"release": "yarn semantic-release",
"prepack": "yarn build:prod && ts-node -T ./src/util/pre-publish.ts",
"postpack": "ts-node -T ./src/util/post-publish.ts",
"postinstall": "yarn build",
"build": "rimraf dist && cpy ./src/lib/pg/pg.js ./dist/lib/pg && tsc -p tsconfig.build.json",
"build:prod": "rimraf dist && cpy ./src/lib/pg/pg.js ./dist/lib/pg && tsc -p tsconfig.build-prod.json",
"test:db:migrate": "DATABASE_URL=postgresql://postgres:secretpassword@localhost:54321/postgres yarn node-pg-migrate -m ./src/test/migrations --tsconfig ./tsconfig.json",
"test:db:migrate:up": "yarn test:db:migrate up",
"test:db:migrate:down": "yarn test:db:migrate down",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { renameSync } from 'fs';
import { resolve } from 'path';

const packageJsonPath = resolve(__dirname, '../../package.json');
renameSync(packageJsonPath + '.backup', packageJsonPath);
19 changes: 19 additions & 0 deletions packages/ts-slonik-live-server-plugin/src/util/pre-publish.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { readFileSync, renameSync, writeFileSync } from 'fs';
import { resolve } from 'path';

const packageJsonPath = resolve(__dirname, '../../package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath).toString());
renameSync(packageJsonPath, packageJsonPath + '.backup');
writeFileSync(
packageJsonPath,
JSON.stringify(
{
...packageJson,
types: undefined,
scripts: undefined,
jest: undefined,
},
null,
2,
),
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "dist", "**/test", "**/zz*"]
}
2 changes: 2 additions & 0 deletions packages/ts-slonik-live-server-plugin/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"extends": "./tsconfig.json",
"exclude": ["node_modules", "dist", "**/test", "**/zz*"],
"compilerOptions": {
"sourceRoot": "src",
"sourceMap": true,
"declaration": true
}
}
4 changes: 1 addition & 3 deletions packages/ts-slonik-live-server-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"sourceRoot": "src",
"outDir": "dist",
"sourceMap": true
"outDir": "dist"
}
}
2 changes: 1 addition & 1 deletion packages/vscode-slonik-live-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"displayName": "Slonik Live Server",
"description": "Tests Slonik SQL template tag queries, suggests table & column names and checks query costs against live PostgreSQL database",
"scripts": {
"prepare": "yarn build",
"postinstall": "yarn build",
"build": "rimraf dist && tsc -p tsconfig.build.json",
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
Expand Down
Loading

0 comments on commit 75796a2

Please sign in to comment.