-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/issue 1253 add initial directory option for init scaffolding (#…
…1280) * add optional project name flag to init scaffolding * update init documentation to promote my-app option * produce a .npmrc file for npm projects * improve next step console logs * clean up errant characters * add npm run dev script to init package.json * fix linting
- Loading branch information
1 parent
d155a31
commit 81c1f81
Showing
14 changed files
with
143 additions
and
37 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
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 @@ | ||
legacy-peer-deps=true |
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
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
69 changes: 69 additions & 0 deletions
69
packages/init/test/cases/init.project-name/init.project-name.spec.js
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,69 @@ | ||
/* | ||
* Use Case | ||
* Scaffold into a custom project directory | ||
* | ||
* User Result | ||
* Should scaffold out the new project into a my-app directory. | ||
* | ||
* User Command | ||
* npx @greenwood/init my-app | ||
* | ||
* User Workspace | ||
* N / A | ||
*/ | ||
import chai from 'chai'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { Runner } from 'gallinago'; | ||
import { fileURLToPath, URL } from 'url'; | ||
|
||
const expect = chai.expect; | ||
|
||
describe('Scaffold Greenwood into a custom directory: ', function() { | ||
const initPath = path.join(process.cwd(), 'packages/init/src/index.js'); | ||
const outputPath = fileURLToPath(new URL('./output', import.meta.url)); | ||
const projectName = 'my-app'; | ||
let runner; | ||
|
||
before(function() { | ||
this.context = { | ||
publicDir: path.join(outputPath, 'public') | ||
}; | ||
runner = new Runner(); | ||
}); | ||
|
||
describe(`Default output to a custom ${projectName} directory`, function () { | ||
|
||
before(function() { | ||
runner.setup(outputPath); | ||
runner.runCommand(initPath, `${projectName} --foo=bar`); | ||
}); | ||
|
||
describe('expected scaffolding output', function () { | ||
|
||
it('should create a src/pages directory', function() { | ||
expect(fs.existsSync(path.join(outputPath, projectName, 'src', 'pages'))).to.be.true; | ||
}); | ||
|
||
it('should generate a .gitignore file', function() { | ||
expect(fs.existsSync(path.join(outputPath, projectName, '.gitignore'))).to.be.true; | ||
}); | ||
|
||
it('should generate a package.json file', function() { | ||
expect(fs.existsSync(path.join(outputPath, projectName, 'package.json'))).to.be.true; | ||
}); | ||
|
||
it('should have the name in package.json match the project name argument', function() { | ||
const packageJson = JSON.parse(fs.readFileSync(path.join(outputPath, projectName, 'package.json'), 'utf-8')); | ||
|
||
expect(packageJson.name).to.equal(projectName); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
after(function() { | ||
runner.teardown([outputPath]); | ||
}); | ||
|
||
}); |
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