Skip to content

Commit

Permalink
chore: update vscode build script
Browse files Browse the repository at this point in the history
- fix vsix-builder tsconfig to what it used to be
- deploy on ci/release branch
- use yarn instead of pnpm
- always use esbuild-wasm for the extension
- add esbuild as vscode deps so that it's bundled in the extension/node_modules
- use previous @pandacss/types release
- add missing deps
  • Loading branch information
astahmer committed Oct 30, 2023
1 parent a3147cc commit d4b64e9
Show file tree
Hide file tree
Showing 29 changed files with 15,119 additions and 9,885 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
16 changes: 6 additions & 10 deletions .github/composite-actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
name: 'Install'
description: 'Sets up Node.js and runs install'
name: "Install"
description: "Sets up Node.js and runs install"

runs:
using: composite
steps:
- uses: pnpm/[email protected]
with:
version: 7

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://registry.npmjs.org'
cache: 'pnpm'
node-version: 20.x
registry-url: "https://registry.npmjs.org"
cache: "yarn"

- name: Setup Git User
shell: bash
Expand All @@ -23,4 +19,4 @@ runs:
- name: Install dependencies
shell: bash
run: pnpm install
run: yarn install --frozen-lockfile
8 changes: 4 additions & 4 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: ./.github/composite-actions/install

- name: Run Prettier
run: pnpm fmt
run: yarn fmt

# tests:
# name: Unit Tests
Expand All @@ -37,7 +37,7 @@ jobs:
# uses: ./.github/composite-actions/install

# - name: Run tests
# run: pnpm test
# run: yarn test

eslint:
name: ESLint
Expand All @@ -50,7 +50,7 @@ jobs:
uses: ./.github/composite-actions/install

- name: Run ESLint
run: pnpm lint
run: yarn lint
env:
NODE_OPTIONS: "--max-old-space-size=4096"

Expand All @@ -65,4 +65,4 @@ jobs:
uses: ./.github/composite-actions/install

- name: Run TypeScript type check
run: pnpm typecheck
run: yarn typecheck
41 changes: 17 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ on:
paths:
- ".changeset/**"
- "packages/**"
- "extension/**"
- ".github/workflows/release.yml"
branches:
- main
- ci/release

jobs:
release:
Expand All @@ -23,13 +24,13 @@ jobs:
uses: ./.github/composite-actions/install

- name: Build packages
run: pnpm build
run: yarn build

- name: Publish packages
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
publish: yarn release
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -38,8 +39,8 @@ jobs:
if: steps.changesets.outputs.published != 'true'
run: |
git checkout main
pnpm changeset version --snapshot dev
pnpm changeset publish --tag dev
yarn changeset version --snapshot dev
yarn changeset publish --tag dev
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down Expand Up @@ -101,35 +102,27 @@ jobs:
uses: ./.github/composite-actions/install

- name: Build packages
run: pnpm build
run: yarn build

- name: Set Environment Variable
run: echo "VSCE_RELEASE_VERSION=$(date +'%s' | cut -c1-8)" >> $GITHUB_ENV

- name: Prepare npm install
working-directory: ./extension/vscode
run: pnpm rewrite-deps && pnpm clean

- name: Overrides esbuild
working-directory: ./extension/vscode
if: contains(matrix.target, 'darwin-arm64')
run: pnpm override-esbuild

- name: Install with npm
working-directory: ./extension/vscode
- name: Publish RC
if: steps.changesets.outputs.published != 'true'
working-directory: ./packages/vscode
run: |
npm i --ignore-scripts
yarn release
env:
npm_config_arch: ${{ matrix.npm_config_arch }}
VSCE_TOKEN: ${{secrets.VSCE_TOKEN}}
VSCE_RELEASE_VERSION: ${{ needs.create_timestamp.outputs.timestamp }}
VSCE_RELEASE_TYPE: rc
VSCE_TARGET: ${{ matrix.target }}

- name: Publish extension
if: steps.changesets.outputs.published == 'true'
working-directory: ./extension/vscode
working-directory: ./packages/vscode
run: |
pnpm rewrite-deps
pnpm clean
npm i
pnpm release
yarn release
env:
VSCE_TOKEN: ${{secrets.VSCE_TOKEN}}
VSCE_RELEASE_VERSION: ${{ needs.create_timestamp.outputs.timestamp }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ ts-import-map-outdir

!packages/studio/styled-system
packages/studio/src/lib/analysis.json

.yarn/install-state.gz
7 changes: 0 additions & 7 deletions .npmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"skipFiles": ["<node_internals>/**"]
},
{
"command": "pnpm test ${relativeFile}",
"command": "yarn test ${relativeFile}",
"name": "Run Vitest",
"request": "launch",
"type": "node-terminal"
Expand Down
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.0.1.cjs
nmHoistingLimits: dependencies
21 changes: 16 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"private": true,
"description": "The repository of css panda",
"scripts": {
"prepare": "pnpm build-fast",
"dev": "pnpm -r --parallel --filter=./packages/** dev",
"build-fast": "pnpm -r --parallel --filter=./packages/** build-fast",
"build": "pnpm -r --filter=./packages/** build",
"prepare": "yarn build-fast",
"dev": "yarn workspaces foreach -A --exclude 'sandbox-vite' -pt run dev",
"build-fast": "yarn workspaces foreach -A --exclude 'sandbox-vite' -pt run build-fast",
"build": "yarn workspaces foreach -A --exclude 'sandbox-vite' run build",
"test": "vitest",
"lint": "eslint packages --ext .ts",
"fmt": "prettier --write packages",
Expand All @@ -29,5 +29,16 @@
"typescript": "5.2.2",
"vitest": "0.33.0"
},
"packageManager": "[email protected]"
"resolutions": {
"panda-css-vscode/esbuild": "npm:[email protected]"
},
"packageManager": "[email protected]",
"workspaces": [
"packages/*",
"sandbox/**"
],
"devDependencies": {
"@types/eslint": "^8",
"eslint": "^8.52.0"
}
}
2 changes: 1 addition & 1 deletion packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@pandacss/parser": "^0.17.0",
"@pandacss/shared": "^0.17.0",
"@pandacss/token-dictionary": "^0.17.0",
"@pandacss/types": "^0.17.0",
"@pandacss/types": "^0.16.0",
"fast-glob": "^3.3.1"
}
}
2 changes: 1 addition & 1 deletion packages/language-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PandaLanguageServer } from './panda-language-server'

const debug = true
const debug = false
new PandaLanguageServer(debug)
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"scripts": {
"build": "tsup src/index.ts --format=esm,cjs --dts",
"build-fast": "tsup src/index.ts --format=esm,cjs --no-dts",
"dev": "pnpm build-fast --watch",
"dev": "yarn build-fast --watch",
"clean": "rimraf dist",
"lint": "eslint ./src --ext .ts,.tsx --fix"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ts-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build": "tsup src/index.ts --format=cjs --dts",
"build-fast": "tsup src/index.ts --format=cjs --no-dts",
"dev": "pnpm build-fast --watch"
"dev": "yarn build-fast --watch"
},
"devDependencies": {
"@pandacss/extension-shared": "workspace:^",
Expand Down
24 changes: 13 additions & 11 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"publisher": "chakra-ui",
"packageManager": "[email protected]",
"name": "panda-css-vscode",
"displayName": "🐼 Panda CSS",
"description": "The official Panda CSS plugin for VS Code",
Expand Down Expand Up @@ -195,47 +196,48 @@
"directory": "packages/vscode"
},
"scripts": {
"build:lsp": "pnpm --filter=../language-server build",
"build:shared": "pnpm --filter=../shared build",
"build:ts-plugin": "pnpm --filter=../ts-plugin build",
"build:all": "pnpm build:shared && pnpm build:lsp && pnpm build:ts-plugin",
"build:all": "yarn workspaces foreach -R run build",
"build": "tsup",
"dev": "tsup --watch src/index.ts --watch ../language-server/dist/index.js --watch ../shared/dist/index.js --watch ../ts-plugin/dist/index.js",
"clean": "rimraf dist node_modules",
"typecheck": "tsc --noEmit",
"rewrite-deps": "tsx ./scripts/rewrite-workspace-dependencies.ts",
"override-esbuild": "tsx ./scripts/override-esbuild-with-wasm.ts",
"release": "pnpm build --silent && tsx ./scripts/publish.ts",
"local:build": "pnpm rewrite-deps && pnpm clean && pnpm override-esbuild && npm i --ignore-scripts && pnpm build:all && pnpm build && pnpm vsix-builder package"
"release": "yarn build --silent && tsx ./scripts/publish.ts",
"pkg": "yarn vsix-builder package"
},
"dependencies": {
"@pandacss/dev": "^0.17.0",
"@pandacss/preset-base": "^0.17.0",
"@pandacss/preset-panda": "^0.17.0",
"@pandacss/ts-plugin": "workspace:^",
"esbuild": "^0.17.8",
"pathe": "1.1.1"
},
"bundledDependencies": [
"@pandacss/ts-plugin",
"@pandacss/dev",
"@pandacss/preset-base",
"@pandacss/preset-panda",
"pathe"
"pathe",
"esbuild"
],
"devDependencies": {
"@pandacss/extension-shared": "workspace:^",
"@pandacss/language-server": "workspace:^",
"@pandacss/types": "^0.16.0",
"@pandacss/vsix-builder": "workspace:^",
"@pnpm/find-workspace-dir": "^6.0.2",
"@pnpm/find-workspace-packages": "^6.0.9",
"@pnpm/types": "^9.4.0",
"@types/node": "20.4.5",
"@types/vscode": "^1.80.0",
"@vscode/vsce": "^2.20.0",
"@types/semver": "^7.5.4",
"@types/vscode": "^1.67.0",
"@vscode/vsce": "^2.22.0",
"dotenv": "^16.3.1",
"execa": "7.2.0",
"fs-extra": "11.1.1",
"semver": "^7.5.4",
"tsup": "7.1.0",
"tsx": "^3.14.0",
"typescript": "^5.2.2",
"vscode": "^1.1.37",
"vscode-languageclient": "^8.1.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/vscode/scripts/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ if (!rcVersion) {
}

const commands = {
vscode_package: `pnpm vsix-builder package ${rcVersion} --target ${target} -o panda.vsix`,
vscode_publish: `pnpm vsce publish --packagePath panda.vsix --pat ${process.env.VSCE_TOKEN}`,
vscode_package: `yarn vsix-builder package ${rcVersion} --target ${target} -o panda.vsix`,
vscode_publish: `yarn vsce publish --packagePath panda.vsix --pat ${process.env.VSCE_TOKEN}`,
// rc release: publish to VS Code Marketplace with today's date as patch number
vscode_package_rc: `pnpm vsix-builder package ${rcVersion} --pre-release --target ${target} -o panda.vsix`,
vscode_rc: `pnpm vsce publish --pre-release --packagePath panda.vsix --pat ${process.env.VSCE_TOKEN}`,
vscode_package_rc: `yarn vsix-builder package ${rcVersion} --pre-release --target ${target} -o panda.vsix`,
vscode_rc: `yarn vsce publish --pre-release --packagePath panda.vsix --pat ${process.env.VSCE_TOKEN}`,
// To publish to the open-vsx registry
openvsx_publish: `npx ovsx publish panda.vsix --pat ${process.env.OVSX_TOKEN}`,
}
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as vscode from 'vscode'
import { LanguageClient } from 'vscode-languageclient/node'
import { PandaExtension } from './panda-extension'

const debug = true
const debug = false
let client: LanguageClient | undefined

export async function activate(context: vscode.ExtensionContext) {
Expand Down
1 change: 0 additions & 1 deletion packages/vscode/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { defineConfig } from 'tsup'

export default defineConfig({
entry: ['src/index.ts', 'src/server.ts'],
watch: ['../language-server/src/**/*', '../ts-plugin/src/**/*', '../shared/src/**/*'],
format: ['cjs'],
external: ['vscode', 'esbuild'],
minify: true,
Expand Down
Loading

0 comments on commit d4b64e9

Please sign in to comment.