feat: add after install script (#3161)

* feat: upgrade yarn to latest 3.x

* feat: adding plugin and after install script

* fix: husky mode

* feat: adding post merge hook

* style: alphabetically organizing scripts

* fix: yarn lock
This commit is contained in:
Matthew Hatcher
2023-10-29 09:37:09 -05:00
committed by GitHub
parent c460c88a84
commit dea4310e9f
10 changed files with 915 additions and 826 deletions

7
.husky/post-merge Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
if git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD | grep -q "yarn\|package.json"; then
echo "hook(post-merge) - Found changes to a yarn file or package.json, running Yarn."
yarn
fi

0
.husky/pre-commit Normal file → Executable file
View File

View File

@@ -0,0 +1,9 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-after-install",
factory: function (require) {
"use strict";var plugin=(()=>{var s=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var n=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(o,e)=>(typeof require<"u"?require:o)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+t+'" is not supported')});var I=(t,o)=>{for(var e in o)s(t,e,{get:o[e],enumerable:!0})},h=(t,o,e,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of x(o))!C.call(t,r)&&r!==e&&s(t,r,{get:()=>o[r],enumerable:!(a=g(o,r))||a.enumerable});return t};var k=t=>h(s({},"__esModule",{value:!0}),t);var P={};I(P,{default:()=>y});var d=n("@yarnpkg/core");var f=n("@yarnpkg/core"),c={afterInstall:{description:"Hook that will always run after install",type:f.SettingsType.STRING,default:""}};var u=n("clipanion"),p=n("@yarnpkg/core");var m=n("@yarnpkg/shell"),l=async(t,o)=>{var r;let e=t.get("afterInstall"),a=!!((r=t.projectCwd)!=null&&r.endsWith(`dlx-${process.pid}`));return e&&!a?(o&&console.log("Running `afterInstall` hook..."),(0,m.execute)(e,[],{cwd:t.projectCwd||void 0})):0};var i=class extends u.Command{async execute(){let o=await p.Configuration.find(this.context.cwd,this.context.plugins);return l(o,!1)}};i.paths=[["after-install"]];var w={configuration:c,commands:[i],hooks:{afterAllInstalled:async(t,o)=>{if((o==null?void 0:o.mode)===d.InstallMode.UpdateLockfile)return;if(await l(t.configuration,!0))throw new Error("The `afterInstall` hook failed, see output above.")}}},y=w;return k(P);})();
return plugin;
}
};

File diff suppressed because one or more lines are too long

874
.yarn/releases/yarn-3.6.4.cjs vendored Executable file

File diff suppressed because one or more lines are too long

View File

@@ -5,5 +5,9 @@ plugins:
spec: '@yarnpkg/plugin-typescript'
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-after-install.cjs
spec: 'https://raw.githubusercontent.com/mhassan1/yarn-plugin-after-install/v0.5.0/bundles/@yarnpkg/plugin-after-install.js'
yarnPath: .yarn/releases/yarn-3.3.0.cjs
yarnPath: .yarn/releases/yarn-3.6.4.cjs
afterInstall: yarn run setup-dd

View File

@@ -8,22 +8,23 @@
],
"scripts": {
"build": "turbo run build",
"fmt": "turbo run fmt",
"build:doc": "typedoc --out ./website/docs/generated/ && node scripts/finalizeTypedocs.js",
"build:type": "turbo run build:type",
"release-build": "turbo run release-build",
"dev": "turbo run dev --parallel",
"lint": "turbo run lint",
"test:type": "turbo run build:type",
"test:unit-coverage": "turbo run test:unit-coverage",
"test:unit": "turbo run test:unit",
"test:integration": "turbo run test:integration",
"test:deno-unit": "turbo run test:deno-unit",
"test:bun-unit": "turbo run test:bun-unit",
"test:e2e": "turbo run test:e2e",
"test:test-type": "turbo run test:test-type",
"fmt": "turbo run fmt",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"lint": "turbo run lint",
"prepare": "husky install",
"build:doc": "typedoc --out ./website/docs/generated/ && node scripts/finalizeTypedocs.js"
"release-build": "turbo run release-build",
"setup-dd": "husky install",
"test:bun-unit": "turbo run test:bun-unit",
"test:deno-unit": "turbo run test:deno-unit",
"test:e2e": "turbo run test:e2e",
"test:integration": "turbo run test:integration",
"test:test-type": "turbo run test:test-type",
"test:type": "turbo run build:type",
"test:unit": "turbo run test:unit",
"test:unit-coverage": "turbo run test:unit-coverage"
},
"devDependencies": {
"eslint": "^8.36.0",
@@ -45,7 +46,7 @@
"eslint --fix --config ./packages/eslint-config-discordeno/index.js --resolve-plugins-relative-to ."
]
},
"packageManager": "yarn@3.3.0",
"packageManager": "yarn@3.6.4",
"dependencies": {
"typedoc-plugin-missing-exports": "^1.0.0"
}

View File

@@ -14,7 +14,8 @@
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc",
"lint": "eslint src --ext ts,tsx",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\""
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx}\"",
"setup-dd": ""
},
"dependencies": {
"@babel/plugin-syntax-flow": "^7.18.6",

View File

@@ -11770,11 +11770,11 @@ __metadata:
"typescript@patch:typescript@^4.9.5#~builtin<compat/typescript>":
version: 4.9.5
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=d73830"
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=289587"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20
checksum: 1f8f3b6aaea19f0f67cba79057674ba580438a7db55057eb89cc06950483c5d632115c14077f6663ea76fd09fce3c190e6414bb98582ec80aa5a4eaf345d5b68
languageName: node
linkType: hard

View File

@@ -5213,11 +5213,11 @@ __metadata:
"typescript@patch:typescript@^4.9.3#~builtin<compat/typescript>, typescript@patch:typescript@^4.9.5#~builtin<compat/typescript>":
version: 4.9.5
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=d73830"
resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=289587"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20
checksum: 1f8f3b6aaea19f0f67cba79057674ba580438a7db55057eb89cc06950483c5d632115c14077f6663ea76fd09fce3c190e6414bb98582ec80aa5a4eaf345d5b68
languageName: node
linkType: hard