-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joao Santos
committed
Jan 8, 2021
1 parent
c0915b5
commit b6b5a89
Showing
7 changed files
with
826 additions
and
5,865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
/** Type of package to process */ | ||
export enum ComponentType { | ||
/** Manager, Monitor, Controller, Driver */ | ||
Component = "Component", | ||
/** Tasks package (must process the metadata file) */ | ||
TasksPackage = "TasksPackage", | ||
} | ||
|
||
/** Possible action to perform */ | ||
export enum ActionType { | ||
/** Delete file */ | ||
DeleteFile = "DeleteFile", | ||
/** Delete directory */ | ||
DeleteDirectory = "DeleteDirectory", | ||
/** Copy entire directory contents */ | ||
CopyDirectory = "CopyDirectory", | ||
/** Copy single file */ | ||
CopyFile = "CopyFile", | ||
/** Move single file */ | ||
MoveFile = "MoveFile", | ||
/** Replace text with another one */ | ||
ReplaceText = "ReplaceText", | ||
} | ||
|
||
/** Configuration structure */ | ||
export interface Configuration { | ||
/** Component Type */ | ||
type: ComponentType; | ||
/** List of files to fully pack (will use src/index.js as default) */ | ||
packs?: Pack[]; | ||
/** Addons required for the package */ | ||
addons?: Addon[]; | ||
/** List of actions to post perform */ | ||
postActions?: Action[]; | ||
} | ||
|
||
/** Action structure */ | ||
export interface Action { | ||
/** Type of action */ | ||
type: ActionType; | ||
/** Action Source */ | ||
source: string; | ||
/** Action Destination */ | ||
destination?: string; | ||
/** Text to search */ | ||
search?: string; | ||
/** Text to replace with */ | ||
replace?: string; | ||
/** File to work */ | ||
file?: string; | ||
/** Search is regular expression */ | ||
isRegularExpression?: boolean; | ||
} | ||
|
||
/** Compiled version/platform specific node addon */ | ||
export interface Addon { | ||
/** Name of the addon (also directory where it is) */ | ||
name: string; | ||
/** Version of the addon (also the subdirectory where it is) */ | ||
version: string; | ||
/** Extension expected (*.node) */ | ||
fileMask: string; | ||
} | ||
|
||
/** Files to pack (will use src/index.js is this section is missing) */ | ||
export interface Pack { | ||
/** Relative directory where the source file is */ | ||
directory: string; | ||
/** Source file to pack (defaults to index.js) */ | ||
source?: string; | ||
/** Destination name to use (defaults to index.js) */ | ||
destination?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
|
||
// this.argument('packageName', { type: String, required: true }); | ||
// console.log(args); | ||
// console.log(opts); | ||
// this.values.fileName = this.camelCaseValue(this.options.packageName); | ||
// // Prepend the package suffix if not present | ||
// if (!this.options.packageName.startsWith(`${this.ctx.packagePrefix}.`)) { | ||
// this.options.packageName = `${this.ctx.packagePrefix}.${this.options.packageName}`; | ||
// } | ||
|
||
// // If this command was not executed from the root, exit | ||
// if (this.config.get("isRoot") !== true) { | ||
// this.env.error(new Error("Please execute this command outside a package. Hint: use the root of the repository.")); | ||
// } | ||
|
||
|
||
import { ConnectIoTGenerator, ValueType, IoTValueType } from "../base"; | ||
import { PackagePacker } from "./packagePacker"; | ||
|
||
class GeneratorPackagePacker extends ConnectIoTGenerator { | ||
|
||
constructor(args: any, opts: any) { | ||
super(args, opts); | ||
|
||
this.option("i", { alias: "input", type: String, default: process.cwd(), description: "Location of the package to pack" }); | ||
this.option("o", { alias: "output", type: String, default: "", description: "Location of the generated package will be stored" }); | ||
this.option("t", { alias: "temp", type: String, default: `${process.cwd()}\\__TEMP__`, description: "Temporary location to use" }); | ||
this.option("c", { alias: "config", type: String, default: `${process.cwd()}\\packConfig.json`, description: "Location of the Configuration to use" }); | ||
this.option("a", { alias: "addons", type: String, default: "", description: "Location of the compiled addons" }); | ||
this.option("d", { alias: "debug", type: Boolean, default: false, description: "Debug Mode (doesn't delete temporary directory after processing)" }); | ||
this.option("v", { alias: "version", type: String, default: "", description: "Version to use to generate the package" }); | ||
|
||
} | ||
|
||
/** | ||
* Will prompt the user for converter details | ||
*/ | ||
// https://www.npmjs.com/package/inquirer | ||
public async prompting() { | ||
} | ||
|
||
/** | ||
* Will copy the templates for the framework tailoring all the files with the base framework it's extending from. | ||
*/ | ||
public async copyTemplates(): Promise<void> { | ||
const generator = new PackagePacker(); | ||
await generator.go(this.options); | ||
} | ||
|
||
/** | ||
* Will install the framework's package as well as the web app. | ||
*/ | ||
public async install() { | ||
} | ||
|
||
public end() { | ||
} | ||
} | ||
|
||
declare var module: any; | ||
(module).exports = GeneratorPackagePacker; |
Oops, something went wrong.