Skip to content

Commit

Permalink
Merge pull request #8 from rodydavis/nativescript
Browse files Browse the repository at this point in the history
Adding NativeScript template
  • Loading branch information
rodydavis authored Dec 14, 2024
2 parents 14408b4 + 372c141 commit 98f9f38
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
9 changes: 9 additions & 0 deletions nativescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NativeScript

https://nativescript.org

Liberate your development by using platform APIs directly without leaving your ❤️ of JavaScript.

<a href="https://idx.google.com/new?template=https://github.com/project-idx/community-templates/tree/main/nativescript">
<img height="32" alt="Try in IDX" src="https://cdn.idx.dev/btn/try_dark_32.svg">
</a>
43 changes: 43 additions & 0 deletions nativescript/dev.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
# Which nixpkgs channel to use.
channel = "stable-23.11"; # or "unstable"
# Use https://search.nixos.org/packages to find packages
packages = [
pkgs.nodejs_20
pkgs.jdk17
];
# Sets environment variables in the workspace
env = { };
idx = {
# Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
extensions = [
"nrwl.angular-console"
"esbenp.prettier-vscode"
"firsttris.vscode-jest-runner"
];
workspace = {
# Runs when a workspace is first created with this `dev.nix` file
onCreate = {
install = ''
npm ci --prefer-offline --no-audit --no-progress --timing
yes | npx ns preview'';
# Open editors for the following files by default, if they exist:
default.openFiles = [ "app/app.js" ];
};
# To run something each time the workspace is (re)started, use the `onStart` hook
};
# Enable previews and customize configuration
# previews = {
# enable = true;
# previews = {
# web = {
# command =
# [ "ns" "preview" "--" "--port" "$PORT" "--hostname" "0.0.0.0" ];
# manager = "web";
# };
# };
# };
};
}
Empty file added nativescript/dev/.gitkeep
Empty file.
29 changes: 29 additions & 0 deletions nativescript/idx-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "NativeScript",
"description": "Liberate your development by using platform APIs directly without leaving your ❤️ of JavaScript.",
"categories": ["Web app", "Mobile"],
"icon": "https://avatars.githubusercontent.com/u/7392261?v=4",
"website": "https://nativescript.org/",
"publisher": "Rody Davis",
"params": [
{
"id": "template",
"name": "Template",
"type": "enum",
"default": "js",
"options": {
"js": "JavaScript",
"ng": "Angular",
"vue": "Vue",
"react": "React",
"svelte": "Svelte"
}
},
{
"id": "ts",
"name": "TypeScript",
"type": "boolean",
"default": "false"
}
]
}
36 changes: 36 additions & 0 deletions nativescript/idx-template.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
Copyright 2024 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

{ pkgs, template ? "js", ts ? false, ... }: {
packages = [
pkgs.nodejs_20
pkgs.python3
pkgs.python311Packages.pip
pkgs.python311Packages.fastapi
pkgs.python311Packages.uvicorn
];
bootstrap = ''
mkdir "$out"
mkdir -p "$out/.idx/"
cp -rf ${./dev.nix} "$out/.idx/dev.nix"
shopt -s dotglob; cp -r ${./dev}/* "$out"
npm install nativescript
./node_modules/nativescript/bin/ns create example --${template} ${if ts then "--ts" else ""} --path "$out"
chmod -R +w "$out"
cd "$out"; npm install -D nativescript
cd "$out"; npm install --package-lock-only --ignore-scripts
'';
}

0 comments on commit 98f9f38

Please sign in to comment.