Skip to content

Commit

Permalink
feat(pkg): snobuild v3
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Oct 8, 2022
1 parent c10e826 commit 611805b
Show file tree
Hide file tree
Showing 33 changed files with 349 additions and 582 deletions.
6 changes: 6 additions & 0 deletions .gitpod.yml
@@ -0,0 +1,6 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file)
# and commit this file to your remote git repository to share the goodness with others.

tasks:
- init: pnpm install && pnpm run build
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -14,7 +14,7 @@
},
"license": "GPLv3",
"author": "Snowstar Miao <snomiao@gmail.com>",
"_bak_npm_workspaces": [
"workspaces": [
"packages/**"
],
"scripts": {
Expand Down
7 changes: 3 additions & 4 deletions packages/chrome-dev/package.json
Expand Up @@ -32,20 +32,19 @@
"lib"
],
"scripts": {
"build": "snobuild --lib",
"build": "snobuild",
"prepack": "npm run build"
},
"dependencies": {
"arg": "^5.0.1",
"dotenv": "^14.2.0",
"puppeteer": "^14.2.1",
"yargs": "^17.5.1"
},
"devDependencies": {
"snobuild": "^2.7.0"
"snobuild": "^3.2.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "ca1c2db9974aa48a03d7695327ba73367192028c"
}
}
19 changes: 3 additions & 16 deletions packages/jsx-rename/package.json
Expand Up @@ -16,22 +16,9 @@
"repository": "https://github.com/snomiao/js/tree/master/packages/jsx-rename",
"license": "GPLv3",
"author": "Snowstar Miao <snomiao@gmail.com>",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
}
},
"main": "lib/index.js",
"bin": {
"jsx-rename": "lib/cli.js"
},
"files": [
"lib"
],
"scripts": {
"_build": "snobuild --lib",
"_prepack": "npm run build"
"build": "snobuild",
"prepack": "npm run build"
},
"dependencies": {
"eslint": "8.2.0",
Expand All @@ -41,6 +28,6 @@
},
"devDependencies": {
"@types/yargs": "^17.0.10",
"snobuild": "^2.7.0"
"snobuild": "^3.2.0"
}
}
27 changes: 10 additions & 17 deletions packages/junction-move/package.json
Expand Up @@ -18,25 +18,18 @@
"author": "Snowstar Miao <snomiao@gmail.com>",
"type": "module",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
}
},
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "./lib/index.d.ts",
"bin": {
"junction-move": "lib/cli.js"
},
"directories": {
"lib": "lib"
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"main": "dist/index.min.cjs",
"module": "dist/index.min.mjs",
"types": "dist/index.d.ts",
"bin": "dist/cli.mjs",
"files": [
"lib"
"dist"
],
"scripts": {
"build": "snobuild --lib",
"build": "snobuild",
"prepack": "npm run build"
},
"dependencies": {
Expand All @@ -45,6 +38,6 @@
},
"devDependencies": {
"@types/yargs": "^17.0.10",
"snobuild": "^2.7.0"
"snobuild": "^3.2.0"
}
}
}
25 changes: 10 additions & 15 deletions packages/md-aggregate/package.json
Expand Up @@ -19,23 +19,18 @@
"author": "Snowstar Miao <snomiao@gmail.com>",
"type": "module",
"exports": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
},
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "./lib/index.d.ts",
"bin": {
"md-aggregate": "lib/cli.js"
},
"directories": {
"lib": "lib"
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"main": "dist/index.min.cjs",
"module": "dist/index.min.mjs",
"types": "dist/index.d.ts",
"bin": "dist/cli.mjs",
"files": [
"lib"
"dist"
],
"scripts": {
"build": "snobuild --lib",
"build": "snobuild",
"prepack": "npm run build",
"postversion": "prettier -w CHANGELOG.md && npm run build && npx md-aggregate README.md CHANGELOG.md -w"
},
Expand All @@ -49,10 +44,10 @@
"@types/node": "^18.7.18",
"@types/yargs": "^17.0.10",
"prettier": "^2.6.2",
"snobuild": "^2.7.0"
"snobuild": "^3.2.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "ca1c2db9974aa48a03d7695327ba73367192028c"
}
}
12 changes: 10 additions & 2 deletions packages/monopkgs/package.json
Expand Up @@ -16,6 +16,13 @@
"license": "GPLv3",
"author": "Snowstar Miao <snomiao@gmail.com>",
"type": "module",
"exports": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"main": "dist/index.min.cjs",
"module": "dist/index.min.mjs",
"types": "dist/index.d.ts",
"bin": {
"monopkgs": "lib/cli.js"
},
Expand All @@ -32,7 +39,8 @@
"yargs": "^17.5.1"
},
"devDependencies": {
"@types/yargs": "^17.0.10"
"@types/yargs": "^17.0.10",
"snobuild": "^3.2.0"
},
"gitHead": "ca1c2db9974aa48a03d7695327ba73367192028c"
}
}
2 changes: 1 addition & 1 deletion packages/monopkgs/src/cli.ts
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import yargs from "yargs";
import { hideBin } from "yargs/helpers";
import monopkgs from ".";
import monopkgs from "./index";
(async function () {
const argv = await yargs(hideBin(process.argv))
.scriptName("monopkgs")
Expand Down
4 changes: 2 additions & 2 deletions packages/monopkgs/src/index.ts
Expand Up @@ -4,7 +4,7 @@ import { globby } from "globby";
import path, { relative, resolve } from "path";
import { promisify } from "util";

export default async function monopkgs({} = {}) {
export default async function monopkgs({ } = {}) {
const rootPkg = resolve("./package.json");
const root = JSON.parse(await readFile(rootPkg, "utf8"));
const rootDir = path.parse(rootPkg).dir;
Expand All @@ -21,7 +21,7 @@ export default async function monopkgs({} = {}) {
const pkgs = await globby("packages/**/package.json", { gitignore: true });

// master will redirect to main rather than 404 if main is not existed in github.
const currentBranch = await (await promisify(exec)("git branch --show-current"))?.stdout.trim();
const currentBranch = (await promisify(exec)("git branch --show-current"))?.stdout.trim();
const mainBranchName = currentBranch || "master";

const pkgParse = async (pkgPath) => {
Expand Down
28 changes: 12 additions & 16 deletions packages/my-version/package.json
Expand Up @@ -14,28 +14,24 @@
"author": "Snowstar Miao <snomiao@gmail.com>",
"type": "module",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
}
},
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "./lib/index.d.ts",
"bin": {
"my-version": "lib/cli.js"
},
"directories": {
"lib": "lib"
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"main": "dist/index.min.cjs",
"module": "dist/index.min.mjs",
"types": "dist/index.d.ts",
"bin": "dist/cli.mjs",
"files": [
"lib"
"dist"
],
"scripts": {
"build": "snobuild --lib",
"build": "snobuild",
"prepack": "npm run build"
},
"dependencies": {
"read-pkg-up": "^9.1.0"
},
"devDependencies": {
"snobuild": "^3.2.0"
}
}
}
23 changes: 9 additions & 14 deletions packages/objtranspose/package.json
Expand Up @@ -22,30 +22,25 @@
"author": "Snowstar Miao <snomiao@gmail.com>",
"type": "module",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
}
},
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "./lib/index.d.ts",
"directories": {
"lib": "lib"
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"main": "dist/index.min.cjs",
"module": "dist/index.min.mjs",
"types": "dist/index.d.ts",
"files": [
"lib"
"dist"
],
"scripts": {
"build": "snobuild --lib",
"build": "snobuild",
"prepack": "npm run build && npm run test",
"test": "mocha --require tsx src/**/*.test.ts"
},
"devDependencies": {
"@types/mocha": "^9.1.1",
"mocha": "^10.0.0",
"snobuild": "^2.7.0",
"snobuild": "^3.2.0",
"tsx": "^3.4.2"
},
"gitHead": "ca1c2db9974aa48a03d7695327ba73367192028c"
}
}
20 changes: 9 additions & 11 deletions packages/outer-join-by/package.json
Expand Up @@ -16,19 +16,17 @@
"author": "Snowstar Miao <snomiao@gmail.com>",
"type": "module",
"exports": {
".": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
}
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "./lib/index.d.ts",
"main": "dist/index.min.cjs",
"module": "dist/index.min.mjs",
"types": "dist/index.d.ts",
"files": [
"lib"
"dist"
],
"scripts": {
"build": "snobuild --lib",
"build": "snobuild",
"prepack": "npm run build && npm run test",
"test": "mocha --require tsx src/**/*.test.ts"
},
Expand All @@ -38,8 +36,8 @@
"devDependencies": {
"@types/mocha": "^9.1.1",
"mocha": "^10.0.0",
"snobuild": "^2.7.0",
"snobuild": "^3.2.0",
"tsx": "^3.4.2"
},
"gitHead": "ca1c2db9974aa48a03d7695327ba73367192028c"
}
}
10 changes: 6 additions & 4 deletions packages/piserve/package.json
Expand Up @@ -7,19 +7,20 @@
],
"license": "ISC",
"author": "",
"type": "module",
"exports": {
"require": "./lib/index.cjs",
"import": "./lib/index.js"
},
"bin": "lib/cli.js",
"main": "lib/index.cjs",
"module": "lib/index.js",
"types": "dist/index.d.ts",
"bin": "lib/cli.js",
"files": [
"lib"
],
"type": "module",
"scripts": {
"build": "snobuild --lib",
"build": "snobuild --node",
"prepack": "npm run build",
"test": "mocha --require tsx src/**/*.test.ts"
},
Expand All @@ -36,6 +37,7 @@
"@types/mocha": "^9.1.1",
"chai": "^4.3.6",
"mocha": "^10.0.0",
"snobuild": "^3.2.0",
"tsx": "^3.4.2"
}
}
}

0 comments on commit 611805b

Please sign in to comment.