Skip to content

Commit

Permalink
Add new create FAST project package (#15)
Browse files Browse the repository at this point in the history
# Pull Request

## 📖 Description

<!--- Provide some background and a description of your work. -->
This change does the following:
- Adds a quick installation and initialization package
- Updates the package.json files to point to the fast-cli repository

### 🎫 Issues

<!---
List and link relevant issues here using the keyword "closes"
if this PR will close an issue, eg. closes #411
-->
Resolves #2 

## 👩‍💻 Reviewer Notes

The build will fail until the other packages have been published.

## ✅ Checklist

### General

<!--- Review the list and put an x in the boxes that apply. -->

- [ ] I have added tests for my changes.
- [x] I have tested my changes.
- [x] I have updated the project documentation to reflect my changes.

## ⏭ Next Steps

<!---
If there is relevant follow-up work to this PR, please list any existing issues or provide brief descriptions of what you would like to do next.
-->
- Plan next steps for MVP
  • Loading branch information
janechu committed Jul 20, 2022
1 parent 80c0768 commit 9c0a01d
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Corrected the package.json repository links",
"packageName": "@microsoft/cfp-template",
"email": "7559015+janechu@users.noreply.github.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Added a new create FAST project package",
"packageName": "@microsoft/create-fast-project",
"email": "7559015+janechu@users.noreply.github.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Corrected the package.json repository links",
"packageName": "@microsoft/fast-cli",
"email": "7559015+janechu@users.noreply.github.com",
"dependentChangeType": "none"
}
32 changes: 30 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions packages/cfp-template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/fast.git"
"url": "git+https://github.com/Microsoft/fast-cli.git"
},
"bugs": {
"url": "https://github.com/Microsoft/fast/issues"
"url": "https://github.com/Microsoft/fast-cli/issues"
},
"main": "index.js",
"scripts": {
Expand Down
15 changes: 15 additions & 0 deletions packages/create-fast-project/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Create FAST Project

This installation tool will allow you to create and configure your own [FAST](https://www.fast.design) project.

## Installation

## Usage

### npx

`npx @microsoft/create-fast-project`

### npm

`npm init @microsoft/fast-project`
33 changes: 33 additions & 0 deletions packages/create-fast-project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@microsoft/create-fast-project",
"type": "module",
"version": "1.0.0-alpha.1",
"description": "A FAST project creation tool",
"bin": "./dist/esm/create.js",
"scripts": {
"build": "npm run build:tsc",
"build:tsc": "tsc -p ./tsconfig.json",
"build:tsc:watch": "tsc -p ./tsconfig.json -w"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/fast-cli.git"
},
"author": {
"name": "Microsoft",
"url": "https://discord.gg/FcSNfg4"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/Microsoft/fast-cli/issues"
},
"homepage": "https://github.com/Microsoft/fast-cli#readme",
"dependencies": {
"@microsoft/fast-cli": "^1.0.0-alpha.1",
"cross-spawn": "^7.0.3"
},
"devDependencies": {
"@types/node": "^17.0.21",
"typescript": "^4.6.3"
}
}
49 changes: 49 additions & 0 deletions packages/create-fast-project/src/create.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env node

import spawn from "cross-spawn";

function installCli(): Promise<void> {
return new Promise<void>((resolve, reject) => {
const args = [
"install",
"@microsoft/fast-cli",
];
const child = spawn("npm", args, { stdio: "inherit" });
child.on("close", code => {
if (code !== 0) {
reject({
command: "npm install @microsoft/fast-cli",
});
return;
}
resolve();
});
}).catch(reason => {
throw reason;
});
}

function init(): Promise<void> {
return new Promise<void>((resolve, reject) => {
const args = ["init"];
const child = spawn("fast", args, { stdio: "inherit" });
child.on("close", code => {
if (code !== 0) {
reject({
command: "fast init",
});
return;
}
resolve();
});
}).catch(reason => {
throw reason;
});
}

/**
* This package only initializes a project from the FAST CLI
*/
(function () {
installCli().then(init);
})();
26 changes: 26 additions & 0 deletions packages/create-fast-project/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"declaration": true,
"esModuleInterop": true,
"strictNullChecks": true,
"moduleResolution": "node",
"declarationDir": "dist/dts",
"outDir": "dist/esm",
"experimentalDecorators": true,
"noImplicitAny": false,
"strictPropertyInitialization": false,
"importsNotUsedAsValues": "error",
"target": "es2015",
"module": "ESNext",
"importHelpers": true,
"types": [
"node"
],
"lib": [
"DOM",
"ES2015",
"ES2016.Array.Include"
]
},
"include": ["src"]
}
6 changes: 3 additions & 3 deletions packages/fast-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/Microsoft/fast.git"
"url": "git+https://github.com/Microsoft/fast-cli.git"
},
"author": {
"name": "Microsoft",
"url": "https://discord.gg/FcSNfg4"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/Microsoft/fast/issues"
"url": "https://github.com/Microsoft/fast-cli/issues"
},
"homepage": "https://github.com/Microsoft/fast#readme",
"homepage": "https://github.com/Microsoft/fast-cli#readme",
"dependencies": {
"commander": "^9.0.0",
"cross-spawn": "^7.0.3",
Expand Down

0 comments on commit 9c0a01d

Please sign in to comment.