Skip to content

Commit

Permalink
ci: publish prebuilt packages
Browse files Browse the repository at this point in the history
  • Loading branch information
juanrgm committed Oct 4, 2024
1 parent c534a37 commit 904f61f
Show file tree
Hide file tree
Showing 7 changed files with 842 additions and 20 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
run: sudo npm test
env:
CI: true
- uses: actions/cache@v3
with:
path: ~/.pkg-cache/
key: ${{ runner.os }}-pkg
- run: pnpm build:bin
- name: Create release pull request or publish to npm
id: changesets
uses: changesets/action@v1
Expand All @@ -53,6 +58,48 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload release artifacts
uses: actions/upload-artifact@v3
with:
name: release-artifacts
path: bin/*
if-no-files-found: error
- id: release-name
uses: actions/github-script@v6
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
with:
script: |
const published = JSON.parse(process.env.PUBLISHED_PACKAGES);
for (const { name, version } of published)
core.setOutput(name, version);
- name: Upload release assets
if: steps.release-name.outputs['datatruck']
uses: softprops/action-gh-release@v1
with:
files: bin/*
name: datatruck@${{ steps.release-name.outputs['datatruck'] }}
tag_name: datatruck@${{ steps.release-name.outputs['datatruck'] }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete nightly release
uses: sgpublic/[email protected]
with:
pre-release-drop: true
pre-release-keep-count: -1
pre-release-drop-tag: true
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Create nightly release
if: steps.release-name.outputs['datatruck'] == ''
uses: softprops/action-gh-release@v1
with:
tag_name: datatruck@nightly
name: datatruck@nightly
files: bin/*
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: changesets_meta
name: Build changesets meta
uses: actions/github-script@v7
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.pnpm-store
coverage
lib
bin
dist
/backup*
node_modules
*.tsbuildinfo
/datatruck*.ts
/datatruck*.json
/datatruck*.yaml
config.schema.json
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
],
"scripts": {
"build": "pnpm build:ts && pnpm build:schema",
"build:bin": "node ./scripts/build-bin.mjs",
"build:dist": "esbuild --bundle --platform=node --target=node20 ./packages/cli/lib/bin.js --outfile=dist/datatruck.js",
"build:schema": "node ./packages/cli/scripts/gen-schema.mjs",
"build:ts": "tsc -b tsconfig.build.json --pretty",
"clean": "tsc -b tsconfig.build.json --clean",
Expand All @@ -36,6 +38,8 @@
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.16.9",
"@yao-pkg/pkg": "^5.15.0",
"esbuild": "^0.24.0",
"npm-check-updates": "^17.1.3",
"prettier": "3.3.3",
"prettier-plugin-packagejson": "^2.5.2",
Expand All @@ -48,7 +52,8 @@
},
"pnpm": {
"patchedDependencies": {
"[email protected]": "patches/[email protected]"
"[email protected]": "patches/[email protected]",
"[email protected]": "patches/[email protected]"
}
},
"engine": {
Expand Down
44 changes: 42 additions & 2 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
diff --git a/package.json b/package.json
index b448ae7d2beab6212654d1d7dc7d67b0b8e505f2..cac137d56fd8a5e75af0bb01d076a83492e8a0c1 100644
--- a/package.json
+++ b/package.json
@@ -6,9 +6,6 @@
"engines": {
"node": ">=6"
},
- "bin": {
- "smartwrap": "src/terminal-adapter.js"
- },
"scripts": {
"test": "./node_modules/.bin/grunt t",
"test-display": "./node_modules/.bin/grunt test-display",
@@ -25,12 +22,9 @@
"author": "tecfu",
"license": "MIT",
"dependencies": {
- "array.prototype.flat": "^1.2.3",
"breakword": "^1.0.5",
- "grapheme-splitter": "^1.0.4",
"strip-ansi": "^6.0.0",
- "wcwidth": "^1.0.1",
- "yargs": "^15.1.0"
+ "wcwidth": "^1.0.1"
},
"devDependencies": {
"chai": "^4.2.0",
diff --git a/src/main.js b/src/main.js
index acdc39bc31da8087a86384b651a32ea2de5a19aa..9e9553e06e942fb6221615933f5baf01072444f2 100644
index acdc39bc31da8087a86384b651a32ea2de5a19aa..0d25228dfbcb77cf9062fd11fb0e97b459f7217d 100644
--- a/src/main.js
+++ b/src/main.js
@@ -171,6 +171,7 @@ const wrap = (input, options) => {
@@ -1,8 +1,6 @@
const breakword = require("breakword")
const stripansi = require("strip-ansi")
const wcwidth = require("wcwidth")
-const flat = require("array.prototype.flat")
-if (!Array.prototype.flat) flat.shim()

const ANSIPattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
@@ -171,6 +169,7 @@ const wrap = (input, options) => {

const splitAnsiInput = (text) => {
// get start and end positions for matches
+ let result
let matches = []
let textArr = [...text]
let textLength = textArr.length
diff --git a/src/terminal-adapter.js b/src/terminal-adapter.js
deleted file mode 100644
index 7ff8458e1a29583c0f85404b93502b70dbf14ec6..0000000000000000000000000000000000000000
30 changes: 30 additions & 0 deletions patches/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/adapters/terminal-adapter.js b/adapters/terminal-adapter.js
deleted file mode 100644
index 3c5e8abc1eac0accb9d6873be268927894d7f6cc..0000000000000000000000000000000000000000
diff --git a/package.json b/package.json
index 618da1af1d7c8473d65581747fd37f0bb1bb1320..bfb114337ada532f0b628ccc809c9ea9c9205a45 100644
--- a/package.json
+++ b/package.json
@@ -7,9 +7,6 @@
"engines": {
"node": ">=8.0.0"
},
- "bin": {
- "tty-table": "adapters/terminal-adapter.js"
- },
"files": [
"adapters/",
"src/",
diff --git a/src/main.js b/src/main.js
index 6981919868be1b0db6ef6c0ad2ac88b5f858192b..d49206a98187d230e8c8f140d1d9782d8bfc0643 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,7 +1,7 @@
if (require.main === module) {
// called directly in terminal
/* istanbul ignore next */
- require("./../adapters/terminal-adapter.js")
+ //require("./../adapters/terminal-adapter.js")
} else {
// called as a module
module.exports = require("./../adapters/default-adapter.js")
Loading

0 comments on commit 904f61f

Please sign in to comment.