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

feat: yarn berry + yarn fetch + docker opti #177

Merged
merged 12 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@ Dockerfile
.dockerignore
node_modules
npm-debug.log
yarn-debug.log
README.md
.next
CHANGELOG.md
.next
.vscode
.github
.kontinuous
.git
15 changes: 5 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "16"
cache: "yarn"
- name: Install dependencies
run: |
yarn install --prefer-offline --frozen-lockfile
yarn --immutable
- name: Build and export
run: |
yarn build
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
build: yarn build
start: yarn start
component: false
install-command: yarn --immutable
env:
NEXTAUTH_URL: "http://keycloak:3000"
NEXTAUTH_SECRET: "A+EQqudlGhqTLDnBbCvohHBfbhUjTXAbZYy1NKsSsys="
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "16"
cache: "yarn"
- name: Install dependencies
run: |
yarn install --prefer-offline --frozen-lockfile
yarn --immutable
- name: Lint
run: |
yarn lint
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: '16.16.0'
cache: 'yarn'
node-version: "16.16.0"
cache: "yarn"

- name: Install dependencies
run: |
yarn install --prefer-offline --frozen-lockfile
yarn --immutable

- name: Deploy
run: |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
node-version: "16"
cache: "yarn"
- name: Install dependencies
run: |
yarn install --prefer-offline --frozen-lockfile
yarn --immutable
- name: Test code
run: |
yarn test
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ cypress/videos
cypress/screenshots

# Robots.txt
robots.txt
robots.txt

# yarn berry
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
10 changes: 8 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ fileignoreconfig:
- filename: .env.development
checksum: 44d017f8bd7ac1f3f4fb8b8175b3dddb6f160cf05b2738ec16b5b848aeb62d3f
- filename: .github/workflows/build.yml
checksum: 76b8b3bba21c8029b1fd0dd2759cf96448ee257439ea4118fddfb4254199a59b
checksum: c2eaa7d33f20ce615a65740718a652474e5fe4ad0437374ca671bd73317cdd95
- filename: .github/workflows/e2e.yml
checksum: eaf3ce6b34b2ceee77a0c89066d8c05b5938c60c71458e4341b636eb6b9d51da
checksum: e6b469e5f566a1a44a481fb8fd65d8a76e5cceb71d2d54225ae20a7760197b2e
- filename: .github/workflows/kontinuous-webhook-delete.yml
checksum: 6debf4f640d4ed9cb39bb19445214ab52dcb23fb7da12feeb85070816d7ee52a
- filename: .github/workflows/kontinuous-webhook-deploy.yml
checksum: 1fa040cef27d48607572966b9f06bf23656c95d03dd4cf5aba2508f0218f3a48
- filename: .github/workflows/lint.yml
checksum: 8998c84b27a0d3e7953ffc78b4414190fef9e16f8cce5f485160234db1d7f9af
- filename: .github/workflows/testing.yml
checksum: 852b1c21aaa42328e42d87b31a2305498d0cec6360fb9d7bb7eb51f7b73c9a4b
- filename: .yarn/**
checksum: any
- filename: Dockerfile
checksum: 3e3c777aa156eb69b7212d18b431e3b605652e42e22d36f89be97c3c2a87c47f
- filename: README.md
Expand Down
19 changes: 19 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-fetch.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* eslint-disable */
//prettier-ignore
module.exports = {
name: "@yarnpkg/plugin-fetch",
factory: function (require) {
var plugin=(()=>{var ce=Object.defineProperty;var ae=(n,t,e)=>t in n?ce(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var c=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+n+'" is not supported')});var a=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var u=(n,t,e)=>(ae(n,typeof t!="symbol"?t+"":t,e),e);var w=a((Ke,D)=>{"use strict";D.exports=function(t){return t.map(function(e){return e&&typeof e=="object"?e.op.replace(/(.)/g,"\\$1"):/["\s]/.test(e)&&!/'/.test(e)?"'"+e.replace(/(['\\])/g,"\\$1")+"'":/["'\s]/.test(e)?'"'+e.replace(/(["\\$`!])/g,"\\$1")+'"':String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g,"$1\\$2")}).join(" ")}});var B=a((We,A)=>{var C=c("fs"),ie=c("path"),{parseSyml:le}=c("@yarnpkg/parsers");A.exports=function(){let t=C.readFileSync("yarn.lock","utf8"),e=le(t),o=Object.keys(e).filter(r=>r.includes("@workspace:")),s=o.map(r=>{let[,i]=e[r].resolution.trim().split("@workspace:");return i==="."?null:i}).filter(Boolean);o.forEach(r=>{let{dependencies:i,dependenciesMeta:l,peerDependencies:q,peerDependenciesMeta:b,resolution:O,bin:ne}=e[r],[oe,P]=O.trim().split("@workspace:"),re=ie.join(P,"package.json"),h={name:oe,version:"0.0.0",description:"**DON'T COMMIT** Generated file for caching",private:!0,dependencies:i,peerDependencies:q,peerDependenciesMeta:b,bin:ne};if(l){let g={};Object.keys(l).forEach(m=>{g[m]=i[m],delete i[m]}),h.optionalDependencies=g}if(P==="."){s.length>0&&(h.workspaces={packages:s});let g=Object.keys(e),m=p=>{let d=p.trim().split("@");return p.startsWith("@")?d=d.slice(0,2):d=d.slice(0,1),d.join("@")};h.resolutions=g.filter(p=>{if(p.includes("@workspace:")||p.includes(", ")||!p.includes("@npm:"))return!1;let d=m(p);return g.every(y=>p===y?!0:y.split(",").map(k=>m(k)).every(k=>k!==d))}).reduce((p,d)=>{let[y,k]=d.trim().split("@npm:");return p[y]=k.includes("@")?`npm:${k}`:k,p},{})}C.mkdirSync(P,{recursive:!0}),C.writeFileSync(re,`${JSON.stringify(h,null,2)}
`)})}});var j=a((_e,Y)=>{var pe=B();Y.exports=n=>{n.context.stdout.write(`[YARN-FETCH] extracting package.json file(s) from yarn.lock
`),pe()}});var R=a((Ge,H)=>{var f=c("fs"),ue=c("path"),{execSync:de}=c("child_process"),{parseSyml:ke}=c("@yarnpkg/parsers"),{BaseCommand:fe}=c("@yarnpkg/cli"),{Command:me,Option:v}=c("clipanion"),ge=w(),he=j(),x;H.exports=(x=class extends fe{protectPackageJson=v.Boolean("--protect-package-json");args=v.Proxy();async execute(){let{protectPackageJson:t=process.stdout.isTTY}=this,e=[];if(t){this.context.stdout.write(`[YARN-FETCH] backup possible package.json file(s)
`);let s=f.readFileSync("yarn.lock","utf8"),r=ke(s);e=Object.keys(r).filter(l=>l.includes("@workspace:")).map(l=>{let{resolution:q}=r[l],[,b]=q.trim().split("@workspace:");return ue.join(b,"package.json")}),e.forEach(l=>{f.existsSync(l)&&!f.existsSync(`${l}.yarn-plugin-fetch-bak`)&&f.copyFileSync(l,`${l}.yarn-plugin-fetch-bak`)})}he(this);let o=`yarn ${ge(this.args)}`;this.context.stdout.write(`[YARN-FETCH] ${o}
`);try{de(o,{stdio:"inherit"})}catch(s){throw s}finally{t&&(this.context.stdout.write(`[YARN-FETCH] restoring possible package.json file(s)
`),e.forEach(s=>{f.existsSync(`${s}.yarn-plugin-fetch-bak`)?f.renameSync(`${s}.yarn-plugin-fetch-bak`,s):f.unlinkSync(s)}))}}},u(x,"paths",[["fetch"]]),u(x,"usage",me.Usage({description:"fetch dependencies from yarn.lock in Docker build",details:`
expand yarn.lock to package.json file(s) and install dependencies in Docker build.
`,examples:[["yarn fetch --immutable","yarn fetch workspace my-package focus"]]})),x)});var M=a((Qe,L)=>{var{BaseCommand:ye}=c("@yarnpkg/cli"),xe=j(),S;L.exports=(S=class extends ye{async execute(){xe(this)}},u(S,"paths",[["fetch-tools","expand-lock"]]),S)});var K=a((Xe,I)=>{function qe(n,t,e){let o=t.split("."),s=n;for(let r of o){if(s[r]===void 0)return e;s=s[r]}return s}function be(n,t,e){let o=t.split("."),s=n;for(let r=0;r<o.length-1;r++){let i=o[r];(!s[i]||typeof s[i]!="object")&&(s[i]={}),s=s[i]}return s[o[o.length-1]]=e,n}function Pe(n,t){let e=t.split("."),o=n;for(let s=0;s<e.length-1;s++){let r=e[s];if(!o[r])return!1;o=o[r]}return delete o[e[e.length-1]],!0}I.exports={get:qe,set:be,unset:Pe}});var F=a((et,_)=>{var W=c("fs"),{get:we,set:Ce,unset:je}=K();_.exports=function(t,e){let o=JSON.parse(W.readFileSync("package.json","utf-8")),s=we(o,t);s!==void 0&&(Ce(o,e,s),je(o,t),W.writeFileSync("package.json",JSON.stringify(o,null,2)))}});var $=a((tt,z)=>{var Se=F();z.exports=function(){Se("scripts._postinstall","scripts.postinstall")}});var U=a((nt,G)=>{var{BaseCommand:Fe}=c("@yarnpkg/cli"),$e=$(),E;G.exports=(E=class extends Fe{async execute(){$e()}},u(E,"paths",[["fetch-tools","disable-postinstall"]]),E)});var J=a((rt,Z)=>{var Ee=F();Z.exports=function(){Ee("scripts.postinstall","scripts._postinstall")}});var V=a((at,Q)=>{var{BaseCommand:Je}=c("@yarnpkg/cli"),Ne=J(),N;Q.exports=(N=class extends Je{async execute(){Ne()}},u(N,"paths",[["fetch-tools","disable-postinstall"]]),N)});var te=a((pt,ee)=>{var{execSync:Te}=c("child_process"),{BaseCommand:Oe}=c("@yarnpkg/cli"),{Option:X}=c("clipanion"),De=w(),Ae=$(),Be=J(),T;ee.exports=(T=class extends Oe{postinstall=X.Boolean("--postinstall");args=X.Proxy();async execute(){this.postinstall||(this.context.stdout.write(`[YARN-FETCH] disable postinstall command in package.json
`),Be());let t=`yarn workspaces focus --production ${De(this.args)}`;this.context.stdout.write(`[YARN-FETCH] ${t}
`),Te(t,{stdio:"inherit"}),this.postinstall||(this.context.stdout.write(`[YARN-FETCH] re-enable postinstall command in package.json
`),Ae())}},u(T,"paths",[["fetch-tools","production"]]),T)});var Me=a((dt,se)=>{var Ye=R(),ve=M(),He=U(),Re=V(),Le=te();se.exports={commands:[Ye,ve,Re,He,Le]}});return Me();})();
return plugin;
}
};
Loading
Loading