Skip to content

Commit

Permalink
fix: jQuery package name generation, apply to react/angular wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
damyanpetev committed Mar 26, 2018
1 parent 3e22a88 commit 2a5537c
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 24 deletions.
33 changes: 25 additions & 8 deletions spec/acceptance/new-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,44 @@ describe("New command", () => {
process.chdir("../");
});

it("Creates jQuery project", async done => {

await cli.run(["new", "jQuery Proj", "--framework=jquery"]);

//TODO: read entire structure from ./templates and verify everything is copied over
expect(fs.existsSync("./jQuery Proj")).toBeTruthy();
const packageText = fs.readFileSync("./jQuery Proj/package.json", "utf-8");
expect(JSON.parse(packageText).name).toEqual("jquery-proj");
expect(fs.existsSync("./jQuery Proj/.gitignore")).toBeTruthy();
this.testFolder = "./jQuery Proj";
done();
});

it("Creates React project", async done => {
// process.argv = ["new", "reactProj", "--framework=react"];

await cli.run(["new", "reactProj", "--framework=react"]);
await cli.run(["new", "React Proj", "--framework=react"]);

//TODO: read entire structure from ./templates and verify everything is copied over
expect(fs.existsSync("./reactProj")).toBeTruthy();
expect(fs.existsSync("./reactProj/.gitignore")).toBeTruthy();
this.testFolder = "./reactProj";
expect(fs.existsSync("./React Proj")).toBeTruthy();
const packageText = fs.readFileSync("./React Proj/package.json", "utf-8");
expect(JSON.parse(packageText).name).toEqual("react-proj");
expect(fs.existsSync("./React Proj/.gitignore")).toBeTruthy();
this.testFolder = "./React Proj";
done();
});

it("Creates Angular project", async done => {
// process.argv = ["new", "reactProj", "--framework=react"];

await cli.run(["new", "ngxProj", "--framework=angular", "--type=igx-ts"]);
await cli.run(["new", "ngx Proj", "--framework=angular", "--type=igx-ts"]);

//TODO: read entire structure from ./templates and verify everything is copied over
expect(fs.existsSync("./ngxProj")).toBeTruthy();
expect(fs.existsSync("./ngxProj/.gitignore")).toBeTruthy();
this.testFolder = "./ngxProj";
expect(fs.existsSync("./ngx Proj")).toBeTruthy();
const packageText = fs.readFileSync("./ngx Proj/package.json", "utf-8");
expect(JSON.parse(packageText).name).toEqual("ngx-proj");
expect(fs.existsSync("./ngx Proj/.gitignore")).toBeTruthy();
this.testFolder = "./ngx Proj";
done();
});

Expand Down
2 changes: 1 addition & 1 deletion templates/angular/ig-ts/projects/empty/files/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "my-project",
"name": "$(dash-name)",
"version": "1.0.0",
"description": "new project package.json",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions templates/angular/ig-ts/projects/empty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class EmptyAngularProject implements ProjectTemplate {
public setExtraConfiguration(extraConfigKeys: any[]) { }
public generateFiles(outputPath: string, name: string, theme: string, ...options: any[]): Promise<boolean> {
const config = {
"$(dash-name)": Util.lowerDashed(name),
"$(name)": name,
"$(theme)": theme,
"__path__": name
Expand Down
29 changes: 15 additions & 14 deletions templates/jquery/js/projects/empty/files/package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"name": "$(name)",
"scripts": {
"test": "karma start"
},
"dependencies": {
"ignite-ui": "^17.2"
},
"devDependencies": {
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-qunit": "^1.2.1",
"qunitjs": "^2.4.1"
}
}
"name": "$(dash-name)",
"version": "0.0.1",
"scripts": {
"test": "karma start"
},
"dependencies": {
"ignite-ui": "^17.2"
},
"devDependencies": {
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-qunit": "^1.2.1",
"qunitjs": "^2.4.1"
}
}
1 change: 1 addition & 0 deletions templates/jquery/js/projects/empty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class EmptyProject implements ProjectTemplate {
themePath = "$(igniteuiSource)/css/themes/" + theme + "/infragistics.theme.css";
}
const variables = {
"$(dash-name)" : Util.lowerDashed(name),
"$(description)" : this.description,
"$(igniteuiSource)": "./node_modules/ignite-ui",
"$(name)" : name,
Expand Down
2 changes: 1 addition & 1 deletion templates/react/es6/projects/empty/files/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-router-dynamic-routes-webpack2",
"name": "$(dash-name)",
"version": "1.0.0",
"private": true,
"description": "React project for Ignite UI CLI",
Expand Down
1 change: 1 addition & 0 deletions templates/react/es6/projects/empty/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class EmptyProject implements ProjectTemplate {

//TODO update the config with [{key: "keyname", "value"}]
const config = {
"$(dash-name)" : Util.lowerDashed(name),
"$(name)": name,
"$(theme)": theme,
"__path__": name
Expand Down

0 comments on commit 2a5537c

Please sign in to comment.