Skip to content

Commit

Permalink
Package VSCode extension
Browse files Browse the repository at this point in the history
  • Loading branch information
garbas committed Dec 1, 2024
1 parent 44613dd commit 700d14d
Show file tree
Hide file tree
Showing 11 changed files with 530 additions and 129 deletions.
379 changes: 378 additions & 1 deletion .flox/env/manifest.lock

Large diffs are not rendered by default.

109 changes: 56 additions & 53 deletions .flox/env/manifest.toml
Original file line number Diff line number Diff line change
@@ -1,60 +1,63 @@
#
# This is a Flox environment manifest.
# Visit flox.dev/docs/concepts/manifest/
# or see flox-edit(1), manifest.toml(5) for more information.
#
# Flox manifest version managed by Flox CLI
version = 1

# List packages you wish to install in your environment inside
# the `[install]` section.
[install]
vscode.pkg-path = "vscode"
nodejs.pkg-path = "nodejs"
# hello.pkg-path = "hello"
# nodejs = { version = "^20.15.1", pkg-path = "nodejs" }

# Set environment variables in the `[vars]` section. These variables may not
# reference one another, and are added to the environment without first
# expanding them. They are available for use in the `[profile]` and `[hook]`
# scripts.
[vars]
# message = "Howdy"

# The `hook.on-activate` script is run by the *bash* shell immediately upon
# activating an environment, and will not be invoked if Flox detects that the
# environment has previously been activated. Variables set by the script will
# be inherited by `[profile]` scripts defined below. Note that any stdout
# generated by the script will be redirected to stderr.
vsce.pkg-path = "vsce"

# helper tools
gum.pkg-path = "gum"
coreutils.pkg-path = "coreutils"

[hook]
# on-activate = '''
# # Set variables, create files and directories
# venv_dir="$(mktemp -d)"
# export venv_dir
#
# # Perform initialization steps, e.g. create a python venv
# python -m venv "$venv_dir"
# '''

# Scripts defined in the `[profile]` section are *sourced* by *your shell* and
# inherit environment variables set in the `[vars]` section and by `[hook]` scripts.
# The `profile.common` script is sourced by all shells and special care should be
# taken to ensure compatibility with all shells, after which exactly one of
# `profile.{bash,fish,tcsh,zsh}` is sourced by the corresponding shell.
[profile]
# common = '''
# echo "it's gettin' flox in here"
# '''

# The `[services]` section of the manifest allows you to define services.
# Services defined here use the packages provided by the `[install]` section
# and any variables you've defined in the `[vars]` section or `hook.on-activate` script.
[services]
# postgres.command = "postgres --config-file=pg.conf"

# Additional options can be set in the `[options]` section. Refer to
# manifest.toml(5) for a list of available options.
on-activate = '''
export FLOX_JAVASCRIPT_NODE_CACHE_DIR="$FLOX_ENV_CACHE/javascript-node"
mkdir -p "$FLOX_JAVASCRIPT_NODE_CACHE_DIR"
export FLOX_JAVASCRIPT_NODE_PACKAGES_HASH_FILE="$FLOX_JAVASCRIPT_NODE_CACHE_DIR/packages-hash"
function with_spinner() {
if [[ "$FLOX_ENVS_TESTING" == "1" ]]; then
bash -c "$1"
else
gum spin \
--show-error \
--spinner line \
--spinner.foreground="#cccccc" \
--title ">>> $2 ..." \
--title.foreground="#cccccc" \
-- bash -c "$1"
fi
}
function install_packages() {
npm install
}
export -f install_packages
if [ -f "package.json" ] && [ -f "package-lock.json" ]; then
export FLOX_JAVASCRIPT_NODE_PACKAGES_HASH="false"
if [ -f "$FLOX_JAVASCRIPT_NODE_PACKAGES_HASH_FILE" ] ; then
export FLOX_JAVASCRIPT_NODE_PACKAGES_HASH=$(cat package.json package-lock.json | sha256sum | cut -d" " -f 1)
fi
if [ "$FLOX_JAVASCRIPT_NODE_PACKAGES_HASH" != "$(cat $FLOX_JAVASCRIPT_NODE_PACKAGES_HASH_FILE 2>/dev/null)" ]; then
with_spinner install_packages "Installing Javascript packages (with NPM)"
echo -e "{{ Foreground \"#ffffff\" \"✅ Javascript packages installed (with NPM).\" }}\n" \
| gum format -t template
echo "$FLOX_JAVASCRIPT_NODE_PACKAGES_HASH" > "$FLOX_JAVASCRIPT_NODE_PACKAGES_HASH_FILE"
fi
fi
'''


[options]
systems = ["aarch64-darwin", "aarch64-linux", "x86_64-darwin", "x86_64-linux"]
# Uncomment to disable CUDA detection.
# cuda-detection = false
systems = [
"aarch64-darwin",
"aarch64-linux",
"x86_64-darwin",
"x86_64-linux",
]
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ jobs:
uses: "flox/activate-action@main"
with:
command: "npm run compile"

- name: "Package"
uses: "flox/activate-action@main"
with:
command: "vsce package --out flox-main.vsix"

- name: "Upload vscode extention as artifact"
uses: "actions/upload-artifact@v4"
with:
name: "flox-main.vsix"
path: "flox-main.vsix"
retention-days: 14
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
src/**
.gitignore
.yarnrc
.flox
vsc-extension-quickstart.md
**/tsconfig.json
**/eslint.config.mjs
Expand Down
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Flox VSCode Extention

## Quick Start

```console
$ cd git clone [email protected]/flox/flox-vscode.git;
$ cd flox-vscode;

# Enter Dev Shell
$ flox activate

# Lint
$ npm run compile

# Run the tests
$ npm run test

# Build
$ npm run compile
```
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright 2023 FloxDev, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
115 changes: 42 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,86 +1,55 @@
# flox README
<h1 align="center">
<a href="https://flox.dev" target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="assets/flox-logo-white-on-black.png" />
<source media="(prefers-color-scheme: light)" srcset="assets/flox-logo-black-on-white.png" />
<img src="assets//flox-logo-black-on-white.png" alt="flox logo" />
</picture>
</a>
</h1>

This is the README for your extension "flox". After writing up a brief
description, we recommend including the following sections.
<h2 align="center">
Developer environments you can take with you
</h2>

## Features
<h3 align="center">
&emsp;
<a href="https://discourse.flox.dev"><b>Discourse</b></a>
&emsp; | &emsp;
<a href="https://flox.dev/docs"><b>Documentation</b></a>
&emsp; | &emsp;
<a href="https://flox.dev/blog"><b>Blog</b></a>
&emsp; | &emsp;
<a href="https://twitter.com/floxdevelopment"><b>Twitter</b></a>
&emsp; | &emsp;
<a href="https://go.flox.dev/slack"><b>Slack</b></a>
&emsp;
</h3>

Describe specific features of your extension including screenshots of your
extension in action. Image paths are relative to this README file.
[Flox][website] is a virtual environment and package manager all in one. With
Flox you create environments that layer and replace dependencies just where it
matters, making them portable across the full software lifecycle.

For example if there is an image subfolder under your extension project
workspace:
`flox-vscode` is a VSCode editor extension that integrated Flox environments
with VSCode editor.

\!\[feature X\]\(images/feature-x.png\)
<!-- TODO: List features (with screenshots) -->

> Tip: Many popular extensions utilize animations. This is an excellent way to
> show off your extension! We recommend short, focused animations that are easy
> to follow.
## 🤝 Found a bug? Missing a specific feature?

## Requirements
Feel free to [file a new issue][new-issue] with a respective title and
description on the `flox/flox-vscode` repository. If you already found a
solution to your problem, we would love to review your pull request!

If you have any requirements or dependencies, add a section describing those
and how to install and configure them.
## ⭐️ Contribute

## Extension Settings
We welcome contributions to this project. Please read the [Contributor
guide](./CONTRIBUTING.md) first.

Include if your extension adds any VS Code settings through the
`contributes.configuration` extension point.
## 🪪 License

For example:
The Flox CLI is licensed under the GPLv2. See [LICENSE](./LICENSE).

This extension contributes the following settings:

* `myExtension.enable`: Enable/disable this extension.
* `myExtension.thing`: Set to `blah` to do something.

## Known Issues

Calling out known issues can help limit users opening duplicate issues against
your extension.

## Release Notes

Users appreciate release notes as you update your extension.

### 1.0.0

Initial release of ...

### 1.0.1

Fixed issue #.

### 1.1.0

Added features X, Y, and Z.

---

## Following extension guidelines

Ensure that you've read through the extensions guidelines and follow the best
practices for creating your extension.

* [Extension
Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)

## Working with Markdown

You can author your README using Visual Studio Code. Here are some useful
editor keyboard shortcuts:

* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and
Linux).
* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown
snippets.

## For more information

* [Visual Studio Code's Markdown
Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax
Reference](https://help.github.com/articles/markdown-basics/)

**Enjoy!**
[website]: https://flox.dev
[new-issue]: https://github.com/flox/flox-vscode/issues/new/choose
Binary file added assets/flox-logo-black-on-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/flox-logo-white-on-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
],
"publisher": "flox",
"license": "???",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/flox/flox-vscode"
Expand Down

0 comments on commit 700d14d

Please sign in to comment.